From c0bcd53d9aabcb4788eac87ec2ca15789a52373b Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Tue, 18 Aug 2026 19:31:16 +0000 Subject: [PATCH 1/3] [fern-generated] Update SDK Generated by Fern CLI Version: unknown Generators: - fernapi/fern-java-sdk: 4.8.4 --- .fern/metadata.json | 6 +- README.md | 5 +- build.gradle | 4 +- .../com/pipedream/api/core/ClientOptions.java | 4 +- .../appoverrides/AppOverridesClient.java | 128 +++ .../appoverrides/AsyncAppOverridesClient.java | 131 +++ .../AsyncRawAppOverridesClient.java | 492 +++++++++++ .../appoverrides/RawAppOverridesClient.java | 398 +++++++++ .../requests/AppOverridesListRequest.java | 203 +++++ .../requests/CreateAppOverrideOpts.java | 254 ++++++ .../requests/UpdateAppOverrideOpts.java | 171 ++++ .../oauthapps/AsyncOauthAppsClient.java | 130 +++ .../oauthapps/AsyncRawOauthAppsClient.java | 493 +++++++++++ .../resources/oauthapps/OauthAppsClient.java | 128 +++ .../oauthapps/RawOauthAppsClient.java | 400 +++++++++ .../requests/CreateOauthAppOpts.java | 384 ++++++++ .../requests/OauthAppsListRequest.java | 233 +++++ .../requests/UpdateOauthAppOpts.java | 266 ++++++ .../com/pipedream/api/types/AppOverride.java | 401 +++++++++ .../api/types/ListAppOverridesResponse.java | 163 ++++ .../api/types/ListOauthAppsResponse.java | 162 ++++ .../com/pipedream/api/types/OauthApp.java | 821 ++++++++++++++++++ .../api/types/ValidateTokenResponse.java | 45 + 23 files changed, 5413 insertions(+), 9 deletions(-) create mode 100644 src/main/java/com/pipedream/api/resources/appoverrides/AppOverridesClient.java create mode 100644 src/main/java/com/pipedream/api/resources/appoverrides/AsyncAppOverridesClient.java create mode 100644 src/main/java/com/pipedream/api/resources/appoverrides/AsyncRawAppOverridesClient.java create mode 100644 src/main/java/com/pipedream/api/resources/appoverrides/RawAppOverridesClient.java create mode 100644 src/main/java/com/pipedream/api/resources/appoverrides/requests/AppOverridesListRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/appoverrides/requests/CreateAppOverrideOpts.java create mode 100644 src/main/java/com/pipedream/api/resources/appoverrides/requests/UpdateAppOverrideOpts.java create mode 100644 src/main/java/com/pipedream/api/resources/oauthapps/AsyncOauthAppsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/oauthapps/AsyncRawOauthAppsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/oauthapps/OauthAppsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/oauthapps/RawOauthAppsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/oauthapps/requests/CreateOauthAppOpts.java create mode 100644 src/main/java/com/pipedream/api/resources/oauthapps/requests/OauthAppsListRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/oauthapps/requests/UpdateOauthAppOpts.java create mode 100644 src/main/java/com/pipedream/api/types/AppOverride.java create mode 100644 src/main/java/com/pipedream/api/types/ListAppOverridesResponse.java create mode 100644 src/main/java/com/pipedream/api/types/ListOauthAppsResponse.java create mode 100644 src/main/java/com/pipedream/api/types/OauthApp.java diff --git a/.fern/metadata.json b/.fern/metadata.json index b960837..5c0771e 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -10,9 +10,9 @@ ], "retry-status-codes": "legacy" }, - "originGitCommit": "0154aca6f568afe2b2c183a43a8454aa86412754", + "originGitCommit": "729a65c6931057ef726cbf54bc9603b5d93c752a", "originGitCommitIsDirty": false, "invokedBy": "ci", "ciProvider": "github", - "sdkVersion": "2.1.0" -} + "sdkVersion": "2.1.1" +} \ No newline at end of file diff --git a/README.md b/README.md index f2529a9..8fb2837 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Add the dependency in your `build.gradle` file: ```groovy dependencies { - implementation 'com.pipedream:pipedream:2.1.0' + implementation 'com.pipedream:pipedream:2.1.1' } ``` @@ -42,7 +42,7 @@ Add the dependency in your `pom.xml` file: com.pipedream pipedream - 2.1.0 + 2.1.1 ``` @@ -267,3 +267,4 @@ On the other hand, contributions to the README are always very welcome! ## Reference A full reference for this library is available [here](https://github.com/PipedreamHQ/pipedream-sdk-java/blob/HEAD/./reference.md). + diff --git a/build.gradle b/build.gradle index 6d6eb8d..1fe1ce3 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,7 @@ java { group = 'com.pipedream' -version = '2.1.0' +version = '2.1.1' jar { dependsOn(":generatePomFileForMavenPublication") @@ -79,7 +79,7 @@ publishing { maven(MavenPublication) { groupId = 'com.pipedream' artifactId = 'pipedream' - version = '2.1.0' + version = '2.1.1' 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 0d8862c..6071745 100644 --- a/src/main/java/com/pipedream/api/core/ClientOptions.java +++ b/src/main/java/com/pipedream/api/core/ClientOptions.java @@ -41,10 +41,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.pipedream:pipedream/2.1.0"); + put("User-Agent", "com.pipedream:pipedream/2.1.1"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.pipedream.fern:api-sdk"); - put("X-Fern-SDK-Version", "2.1.0"); + put("X-Fern-SDK-Version", "2.1.1"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/pipedream/api/resources/appoverrides/AppOverridesClient.java b/src/main/java/com/pipedream/api/resources/appoverrides/AppOverridesClient.java new file mode 100644 index 0000000..b5ab766 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/appoverrides/AppOverridesClient.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appoverrides; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.appoverrides.requests.AppOverridesListRequest; +import com.pipedream.api.resources.appoverrides.requests.CreateAppOverrideOpts; +import com.pipedream.api.resources.appoverrides.requests.UpdateAppOverrideOpts; +import com.pipedream.api.types.AppOverride; + +public class AppOverridesClient { + protected final ClientOptions clientOptions; + + private final RawAppOverridesClient rawClient; + + public AppOverridesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAppOverridesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAppOverridesClient withRawResponse() { + return this.rawClient; + } + + /** + * List the app overrides available to the project, including the parent workspace's + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * List the app overrides available to the project, including the parent workspace's + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * List the app overrides available to the project, including the parent workspace's + */ + public SyncPagingIterable list(AppOverridesListRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * List the app overrides available to the project, including the parent workspace's + */ + public SyncPagingIterable list(AppOverridesListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Create an app override with pre-defined custom field values + */ + public AppOverride create(CreateAppOverrideOpts request) { + return this.rawClient.create(request).body(); + } + + /** + * Create an app override with pre-defined custom field values + */ + public AppOverride create(CreateAppOverrideOpts request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Get the configuration of a specific app override + */ + public AppOverride retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Get the configuration of a specific app override + */ + public AppOverride retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Update an app override's name, custom field values, or OAuth client selection + */ + public AppOverride update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Update an app override's name, custom field values, or OAuth client selection + */ + public AppOverride update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Update an app override's name, custom field values, or OAuth client selection + */ + public AppOverride update(String id, UpdateAppOverrideOpts request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Update an app override's name, custom field values, or OAuth client selection + */ + public AppOverride update(String id, UpdateAppOverrideOpts request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Delete an app override without affecting accounts already connected with it + */ + public void delete(String id) { + this.rawClient.delete(id).body(); + } + + /** + * Delete an app override without affecting accounts already connected with it + */ + public void delete(String id, RequestOptions requestOptions) { + this.rawClient.delete(id, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/appoverrides/AsyncAppOverridesClient.java b/src/main/java/com/pipedream/api/resources/appoverrides/AsyncAppOverridesClient.java new file mode 100644 index 0000000..36246a5 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/appoverrides/AsyncAppOverridesClient.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appoverrides; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.appoverrides.requests.AppOverridesListRequest; +import com.pipedream.api.resources.appoverrides.requests.CreateAppOverrideOpts; +import com.pipedream.api.resources.appoverrides.requests.UpdateAppOverrideOpts; +import com.pipedream.api.types.AppOverride; +import java.util.concurrent.CompletableFuture; + +public class AsyncAppOverridesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAppOverridesClient rawClient; + + public AsyncAppOverridesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAppOverridesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAppOverridesClient withRawResponse() { + return this.rawClient; + } + + /** + * List the app overrides available to the project, including the parent workspace's + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * List the app overrides available to the project, including the parent workspace's + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * List the app overrides available to the project, including the parent workspace's + */ + public CompletableFuture> list(AppOverridesListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * List the app overrides available to the project, including the parent workspace's + */ + public CompletableFuture> list( + AppOverridesListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Create an app override with pre-defined custom field values + */ + public CompletableFuture create(CreateAppOverrideOpts request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Create an app override with pre-defined custom field values + */ + public CompletableFuture create(CreateAppOverrideOpts request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Get the configuration of a specific app override + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Get the configuration of a specific app override + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update an app override's name, custom field values, or OAuth client selection + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Update an app override's name, custom field values, or OAuth client selection + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update an app override's name, custom field values, or OAuth client selection + */ + public CompletableFuture update(String id, UpdateAppOverrideOpts request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Update an app override's name, custom field values, or OAuth client selection + */ + public CompletableFuture update( + String id, UpdateAppOverrideOpts request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Delete an app override without affecting accounts already connected with it + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Delete an app override without affecting accounts already connected with it + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/appoverrides/AsyncRawAppOverridesClient.java b/src/main/java/com/pipedream/api/resources/appoverrides/AsyncRawAppOverridesClient.java new file mode 100644 index 0000000..0166bb7 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/appoverrides/AsyncRawAppOverridesClient.java @@ -0,0 +1,492 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appoverrides; + +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.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.errors.BadRequestError; +import com.pipedream.api.errors.NotFoundError; +import com.pipedream.api.errors.TooManyRequestsError; +import com.pipedream.api.resources.appoverrides.requests.AppOverridesListRequest; +import com.pipedream.api.resources.appoverrides.requests.CreateAppOverrideOpts; +import com.pipedream.api.resources.appoverrides.requests.UpdateAppOverrideOpts; +import com.pipedream.api.types.AppOverride; +import com.pipedream.api.types.ListAppOverridesResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAppOverridesClient { + protected final ClientOptions clientOptions; + + public AsyncRawAppOverridesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * List the app overrides available to the project, including the parent workspace's + */ + public CompletableFuture>> list() { + return list(AppOverridesListRequest.builder().build()); + } + + /** + * List the app overrides available to the project, including the parent workspace's + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(AppOverridesListRequest.builder().build(), requestOptions); + } + + /** + * List the app overrides available to the project, including the parent workspace's + */ + public CompletableFuture>> list( + AppOverridesListRequest request) { + return list(request, null); + } + + /** + * List the app overrides available to the project, including the parent workspace's + */ + public CompletableFuture>> list( + AppOverridesListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("app_overrides"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + 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()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAppOverridesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAppOverridesResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + AppOverridesListRequest nextRequest = AppOverridesListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new BaseClientHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 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 + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, 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; + } + + /** + * Create an app override with pre-defined custom field values + */ + public CompletableFuture> create(CreateAppOverrideOpts request) { + return create(request, null); + } + + /** + * Create an app override with pre-defined custom field values + */ + public CompletableFuture> create( + CreateAppOverrideOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("app_overrides"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseClientException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .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()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AppOverride.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 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 + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, 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; + } + + /** + * Get the configuration of a specific app override + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, null); + } + + /** + * Get the configuration of a specific app override + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("app_overrides") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .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()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AppOverride.class), response)); + return; + } + 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 + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, 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; + } + + /** + * Update an app override's name, custom field values, or OAuth client selection + */ + public CompletableFuture> update(String id) { + return update(id, UpdateAppOverrideOpts.builder().build()); + } + + /** + * Update an app override's name, custom field values, or OAuth client selection + */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateAppOverrideOpts.builder().build(), requestOptions); + } + + /** + * Update an app override's name, custom field values, or OAuth client selection + */ + public CompletableFuture> update(String id, UpdateAppOverrideOpts request) { + return update(id, request, null); + } + + /** + * Update an app override's name, custom field values, or OAuth client selection + */ + public CompletableFuture> update( + String id, UpdateAppOverrideOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("app_overrides") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseClientException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .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()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AppOverride.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 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 + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, 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; + } + + /** + * Delete an app override without affecting accounts already connected with it + */ + public CompletableFuture> delete(String id) { + return delete(id, null); + } + + /** + * Delete an app override without affecting accounts already connected with it + */ + public CompletableFuture> delete(String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("app_overrides") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .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 + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, 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/appoverrides/RawAppOverridesClient.java b/src/main/java/com/pipedream/api/resources/appoverrides/RawAppOverridesClient.java new file mode 100644 index 0000000..450f943 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/appoverrides/RawAppOverridesClient.java @@ -0,0 +1,398 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appoverrides; + +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.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.errors.BadRequestError; +import com.pipedream.api.errors.NotFoundError; +import com.pipedream.api.errors.TooManyRequestsError; +import com.pipedream.api.resources.appoverrides.requests.AppOverridesListRequest; +import com.pipedream.api.resources.appoverrides.requests.CreateAppOverrideOpts; +import com.pipedream.api.resources.appoverrides.requests.UpdateAppOverrideOpts; +import com.pipedream.api.types.AppOverride; +import com.pipedream.api.types.ListAppOverridesResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAppOverridesClient { + protected final ClientOptions clientOptions; + + public RawAppOverridesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * List the app overrides available to the project, including the parent workspace's + */ + public BaseClientHttpResponse> list() { + return list(AppOverridesListRequest.builder().build()); + } + + /** + * List the app overrides available to the project, including the parent workspace's + */ + public BaseClientHttpResponse> list(RequestOptions requestOptions) { + return list(AppOverridesListRequest.builder().build(), requestOptions); + } + + /** + * List the app overrides available to the project, including the parent workspace's + */ + public BaseClientHttpResponse> list(AppOverridesListRequest request) { + return list(request, null); + } + + /** + * List the app overrides available to the project, including the parent workspace's + */ + public BaseClientHttpResponse> list( + AppOverridesListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("app_overrides"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + 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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAppOverridesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAppOverridesResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + AppOverridesListRequest nextRequest = AppOverridesListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new BaseClientHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, parsedResponse, () -> list( + nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseClientException("Network error executing HTTP request", e); + } + } + + /** + * Create an app override with pre-defined custom field values + */ + public BaseClientHttpResponse create(CreateAppOverrideOpts request) { + return create(request, null); + } + + /** + * Create an app override with pre-defined custom field values + */ + public BaseClientHttpResponse create(CreateAppOverrideOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("app_overrides"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseClientException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AppOverride.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseClientException("Network error executing HTTP request", e); + } + } + + /** + * Get the configuration of a specific app override + */ + public BaseClientHttpResponse retrieve(String id) { + return retrieve(id, null); + } + + /** + * Get the configuration of a specific app override + */ + public BaseClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("app_overrides") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AppOverride.class), response); + } + 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 + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseClientException("Network error executing HTTP request", e); + } + } + + /** + * Update an app override's name, custom field values, or OAuth client selection + */ + public BaseClientHttpResponse update(String id) { + return update(id, UpdateAppOverrideOpts.builder().build()); + } + + /** + * Update an app override's name, custom field values, or OAuth client selection + */ + public BaseClientHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateAppOverrideOpts.builder().build(), requestOptions); + } + + /** + * Update an app override's name, custom field values, or OAuth client selection + */ + public BaseClientHttpResponse update(String id, UpdateAppOverrideOpts request) { + return update(id, request, null); + } + + /** + * Update an app override's name, custom field values, or OAuth client selection + */ + public BaseClientHttpResponse update( + String id, UpdateAppOverrideOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("app_overrides") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseClientException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AppOverride.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseClientException("Network error executing HTTP request", e); + } + } + + /** + * Delete an app override without affecting accounts already connected with it + */ + public BaseClientHttpResponse delete(String id) { + return delete(id, null); + } + + /** + * Delete an app override without affecting accounts already connected with it + */ + public BaseClientHttpResponse delete(String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("app_overrides") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .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 + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseClientException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/appoverrides/requests/AppOverridesListRequest.java b/src/main/java/com/pipedream/api/resources/appoverrides/requests/AppOverridesListRequest.java new file mode 100644 index 0000000..ff64405 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/appoverrides/requests/AppOverridesListRequest.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appoverrides.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.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; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppOverridesListRequest.Builder.class) +public final class AppOverridesListRequest { + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional app; + + private final Map additionalProperties; + + private AppOverridesListRequest( + Optional after, + Optional before, + Optional limit, + Optional app, + Map additionalProperties) { + this.after = after; + this.before = before; + this.limit = limit; + this.app = app; + this.additionalProperties = additionalProperties; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Only return overrides for this app (ID or name slug) + */ + @JsonProperty("app") + public Optional getApp() { + return app; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppOverridesListRequest && equalTo((AppOverridesListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppOverridesListRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && app.equals(other.app); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.limit, this.app); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional app = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AppOverridesListRequest other) { + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + app(other.getApp()); + return this; + } + + /** + *

The cursor to start from for pagination

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The cursor to end before for pagination

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The maximum number of results to return

+ */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

Only return overrides for this app (ID or name slug)

+ */ + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(String app) { + this.app = Optional.ofNullable(app); + return this; + } + + public AppOverridesListRequest build() { + return new AppOverridesListRequest(after, before, limit, app, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/appoverrides/requests/CreateAppOverrideOpts.java b/src/main/java/com/pipedream/api/resources/appoverrides/requests/CreateAppOverrideOpts.java new file mode 100644 index 0000000..222a770 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/appoverrides/requests/CreateAppOverrideOpts.java @@ -0,0 +1,254 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appoverrides.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.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) +@JsonDeserialize(builder = CreateAppOverrideOpts.Builder.class) +public final class CreateAppOverrideOpts { + private final String app; + + private final String name; + + private final Optional oauthAppId; + + private final Optional> cfmap; + + private final Map additionalProperties; + + private CreateAppOverrideOpts( + String app, + String name, + Optional oauthAppId, + Optional> cfmap, + Map additionalProperties) { + this.app = app; + this.name = name; + this.oauthAppId = oauthAppId; + this.cfmap = cfmap; + this.additionalProperties = additionalProperties; + } + + /** + * @return The app's ID or name slug + */ + @JsonProperty("app") + public String getApp() { + return app; + } + + /** + * @return Name of the override, unique per owner + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return Hash ID of the custom OAuth client to use + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + + /** + * @return Pre-defined custom field values, keyed by the app's custom field names. Sensitive (password-type) fields are rejected. + */ + @JsonProperty("cfmap") + public Optional> getCfmap() { + return cfmap; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAppOverrideOpts && equalTo((CreateAppOverrideOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAppOverrideOpts other) { + return app.equals(other.app) + && name.equals(other.name) + && oauthAppId.equals(other.oauthAppId) + && cfmap.equals(other.cfmap); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.app, this.name, this.oauthAppId, this.cfmap); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AppStage builder() { + return new Builder(); + } + + public interface AppStage { + /** + *

The app's ID or name slug

+ */ + NameStage app(@NotNull String app); + + Builder from(CreateAppOverrideOpts other); + } + + public interface NameStage { + /** + *

Name of the override, unique per owner

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + CreateAppOverrideOpts build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Hash ID of the custom OAuth client to use

+ */ + _FinalStage oauthAppId(Optional oauthAppId); + + _FinalStage oauthAppId(String oauthAppId); + + /** + *

Pre-defined custom field values, keyed by the app's custom field names. Sensitive (password-type) fields are rejected.

+ */ + _FinalStage cfmap(Optional> cfmap); + + _FinalStage cfmap(Map cfmap); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AppStage, NameStage, _FinalStage { + private String app; + + private String name; + + private Optional> cfmap = Optional.empty(); + + private Optional oauthAppId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateAppOverrideOpts other) { + app(other.getApp()); + name(other.getName()); + oauthAppId(other.getOauthAppId()); + cfmap(other.getCfmap()); + return this; + } + + /** + *

The app's ID or name slug

+ *

The app's ID or name slug

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("app") + public NameStage app(@NotNull String app) { + this.app = Objects.requireNonNull(app, "app must not be null"); + return this; + } + + /** + *

Name of the override, unique per owner

+ *

Name of the override, unique per owner

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

Pre-defined custom field values, keyed by the app's custom field names. Sensitive (password-type) fields are rejected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cfmap(Map cfmap) { + this.cfmap = Optional.ofNullable(cfmap); + return this; + } + + /** + *

Pre-defined custom field values, keyed by the app's custom field names. Sensitive (password-type) fields are rejected.

+ */ + @java.lang.Override + @JsonSetter(value = "cfmap", nulls = Nulls.SKIP) + public _FinalStage cfmap(Optional> cfmap) { + this.cfmap = cfmap; + return this; + } + + /** + *

Hash ID of the custom OAuth client to use

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage oauthAppId(String oauthAppId) { + this.oauthAppId = Optional.ofNullable(oauthAppId); + return this; + } + + /** + *

Hash ID of the custom OAuth client to use

+ */ + @java.lang.Override + @JsonSetter(value = "oauth_app_id", nulls = Nulls.SKIP) + public _FinalStage oauthAppId(Optional oauthAppId) { + this.oauthAppId = oauthAppId; + return this; + } + + @java.lang.Override + public CreateAppOverrideOpts build() { + return new CreateAppOverrideOpts(app, name, oauthAppId, cfmap, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/appoverrides/requests/UpdateAppOverrideOpts.java b/src/main/java/com/pipedream/api/resources/appoverrides/requests/UpdateAppOverrideOpts.java new file mode 100644 index 0000000..a4428fe --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/appoverrides/requests/UpdateAppOverrideOpts.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appoverrides.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.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; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAppOverrideOpts.Builder.class) +public final class UpdateAppOverrideOpts { + private final Optional name; + + private final Optional oauthAppId; + + private final Optional> cfmap; + + private final Map additionalProperties; + + private UpdateAppOverrideOpts( + Optional name, + Optional oauthAppId, + Optional> cfmap, + Map additionalProperties) { + this.name = name; + this.oauthAppId = oauthAppId; + this.cfmap = cfmap; + this.additionalProperties = additionalProperties; + } + + /** + * @return Name of the override, unique per owner + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Hash ID of the custom OAuth client to use. Pass null to clear it. + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + + /** + * @return Pre-defined custom field values, keyed by the app's custom field names. Sensitive (password-type) fields are rejected. + */ + @JsonProperty("cfmap") + public Optional> getCfmap() { + return cfmap; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAppOverrideOpts && equalTo((UpdateAppOverrideOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAppOverrideOpts other) { + return name.equals(other.name) && oauthAppId.equals(other.oauthAppId) && cfmap.equals(other.cfmap); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.oauthAppId, this.cfmap); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional name = Optional.empty(); + + private Optional oauthAppId = Optional.empty(); + + private Optional> cfmap = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAppOverrideOpts other) { + name(other.getName()); + oauthAppId(other.getOauthAppId()); + cfmap(other.getCfmap()); + return this; + } + + /** + *

Name of the override, unique per owner

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Hash ID of the custom OAuth client to use. Pass null to clear it.

+ */ + @JsonSetter(value = "oauth_app_id", nulls = Nulls.SKIP) + public Builder oauthAppId(Optional oauthAppId) { + this.oauthAppId = oauthAppId; + return this; + } + + public Builder oauthAppId(String oauthAppId) { + this.oauthAppId = Optional.ofNullable(oauthAppId); + return this; + } + + /** + *

Pre-defined custom field values, keyed by the app's custom field names. Sensitive (password-type) fields are rejected.

+ */ + @JsonSetter(value = "cfmap", nulls = Nulls.SKIP) + public Builder cfmap(Optional> cfmap) { + this.cfmap = cfmap; + return this; + } + + public Builder cfmap(Map cfmap) { + this.cfmap = Optional.ofNullable(cfmap); + return this; + } + + public UpdateAppOverrideOpts build() { + return new UpdateAppOverrideOpts(name, oauthAppId, cfmap, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/oauthapps/AsyncOauthAppsClient.java b/src/main/java/com/pipedream/api/resources/oauthapps/AsyncOauthAppsClient.java new file mode 100644 index 0000000..ce6e73a --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/oauthapps/AsyncOauthAppsClient.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthapps; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.oauthapps.requests.CreateOauthAppOpts; +import com.pipedream.api.resources.oauthapps.requests.OauthAppsListRequest; +import com.pipedream.api.resources.oauthapps.requests.UpdateOauthAppOpts; +import com.pipedream.api.types.OauthApp; +import java.util.concurrent.CompletableFuture; + +public class AsyncOauthAppsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawOauthAppsClient rawClient; + + public AsyncOauthAppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawOauthAppsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawOauthAppsClient withRawResponse() { + return this.rawClient; + } + + /** + * List the custom OAuth clients available to the project, including the parent workspace's + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * List the custom OAuth clients available to the project, including the parent workspace's + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * List the custom OAuth clients available to the project, including the parent workspace's + */ + public CompletableFuture> list(OauthAppsListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * List the custom OAuth clients available to the project, including the parent workspace's + */ + public CompletableFuture> list( + OauthAppsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Register a custom OAuth client for an app + */ + public CompletableFuture create(CreateOauthAppOpts request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Register a custom OAuth client for an app + */ + public CompletableFuture create(CreateOauthAppOpts request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Get the configuration of a specific custom OAuth client + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Get the configuration of a specific custom OAuth client + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update a custom OAuth client's credentials or configuration + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Update a custom OAuth client's credentials or configuration + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update a custom OAuth client's credentials or configuration + */ + public CompletableFuture update(String id, UpdateOauthAppOpts request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Update a custom OAuth client's credentials or configuration + */ + public CompletableFuture update(String id, UpdateOauthAppOpts request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Remove a custom OAuth client that is no longer in use + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Remove a custom OAuth client that is no longer in use + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/oauthapps/AsyncRawOauthAppsClient.java b/src/main/java/com/pipedream/api/resources/oauthapps/AsyncRawOauthAppsClient.java new file mode 100644 index 0000000..dbbe396 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/oauthapps/AsyncRawOauthAppsClient.java @@ -0,0 +1,493 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthapps; + +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.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.errors.BadRequestError; +import com.pipedream.api.errors.NotFoundError; +import com.pipedream.api.errors.TooManyRequestsError; +import com.pipedream.api.resources.oauthapps.requests.CreateOauthAppOpts; +import com.pipedream.api.resources.oauthapps.requests.OauthAppsListRequest; +import com.pipedream.api.resources.oauthapps.requests.UpdateOauthAppOpts; +import com.pipedream.api.types.ListOauthAppsResponse; +import com.pipedream.api.types.OauthApp; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawOauthAppsClient { + protected final ClientOptions clientOptions; + + public AsyncRawOauthAppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * List the custom OAuth clients available to the project, including the parent workspace's + */ + public CompletableFuture>> list() { + return list(OauthAppsListRequest.builder().build()); + } + + /** + * List the custom OAuth clients available to the project, including the parent workspace's + */ + public CompletableFuture>> list(RequestOptions requestOptions) { + return list(OauthAppsListRequest.builder().build(), requestOptions); + } + + /** + * List the custom OAuth clients available to the project, including the parent workspace's + */ + public CompletableFuture>> list(OauthAppsListRequest request) { + return list(request, null); + } + + /** + * List the custom OAuth clients available to the project, including the parent workspace's + */ + public CompletableFuture>> list( + OauthAppsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("oauth_apps"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + 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()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListOauthAppsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListOauthAppsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + OauthAppsListRequest nextRequest = OauthAppsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new BaseClientHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 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 + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, 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; + } + + /** + * Register a custom OAuth client for an app + */ + public CompletableFuture> create(CreateOauthAppOpts request) { + return create(request, null); + } + + /** + * Register a custom OAuth client for an app + */ + public CompletableFuture> create( + CreateOauthAppOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("oauth_apps"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseClientException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .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()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, OauthApp.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 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 + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, 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; + } + + /** + * Get the configuration of a specific custom OAuth client + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, null); + } + + /** + * Get the configuration of a specific custom OAuth client + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("oauth_apps") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .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()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, OauthApp.class), response)); + return; + } + 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 + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, 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; + } + + /** + * Update a custom OAuth client's credentials or configuration + */ + public CompletableFuture> update(String id) { + return update(id, UpdateOauthAppOpts.builder().build()); + } + + /** + * Update a custom OAuth client's credentials or configuration + */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateOauthAppOpts.builder().build(), requestOptions); + } + + /** + * Update a custom OAuth client's credentials or configuration + */ + public CompletableFuture> update(String id, UpdateOauthAppOpts request) { + return update(id, request, null); + } + + /** + * Update a custom OAuth client's credentials or configuration + */ + public CompletableFuture> update( + String id, UpdateOauthAppOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("oauth_apps") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseClientException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .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()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, OauthApp.class), response)); + return; + } + 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 + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, 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; + } + + /** + * Remove a custom OAuth client that is no longer in use + */ + public CompletableFuture> delete(String id) { + return delete(id, null); + } + + /** + * Remove a custom OAuth client that is no longer in use + */ + public CompletableFuture> delete(String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("oauth_apps") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .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 { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 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 + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, 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/oauthapps/OauthAppsClient.java b/src/main/java/com/pipedream/api/resources/oauthapps/OauthAppsClient.java new file mode 100644 index 0000000..c6d77be --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/oauthapps/OauthAppsClient.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthapps; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.oauthapps.requests.CreateOauthAppOpts; +import com.pipedream.api.resources.oauthapps.requests.OauthAppsListRequest; +import com.pipedream.api.resources.oauthapps.requests.UpdateOauthAppOpts; +import com.pipedream.api.types.OauthApp; + +public class OauthAppsClient { + protected final ClientOptions clientOptions; + + private final RawOauthAppsClient rawClient; + + public OauthAppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawOauthAppsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawOauthAppsClient withRawResponse() { + return this.rawClient; + } + + /** + * List the custom OAuth clients available to the project, including the parent workspace's + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * List the custom OAuth clients available to the project, including the parent workspace's + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * List the custom OAuth clients available to the project, including the parent workspace's + */ + public SyncPagingIterable list(OauthAppsListRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * List the custom OAuth clients available to the project, including the parent workspace's + */ + public SyncPagingIterable list(OauthAppsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Register a custom OAuth client for an app + */ + public OauthApp create(CreateOauthAppOpts request) { + return this.rawClient.create(request).body(); + } + + /** + * Register a custom OAuth client for an app + */ + public OauthApp create(CreateOauthAppOpts request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Get the configuration of a specific custom OAuth client + */ + public OauthApp retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Get the configuration of a specific custom OAuth client + */ + public OauthApp retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Update a custom OAuth client's credentials or configuration + */ + public OauthApp update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Update a custom OAuth client's credentials or configuration + */ + public OauthApp update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Update a custom OAuth client's credentials or configuration + */ + public OauthApp update(String id, UpdateOauthAppOpts request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Update a custom OAuth client's credentials or configuration + */ + public OauthApp update(String id, UpdateOauthAppOpts request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Remove a custom OAuth client that is no longer in use + */ + public void delete(String id) { + this.rawClient.delete(id).body(); + } + + /** + * Remove a custom OAuth client that is no longer in use + */ + public void delete(String id, RequestOptions requestOptions) { + this.rawClient.delete(id, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/oauthapps/RawOauthAppsClient.java b/src/main/java/com/pipedream/api/resources/oauthapps/RawOauthAppsClient.java new file mode 100644 index 0000000..0f61d5a --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/oauthapps/RawOauthAppsClient.java @@ -0,0 +1,400 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthapps; + +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.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.errors.BadRequestError; +import com.pipedream.api.errors.NotFoundError; +import com.pipedream.api.errors.TooManyRequestsError; +import com.pipedream.api.resources.oauthapps.requests.CreateOauthAppOpts; +import com.pipedream.api.resources.oauthapps.requests.OauthAppsListRequest; +import com.pipedream.api.resources.oauthapps.requests.UpdateOauthAppOpts; +import com.pipedream.api.types.ListOauthAppsResponse; +import com.pipedream.api.types.OauthApp; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawOauthAppsClient { + protected final ClientOptions clientOptions; + + public RawOauthAppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * List the custom OAuth clients available to the project, including the parent workspace's + */ + public BaseClientHttpResponse> list() { + return list(OauthAppsListRequest.builder().build()); + } + + /** + * List the custom OAuth clients available to the project, including the parent workspace's + */ + public BaseClientHttpResponse> list(RequestOptions requestOptions) { + return list(OauthAppsListRequest.builder().build(), requestOptions); + } + + /** + * List the custom OAuth clients available to the project, including the parent workspace's + */ + public BaseClientHttpResponse> list(OauthAppsListRequest request) { + return list(request, null); + } + + /** + * List the custom OAuth clients available to the project, including the parent workspace's + */ + public BaseClientHttpResponse> list( + OauthAppsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("oauth_apps"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + 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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListOauthAppsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListOauthAppsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + OauthAppsListRequest nextRequest = OauthAppsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new BaseClientHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, parsedResponse, () -> list( + nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseClientException("Network error executing HTTP request", e); + } + } + + /** + * Register a custom OAuth client for an app + */ + public BaseClientHttpResponse create(CreateOauthAppOpts request) { + return create(request, null); + } + + /** + * Register a custom OAuth client for an app + */ + public BaseClientHttpResponse create(CreateOauthAppOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("oauth_apps"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseClientException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, OauthApp.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseClientException("Network error executing HTTP request", e); + } + } + + /** + * Get the configuration of a specific custom OAuth client + */ + public BaseClientHttpResponse retrieve(String id) { + return retrieve(id, null); + } + + /** + * Get the configuration of a specific custom OAuth client + */ + public BaseClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("oauth_apps") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, OauthApp.class), response); + } + 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 + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseClientException("Network error executing HTTP request", e); + } + } + + /** + * Update a custom OAuth client's credentials or configuration + */ + public BaseClientHttpResponse update(String id) { + return update(id, UpdateOauthAppOpts.builder().build()); + } + + /** + * Update a custom OAuth client's credentials or configuration + */ + public BaseClientHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateOauthAppOpts.builder().build(), requestOptions); + } + + /** + * Update a custom OAuth client's credentials or configuration + */ + public BaseClientHttpResponse update(String id, UpdateOauthAppOpts request) { + return update(id, request, null); + } + + /** + * Update a custom OAuth client's credentials or configuration + */ + public BaseClientHttpResponse update( + String id, UpdateOauthAppOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("oauth_apps") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseClientException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, OauthApp.class), response); + } + 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 + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseClientException("Network error executing HTTP request", e); + } + } + + /** + * Remove a custom OAuth client that is no longer in use + */ + public BaseClientHttpResponse delete(String id) { + return delete(id, null); + } + + /** + * Remove a custom OAuth client that is no longer in use + */ + public BaseClientHttpResponse delete(String id, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("oauth_apps") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .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 { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseClientException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/oauthapps/requests/CreateOauthAppOpts.java b/src/main/java/com/pipedream/api/resources/oauthapps/requests/CreateOauthAppOpts.java new file mode 100644 index 0000000..a828022 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/oauthapps/requests/CreateOauthAppOpts.java @@ -0,0 +1,384 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthapps.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.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateOauthAppOpts.Builder.class) +public final class CreateOauthAppOpts { + private final String app; + + private final String clientId; + + private final String clientSecret; + + private final Optional name; + + private final Optional description; + + private final Optional> scopes; + + private final Optional> additionalScopes; + + private final Map additionalProperties; + + private CreateOauthAppOpts( + String app, + String clientId, + String clientSecret, + Optional name, + Optional description, + Optional> scopes, + Optional> additionalScopes, + Map additionalProperties) { + this.app = app; + this.clientId = clientId; + this.clientSecret = clientSecret; + this.name = name; + this.description = description; + this.scopes = scopes; + this.additionalScopes = additionalScopes; + this.additionalProperties = additionalProperties; + } + + /** + * @return The app's ID or name slug. The app must have custom OAuth clients enabled. + */ + @JsonProperty("app") + public String getApp() { + return app; + } + + /** + * @return The OAuth client ID registered with the upstream provider + */ + @JsonProperty("client_id") + public String getClientId() { + return clientId; + } + + /** + * @return The OAuth client secret. Write-only; never returned in responses. + */ + @JsonProperty("client_secret") + public String getClientSecret() { + return clientSecret; + } + + /** + * @return Display name of the OAuth client + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Description of the OAuth client + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return OAuth scopes to request when users connect through this client + */ + @JsonProperty("scopes") + public Optional> getScopes() { + return scopes; + } + + /** + * @return Extra OAuth scopes users may grant on top of the base scopes + */ + @JsonProperty("additional_scopes") + public Optional> getAdditionalScopes() { + return additionalScopes; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOauthAppOpts && equalTo((CreateOauthAppOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateOauthAppOpts other) { + return app.equals(other.app) + && clientId.equals(other.clientId) + && clientSecret.equals(other.clientSecret) + && name.equals(other.name) + && description.equals(other.description) + && scopes.equals(other.scopes) + && additionalScopes.equals(other.additionalScopes); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.app, + this.clientId, + this.clientSecret, + this.name, + this.description, + this.scopes, + this.additionalScopes); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AppStage builder() { + return new Builder(); + } + + public interface AppStage { + /** + *

The app's ID or name slug. The app must have custom OAuth clients enabled.

+ */ + ClientIdStage app(@NotNull String app); + + Builder from(CreateOauthAppOpts other); + } + + public interface ClientIdStage { + /** + *

The OAuth client ID registered with the upstream provider

+ */ + ClientSecretStage clientId(@NotNull String clientId); + } + + public interface ClientSecretStage { + /** + *

The OAuth client secret. Write-only; never returned in responses.

+ */ + _FinalStage clientSecret(@NotNull String clientSecret); + } + + public interface _FinalStage { + CreateOauthAppOpts build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Display name of the OAuth client

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + /** + *

Description of the OAuth client

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + /** + *

OAuth scopes to request when users connect through this client

+ */ + _FinalStage scopes(Optional> scopes); + + _FinalStage scopes(List scopes); + + /** + *

Extra OAuth scopes users may grant on top of the base scopes

+ */ + _FinalStage additionalScopes(Optional> additionalScopes); + + _FinalStage additionalScopes(List additionalScopes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AppStage, ClientIdStage, ClientSecretStage, _FinalStage { + private String app; + + private String clientId; + + private String clientSecret; + + private Optional> additionalScopes = Optional.empty(); + + private Optional> scopes = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateOauthAppOpts other) { + app(other.getApp()); + clientId(other.getClientId()); + clientSecret(other.getClientSecret()); + name(other.getName()); + description(other.getDescription()); + scopes(other.getScopes()); + additionalScopes(other.getAdditionalScopes()); + return this; + } + + /** + *

The app's ID or name slug. The app must have custom OAuth clients enabled.

+ *

The app's ID or name slug. The app must have custom OAuth clients enabled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("app") + public ClientIdStage app(@NotNull String app) { + this.app = Objects.requireNonNull(app, "app must not be null"); + return this; + } + + /** + *

The OAuth client ID registered with the upstream provider

+ *

The OAuth client ID registered with the upstream provider

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("client_id") + public ClientSecretStage clientId(@NotNull String clientId) { + this.clientId = Objects.requireNonNull(clientId, "clientId must not be null"); + return this; + } + + /** + *

The OAuth client secret. Write-only; never returned in responses.

+ *

The OAuth client secret. Write-only; never returned in responses.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("client_secret") + public _FinalStage clientSecret(@NotNull String clientSecret) { + this.clientSecret = Objects.requireNonNull(clientSecret, "clientSecret must not be null"); + return this; + } + + /** + *

Extra OAuth scopes users may grant on top of the base scopes

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage additionalScopes(List additionalScopes) { + this.additionalScopes = Optional.ofNullable(additionalScopes); + return this; + } + + /** + *

Extra OAuth scopes users may grant on top of the base scopes

+ */ + @java.lang.Override + @JsonSetter(value = "additional_scopes", nulls = Nulls.SKIP) + public _FinalStage additionalScopes(Optional> additionalScopes) { + this.additionalScopes = additionalScopes; + return this; + } + + /** + *

OAuth scopes to request when users connect through this client

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage scopes(List scopes) { + this.scopes = Optional.ofNullable(scopes); + return this; + } + + /** + *

OAuth scopes to request when users connect through this client

+ */ + @java.lang.Override + @JsonSetter(value = "scopes", nulls = Nulls.SKIP) + public _FinalStage scopes(Optional> scopes) { + this.scopes = scopes; + return this; + } + + /** + *

Description of the OAuth client

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

Description of the OAuth client

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

Display name of the OAuth client

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Display name of the OAuth client

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public CreateOauthAppOpts build() { + return new CreateOauthAppOpts( + app, clientId, clientSecret, name, description, scopes, additionalScopes, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/oauthapps/requests/OauthAppsListRequest.java b/src/main/java/com/pipedream/api/resources/oauthapps/requests/OauthAppsListRequest.java new file mode 100644 index 0000000..5e2fd1e --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/oauthapps/requests/OauthAppsListRequest.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthapps.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.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; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = OauthAppsListRequest.Builder.class) +public final class OauthAppsListRequest { + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional app; + + private final Optional q; + + private final Map additionalProperties; + + private OauthAppsListRequest( + Optional after, + Optional before, + Optional limit, + Optional app, + Optional q, + Map additionalProperties) { + this.after = after; + this.before = before; + this.limit = limit; + this.app = app; + this.q = q; + this.additionalProperties = additionalProperties; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Only return OAuth clients for this app (ID or name slug) + */ + @JsonProperty("app") + public Optional getApp() { + return app; + } + + /** + * @return A search query to filter the OAuth clients by name or description + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OauthAppsListRequest && equalTo((OauthAppsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(OauthAppsListRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && app.equals(other.app) + && q.equals(other.q); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.limit, this.app, this.q); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional app = Optional.empty(); + + private Optional q = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(OauthAppsListRequest other) { + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + app(other.getApp()); + q(other.getQ()); + return this; + } + + /** + *

The cursor to start from for pagination

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The cursor to end before for pagination

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The maximum number of results to return

+ */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

Only return OAuth clients for this app (ID or name slug)

+ */ + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(String app) { + this.app = Optional.ofNullable(app); + return this; + } + + /** + *

A search query to filter the OAuth clients by name or description

+ */ + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + public OauthAppsListRequest build() { + return new OauthAppsListRequest(after, before, limit, app, q, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/oauthapps/requests/UpdateOauthAppOpts.java b/src/main/java/com/pipedream/api/resources/oauthapps/requests/UpdateOauthAppOpts.java new file mode 100644 index 0000000..0585513 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/oauthapps/requests/UpdateOauthAppOpts.java @@ -0,0 +1,266 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthapps.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.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateOauthAppOpts.Builder.class) +public final class UpdateOauthAppOpts { + private final Optional name; + + private final Optional description; + + private final Optional clientId; + + private final Optional clientSecret; + + private final Optional> scopes; + + private final Optional> additionalScopes; + + private final Map additionalProperties; + + private UpdateOauthAppOpts( + Optional name, + Optional description, + Optional clientId, + Optional clientSecret, + Optional> scopes, + Optional> additionalScopes, + Map additionalProperties) { + this.name = name; + this.description = description; + this.clientId = clientId; + this.clientSecret = clientSecret; + this.scopes = scopes; + this.additionalScopes = additionalScopes; + this.additionalProperties = additionalProperties; + } + + /** + * @return Display name of the OAuth client + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Description of the OAuth client + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return The OAuth client ID registered with the upstream provider + */ + @JsonProperty("client_id") + public Optional getClientId() { + return clientId; + } + + /** + * @return The OAuth client secret. Write-only; blank values are ignored and the existing secret is kept. + */ + @JsonProperty("client_secret") + public Optional getClientSecret() { + return clientSecret; + } + + /** + * @return OAuth scopes to request when users connect through this client + */ + @JsonProperty("scopes") + public Optional> getScopes() { + return scopes; + } + + /** + * @return Extra OAuth scopes users may grant on top of the base scopes + */ + @JsonProperty("additional_scopes") + public Optional> getAdditionalScopes() { + return additionalScopes; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateOauthAppOpts && equalTo((UpdateOauthAppOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateOauthAppOpts other) { + return name.equals(other.name) + && description.equals(other.description) + && clientId.equals(other.clientId) + && clientSecret.equals(other.clientSecret) + && scopes.equals(other.scopes) + && additionalScopes.equals(other.additionalScopes); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.name, this.description, this.clientId, this.clientSecret, this.scopes, this.additionalScopes); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional name = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional clientId = Optional.empty(); + + private Optional clientSecret = Optional.empty(); + + private Optional> scopes = Optional.empty(); + + private Optional> additionalScopes = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateOauthAppOpts other) { + name(other.getName()); + description(other.getDescription()); + clientId(other.getClientId()); + clientSecret(other.getClientSecret()); + scopes(other.getScopes()); + additionalScopes(other.getAdditionalScopes()); + return this; + } + + /** + *

Display name of the OAuth client

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Description of the OAuth client

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

The OAuth client ID registered with the upstream provider

+ */ + @JsonSetter(value = "client_id", nulls = Nulls.SKIP) + public Builder clientId(Optional clientId) { + this.clientId = clientId; + return this; + } + + public Builder clientId(String clientId) { + this.clientId = Optional.ofNullable(clientId); + return this; + } + + /** + *

The OAuth client secret. Write-only; blank values are ignored and the existing secret is kept.

+ */ + @JsonSetter(value = "client_secret", nulls = Nulls.SKIP) + public Builder clientSecret(Optional clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + public Builder clientSecret(String clientSecret) { + this.clientSecret = Optional.ofNullable(clientSecret); + return this; + } + + /** + *

OAuth scopes to request when users connect through this client

+ */ + @JsonSetter(value = "scopes", nulls = Nulls.SKIP) + public Builder scopes(Optional> scopes) { + this.scopes = scopes; + return this; + } + + public Builder scopes(List scopes) { + this.scopes = Optional.ofNullable(scopes); + return this; + } + + /** + *

Extra OAuth scopes users may grant on top of the base scopes

+ */ + @JsonSetter(value = "additional_scopes", nulls = Nulls.SKIP) + public Builder additionalScopes(Optional> additionalScopes) { + this.additionalScopes = additionalScopes; + return this; + } + + public Builder additionalScopes(List additionalScopes) { + this.additionalScopes = Optional.ofNullable(additionalScopes); + return this; + } + + public UpdateOauthAppOpts build() { + return new UpdateOauthAppOpts( + name, description, clientId, clientSecret, scopes, additionalScopes, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/pipedream/api/types/AppOverride.java b/src/main/java/com/pipedream/api/types/AppOverride.java new file mode 100644 index 0000000..959578e --- /dev/null +++ b/src/main/java/com/pipedream/api/types/AppOverride.java @@ -0,0 +1,401 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +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.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppOverride.Builder.class) +public final class AppOverride { + private final String id; + + private final String name; + + private final App app; + + private final Optional oauthAppId; + + private final Map cfmap; + + private final String ownerId; + + private final Optional createdAt; + + private final Optional updatedAt; + + private final Map additionalProperties; + + private AppOverride( + String id, + String name, + App app, + Optional oauthAppId, + Map cfmap, + String ownerId, + Optional createdAt, + Optional updatedAt, + Map additionalProperties) { + this.id = id; + this.name = name; + this.app = app; + this.oauthAppId = oauthAppId; + this.cfmap = cfmap; + this.ownerId = ownerId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return Hash ID for the app override + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Name of the override, unique per owner + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("app") + public App getApp() { + return app; + } + + /** + * @return Hash ID of the custom OAuth client the override selects, if any + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + + /** + * @return Pre-defined custom field values, keyed by the app's custom field names. Sensitive (password-type) fields cannot be pre-defined. + */ + @JsonProperty("cfmap") + public Map getCfmap() { + return cfmap; + } + + /** + * @return Hash ID of the owner: the workspace (o_...) or the project (proj_...) + */ + @JsonProperty("owner_id") + public String getOwnerId() { + return ownerId; + } + + @JsonProperty("created_at") + public Optional getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public Optional getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppOverride && equalTo((AppOverride) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppOverride other) { + return id.equals(other.id) + && name.equals(other.name) + && app.equals(other.app) + && oauthAppId.equals(other.oauthAppId) + && cfmap.equals(other.cfmap) + && ownerId.equals(other.ownerId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.name, + this.app, + this.oauthAppId, + this.cfmap, + this.ownerId, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Hash ID for the app override

+ */ + NameStage id(@NotNull String id); + + Builder from(AppOverride other); + } + + public interface NameStage { + /** + *

Name of the override, unique per owner

+ */ + AppStage name(@NotNull String name); + } + + public interface AppStage { + OwnerIdStage app(@NotNull App app); + } + + public interface OwnerIdStage { + /** + *

Hash ID of the owner: the workspace (o_...) or the project (proj_...)

+ */ + _FinalStage ownerId(@NotNull String ownerId); + } + + public interface _FinalStage { + AppOverride build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Hash ID of the custom OAuth client the override selects, if any

+ */ + _FinalStage oauthAppId(Optional oauthAppId); + + _FinalStage oauthAppId(String oauthAppId); + + /** + *

Pre-defined custom field values, keyed by the app's custom field names. Sensitive (password-type) fields cannot be pre-defined.

+ */ + _FinalStage cfmap(Map cfmap); + + _FinalStage putAllCfmap(Map cfmap); + + _FinalStage cfmap(String key, Object value); + + _FinalStage createdAt(Optional createdAt); + + _FinalStage createdAt(OffsetDateTime createdAt); + + _FinalStage updatedAt(Optional updatedAt); + + _FinalStage updatedAt(OffsetDateTime updatedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, AppStage, OwnerIdStage, _FinalStage { + private String id; + + private String name; + + private App app; + + private String ownerId; + + private Optional updatedAt = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Map cfmap = new LinkedHashMap<>(); + + private Optional oauthAppId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AppOverride other) { + id(other.getId()); + name(other.getName()); + app(other.getApp()); + oauthAppId(other.getOauthAppId()); + cfmap(other.getCfmap()); + ownerId(other.getOwnerId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

Hash ID for the app override

+ *

Hash ID for the app override

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Name of the override, unique per owner

+ *

Name of the override, unique per owner

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public AppStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("app") + public OwnerIdStage app(@NotNull App app) { + this.app = Objects.requireNonNull(app, "app must not be null"); + return this; + } + + /** + *

Hash ID of the owner: the workspace (o_...) or the project (proj_...)

+ *

Hash ID of the owner: the workspace (o_...) or the project (proj_...)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("owner_id") + public _FinalStage ownerId(@NotNull String ownerId) { + this.ownerId = Objects.requireNonNull(ownerId, "ownerId must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = Optional.ofNullable(updatedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) + public _FinalStage updatedAt(Optional updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + @java.lang.Override + public _FinalStage createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public _FinalStage createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + *

Pre-defined custom field values, keyed by the app's custom field names. Sensitive (password-type) fields cannot be pre-defined.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cfmap(String key, Object value) { + this.cfmap.put(key, value); + return this; + } + + /** + *

Pre-defined custom field values, keyed by the app's custom field names. Sensitive (password-type) fields cannot be pre-defined.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllCfmap(Map cfmap) { + if (cfmap != null) { + this.cfmap.putAll(cfmap); + } + return this; + } + + /** + *

Pre-defined custom field values, keyed by the app's custom field names. Sensitive (password-type) fields cannot be pre-defined.

+ */ + @java.lang.Override + @JsonSetter(value = "cfmap", nulls = Nulls.SKIP) + public _FinalStage cfmap(Map cfmap) { + this.cfmap.clear(); + if (cfmap != null) { + this.cfmap.putAll(cfmap); + } + return this; + } + + /** + *

Hash ID of the custom OAuth client the override selects, if any

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage oauthAppId(String oauthAppId) { + this.oauthAppId = Optional.ofNullable(oauthAppId); + return this; + } + + /** + *

Hash ID of the custom OAuth client the override selects, if any

+ */ + @java.lang.Override + @JsonSetter(value = "oauth_app_id", nulls = Nulls.SKIP) + public _FinalStage oauthAppId(Optional oauthAppId) { + this.oauthAppId = oauthAppId; + return this; + } + + @java.lang.Override + public AppOverride build() { + return new AppOverride( + id, name, app, oauthAppId, cfmap, ownerId, createdAt, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ListAppOverridesResponse.java b/src/main/java/com/pipedream/api/types/ListAppOverridesResponse.java new file mode 100644 index 0000000..9ec5c8a --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ListAppOverridesResponse.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +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.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAppOverridesResponse.Builder.class) +public final class ListAppOverridesResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListAppOverridesResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAppOverridesResponse && equalTo((ListAppOverridesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAppOverridesResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListAppOverridesResponse other); + } + + public interface _FinalStage { + ListAppOverridesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(AppOverride data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAppOverridesResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(AppOverride data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListAppOverridesResponse build() { + return new ListAppOverridesResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ListOauthAppsResponse.java b/src/main/java/com/pipedream/api/types/ListOauthAppsResponse.java new file mode 100644 index 0000000..295e525 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ListOauthAppsResponse.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +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.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListOauthAppsResponse.Builder.class) +public final class ListOauthAppsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListOauthAppsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListOauthAppsResponse && equalTo((ListOauthAppsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListOauthAppsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListOauthAppsResponse other); + } + + public interface _FinalStage { + ListOauthAppsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(OauthApp data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListOauthAppsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(OauthApp data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListOauthAppsResponse build() { + return new ListOauthAppsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/pipedream/api/types/OauthApp.java b/src/main/java/com/pipedream/api/types/OauthApp.java new file mode 100644 index 0000000..e361ec8 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/OauthApp.java @@ -0,0 +1,821 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +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.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = OauthApp.Builder.class) +public final class OauthApp { + private final Optional id; + + private final String clientId; + + private final Optional> scopes; + + private final Optional> additionalScopes; + + private final Optional redirectUri; + + private final String ownerId; + + private final Optional createdAt; + + private final Optional updatedAt; + + private final String nameSlug; + + private final String name; + + private final Optional authType; + + private final Optional description; + + private final String imgSrc; + + private final Optional customFieldsJson; + + private final List categories; + + private final double featuredWeight; + + private final List scopeProfiles; + + private final Map additionalProperties; + + private OauthApp( + Optional id, + String clientId, + Optional> scopes, + Optional> additionalScopes, + Optional redirectUri, + String ownerId, + Optional createdAt, + Optional updatedAt, + String nameSlug, + String name, + Optional authType, + Optional description, + String imgSrc, + Optional customFieldsJson, + List categories, + double featuredWeight, + List scopeProfiles, + Map additionalProperties) { + this.id = id; + this.clientId = clientId; + this.scopes = scopes; + this.additionalScopes = additionalScopes; + this.redirectUri = redirectUri; + this.ownerId = ownerId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.nameSlug = nameSlug; + this.name = name; + this.authType = authType; + this.description = description; + this.imgSrc = imgSrc; + this.customFieldsJson = customFieldsJson; + this.categories = categories; + this.featuredWeight = featuredWeight; + this.scopeProfiles = scopeProfiles; + this.additionalProperties = additionalProperties; + } + + /** + * @return Hash ID for the OAuth client + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The OAuth client ID registered with the upstream provider + */ + @JsonProperty("client_id") + public String getClientId() { + return clientId; + } + + /** + * @return OAuth scopes requested when users connect through this client + */ + @JsonProperty("scopes") + public Optional> getScopes() { + return scopes; + } + + /** + * @return Extra OAuth scopes users may grant on top of the base scopes + */ + @JsonProperty("additional_scopes") + public Optional> getAdditionalScopes() { + return additionalScopes; + } + + /** + * @return The redirect URI to register with the upstream OAuth provider + */ + @JsonProperty("redirect_uri") + public Optional getRedirectUri() { + return redirectUri; + } + + /** + * @return Hash ID of the owner: the workspace (o_...) or the project (proj_...) + */ + @JsonProperty("owner_id") + public String getOwnerId() { + return ownerId; + } + + @JsonProperty("created_at") + public Optional getCreatedAt() { + return createdAt; + } + + @JsonProperty("updated_at") + public Optional getUpdatedAt() { + return updatedAt; + } + + /** + * @return The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug) + */ + @JsonProperty("name_slug") + public String getNameSlug() { + return nameSlug; + } + + /** + * @return The human-readable name of the app + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("auth_type") + public Optional getAuthType() { + return authType; + } + + /** + * @return A short description of the app + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return The URL to the app's logo + */ + @JsonProperty("img_src") + public String getImgSrc() { + return imgSrc; + } + + /** + * @return A JSON string representing the custom fields for the app + */ + @JsonProperty("custom_fields_json") + public Optional getCustomFieldsJson() { + return customFieldsJson; + } + + /** + * @return Categories associated with the app + */ + @JsonProperty("categories") + public List getCategories() { + return categories; + } + + /** + * @return A rough directional ordering of app popularity, subject to changes by Pipedream + */ + @JsonProperty("featured_weight") + public double getFeaturedWeight() { + return featuredWeight; + } + + /** + * @return Named subsets of the app's OAuth scopes that may be requested when users connect their accounts (via the oauth_scope_profile parameter). Empty for apps that don't define any. + */ + @JsonProperty("scope_profiles") + public List getScopeProfiles() { + return scopeProfiles; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OauthApp && equalTo((OauthApp) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(OauthApp other) { + return id.equals(other.id) + && clientId.equals(other.clientId) + && scopes.equals(other.scopes) + && additionalScopes.equals(other.additionalScopes) + && redirectUri.equals(other.redirectUri) + && ownerId.equals(other.ownerId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && nameSlug.equals(other.nameSlug) + && name.equals(other.name) + && authType.equals(other.authType) + && description.equals(other.description) + && imgSrc.equals(other.imgSrc) + && customFieldsJson.equals(other.customFieldsJson) + && categories.equals(other.categories) + && featuredWeight == other.featuredWeight + && scopeProfiles.equals(other.scopeProfiles); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.clientId, + this.scopes, + this.additionalScopes, + this.redirectUri, + this.ownerId, + this.createdAt, + this.updatedAt, + this.nameSlug, + this.name, + this.authType, + this.description, + this.imgSrc, + this.customFieldsJson, + this.categories, + this.featuredWeight, + this.scopeProfiles); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ClientIdStage builder() { + return new Builder(); + } + + public interface ClientIdStage { + /** + *

The OAuth client ID registered with the upstream provider

+ */ + OwnerIdStage clientId(@NotNull String clientId); + + Builder from(OauthApp other); + } + + public interface OwnerIdStage { + /** + *

Hash ID of the owner: the workspace (o_...) or the project (proj_...)

+ */ + NameSlugStage ownerId(@NotNull String ownerId); + } + + public interface NameSlugStage { + /** + *

The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug)

+ */ + NameStage nameSlug(@NotNull String nameSlug); + } + + public interface NameStage { + /** + *

The human-readable name of the app

+ */ + ImgSrcStage name(@NotNull String name); + } + + public interface ImgSrcStage { + /** + *

The URL to the app's logo

+ */ + FeaturedWeightStage imgSrc(@NotNull String imgSrc); + } + + public interface FeaturedWeightStage { + /** + *

A rough directional ordering of app popularity, subject to changes by Pipedream

+ */ + _FinalStage featuredWeight(double featuredWeight); + } + + public interface _FinalStage { + OauthApp build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Hash ID for the OAuth client

+ */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + + /** + *

OAuth scopes requested when users connect through this client

+ */ + _FinalStage scopes(Optional> scopes); + + _FinalStage scopes(List scopes); + + /** + *

Extra OAuth scopes users may grant on top of the base scopes

+ */ + _FinalStage additionalScopes(Optional> additionalScopes); + + _FinalStage additionalScopes(List additionalScopes); + + /** + *

The redirect URI to register with the upstream OAuth provider

+ */ + _FinalStage redirectUri(Optional redirectUri); + + _FinalStage redirectUri(String redirectUri); + + _FinalStage createdAt(Optional createdAt); + + _FinalStage createdAt(OffsetDateTime createdAt); + + _FinalStage updatedAt(Optional updatedAt); + + _FinalStage updatedAt(OffsetDateTime updatedAt); + + _FinalStage authType(Optional authType); + + _FinalStage authType(AppAuthType authType); + + /** + *

A short description of the app

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + /** + *

A JSON string representing the custom fields for the app

+ */ + _FinalStage customFieldsJson(Optional customFieldsJson); + + _FinalStage customFieldsJson(String customFieldsJson); + + /** + *

Categories associated with the app

+ */ + _FinalStage categories(List categories); + + _FinalStage addCategories(String categories); + + _FinalStage addAllCategories(List categories); + + /** + *

Named subsets of the app's OAuth scopes that may be requested when users connect their accounts (via the oauth_scope_profile parameter). Empty for apps that don't define any.

+ */ + _FinalStage scopeProfiles(List scopeProfiles); + + _FinalStage addScopeProfiles(AppScopeProfilesItem scopeProfiles); + + _FinalStage addAllScopeProfiles(List scopeProfiles); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ClientIdStage, + OwnerIdStage, + NameSlugStage, + NameStage, + ImgSrcStage, + FeaturedWeightStage, + _FinalStage { + private String clientId; + + private String ownerId; + + private String nameSlug; + + private String name; + + private String imgSrc; + + private double featuredWeight; + + private List scopeProfiles = new ArrayList<>(); + + private List categories = new ArrayList<>(); + + private Optional customFieldsJson = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional authType = Optional.empty(); + + private Optional updatedAt = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional redirectUri = Optional.empty(); + + private Optional> additionalScopes = Optional.empty(); + + private Optional> scopes = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(OauthApp other) { + id(other.getId()); + clientId(other.getClientId()); + scopes(other.getScopes()); + additionalScopes(other.getAdditionalScopes()); + redirectUri(other.getRedirectUri()); + ownerId(other.getOwnerId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + nameSlug(other.getNameSlug()); + name(other.getName()); + authType(other.getAuthType()); + description(other.getDescription()); + imgSrc(other.getImgSrc()); + customFieldsJson(other.getCustomFieldsJson()); + categories(other.getCategories()); + featuredWeight(other.getFeaturedWeight()); + scopeProfiles(other.getScopeProfiles()); + return this; + } + + /** + *

The OAuth client ID registered with the upstream provider

+ *

The OAuth client ID registered with the upstream provider

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("client_id") + public OwnerIdStage clientId(@NotNull String clientId) { + this.clientId = Objects.requireNonNull(clientId, "clientId must not be null"); + return this; + } + + /** + *

Hash ID of the owner: the workspace (o_...) or the project (proj_...)

+ *

Hash ID of the owner: the workspace (o_...) or the project (proj_...)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("owner_id") + public NameSlugStage ownerId(@NotNull String ownerId) { + this.ownerId = Objects.requireNonNull(ownerId, "ownerId must not be null"); + return this; + } + + /** + *

The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug)

+ *

The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name_slug") + public NameStage nameSlug(@NotNull String nameSlug) { + this.nameSlug = Objects.requireNonNull(nameSlug, "nameSlug must not be null"); + return this; + } + + /** + *

The human-readable name of the app

+ *

The human-readable name of the app

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public ImgSrcStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

The URL to the app's logo

+ *

The URL to the app's logo

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("img_src") + public FeaturedWeightStage imgSrc(@NotNull String imgSrc) { + this.imgSrc = Objects.requireNonNull(imgSrc, "imgSrc must not be null"); + return this; + } + + /** + *

A rough directional ordering of app popularity, subject to changes by Pipedream

+ *

A rough directional ordering of app popularity, subject to changes by Pipedream

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("featured_weight") + public _FinalStage featuredWeight(double featuredWeight) { + this.featuredWeight = featuredWeight; + return this; + } + + /** + *

Named subsets of the app's OAuth scopes that may be requested when users connect their accounts (via the oauth_scope_profile parameter). Empty for apps that don't define any.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllScopeProfiles(List scopeProfiles) { + if (scopeProfiles != null) { + this.scopeProfiles.addAll(scopeProfiles); + } + return this; + } + + /** + *

Named subsets of the app's OAuth scopes that may be requested when users connect their accounts (via the oauth_scope_profile parameter). Empty for apps that don't define any.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addScopeProfiles(AppScopeProfilesItem scopeProfiles) { + this.scopeProfiles.add(scopeProfiles); + return this; + } + + /** + *

Named subsets of the app's OAuth scopes that may be requested when users connect their accounts (via the oauth_scope_profile parameter). Empty for apps that don't define any.

+ */ + @java.lang.Override + @JsonSetter(value = "scope_profiles", nulls = Nulls.SKIP) + public _FinalStage scopeProfiles(List scopeProfiles) { + this.scopeProfiles.clear(); + if (scopeProfiles != null) { + this.scopeProfiles.addAll(scopeProfiles); + } + return this; + } + + /** + *

Categories associated with the app

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllCategories(List categories) { + if (categories != null) { + this.categories.addAll(categories); + } + return this; + } + + /** + *

Categories associated with the app

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addCategories(String categories) { + this.categories.add(categories); + return this; + } + + /** + *

Categories associated with the app

+ */ + @java.lang.Override + @JsonSetter(value = "categories", nulls = Nulls.SKIP) + public _FinalStage categories(List categories) { + this.categories.clear(); + if (categories != null) { + this.categories.addAll(categories); + } + return this; + } + + /** + *

A JSON string representing the custom fields for the app

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customFieldsJson(String customFieldsJson) { + this.customFieldsJson = Optional.ofNullable(customFieldsJson); + return this; + } + + /** + *

A JSON string representing the custom fields for the app

+ */ + @java.lang.Override + @JsonSetter(value = "custom_fields_json", nulls = Nulls.SKIP) + public _FinalStage customFieldsJson(Optional customFieldsJson) { + this.customFieldsJson = customFieldsJson; + return this; + } + + /** + *

A short description of the app

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

A short description of the app

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public _FinalStage authType(AppAuthType authType) { + this.authType = Optional.ofNullable(authType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auth_type", nulls = Nulls.SKIP) + public _FinalStage authType(Optional authType) { + this.authType = authType; + return this; + } + + @java.lang.Override + public _FinalStage updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = Optional.ofNullable(updatedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) + public _FinalStage updatedAt(Optional updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + @java.lang.Override + public _FinalStage createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public _FinalStage createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + *

The redirect URI to register with the upstream OAuth provider

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectUri(String redirectUri) { + this.redirectUri = Optional.ofNullable(redirectUri); + return this; + } + + /** + *

The redirect URI to register with the upstream OAuth provider

+ */ + @java.lang.Override + @JsonSetter(value = "redirect_uri", nulls = Nulls.SKIP) + public _FinalStage redirectUri(Optional redirectUri) { + this.redirectUri = redirectUri; + return this; + } + + /** + *

Extra OAuth scopes users may grant on top of the base scopes

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage additionalScopes(List additionalScopes) { + this.additionalScopes = Optional.ofNullable(additionalScopes); + return this; + } + + /** + *

Extra OAuth scopes users may grant on top of the base scopes

+ */ + @java.lang.Override + @JsonSetter(value = "additional_scopes", nulls = Nulls.SKIP) + public _FinalStage additionalScopes(Optional> additionalScopes) { + this.additionalScopes = additionalScopes; + return this; + } + + /** + *

OAuth scopes requested when users connect through this client

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage scopes(List scopes) { + this.scopes = Optional.ofNullable(scopes); + return this; + } + + /** + *

OAuth scopes requested when users connect through this client

+ */ + @java.lang.Override + @JsonSetter(value = "scopes", nulls = Nulls.SKIP) + public _FinalStage scopes(Optional> scopes) { + this.scopes = scopes; + return this; + } + + /** + *

Hash ID for the OAuth client

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

Hash ID for the OAuth client

+ */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @java.lang.Override + public OauthApp build() { + return new OauthApp( + id, + clientId, + scopes, + additionalScopes, + redirectUri, + ownerId, + createdAt, + updatedAt, + nameSlug, + name, + authType, + description, + imgSrc, + customFieldsJson, + categories, + featuredWeight, + scopeProfiles, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ValidateTokenResponse.java b/src/main/java/com/pipedream/api/types/ValidateTokenResponse.java index 887b8b4..2fda3df 100644 --- a/src/main/java/com/pipedream/api/types/ValidateTokenResponse.java +++ b/src/main/java/com/pipedream/api/types/ValidateTokenResponse.java @@ -28,6 +28,8 @@ public final class ValidateTokenResponse { private final Optional oauthAppId; + private final Optional oauthAppWorkdayOfficial; + private final Optional projectAppName; private final Optional projectEnvironment; @@ -47,6 +49,7 @@ private ValidateTokenResponse( Optional error, Optional errorRedirectUri, Optional oauthAppId, + Optional oauthAppWorkdayOfficial, Optional projectAppName, Optional projectEnvironment, Optional projectId, @@ -58,6 +61,7 @@ private ValidateTokenResponse( this.error = error; this.errorRedirectUri = errorRedirectUri; this.oauthAppId = oauthAppId; + this.oauthAppWorkdayOfficial = oauthAppWorkdayOfficial; this.projectAppName = projectAppName; this.projectEnvironment = projectEnvironment; this.projectId = projectId; @@ -96,6 +100,14 @@ public Optional getOauthAppId() { return oauthAppId; } + /** + * @return True when the resolved OAuth client is the app's Workday-official client + */ + @JsonProperty("oauth_app_workday_official") + public Optional getOauthAppWorkdayOfficial() { + return oauthAppWorkdayOfficial; + } + /** * @return Name of the project app */ @@ -160,6 +172,7 @@ private boolean equalTo(ValidateTokenResponse other) { && error.equals(other.error) && errorRedirectUri.equals(other.errorRedirectUri) && oauthAppId.equals(other.oauthAppId) + && oauthAppWorkdayOfficial.equals(other.oauthAppWorkdayOfficial) && projectAppName.equals(other.projectAppName) && projectEnvironment.equals(other.projectEnvironment) && projectId.equals(other.projectId) @@ -175,6 +188,7 @@ public int hashCode() { this.error, this.errorRedirectUri, this.oauthAppId, + this.oauthAppWorkdayOfficial, this.projectAppName, this.projectEnvironment, this.projectId, @@ -233,6 +247,13 @@ public interface _FinalStage { _FinalStage oauthAppId(String oauthAppId); + /** + *

True when the resolved OAuth client is the app's Workday-official client

+ */ + _FinalStage oauthAppWorkdayOfficial(Optional oauthAppWorkdayOfficial); + + _FinalStage oauthAppWorkdayOfficial(Boolean oauthAppWorkdayOfficial); + /** *

Name of the project app

*/ @@ -283,6 +304,8 @@ public static final class Builder implements SuccessStage, _FinalStage { private Optional projectAppName = Optional.empty(); + private Optional oauthAppWorkdayOfficial = Optional.empty(); + private Optional oauthAppId = Optional.empty(); private Optional errorRedirectUri = Optional.empty(); @@ -302,6 +325,7 @@ public Builder from(ValidateTokenResponse other) { error(other.getError()); errorRedirectUri(other.getErrorRedirectUri()); oauthAppId(other.getOauthAppId()); + oauthAppWorkdayOfficial(other.getOauthAppWorkdayOfficial()); projectAppName(other.getProjectAppName()); projectEnvironment(other.getProjectEnvironment()); projectId(other.getProjectId()); @@ -423,6 +447,26 @@ public _FinalStage projectAppName(Optional projectAppName) { return this; } + /** + *

True when the resolved OAuth client is the app's Workday-official client

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage oauthAppWorkdayOfficial(Boolean oauthAppWorkdayOfficial) { + this.oauthAppWorkdayOfficial = Optional.ofNullable(oauthAppWorkdayOfficial); + return this; + } + + /** + *

True when the resolved OAuth client is the app's Workday-official client

+ */ + @java.lang.Override + @JsonSetter(value = "oauth_app_workday_official", nulls = Nulls.SKIP) + public _FinalStage oauthAppWorkdayOfficial(Optional oauthAppWorkdayOfficial) { + this.oauthAppWorkdayOfficial = oauthAppWorkdayOfficial; + return this; + } + /** *

OAuth app ID if applicable

* @return Reference to {@code this} so that method calls can be chained together. @@ -503,6 +547,7 @@ public ValidateTokenResponse build() { error, errorRedirectUri, oauthAppId, + oauthAppWorkdayOfficial, projectAppName, projectEnvironment, projectId, From 0e5c10d5d7ecac038798b2643958c624ccb77da9 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Tue, 18 Aug 2026 19:31:16 +0000 Subject: [PATCH 2/3] [fern-replay] Applied customizations Patches with unresolved conflicts (1): - patch-edb0fd1d: Normalize paths in the request URLs Run `fern-replay resolve` to apply these customizations. --- .fern/replay.lock | 8 +++++++- README.md | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.fern/replay.lock b/.fern/replay.lock index cc42665..2fc172b 100644 --- a/.fern/replay.lock +++ b/.fern/replay.lock @@ -6,5 +6,11 @@ generations: timestamp: 2026-05-19T23:19:48.346Z cli_version: unknown generator_versions: {} -current_generation: 93fd7063699edbf599967cbed5ad90943ff88a16 + - commit_sha: d9d1ea8e33820dc82ac6241ea80ca1aa60d5eca0 + tree_hash: 8841ae3ff048873fd5efd7151adab187c2687980 + timestamp: 2026-08-18T19:31:13.302Z + cli_version: unknown + generator_versions: + fernapi/fern-java-sdk: 4.8.4 +current_generation: d9d1ea8e33820dc82ac6241ea80ca1aa60d5eca0 patches: [] diff --git a/README.md b/README.md index 8fb2837..8f935d1 100644 --- a/README.md +++ b/README.md @@ -267,4 +267,3 @@ On the other hand, contributions to the README are always very welcome! ## Reference A full reference for this library is available [here](https://github.com/PipedreamHQ/pipedream-sdk-java/blob/HEAD/./reference.md). - From c20bfef7f500f7b6d7853c8a9de4438a4ed83f8a Mon Sep 17 00:00:00 2001 From: Jay Vercellone Date: Tue, 18 Aug 2026 15:41:55 -0700 Subject: [PATCH 3/3] Bump version --- .fern/metadata.json | 4 ++-- README.md | 8 ++++++-- build.gradle | 4 ++-- src/main/java/com/pipedream/api/core/ClientOptions.java | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.fern/metadata.json b/.fern/metadata.json index 5c0771e..3abe440 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -14,5 +14,5 @@ "originGitCommitIsDirty": false, "invokedBy": "ci", "ciProvider": "github", - "sdkVersion": "2.1.1" -} \ No newline at end of file + "sdkVersion": "2.1.2" +} diff --git a/README.md b/README.md index 8f935d1..d2f2b14 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Add the dependency in your `build.gradle` file: ```groovy dependencies { - implementation 'com.pipedream:pipedream:2.1.1' + implementation 'com.pipedream:pipedream:2.1.2' } ``` @@ -42,7 +42,7 @@ Add the dependency in your `pom.xml` file: com.pipedream pipedream - 2.1.1 + 2.1.2 ``` @@ -171,11 +171,13 @@ the `Retry-After` header (as either in seconds or as an HTTP date), and then the Which status codes are retried depends on the `retry-status-codes` generator configuration: **`legacy`** (current default): retries on + - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) **`recommended`**: retries on + - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) - [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) @@ -196,6 +198,7 @@ BaseClient client = BaseClient ### Timeouts The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level. + ```java import com.pipedream.api.BaseClient; import com.pipedream.api.core.RequestOptions; @@ -264,6 +267,7 @@ a proof of concept, but know that we will not be able to merge it as-is. We sugg an issue first to discuss with us! On the other hand, contributions to the README are always very welcome! + ## Reference A full reference for this library is available [here](https://github.com/PipedreamHQ/pipedream-sdk-java/blob/HEAD/./reference.md). diff --git a/build.gradle b/build.gradle index 1fe1ce3..91cf761 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,7 @@ java { group = 'com.pipedream' -version = '2.1.1' +version = '2.1.2' jar { dependsOn(":generatePomFileForMavenPublication") @@ -79,7 +79,7 @@ publishing { maven(MavenPublication) { groupId = 'com.pipedream' artifactId = 'pipedream' - version = '2.1.1' + version = '2.1.2' 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 6071745..9bba2cc 100644 --- a/src/main/java/com/pipedream/api/core/ClientOptions.java +++ b/src/main/java/com/pipedream/api/core/ClientOptions.java @@ -41,10 +41,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.pipedream:pipedream/2.1.1"); + put("User-Agent", "com.pipedream:pipedream/2.1.2"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.pipedream.fern:api-sdk"); - put("X-Fern-SDK-Version", "2.1.1"); + put("X-Fern-SDK-Version", "2.1.2"); } }); this.headerSuppliers = headerSuppliers;