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
5 changes: 5 additions & 0 deletions core/api/core.api
Original file line number Diff line number Diff line change
Expand Up @@ -3746,6 +3746,7 @@ public class com/dropbox/core/v2/files/DbxAppGetThumbnailV2Builder : com/dropbox
public fun withExcludeMediaInfo (Ljava/lang/Boolean;)Lcom/dropbox/core/v2/files/DbxAppGetThumbnailV2Builder;
public fun withFormat (Lcom/dropbox/core/v2/files/ThumbnailFormat;)Lcom/dropbox/core/v2/files/DbxAppGetThumbnailV2Builder;
public fun withMode (Lcom/dropbox/core/v2/files/ThumbnailMode;)Lcom/dropbox/core/v2/files/DbxAppGetThumbnailV2Builder;
public fun withPreserveTransparency (Ljava/lang/Boolean;)Lcom/dropbox/core/v2/files/DbxAppGetThumbnailV2Builder;
public fun withQuality (Lcom/dropbox/core/v2/files/ThumbnailQuality;)Lcom/dropbox/core/v2/files/DbxAppGetThumbnailV2Builder;
public fun withSize (Lcom/dropbox/core/v2/files/ThumbnailSize;)Lcom/dropbox/core/v2/files/DbxAppGetThumbnailV2Builder;
}
Expand Down Expand Up @@ -3880,6 +3881,7 @@ public class com/dropbox/core/v2/files/DbxUserGetThumbnailV2Builder : com/dropbo
public fun withExcludeMediaInfo (Ljava/lang/Boolean;)Lcom/dropbox/core/v2/files/DbxUserGetThumbnailV2Builder;
public fun withFormat (Lcom/dropbox/core/v2/files/ThumbnailFormat;)Lcom/dropbox/core/v2/files/DbxUserGetThumbnailV2Builder;
public fun withMode (Lcom/dropbox/core/v2/files/ThumbnailMode;)Lcom/dropbox/core/v2/files/DbxUserGetThumbnailV2Builder;
public fun withPreserveTransparency (Ljava/lang/Boolean;)Lcom/dropbox/core/v2/files/DbxUserGetThumbnailV2Builder;
public fun withQuality (Lcom/dropbox/core/v2/files/ThumbnailQuality;)Lcom/dropbox/core/v2/files/DbxUserGetThumbnailV2Builder;
public fun withSize (Lcom/dropbox/core/v2/files/ThumbnailSize;)Lcom/dropbox/core/v2/files/DbxUserGetThumbnailV2Builder;
}
Expand Down Expand Up @@ -6589,6 +6591,7 @@ public final class com/dropbox/core/v2/files/ThumbnailV2Error {
public static final field OTHER Lcom/dropbox/core/v2/files/ThumbnailV2Error;
public static final field UNSUPPORTED_EXTENSION Lcom/dropbox/core/v2/files/ThumbnailV2Error;
public static final field UNSUPPORTED_IMAGE Lcom/dropbox/core/v2/files/ThumbnailV2Error;
public static final field UNSUPPORTED_OUTPUT_FORMAT Lcom/dropbox/core/v2/files/ThumbnailV2Error;
public fun equals (Ljava/lang/Object;)Z
public fun getPathValue ()Lcom/dropbox/core/v2/files/LookupError;
public fun hashCode ()I
Expand All @@ -6600,6 +6603,7 @@ public final class com/dropbox/core/v2/files/ThumbnailV2Error {
public fun isPath ()Z
public fun isUnsupportedExtension ()Z
public fun isUnsupportedImage ()Z
public fun isUnsupportedOutputFormat ()Z
public static fun path (Lcom/dropbox/core/v2/files/LookupError;)Lcom/dropbox/core/v2/files/ThumbnailV2Error;
public fun tag ()Lcom/dropbox/core/v2/files/ThumbnailV2Error$Tag;
public fun toString ()Ljava/lang/String;
Expand All @@ -6615,6 +6619,7 @@ public final class com/dropbox/core/v2/files/ThumbnailV2Error$Tag : java/lang/En
public static final field PATH Lcom/dropbox/core/v2/files/ThumbnailV2Error$Tag;
public static final field UNSUPPORTED_EXTENSION Lcom/dropbox/core/v2/files/ThumbnailV2Error$Tag;
public static final field UNSUPPORTED_IMAGE Lcom/dropbox/core/v2/files/ThumbnailV2Error$Tag;
public static final field UNSUPPORTED_OUTPUT_FORMAT Lcom/dropbox/core/v2/files/ThumbnailV2Error$Tag;
public static fun valueOf (Ljava/lang/String;)Lcom/dropbox/core/v2/files/ThumbnailV2Error$Tag;
public static fun values ()[Lcom/dropbox/core/v2/files/ThumbnailV2Error$Tag;
}
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,23 @@ public DbxAppGetThumbnailV2Builder withExcludeMediaInfo(Boolean excludeMediaInfo
return this;
}

/**
* Set value for optional field.
*
* <p> If left unset or set to {@code null}, defaults to {@code false}. </p>
*
* @param preserveTransparency Whether to preserve the original image's
* transparency in the thumbnail. This is supported only when the output
* format is PNG or WebP. Requests that set this flag with JPEG output
* return an error. Defaults to {@code false} when set to {@code null}.
*
* @return this builder
*/
public DbxAppGetThumbnailV2Builder withPreserveTransparency(Boolean preserveTransparency) {
this._builder.withPreserveTransparency(preserveTransparency);
return this;
}

@Override
public DbxDownloader<PreviewResult> start() throws ThumbnailV2ErrorException, DbxException {
ThumbnailV2Arg arg_ = this._builder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,23 @@ public DbxUserGetThumbnailV2Builder withExcludeMediaInfo(Boolean excludeMediaInf
return this;
}

/**
* Set value for optional field.
*
* <p> If left unset or set to {@code null}, defaults to {@code false}. </p>
*
* @param preserveTransparency Whether to preserve the original image's
* transparency in the thumbnail. This is supported only when the output
* format is PNG or WebP. Requests that set this flag with JPEG output
* return an error. Defaults to {@code false} when set to {@code null}.
*
* @return this builder
*/
public DbxUserGetThumbnailV2Builder withPreserveTransparency(Boolean preserveTransparency) {
this._builder.withPreserveTransparency(preserveTransparency);
return this;
}

@Override
public DbxDownloader<PreviewResult> start() throws ThumbnailV2ErrorException, DbxException {
ThumbnailV2Arg arg_ = this._builder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class ThumbnailV2Arg {
protected final ThumbnailQuality quality;
@Nullable
protected final Boolean excludeMediaInfo;
protected final boolean preserveTransparency;

/**
* Use {@link newBuilder} to create instances of this class without
Expand All @@ -56,11 +57,15 @@ class ThumbnailV2Arg {
* set for photo and video. When this flag is true, {@link
* FileMetadata#getMediaInfo} is not populated. This improves latency
* for use cases where `media_info` is not needed.
* @param preserveTransparency Whether to preserve the original image's
* transparency in the thumbnail. This is supported only when the output
* format is PNG or WebP. Requests that set this flag with JPEG output
* return an error.
*
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public ThumbnailV2Arg(@Nonnull PathOrLink resource, @Nonnull ThumbnailFormat format, @Nonnull ThumbnailSize size, @Nonnull ThumbnailMode mode, @Nonnull ThumbnailQuality quality, @Nullable Boolean excludeMediaInfo) {
public ThumbnailV2Arg(@Nonnull PathOrLink resource, @Nonnull ThumbnailFormat format, @Nonnull ThumbnailSize size, @Nonnull ThumbnailMode mode, @Nonnull ThumbnailQuality quality, @Nullable Boolean excludeMediaInfo, boolean preserveTransparency) {
if (resource == null) {
throw new IllegalArgumentException("Required value for 'resource' is null");
}
Expand All @@ -82,6 +87,7 @@ public ThumbnailV2Arg(@Nonnull PathOrLink resource, @Nonnull ThumbnailFormat for
}
this.quality = quality;
this.excludeMediaInfo = excludeMediaInfo;
this.preserveTransparency = preserveTransparency;
}

/**
Expand All @@ -98,7 +104,7 @@ public ThumbnailV2Arg(@Nonnull PathOrLink resource, @Nonnull ThumbnailFormat for
* preconditions.
*/
public ThumbnailV2Arg(@Nonnull PathOrLink resource) {
this(resource, ThumbnailFormat.JPEG, ThumbnailSize.W64H64, ThumbnailMode.STRICT, ThumbnailQuality.QUALITY_80, null);
this(resource, ThumbnailFormat.JPEG, ThumbnailSize.W64H64, ThumbnailMode.STRICT, ThumbnailQuality.QUALITY_80, null, false);
}

/**
Expand Down Expand Up @@ -173,6 +179,18 @@ public Boolean getExcludeMediaInfo() {
return excludeMediaInfo;
}

/**
* Whether to preserve the original image's transparency in the thumbnail.
* This is supported only when the output format is PNG or WebP. Requests
* that set this flag with JPEG output return an error.
*
* @return value for this field, or {@code null} if not present. Defaults to
* false.
*/
public boolean getPreserveTransparency() {
return preserveTransparency;
}

/**
* Returns a new builder for creating an instance of this class.
*
Expand Down Expand Up @@ -201,6 +219,7 @@ public static class Builder {
protected ThumbnailMode mode;
protected ThumbnailQuality quality;
protected Boolean excludeMediaInfo;
protected boolean preserveTransparency;

protected Builder(PathOrLink resource) {
if (resource == null) {
Expand All @@ -212,6 +231,7 @@ protected Builder(PathOrLink resource) {
this.mode = ThumbnailMode.STRICT;
this.quality = ThumbnailQuality.QUALITY_80;
this.excludeMediaInfo = null;
this.preserveTransparency = false;
}

/**
Expand Down Expand Up @@ -332,14 +352,38 @@ public Builder withExcludeMediaInfo(Boolean excludeMediaInfo) {
return this;
}

/**
* Set value for optional field.
*
* <p> If left unset or set to {@code null}, defaults to {@code false}.
* </p>
*
* @param preserveTransparency Whether to preserve the original image's
* transparency in the thumbnail. This is supported only when the
* output format is PNG or WebP. Requests that set this flag with
* JPEG output return an error. Defaults to {@code false} when set
* to {@code null}.
*
* @return this builder
*/
public Builder withPreserveTransparency(Boolean preserveTransparency) {
if (preserveTransparency != null) {
this.preserveTransparency = preserveTransparency;
}
else {
this.preserveTransparency = false;
}
return this;
}

/**
* Builds an instance of {@link ThumbnailV2Arg} configured with this
* builder's values
*
* @return new instance of {@link ThumbnailV2Arg}
*/
public ThumbnailV2Arg build() {
return new ThumbnailV2Arg(resource, format, size, mode, quality, excludeMediaInfo);
return new ThumbnailV2Arg(resource, format, size, mode, quality, excludeMediaInfo, preserveTransparency);
}
}

Expand All @@ -351,7 +395,8 @@ public int hashCode() {
this.size,
this.mode,
this.quality,
this.excludeMediaInfo
this.excludeMediaInfo,
this.preserveTransparency
});
return hash;
}
Expand All @@ -373,6 +418,7 @@ else if (obj.getClass().equals(this.getClass())) {
&& ((this.mode == other.mode) || (this.mode.equals(other.mode)))
&& ((this.quality == other.quality) || (this.quality.equals(other.quality)))
&& ((this.excludeMediaInfo == other.excludeMediaInfo) || (this.excludeMediaInfo != null && this.excludeMediaInfo.equals(other.excludeMediaInfo)))
&& (this.preserveTransparency == other.preserveTransparency)
;
}
else {
Expand Down Expand Up @@ -422,6 +468,8 @@ public void serialize(ThumbnailV2Arg value, JsonGenerator g, boolean collapse) t
g.writeFieldName("exclude_media_info");
StoneSerializers.nullable(StoneSerializers.boolean_()).serialize(value.excludeMediaInfo, g);
}
g.writeFieldName("preserve_transparency");
StoneSerializers.boolean_().serialize(value.preserveTransparency, g);
if (!collapse) {
g.writeEndObject();
}
Expand All @@ -442,6 +490,7 @@ public ThumbnailV2Arg deserialize(JsonParser p, boolean collapsed) throws IOExce
ThumbnailMode f_mode = ThumbnailMode.STRICT;
ThumbnailQuality f_quality = ThumbnailQuality.QUALITY_80;
Boolean f_excludeMediaInfo = null;
Boolean f_preserveTransparency = false;
while (p.getCurrentToken() == JsonToken.FIELD_NAME) {
String field = p.getCurrentName();
p.nextToken();
Expand All @@ -463,14 +512,17 @@ else if ("quality".equals(field)) {
else if ("exclude_media_info".equals(field)) {
f_excludeMediaInfo = StoneSerializers.nullable(StoneSerializers.boolean_()).deserialize(p);
}
else if ("preserve_transparency".equals(field)) {
f_preserveTransparency = StoneSerializers.boolean_().deserialize(p);
}
else {
skipValue(p);
}
}
if (f_resource == null) {
throw new JsonParseException(p, "Required field \"resource\" missing.");
}
value = new ThumbnailV2Arg(f_resource, f_format, f_size, f_mode, f_quality, f_excludeMediaInfo);
value = new ThumbnailV2Arg(f_resource, f_format, f_size, f_mode, f_quality, f_excludeMediaInfo, f_preserveTransparency);
}
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 @@ -61,6 +61,10 @@ public enum Tag {
* The shared link does not exist.
*/
NOT_FOUND,
/**
* Transparency preservation is supported only for PNG and WebP output.
*/
UNSUPPORTED_OUTPUT_FORMAT,
/**
* Catch-all used for unknown tag values returned by the Dropbox
* servers.
Expand Down Expand Up @@ -96,6 +100,10 @@ public enum Tag {
* The shared link does not exist.
*/
public static final ThumbnailV2Error NOT_FOUND = new ThumbnailV2Error().withTag(Tag.NOT_FOUND);
/**
* Transparency preservation is supported only for PNG and WebP output.
*/
public static final ThumbnailV2Error UNSUPPORTED_OUTPUT_FORMAT = new ThumbnailV2Error().withTag(Tag.UNSUPPORTED_OUTPUT_FORMAT);
/**
* Catch-all used for unknown tag values returned by the Dropbox servers.
*
Expand Down Expand Up @@ -273,6 +281,17 @@ public boolean isNotFound() {
return this._tag == Tag.NOT_FOUND;
}

/**
* Returns {@code true} if this instance has the tag {@link
* Tag#UNSUPPORTED_OUTPUT_FORMAT}, {@code false} otherwise.
*
* @return {@code true} if this instance is tagged as {@link
* Tag#UNSUPPORTED_OUTPUT_FORMAT}, {@code false} otherwise.
*/
public boolean isUnsupportedOutputFormat() {
return this._tag == Tag.UNSUPPORTED_OUTPUT_FORMAT;
}

/**
* Returns {@code true} if this instance has the tag {@link Tag#OTHER},
* {@code false} otherwise.
Expand Down Expand Up @@ -321,6 +340,8 @@ else if (obj instanceof ThumbnailV2Error) {
return true;
case NOT_FOUND:
return true;
case UNSUPPORTED_OUTPUT_FORMAT:
return true;
case OTHER:
return true;
default:
Expand Down Expand Up @@ -390,6 +411,10 @@ public void serialize(ThumbnailV2Error value, JsonGenerator g) throws IOExceptio
g.writeString("not_found");
break;
}
case UNSUPPORTED_OUTPUT_FORMAT: {
g.writeString("unsupported_output_format");
break;
}
default: {
g.writeString("other");
}
Expand Down Expand Up @@ -438,6 +463,9 @@ else if ("access_denied".equals(tag)) {
else if ("not_found".equals(tag)) {
value = ThumbnailV2Error.NOT_FOUND;
}
else if ("unsupported_output_format".equals(tag)) {
value = ThumbnailV2Error.UNSUPPORTED_OUTPUT_FORMAT;
}
else {
value = ThumbnailV2Error.OTHER;
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/stone
Submodule stone updated 1 files
+6 −1 files.stone
Loading