From d257e7b932f83cac807e1a9d0307e82663997183 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Thu, 18 Sep 2025 18:27:52 +0000 Subject: [PATCH] SDK regeneration --- README.md | 2 +- build.gradle | 4 +- .../com/pipedream/api/core/ClientOptions.java | 4 +- .../filestash/AsyncFileStashClient.java | 41 +++++++ .../filestash/AsyncRawFileStashClient.java | 100 +++++++++++++++++ .../resources/filestash/FileStashClient.java | 40 +++++++ .../filestash/RawFileStashClient.java | 82 ++++++++++++++ .../FileStashDownloadFileRequest.java | 102 +++++++++++++++++ .../com/pipedream/api/types/PropOption.java | 34 +++--- .../pipedream/api/types/PropOptionValue.java | 105 ++++++++++++++++++ 10 files changed, 496 insertions(+), 18 deletions(-) create mode 100644 src/main/java/com/pipedream/api/resources/filestash/AsyncFileStashClient.java create mode 100644 src/main/java/com/pipedream/api/resources/filestash/AsyncRawFileStashClient.java create mode 100644 src/main/java/com/pipedream/api/resources/filestash/FileStashClient.java create mode 100644 src/main/java/com/pipedream/api/resources/filestash/RawFileStashClient.java create mode 100644 src/main/java/com/pipedream/api/resources/filestash/requests/FileStashDownloadFileRequest.java create mode 100644 src/main/java/com/pipedream/api/types/PropOptionValue.java diff --git a/README.md b/README.md index 3861922..8516429 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Add the dependency in your `pom.xml` file: com.pipedream pipedream - 1.0.4 + 1.0.5 ``` diff --git a/build.gradle b/build.gradle index 40f9a59..e8564b2 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,7 @@ java { group = 'com.pipedream' -version = '1.0.4' +version = '1.0.5' jar { dependsOn(":generatePomFileForMavenPublication") @@ -79,7 +79,7 @@ publishing { maven(MavenPublication) { groupId = 'com.pipedream' artifactId = 'pipedream' - version = '1.0.4' + version = '1.0.5' from components.java pom { name = 'pipedream' diff --git a/src/main/java/com/pipedream/api/core/ClientOptions.java b/src/main/java/com/pipedream/api/core/ClientOptions.java index 5e483e4..1dd75f9 100644 --- a/src/main/java/com/pipedream/api/core/ClientOptions.java +++ b/src/main/java/com/pipedream/api/core/ClientOptions.java @@ -35,10 +35,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.pipedream:pipedream/1.0.4"); + put("User-Agent", "com.pipedream:pipedream/1.0.5"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.pipedream.fern:api-sdk"); - put("X-Fern-SDK-Version", "1.0.4"); + put("X-Fern-SDK-Version", "1.0.5"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/pipedream/api/resources/filestash/AsyncFileStashClient.java b/src/main/java/com/pipedream/api/resources/filestash/AsyncFileStashClient.java new file mode 100644 index 0000000..72caf81 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/filestash/AsyncFileStashClient.java @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.filestash; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.filestash.requests.FileStashDownloadFileRequest; +import java.util.concurrent.CompletableFuture; + +public class AsyncFileStashClient { + protected final ClientOptions clientOptions; + + private final AsyncRawFileStashClient rawClient; + + public AsyncFileStashClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawFileStashClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawFileStashClient withRawResponse() { + return this.rawClient; + } + + /** + * Download a file from File Stash + */ + public CompletableFuture downloadFile(FileStashDownloadFileRequest request) { + return this.rawClient.downloadFile(request).thenApply(response -> response.body()); + } + + /** + * Download a file from File Stash + */ + public CompletableFuture downloadFile(FileStashDownloadFileRequest request, RequestOptions requestOptions) { + return this.rawClient.downloadFile(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/filestash/AsyncRawFileStashClient.java b/src/main/java/com/pipedream/api/resources/filestash/AsyncRawFileStashClient.java new file mode 100644 index 0000000..89668b6 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/filestash/AsyncRawFileStashClient.java @@ -0,0 +1,100 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.filestash; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.BaseClientApiException; +import com.pipedream.api.core.BaseClientException; +import com.pipedream.api.core.BaseClientHttpResponse; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.errors.TooManyRequestsError; +import com.pipedream.api.resources.filestash.requests.FileStashDownloadFileRequest; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawFileStashClient { + protected final ClientOptions clientOptions; + + public AsyncRawFileStashClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Download a file from File Stash + */ + public CompletableFuture> downloadFile(FileStashDownloadFileRequest request) { + return downloadFile(request, null); + } + + /** + * Download a file from File Stash + */ + public CompletableFuture> downloadFile( + FileStashDownloadFileRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("file_stash/download"); + QueryStringMapper.addQueryParameter(httpUrl, "s3_key", request.getS3Key(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new BaseClientHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 429) { + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new BaseClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/filestash/FileStashClient.java b/src/main/java/com/pipedream/api/resources/filestash/FileStashClient.java new file mode 100644 index 0000000..f889b1e --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/filestash/FileStashClient.java @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.filestash; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.filestash.requests.FileStashDownloadFileRequest; + +public class FileStashClient { + protected final ClientOptions clientOptions; + + private final RawFileStashClient rawClient; + + public FileStashClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawFileStashClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawFileStashClient withRawResponse() { + return this.rawClient; + } + + /** + * Download a file from File Stash + */ + public void downloadFile(FileStashDownloadFileRequest request) { + this.rawClient.downloadFile(request).body(); + } + + /** + * Download a file from File Stash + */ + public void downloadFile(FileStashDownloadFileRequest request, RequestOptions requestOptions) { + this.rawClient.downloadFile(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/filestash/RawFileStashClient.java b/src/main/java/com/pipedream/api/resources/filestash/RawFileStashClient.java new file mode 100644 index 0000000..777c227 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/filestash/RawFileStashClient.java @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.filestash; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.BaseClientApiException; +import com.pipedream.api.core.BaseClientException; +import com.pipedream.api.core.BaseClientHttpResponse; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.errors.TooManyRequestsError; +import com.pipedream.api.resources.filestash.requests.FileStashDownloadFileRequest; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawFileStashClient { + protected final ClientOptions clientOptions; + + public RawFileStashClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Download a file from File Stash + */ + public BaseClientHttpResponse downloadFile(FileStashDownloadFileRequest request) { + return downloadFile(request, null); + } + + /** + * Download a file from File Stash + */ + public BaseClientHttpResponse downloadFile( + FileStashDownloadFileRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("file_stash/download"); + QueryStringMapper.addQueryParameter(httpUrl, "s3_key", request.getS3Key(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new BaseClientHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 429) { + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + throw new BaseClientApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new BaseClientException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/filestash/requests/FileStashDownloadFileRequest.java b/src/main/java/com/pipedream/api/resources/filestash/requests/FileStashDownloadFileRequest.java new file mode 100644 index 0000000..f85c1ab --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/filestash/requests/FileStashDownloadFileRequest.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.filestash.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FileStashDownloadFileRequest.Builder.class) +public final class FileStashDownloadFileRequest { + private final String s3Key; + + private final Map additionalProperties; + + private FileStashDownloadFileRequest(String s3Key, Map additionalProperties) { + this.s3Key = s3Key; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("s3_key") + public String getS3Key() { + return s3Key; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FileStashDownloadFileRequest && equalTo((FileStashDownloadFileRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FileStashDownloadFileRequest other) { + return s3Key.equals(other.s3Key); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.s3Key); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static S3KeyStage builder() { + return new Builder(); + } + + public interface S3KeyStage { + _FinalStage s3Key(@NotNull String s3Key); + + Builder from(FileStashDownloadFileRequest other); + } + + public interface _FinalStage { + FileStashDownloadFileRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements S3KeyStage, _FinalStage { + private String s3Key; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FileStashDownloadFileRequest other) { + s3Key(other.getS3Key()); + return this; + } + + @java.lang.Override + @JsonSetter("s3_key") + public _FinalStage s3Key(@NotNull String s3Key) { + this.s3Key = Objects.requireNonNull(s3Key, "s3Key must not be null"); + return this; + } + + @java.lang.Override + public FileStashDownloadFileRequest build() { + return new FileStashDownloadFileRequest(s3Key, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/PropOption.java b/src/main/java/com/pipedream/api/types/PropOption.java index f3fd389..29d341b 100644 --- a/src/main/java/com/pipedream/api/types/PropOption.java +++ b/src/main/java/com/pipedream/api/types/PropOption.java @@ -9,11 +9,13 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.pipedream.api.core.ObjectMappers; import java.util.HashMap; import java.util.Map; import java.util.Objects; +import java.util.Optional; import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @@ -21,11 +23,11 @@ public final class PropOption { private final String label; - private final Object value; + private final Optional value; private final Map additionalProperties; - private PropOption(String label, Object value, Map additionalProperties) { + private PropOption(String label, Optional value, Map additionalProperties) { this.label = label; this.value = value; this.additionalProperties = additionalProperties; @@ -40,7 +42,7 @@ public String getLabel() { } @JsonProperty("value") - public Object getValue() { + public Optional getValue() { return value; } @@ -77,24 +79,24 @@ public interface LabelStage { /** *

The human-readable label for the option

*/ - ValueStage label(@NotNull String label); + _FinalStage label(@NotNull String label); Builder from(PropOption other); } - public interface ValueStage { - _FinalStage value(Object value); - } - public interface _FinalStage { PropOption build(); + + _FinalStage value(Optional value); + + _FinalStage value(PropOptionValue value); } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements LabelStage, ValueStage, _FinalStage { + public static final class Builder implements LabelStage, _FinalStage { private String label; - private Object value; + private Optional value = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -115,14 +117,20 @@ public Builder from(PropOption other) { */ @java.lang.Override @JsonSetter("label") - public ValueStage label(@NotNull String label) { + public _FinalStage label(@NotNull String label) { this.label = Objects.requireNonNull(label, "label must not be null"); return this; } @java.lang.Override - @JsonSetter("value") - public _FinalStage value(Object value) { + public _FinalStage value(PropOptionValue value) { + this.value = Optional.ofNullable(value); + return this; + } + + @java.lang.Override + @JsonSetter(value = "value", nulls = Nulls.SKIP) + public _FinalStage value(Optional value) { this.value = value; return this; } diff --git a/src/main/java/com/pipedream/api/types/PropOptionValue.java b/src/main/java/com/pipedream/api/types/PropOptionValue.java new file mode 100644 index 0000000..4ccaf0b --- /dev/null +++ b/src/main/java/com/pipedream/api/types/PropOptionValue.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.pipedream.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = PropOptionValue.Deserializer.class) +public final class PropOptionValue { + private final Object value; + + private final int type; + + private PropOptionValue(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((String) this.value); + } else if (this.type == 1) { + return visitor.visit((int) this.value); + } else if (this.type == 2) { + return visitor.visit((boolean) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PropOptionValue && equalTo((PropOptionValue) other); + } + + private boolean equalTo(PropOptionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static PropOptionValue of(String value) { + return new PropOptionValue(value, 0); + } + + public static PropOptionValue of(int value) { + return new PropOptionValue(value, 1); + } + + public static PropOptionValue of(boolean value) { + return new PropOptionValue(value, 2); + } + + public interface Visitor { + T visit(String value); + + T visit(int value); + + T visit(boolean value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(PropOptionValue.class); + } + + @java.lang.Override + public PropOptionValue deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (RuntimeException e) { + } + if (value instanceof Integer) { + return of((Integer) value); + } + if (value instanceof Boolean) { + return of((Boolean) value); + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +}