Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 87 additions & 8 deletions core/api/core.api

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,16 @@ public class FileLinkMetadata extends SharedLinkMetadata {
* This field will only be present if the content's owner is a team
* member and the content's owner team is different from the link's
* owner team.
* @param previewType The preview type is determined by the file extension
* of the shared link. It will be null if the file cannot be previewed
* by the file viewer.
* @param createdTimestamp The time the shared link was created.
*
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public FileLinkMetadata(@Nonnull String url, @Nonnull String name, @Nonnull LinkPermissions linkPermissions, @Nonnull Date clientModified, @Nonnull Date serverModified, @Nonnull String rev, long size, @Nullable String id, @Nullable Date expires, @Nullable String pathLower, @Nullable TeamMemberInfo teamMemberInfo, @Nullable Team contentOwnerTeamInfo) {
super(url, name, linkPermissions, id, expires, pathLower, teamMemberInfo, contentOwnerTeamInfo);
public FileLinkMetadata(@Nonnull String url, @Nonnull String name, @Nonnull LinkPermissions linkPermissions, @Nonnull Date clientModified, @Nonnull Date serverModified, @Nonnull String rev, long size, @Nullable String id, @Nullable Date expires, @Nullable String pathLower, @Nullable TeamMemberInfo teamMemberInfo, @Nullable Team contentOwnerTeamInfo, @Nullable String previewType, @Nullable Date createdTimestamp) {
super(url, name, linkPermissions, id, expires, pathLower, teamMemberInfo, contentOwnerTeamInfo, previewType, createdTimestamp);
if (clientModified == null) {
throw new IllegalArgumentException("Required value for 'clientModified' is null");
}
Expand Down Expand Up @@ -131,7 +135,7 @@ public FileLinkMetadata(@Nonnull String url, @Nonnull String name, @Nonnull Link
* preconditions.
*/
public FileLinkMetadata(@Nonnull String url, @Nonnull String name, @Nonnull LinkPermissions linkPermissions, @Nonnull Date clientModified, @Nonnull Date serverModified, @Nonnull String rev, long size) {
this(url, name, linkPermissions, clientModified, serverModified, rev, size, null, null, null, null, null);
this(url, name, linkPermissions, clientModified, serverModified, rev, size, null, null, null, null, null, null, null);
}

/**
Expand Down Expand Up @@ -264,6 +268,27 @@ public Team getContentOwnerTeamInfo() {
return contentOwnerTeamInfo;
}

/**
* The preview type is determined by the file extension of the shared link.
* It will be null if the file cannot be previewed by the file viewer.
*
* @return value for this field, or {@code null} if not present.
*/
@Nullable
public String getPreviewType() {
return previewType;
}

/**
* The time the shared link was created.
*
* @return value for this field, or {@code null} if not present.
*/
@Nullable
public Date getCreatedTimestamp() {
return createdTimestamp;
}

/**
* Returns a new builder for creating an instance of this class.
*
Expand Down Expand Up @@ -400,14 +425,40 @@ public Builder withContentOwnerTeamInfo(Team contentOwnerTeamInfo) {
return this;
}

/**
* Set value for optional field.
*
* @param previewType The preview type is determined by the file
* extension of the shared link. It will be null if the file cannot
* be previewed by the file viewer.
*
* @return this builder
*/
public Builder withPreviewType(String previewType) {
super.withPreviewType(previewType);
return this;
}

/**
* Set value for optional field.
*
* @param createdTimestamp The time the shared link was created.
*
* @return this builder
*/
public Builder withCreatedTimestamp(Date createdTimestamp) {
super.withCreatedTimestamp(createdTimestamp);
return this;
}

/**
* Builds an instance of {@link FileLinkMetadata} configured with this
* builder's values
*
* @return new instance of {@link FileLinkMetadata}
*/
public FileLinkMetadata build() {
return new FileLinkMetadata(url, name, linkPermissions, clientModified, serverModified, rev, size, id, expires, pathLower, teamMemberInfo, contentOwnerTeamInfo);
return new FileLinkMetadata(url, name, linkPermissions, clientModified, serverModified, rev, size, id, expires, pathLower, teamMemberInfo, contentOwnerTeamInfo, previewType, createdTimestamp);
}
}

Expand Down Expand Up @@ -446,6 +497,8 @@ else if (obj.getClass().equals(this.getClass())) {
&& ((this.pathLower == other.pathLower) || (this.pathLower != null && this.pathLower.equals(other.pathLower)))
&& ((this.teamMemberInfo == other.teamMemberInfo) || (this.teamMemberInfo != null && this.teamMemberInfo.equals(other.teamMemberInfo)))
&& ((this.contentOwnerTeamInfo == other.contentOwnerTeamInfo) || (this.contentOwnerTeamInfo != null && this.contentOwnerTeamInfo.equals(other.contentOwnerTeamInfo)))
&& ((this.previewType == other.previewType) || (this.previewType != null && this.previewType.equals(other.previewType)))
&& ((this.createdTimestamp == other.createdTimestamp) || (this.createdTimestamp != null && this.createdTimestamp.equals(other.createdTimestamp)))
;
}
else {
Expand Down Expand Up @@ -516,6 +569,14 @@ public void serialize(FileLinkMetadata value, JsonGenerator g, boolean collapse)
g.writeFieldName("content_owner_team_info");
StoneSerializers.nullableStruct(Team.Serializer.INSTANCE).serialize(value.contentOwnerTeamInfo, g);
}
if (value.previewType != null) {
g.writeFieldName("preview_type");
StoneSerializers.nullable(StoneSerializers.string()).serialize(value.previewType, g);
}
if (value.createdTimestamp != null) {
g.writeFieldName("created_timestamp");
StoneSerializers.nullable(StoneSerializers.timestamp()).serialize(value.createdTimestamp, g);
}
if (!collapse) {
g.writeEndObject();
}
Expand Down Expand Up @@ -545,6 +606,8 @@ public FileLinkMetadata deserialize(JsonParser p, boolean collapsed) throws IOEx
String f_pathLower = null;
TeamMemberInfo f_teamMemberInfo = null;
Team f_contentOwnerTeamInfo = null;
String f_previewType = null;
Date f_createdTimestamp = null;
while (p.getCurrentToken() == JsonToken.FIELD_NAME) {
String field = p.getCurrentName();
p.nextToken();
Expand Down Expand Up @@ -584,6 +647,12 @@ else if ("team_member_info".equals(field)) {
else if ("content_owner_team_info".equals(field)) {
f_contentOwnerTeamInfo = StoneSerializers.nullableStruct(Team.Serializer.INSTANCE).deserialize(p);
}
else if ("preview_type".equals(field)) {
f_previewType = StoneSerializers.nullable(StoneSerializers.string()).deserialize(p);
}
else if ("created_timestamp".equals(field)) {
f_createdTimestamp = StoneSerializers.nullable(StoneSerializers.timestamp()).deserialize(p);
}
else {
skipValue(p);
}
Expand All @@ -609,7 +678,7 @@ else if ("content_owner_team_info".equals(field)) {
if (f_size == null) {
throw new JsonParseException(p, "Required field \"size\" missing.");
}
value = new FileLinkMetadata(f_url, f_name, f_linkPermissions, f_clientModified, f_serverModified, f_rev, f_size, f_id, f_expires, f_pathLower, f_teamMemberInfo, f_contentOwnerTeamInfo);
value = new FileLinkMetadata(f_url, f_name, f_linkPermissions, f_clientModified, f_serverModified, f_rev, f_size, f_id, f_expires, f_pathLower, f_teamMemberInfo, f_contentOwnerTeamInfo, f_previewType, f_createdTimestamp);
}
else {
throw new JsonParseException(p, "No subtype found that matches tag: \"" + tag + "\"");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,16 @@ public class FolderLinkMetadata extends SharedLinkMetadata {
* This field will only be present if the content's owner is a team
* member and the content's owner team is different from the link's
* owner team.
* @param previewType The preview type is determined by the file extension
* of the shared link. It will be null if the file cannot be previewed
* by the file viewer.
* @param createdTimestamp The time the shared link was created.
*
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public FolderLinkMetadata(@Nonnull String url, @Nonnull String name, @Nonnull LinkPermissions linkPermissions, @Nullable String id, @Nullable Date expires, @Nullable String pathLower, @Nullable TeamMemberInfo teamMemberInfo, @Nullable Team contentOwnerTeamInfo) {
super(url, name, linkPermissions, id, expires, pathLower, teamMemberInfo, contentOwnerTeamInfo);
public FolderLinkMetadata(@Nonnull String url, @Nonnull String name, @Nonnull LinkPermissions linkPermissions, @Nullable String id, @Nullable Date expires, @Nullable String pathLower, @Nullable TeamMemberInfo teamMemberInfo, @Nullable Team contentOwnerTeamInfo, @Nullable String previewType, @Nullable Date createdTimestamp) {
super(url, name, linkPermissions, id, expires, pathLower, teamMemberInfo, contentOwnerTeamInfo, previewType, createdTimestamp);
}

/**
Expand All @@ -77,7 +81,7 @@ public FolderLinkMetadata(@Nonnull String url, @Nonnull String name, @Nonnull Li
* preconditions.
*/
public FolderLinkMetadata(@Nonnull String url, @Nonnull String name, @Nonnull LinkPermissions linkPermissions) {
this(url, name, linkPermissions, null, null, null, null, null);
this(url, name, linkPermissions, null, null, null, null, null, null, null);
}

/**
Expand Down Expand Up @@ -165,6 +169,27 @@ public Team getContentOwnerTeamInfo() {
return contentOwnerTeamInfo;
}

/**
* The preview type is determined by the file extension of the shared link.
* It will be null if the file cannot be previewed by the file viewer.
*
* @return value for this field, or {@code null} if not present.
*/
@Nullable
public String getPreviewType() {
return previewType;
}

/**
* The time the shared link was created.
*
* @return value for this field, or {@code null} if not present.
*/
@Nullable
public Date getCreatedTimestamp() {
return createdTimestamp;
}

/**
* Returns a new builder for creating an instance of this class.
*
Expand Down Expand Up @@ -265,14 +290,40 @@ public Builder withContentOwnerTeamInfo(Team contentOwnerTeamInfo) {
return this;
}

/**
* Set value for optional field.
*
* @param previewType The preview type is determined by the file
* extension of the shared link. It will be null if the file cannot
* be previewed by the file viewer.
*
* @return this builder
*/
public Builder withPreviewType(String previewType) {
super.withPreviewType(previewType);
return this;
}

/**
* Set value for optional field.
*
* @param createdTimestamp The time the shared link was created.
*
* @return this builder
*/
public Builder withCreatedTimestamp(Date createdTimestamp) {
super.withCreatedTimestamp(createdTimestamp);
return this;
}

/**
* Builds an instance of {@link FolderLinkMetadata} configured with this
* builder's values
*
* @return new instance of {@link FolderLinkMetadata}
*/
public FolderLinkMetadata build() {
return new FolderLinkMetadata(url, name, linkPermissions, id, expires, pathLower, teamMemberInfo, contentOwnerTeamInfo);
return new FolderLinkMetadata(url, name, linkPermissions, id, expires, pathLower, teamMemberInfo, contentOwnerTeamInfo, previewType, createdTimestamp);
}
}

Expand Down Expand Up @@ -301,6 +352,8 @@ else if (obj.getClass().equals(this.getClass())) {
&& ((this.pathLower == other.pathLower) || (this.pathLower != null && this.pathLower.equals(other.pathLower)))
&& ((this.teamMemberInfo == other.teamMemberInfo) || (this.teamMemberInfo != null && this.teamMemberInfo.equals(other.teamMemberInfo)))
&& ((this.contentOwnerTeamInfo == other.contentOwnerTeamInfo) || (this.contentOwnerTeamInfo != null && this.contentOwnerTeamInfo.equals(other.contentOwnerTeamInfo)))
&& ((this.previewType == other.previewType) || (this.previewType != null && this.previewType.equals(other.previewType)))
&& ((this.createdTimestamp == other.createdTimestamp) || (this.createdTimestamp != null && this.createdTimestamp.equals(other.createdTimestamp)))
;
}
else {
Expand Down Expand Up @@ -363,6 +416,14 @@ public void serialize(FolderLinkMetadata value, JsonGenerator g, boolean collaps
g.writeFieldName("content_owner_team_info");
StoneSerializers.nullableStruct(Team.Serializer.INSTANCE).serialize(value.contentOwnerTeamInfo, g);
}
if (value.previewType != null) {
g.writeFieldName("preview_type");
StoneSerializers.nullable(StoneSerializers.string()).serialize(value.previewType, g);
}
if (value.createdTimestamp != null) {
g.writeFieldName("created_timestamp");
StoneSerializers.nullable(StoneSerializers.timestamp()).serialize(value.createdTimestamp, g);
}
if (!collapse) {
g.writeEndObject();
}
Expand All @@ -388,6 +449,8 @@ public FolderLinkMetadata deserialize(JsonParser p, boolean collapsed) throws IO
String f_pathLower = null;
TeamMemberInfo f_teamMemberInfo = null;
Team f_contentOwnerTeamInfo = null;
String f_previewType = null;
Date f_createdTimestamp = null;
while (p.getCurrentToken() == JsonToken.FIELD_NAME) {
String field = p.getCurrentName();
p.nextToken();
Expand Down Expand Up @@ -415,6 +478,12 @@ else if ("team_member_info".equals(field)) {
else if ("content_owner_team_info".equals(field)) {
f_contentOwnerTeamInfo = StoneSerializers.nullableStruct(Team.Serializer.INSTANCE).deserialize(p);
}
else if ("preview_type".equals(field)) {
f_previewType = StoneSerializers.nullable(StoneSerializers.string()).deserialize(p);
}
else if ("created_timestamp".equals(field)) {
f_createdTimestamp = StoneSerializers.nullable(StoneSerializers.timestamp()).deserialize(p);
}
else {
skipValue(p);
}
Expand All @@ -428,7 +497,7 @@ else if ("content_owner_team_info".equals(field)) {
if (f_linkPermissions == null) {
throw new JsonParseException(p, "Required field \"link_permissions\" missing.");
}
value = new FolderLinkMetadata(f_url, f_name, f_linkPermissions, f_id, f_expires, f_pathLower, f_teamMemberInfo, f_contentOwnerTeamInfo);
value = new FolderLinkMetadata(f_url, f_name, f_linkPermissions, f_id, f_expires, f_pathLower, f_teamMemberInfo, f_contentOwnerTeamInfo, f_previewType, f_createdTimestamp);
}
else {
throw new JsonParseException(p, "No subtype found that matches tag: \"" + tag + "\"");
Expand Down
Loading
Loading