diff --git a/.fern/metadata.json b/.fern/metadata.json index ba6e54a..105524f 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -10,9 +10,9 @@ ], "retry-status-codes": "legacy" }, - "originGitCommit": "4ec89179f0cd7c09cc536f40a9c42a089d9cd425", + "originGitCommit": "c2e5677e51c00b8d3b0c89f56c00a2ddadb4c490", "originGitCommitIsDirty": false, "invokedBy": "ci", "ciProvider": "github", - "sdkVersion": "2.2.0" + "sdkVersion": "2.3.0" } \ No newline at end of file diff --git a/.fern/replay.lock b/.fern/replay.lock index 60be37c..43a0d00 100644 --- a/.fern/replay.lock +++ b/.fern/replay.lock @@ -18,5 +18,11 @@ generations: cli_version: unknown generator_versions: fernapi/fern-java-sdk: 4.8.4 -current_generation: e296916f2e3ace45c8c47dc725cbb525c94a22b7 + - commit_sha: 8c319d29407916a34259336340a8b7f16817613d + tree_hash: 055861dbd09a73a8076558b21181cdc053454163 + timestamp: 2026-10-21T00:09:58.669Z + cli_version: unknown + generator_versions: + fernapi/fern-java-sdk: 4.8.4 +current_generation: 8c319d29407916a34259336340a8b7f16817613d patches: [] diff --git a/README.md b/README.md index 7a953a0..2e4b738 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.2.0' + implementation 'com.pipedream:pipedream:2.3.0' } ``` @@ -42,7 +42,7 @@ Add the dependency in your `pom.xml` file: com.pipedream pipedream - 2.2.0 + 2.3.0 ``` diff --git a/build.gradle b/build.gradle index 001ca7b..c015380 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,7 @@ java { group = 'com.pipedream' -version = '2.2.0' +version = '2.3.0' jar { dependsOn(":generatePomFileForMavenPublication") @@ -79,7 +79,7 @@ publishing { maven(MavenPublication) { groupId = 'com.pipedream' artifactId = 'pipedream' - version = '2.2.0' + version = '2.3.0' 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 346d523..8daa5e1 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.2.0"); + put("User-Agent", "com.pipedream:pipedream/2.3.0"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.pipedream.fern:api-sdk"); - put("X-Fern-SDK-Version", "2.2.0"); + put("X-Fern-SDK-Version", "2.3.0"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/pipedream/api/errors/UnauthorizedError.java b/src/main/java/com/pipedream/api/errors/UnauthorizedError.java new file mode 100644 index 0000000..d0d8b58 --- /dev/null +++ b/src/main/java/com/pipedream/api/errors/UnauthorizedError.java @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.errors; + +import com.pipedream.api.core.BaseClientApiException; +import com.pipedream.api.types.UnauthorizedErrorBody; +import okhttp3.Response; + +public final class UnauthorizedError extends BaseClientApiException { + /** + * The body of the response that triggered the exception. + */ + private final UnauthorizedErrorBody body; + + public UnauthorizedError(UnauthorizedErrorBody body) { + super("UnauthorizedError", 401, body); + this.body = body; + } + + public UnauthorizedError(UnauthorizedErrorBody body, Response rawResponse) { + super("UnauthorizedError", 401, body, rawResponse); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public UnauthorizedErrorBody body() { + return this.body; + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java index c3011ff..235a8b2 100644 --- a/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java @@ -12,6 +12,7 @@ import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRegenerateWebhookSigningKeyRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersResetWebhookDeliveryStateRequest; import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveWebhookRequest; import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; @@ -205,6 +206,29 @@ public CompletableFuture retrieveWebhook( .thenApply(response -> response.body()); } + /** + * Reactivate a disabled webhook and clear its delivery failure evidence + */ + public CompletableFuture resetWebhookDeliveryState( + String triggerId, String webhookId, DeployedTriggersResetWebhookDeliveryStateRequest request) { + return this.rawClient + .resetWebhookDeliveryState(triggerId, webhookId, request) + .thenApply(response -> response.body()); + } + + /** + * Reactivate a disabled webhook and clear its delivery failure evidence + */ + public CompletableFuture resetWebhookDeliveryState( + String triggerId, + String webhookId, + DeployedTriggersResetWebhookDeliveryStateRequest request, + RequestOptions requestOptions) { + return this.rawClient + .resetWebhookDeliveryState(triggerId, webhookId, request, requestOptions) + .thenApply(response -> response.body()); + } + /** * Regenerate the signing key for a specific webhook on a deployed trigger */ diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java index 921afa7..f17b55c 100644 --- a/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java @@ -20,6 +20,7 @@ import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRegenerateWebhookSigningKeyRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersResetWebhookDeliveryStateRequest; import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveWebhookRequest; import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; @@ -862,6 +863,86 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + /** + * Reactivate a disabled webhook and clear its delivery failure evidence + */ + public CompletableFuture> resetWebhookDeliveryState( + String triggerId, String webhookId, DeployedTriggersResetWebhookDeliveryStateRequest request) { + return resetWebhookDeliveryState(triggerId, webhookId, request, null); + } + + /** + * Reactivate a disabled webhook and clear its delivery failure evidence + */ + public CompletableFuture> resetWebhookDeliveryState( + String triggerId, + String webhookId, + DeployedTriggersResetWebhookDeliveryStateRequest request, + RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("webhooks") + .addPathSegment(webhookId) + .addPathSegments("reset_delivery_state"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", 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()) { + future.complete(new BaseClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GetWebhookWithSigningKeyResponse.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; + } + /** * Regenerate the signing key for a specific webhook on a deployed trigger */ diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java index 0f1630a..5f9a959 100644 --- a/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java @@ -12,6 +12,7 @@ import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRegenerateWebhookSigningKeyRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersResetWebhookDeliveryStateRequest; import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveWebhookRequest; import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; @@ -195,6 +196,29 @@ public GetWebhookWithSigningKeyResponse retrieveWebhook( .body(); } + /** + * Reactivate a disabled webhook and clear its delivery failure evidence + */ + public GetWebhookWithSigningKeyResponse resetWebhookDeliveryState( + String triggerId, String webhookId, DeployedTriggersResetWebhookDeliveryStateRequest request) { + return this.rawClient + .resetWebhookDeliveryState(triggerId, webhookId, request) + .body(); + } + + /** + * Reactivate a disabled webhook and clear its delivery failure evidence + */ + public GetWebhookWithSigningKeyResponse resetWebhookDeliveryState( + String triggerId, + String webhookId, + DeployedTriggersResetWebhookDeliveryStateRequest request, + RequestOptions requestOptions) { + return this.rawClient + .resetWebhookDeliveryState(triggerId, webhookId, request, requestOptions) + .body(); + } + /** * Regenerate the signing key for a specific webhook on a deployed trigger */ diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java index 9358d72..5cf05e9 100644 --- a/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java @@ -20,6 +20,7 @@ import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRegenerateWebhookSigningKeyRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersResetWebhookDeliveryStateRequest; import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveWebhookRequest; import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; @@ -701,6 +702,71 @@ public BaseClientHttpResponse retrieveWebhook( } } + /** + * Reactivate a disabled webhook and clear its delivery failure evidence + */ + public BaseClientHttpResponse resetWebhookDeliveryState( + String triggerId, String webhookId, DeployedTriggersResetWebhookDeliveryStateRequest request) { + return resetWebhookDeliveryState(triggerId, webhookId, request, null); + } + + /** + * Reactivate a disabled webhook and clear its delivery failure evidence + */ + public BaseClientHttpResponse resetWebhookDeliveryState( + String triggerId, + String webhookId, + DeployedTriggersResetWebhookDeliveryStateRequest request, + RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("webhooks") + .addPathSegment(webhookId) + .addPathSegments("reset_delivery_state"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", 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()) { + return new BaseClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetWebhookWithSigningKeyResponse.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); + } + } + /** * Regenerate the signing key for a specific webhook on a deployed trigger */ diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersResetWebhookDeliveryStateRequest.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersResetWebhookDeliveryStateRequest.java new file mode 100644 index 0000000..b615bb5 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersResetWebhookDeliveryStateRequest.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedTriggersResetWebhookDeliveryStateRequest.Builder.class) +public final class DeployedTriggersResetWebhookDeliveryStateRequest { + private final String externalUserId; + + private final Map additionalProperties; + + private DeployedTriggersResetWebhookDeliveryStateRequest( + String externalUserId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersResetWebhookDeliveryStateRequest + && equalTo((DeployedTriggersResetWebhookDeliveryStateRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersResetWebhookDeliveryStateRequest other) { + return externalUserId.equals(other.externalUserId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID who owns the trigger

+ */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(DeployedTriggersResetWebhookDeliveryStateRequest other); + } + + public interface _FinalStage { + DeployedTriggersResetWebhookDeliveryStateRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersResetWebhookDeliveryStateRequest other) { + externalUserId(other.getExternalUserId()); + return this; + } + + /** + *

The external user ID who owns the trigger

+ *

The external user ID who owns the trigger

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + @java.lang.Override + public DeployedTriggersResetWebhookDeliveryStateRequest build() { + return new DeployedTriggersResetWebhookDeliveryStateRequest(externalUserId, 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/AsyncOauthAppsClient.java b/src/main/java/com/pipedream/api/resources/oauthapps/AsyncOauthAppsClient.java index ce6e73a..0a2f718 100644 --- a/src/main/java/com/pipedream/api/resources/oauthapps/AsyncOauthAppsClient.java +++ b/src/main/java/com/pipedream/api/resources/oauthapps/AsyncOauthAppsClient.java @@ -73,14 +73,14 @@ public CompletableFuture create(CreateOauthAppOpts request, RequestOpt } /** - * Get the configuration of a specific custom OAuth client + * Get the configuration of a specific OAuth client: one of your custom clients, or a Pipedream official client (see an app's oauth_app_id) */ public CompletableFuture retrieve(String id) { return this.rawClient.retrieve(id).thenApply(response -> response.body()); } /** - * Get the configuration of a specific custom OAuth client + * Get the configuration of a specific OAuth client: one of your custom clients, or a Pipedream official client (see an app's oauth_app_id) */ public CompletableFuture retrieve(String id, RequestOptions requestOptions) { return this.rawClient.retrieve(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 index dbbe396..4fae903 100644 --- a/src/main/java/com/pipedream/api/resources/oauthapps/AsyncRawOauthAppsClient.java +++ b/src/main/java/com/pipedream/api/resources/oauthapps/AsyncRawOauthAppsClient.java @@ -256,14 +256,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { } /** - * Get the configuration of a specific custom OAuth client + * Get the configuration of a specific OAuth client: one of your custom clients, or a Pipedream official client (see an app's oauth_app_id) */ public CompletableFuture> retrieve(String id) { return retrieve(id, null); } /** - * Get the configuration of a specific custom OAuth client + * Get the configuration of a specific OAuth client: one of your custom clients, or a Pipedream official client (see an app's oauth_app_id) */ public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) diff --git a/src/main/java/com/pipedream/api/resources/oauthapps/OauthAppsClient.java b/src/main/java/com/pipedream/api/resources/oauthapps/OauthAppsClient.java index c6d77be..3f52379 100644 --- a/src/main/java/com/pipedream/api/resources/oauthapps/OauthAppsClient.java +++ b/src/main/java/com/pipedream/api/resources/oauthapps/OauthAppsClient.java @@ -71,14 +71,14 @@ public OauthApp create(CreateOauthAppOpts request, RequestOptions requestOptions } /** - * Get the configuration of a specific custom OAuth client + * Get the configuration of a specific OAuth client: one of your custom clients, or a Pipedream official client (see an app's oauth_app_id) */ public OauthApp retrieve(String id) { return this.rawClient.retrieve(id).body(); } /** - * Get the configuration of a specific custom OAuth client + * Get the configuration of a specific OAuth client: one of your custom clients, or a Pipedream official client (see an app's oauth_app_id) */ public OauthApp retrieve(String id, RequestOptions requestOptions) { return this.rawClient.retrieve(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 index 0f61d5a..aefebb7 100644 --- a/src/main/java/com/pipedream/api/resources/oauthapps/RawOauthAppsClient.java +++ b/src/main/java/com/pipedream/api/resources/oauthapps/RawOauthAppsClient.java @@ -208,14 +208,14 @@ public BaseClientHttpResponse create(CreateOauthAppOpts request, Reque } /** - * Get the configuration of a specific custom OAuth client + * Get the configuration of a specific OAuth client: one of your custom clients, or a Pipedream official client (see an app's oauth_app_id) */ public BaseClientHttpResponse retrieve(String id) { return retrieve(id, null); } /** - * Get the configuration of a specific custom OAuth client + * Get the configuration of a specific OAuth client: one of your custom clients, or a Pipedream official client (see an app's oauth_app_id) */ public BaseClientHttpResponse retrieve(String id, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) 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 index a828022..0a8b55f 100644 --- a/src/main/java/com/pipedream/api/resources/oauthapps/requests/CreateOauthAppOpts.java +++ b/src/main/java/com/pipedream/api/resources/oauthapps/requests/CreateOauthAppOpts.java @@ -24,9 +24,9 @@ public final class CreateOauthAppOpts { private final String app; - private final String clientId; + private final Optional clientId; - private final String clientSecret; + private final Optional clientSecret; private final Optional name; @@ -40,8 +40,8 @@ public final class CreateOauthAppOpts { private CreateOauthAppOpts( String app, - String clientId, - String clientSecret, + Optional clientId, + Optional clientSecret, Optional name, Optional description, Optional> scopes, @@ -66,18 +66,18 @@ public String getApp() { } /** - * @return The OAuth client ID registered with the upstream provider + * @return The OAuth client ID registered with the upstream provider. Optional: providers that only issue credentials once they have a callback URL can be registered without one, and the client cannot connect accounts until it is set. */ @JsonProperty("client_id") - public String getClientId() { + public Optional getClientId() { return clientId; } /** - * @return The OAuth client secret. Write-only; never returned in responses. + * @return The OAuth client secret. Optional, like the client ID. Write-only; never returned in responses. */ @JsonProperty("client_secret") - public String getClientSecret() { + public Optional getClientSecret() { return clientSecret; } @@ -159,25 +159,11 @@ public interface AppStage { /** *

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

*/ - ClientIdStage app(@NotNull String app); + _FinalStage 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(); @@ -185,6 +171,20 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + /** + *

The OAuth client ID registered with the upstream provider. Optional: providers that only issue credentials once they have a callback URL can be registered without one, and the client cannot connect accounts until it is set.

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

The OAuth client secret. Optional, like the client ID. Write-only; never returned in responses.

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

Display name of the OAuth client

*/ @@ -215,13 +215,9 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements AppStage, ClientIdStage, ClientSecretStage, _FinalStage { + public static final class Builder implements AppStage, _FinalStage { private String app; - private String clientId; - - private String clientSecret; - private Optional> additionalScopes = Optional.empty(); private Optional> scopes = Optional.empty(); @@ -230,6 +226,10 @@ public static final class Builder implements AppStage, ClientIdStage, ClientSecr private Optional name = Optional.empty(); + private Optional clientSecret = Optional.empty(); + + private Optional clientId = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -254,35 +254,11 @@ public Builder from(CreateOauthAppOpts other) { */ @java.lang.Override @JsonSetter("app") - public ClientIdStage app(@NotNull String app) { + public _FinalStage 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. @@ -363,6 +339,46 @@ public _FinalStage name(Optional name) { return this; } + /** + *

The OAuth client secret. Optional, like the client ID. Write-only; never returned in responses.

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

The OAuth client secret. Optional, like the client ID. Write-only; never returned in responses.

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

The OAuth client ID registered with the upstream provider. Optional: providers that only issue credentials once they have a callback URL can be registered without one, and the client cannot connect accounts until it is set.

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

The OAuth client ID registered with the upstream provider. Optional: providers that only issue credentials once they have a callback URL can be registered without one, and the client cannot connect accounts until it is set.

+ */ + @java.lang.Override + @JsonSetter(value = "client_id", nulls = Nulls.SKIP) + public _FinalStage clientId(Optional clientId) { + this.clientId = clientId; + return this; + } + @java.lang.Override public CreateOauthAppOpts build() { return new CreateOauthAppOpts( 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 index 0585513..73ff2c1 100644 --- a/src/main/java/com/pipedream/api/resources/oauthapps/requests/UpdateOauthAppOpts.java +++ b/src/main/java/com/pipedream/api/resources/oauthapps/requests/UpdateOauthAppOpts.java @@ -69,7 +69,7 @@ public Optional getDescription() { } /** - * @return The OAuth client ID registered with the upstream provider + * @return The OAuth client ID registered with the upstream provider. Blank values are ignored and the existing client ID is kept. */ @JsonProperty("client_id") public Optional getClientId() { @@ -193,7 +193,7 @@ public Builder description(String description) { } /** - *

The OAuth client ID registered with the upstream provider

+ *

The OAuth client ID registered with the upstream provider. Blank values are ignored and the existing client ID is kept.

*/ @JsonSetter(value = "client_id", nulls = Nulls.SKIP) public Builder clientId(Optional clientId) { diff --git a/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java b/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java index 1e00c9d..549207a 100644 --- a/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java +++ b/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java @@ -11,9 +11,12 @@ import com.pipedream.api.core.MediaTypes; import com.pipedream.api.core.ObjectMappers; import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.errors.BadRequestError; import com.pipedream.api.errors.TooManyRequestsError; +import com.pipedream.api.errors.UnauthorizedError; import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; import com.pipedream.api.types.CreateOAuthTokenResponse; +import com.pipedream.api.types.UnauthorizedErrorBody; import java.io.IOException; import java.util.concurrent.CompletableFuture; import okhttp3.Call; @@ -85,10 +88,23 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO return; } try { - if (response.code() == 429) { - future.completeExceptionally(new TooManyRequestsError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UnauthorizedErrorBody.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 diff --git a/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java b/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java index 9b07f66..6af9b18 100644 --- a/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java +++ b/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java @@ -11,9 +11,12 @@ import com.pipedream.api.core.MediaTypes; import com.pipedream.api.core.ObjectMappers; import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.errors.BadRequestError; import com.pipedream.api.errors.TooManyRequestsError; +import com.pipedream.api.errors.UnauthorizedError; import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; import com.pipedream.api.types.CreateOAuthTokenResponse; +import com.pipedream.api.types.UnauthorizedErrorBody; import java.io.IOException; import okhttp3.Headers; import okhttp3.HttpUrl; @@ -77,9 +80,17 @@ public BaseClientHttpResponse create( response); } try { - if (response.code() == 429) { - throw new TooManyRequestsError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UnauthorizedErrorBody.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 diff --git a/src/main/java/com/pipedream/api/types/App.java b/src/main/java/com/pipedream/api/types/App.java index c447cca..92fcc46 100644 --- a/src/main/java/com/pipedream/api/types/App.java +++ b/src/main/java/com/pipedream/api/types/App.java @@ -43,6 +43,8 @@ public final class App { private final List scopeProfiles; + private final Optional oauthAppId; + private final Map additionalProperties; private App( @@ -56,6 +58,7 @@ private App( List categories, double featuredWeight, List scopeProfiles, + Optional oauthAppId, Map additionalProperties) { this.id = id; this.nameSlug = nameSlug; @@ -67,6 +70,7 @@ private App( this.categories = categories; this.featuredWeight = featuredWeight; this.scopeProfiles = scopeProfiles; + this.oauthAppId = oauthAppId; this.additionalProperties = additionalProperties; } @@ -147,6 +151,14 @@ public List getScopeProfiles() { return scopeProfiles; } + /** + * @return ID of the app's Pipedream official OAuth client, or null if the app doesn't use OAuth or has no official client. Retrieve the client, including its scopes, with the Retrieve OAuth client endpoint. Returned by the List apps and Retrieve app endpoints. + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -168,7 +180,8 @@ private boolean equalTo(App other) { && customFieldsJson.equals(other.customFieldsJson) && categories.equals(other.categories) && featuredWeight == other.featuredWeight - && scopeProfiles.equals(other.scopeProfiles); + && scopeProfiles.equals(other.scopeProfiles) + && oauthAppId.equals(other.oauthAppId); } @java.lang.Override @@ -183,7 +196,8 @@ public int hashCode() { this.customFieldsJson, this.categories, this.featuredWeight, - this.scopeProfiles); + this.scopeProfiles, + this.oauthAppId); } @java.lang.Override @@ -274,6 +288,13 @@ public interface _FinalStage { _FinalStage addScopeProfiles(AppScopeProfilesItem scopeProfiles); _FinalStage addAllScopeProfiles(List scopeProfiles); + + /** + *

ID of the app's Pipedream official OAuth client, or null if the app doesn't use OAuth or has no official client. Retrieve the client, including its scopes, with the Retrieve OAuth client endpoint. Returned by the List apps and Retrieve app endpoints.

+ */ + _FinalStage oauthAppId(Optional oauthAppId); + + _FinalStage oauthAppId(String oauthAppId); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -287,6 +308,8 @@ public static final class Builder private double featuredWeight; + private Optional oauthAppId = Optional.empty(); + private List scopeProfiles = new ArrayList<>(); private List categories = new ArrayList<>(); @@ -316,6 +339,7 @@ public Builder from(App other) { categories(other.getCategories()); featuredWeight(other.getFeaturedWeight()); scopeProfiles(other.getScopeProfiles()); + oauthAppId(other.getOauthAppId()); return this; } @@ -367,6 +391,26 @@ public _FinalStage featuredWeight(double featuredWeight) { return this; } + /** + *

ID of the app's Pipedream official OAuth client, or null if the app doesn't use OAuth or has no official client. Retrieve the client, including its scopes, with the Retrieve OAuth client endpoint. Returned by the List apps and Retrieve app endpoints.

+ * @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; + } + + /** + *

ID of the app's Pipedream official OAuth client, or null if the app doesn't use OAuth or has no official client. Retrieve the client, including its scopes, with the Retrieve OAuth client endpoint. Returned by the List apps and Retrieve app endpoints.

+ */ + @java.lang.Override + @JsonSetter(value = "oauth_app_id", nulls = Nulls.SKIP) + public _FinalStage oauthAppId(Optional oauthAppId) { + this.oauthAppId = oauthAppId; + 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. @@ -523,6 +567,7 @@ public App build() { categories, featuredWeight, scopeProfiles, + oauthAppId, additionalProperties); } diff --git a/src/main/java/com/pipedream/api/types/BadRequestErrorBody.java b/src/main/java/com/pipedream/api/types/BadRequestErrorBody.java new file mode 100644 index 0000000..a2f2248 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/BadRequestErrorBody.java @@ -0,0 +1,118 @@ +/** + * 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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BadRequestErrorBody.Builder.class) +public final class BadRequestErrorBody { + private final String error; + + private final Map additionalProperties; + + private BadRequestErrorBody(String error, Map additionalProperties) { + this.error = error; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("error") + public String getError() { + return error; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BadRequestErrorBody && equalTo((BadRequestErrorBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BadRequestErrorBody other) { + return error.equals(other.error); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.error); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ErrorStage builder() { + return new Builder(); + } + + public interface ErrorStage { + _FinalStage error(@NotNull String error); + + Builder from(BadRequestErrorBody other); + } + + public interface _FinalStage { + BadRequestErrorBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ErrorStage, _FinalStage { + private String error; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BadRequestErrorBody other) { + error(other.getError()); + return this; + } + + @java.lang.Override + @JsonSetter("error") + public _FinalStage error(@NotNull String error) { + this.error = Objects.requireNonNull(error, "error must not be null"); + return this; + } + + @java.lang.Override + public BadRequestErrorBody build() { + return new BadRequestErrorBody(error, 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 index e361ec8..3c93a88 100644 --- a/src/main/java/com/pipedream/api/types/OauthApp.java +++ b/src/main/java/com/pipedream/api/types/OauthApp.java @@ -26,7 +26,7 @@ public final class OauthApp { private final Optional id; - private final String clientId; + private final Optional clientId; private final Optional> scopes; @@ -34,7 +34,7 @@ public final class OauthApp { private final Optional redirectUri; - private final String ownerId; + private final Optional ownerId; private final Optional createdAt; @@ -58,15 +58,17 @@ public final class OauthApp { private final List scopeProfiles; + private final Optional oauthAppId; + private final Map additionalProperties; private OauthApp( Optional id, - String clientId, + Optional clientId, Optional> scopes, Optional> additionalScopes, Optional redirectUri, - String ownerId, + Optional ownerId, Optional createdAt, Optional updatedAt, String nameSlug, @@ -78,6 +80,7 @@ private OauthApp( List categories, double featuredWeight, List scopeProfiles, + Optional oauthAppId, Map additionalProperties) { this.id = id; this.clientId = clientId; @@ -96,6 +99,7 @@ private OauthApp( this.categories = categories; this.featuredWeight = featuredWeight; this.scopeProfiles = scopeProfiles; + this.oauthAppId = oauthAppId; this.additionalProperties = additionalProperties; } @@ -108,10 +112,10 @@ public Optional getId() { } /** - * @return The OAuth client ID registered with the upstream provider + * @return The OAuth client ID registered with the upstream provider. Null for a client registered before its provider issued credentials. */ @JsonProperty("client_id") - public String getClientId() { + public Optional getClientId() { return clientId; } @@ -140,10 +144,10 @@ public Optional getRedirectUri() { } /** - * @return Hash ID of the owner: the workspace (o_...) or the project (proj_...) + * @return Hash ID of the owner: the workspace (o_...) or the project (proj_...). Null for Pipedream official clients. */ @JsonProperty("owner_id") - public String getOwnerId() { + public Optional getOwnerId() { return ownerId; } @@ -226,6 +230,14 @@ public List getScopeProfiles() { return scopeProfiles; } + /** + * @return ID of the app's Pipedream official OAuth client, or null if the app doesn't use OAuth or has no official client. Retrieve the client, including its scopes, with the Retrieve OAuth client endpoint. Returned by the List apps and Retrieve app endpoints. + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -254,7 +266,8 @@ private boolean equalTo(OauthApp other) { && customFieldsJson.equals(other.customFieldsJson) && categories.equals(other.categories) && featuredWeight == other.featuredWeight - && scopeProfiles.equals(other.scopeProfiles); + && scopeProfiles.equals(other.scopeProfiles) + && oauthAppId.equals(other.oauthAppId); } @java.lang.Override @@ -276,7 +289,8 @@ public int hashCode() { this.customFieldsJson, this.categories, this.featuredWeight, - this.scopeProfiles); + this.scopeProfiles, + this.oauthAppId); } @java.lang.Override @@ -284,31 +298,17 @@ public String toString() { return ObjectMappers.stringify(this); } - public static ClientIdStage builder() { + public static NameSlugStage 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); + + Builder from(OauthApp other); } public interface NameStage { @@ -346,6 +346,13 @@ public interface _FinalStage { _FinalStage id(String id); + /** + *

The OAuth client ID registered with the upstream provider. Null for a client registered before its provider issued credentials.

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

OAuth scopes requested when users connect through this client

*/ @@ -367,6 +374,13 @@ public interface _FinalStage { _FinalStage redirectUri(String redirectUri); + /** + *

Hash ID of the owner: the workspace (o_...) or the project (proj_...). Null for Pipedream official clients.

+ */ + _FinalStage ownerId(Optional ownerId); + + _FinalStage ownerId(String ownerId); + _FinalStage createdAt(Optional createdAt); _FinalStage createdAt(OffsetDateTime createdAt); @@ -410,21 +424,18 @@ public interface _FinalStage { _FinalStage addScopeProfiles(AppScopeProfilesItem scopeProfiles); _FinalStage addAllScopeProfiles(List scopeProfiles); + + /** + *

ID of the app's Pipedream official OAuth client, or null if the app doesn't use OAuth or has no official client. Retrieve the client, including its scopes, with the Retrieve OAuth client endpoint. Returned by the List apps and Retrieve app endpoints.

+ */ + _FinalStage oauthAppId(Optional oauthAppId); + + _FinalStage oauthAppId(String oauthAppId); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements ClientIdStage, - OwnerIdStage, - NameSlugStage, - NameStage, - ImgSrcStage, - FeaturedWeightStage, - _FinalStage { - private String clientId; - - private String ownerId; - + implements NameSlugStage, NameStage, ImgSrcStage, FeaturedWeightStage, _FinalStage { private String nameSlug; private String name; @@ -433,6 +444,8 @@ public static final class Builder private double featuredWeight; + private Optional oauthAppId = Optional.empty(); + private List scopeProfiles = new ArrayList<>(); private List categories = new ArrayList<>(); @@ -447,12 +460,16 @@ public static final class Builder private Optional createdAt = Optional.empty(); + private Optional ownerId = Optional.empty(); + private Optional redirectUri = Optional.empty(); private Optional> additionalScopes = Optional.empty(); private Optional> scopes = Optional.empty(); + private Optional clientId = Optional.empty(); + private Optional id = Optional.empty(); @JsonAnySetter @@ -479,30 +496,7 @@ public Builder from(OauthApp other) { 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"); + oauthAppId(other.getOauthAppId()); return this; } @@ -554,6 +548,26 @@ public _FinalStage featuredWeight(double featuredWeight) { return this; } + /** + *

ID of the app's Pipedream official OAuth client, or null if the app doesn't use OAuth or has no official client. Retrieve the client, including its scopes, with the Retrieve OAuth client endpoint. Returned by the List apps and Retrieve app endpoints.

+ * @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; + } + + /** + *

ID of the app's Pipedream official OAuth client, or null if the app doesn't use OAuth or has no official client. Retrieve the client, including its scopes, with the Retrieve OAuth client endpoint. Returned by the List apps and Retrieve app endpoints.

+ */ + @java.lang.Override + @JsonSetter(value = "oauth_app_id", nulls = Nulls.SKIP) + public _FinalStage oauthAppId(Optional oauthAppId) { + this.oauthAppId = oauthAppId; + 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. @@ -703,6 +717,26 @@ public _FinalStage createdAt(Optional createdAt) { return this; } + /** + *

Hash ID of the owner: the workspace (o_...) or the project (proj_...). Null for Pipedream official clients.

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

Hash ID of the owner: the workspace (o_...) or the project (proj_...). Null for Pipedream official clients.

+ */ + @java.lang.Override + @JsonSetter(value = "owner_id", nulls = Nulls.SKIP) + public _FinalStage ownerId(Optional ownerId) { + this.ownerId = ownerId; + 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. @@ -763,6 +797,26 @@ public _FinalStage scopes(Optional> scopes) { return this; } + /** + *

The OAuth client ID registered with the upstream provider. Null for a client registered before its provider issued credentials.

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

The OAuth client ID registered with the upstream provider. Null for a client registered before its provider issued credentials.

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

Hash ID for the OAuth client

* @return Reference to {@code this} so that method calls can be chained together. @@ -803,6 +857,7 @@ public OauthApp build() { categories, featuredWeight, scopeProfiles, + oauthAppId, additionalProperties); } diff --git a/src/main/java/com/pipedream/api/types/TriggerWebhook.java b/src/main/java/com/pipedream/api/types/TriggerWebhook.java index 366d742..8f4a740 100644 --- a/src/main/java/com/pipedream/api/types/TriggerWebhook.java +++ b/src/main/java/com/pipedream/api/types/TriggerWebhook.java @@ -29,6 +29,12 @@ public final class TriggerWebhook { private final boolean signingKeySet; + private final Optional active; + + private final Optional deliveryBackend; + + private final Optional deliveryState; + private final Map additionalProperties; private TriggerWebhook( @@ -36,11 +42,17 @@ private TriggerWebhook( String url, Optional signingKey, boolean signingKeySet, + Optional active, + Optional deliveryBackend, + Optional deliveryState, Map additionalProperties) { this.id = id; this.url = url; this.signingKey = signingKey; this.signingKeySet = signingKeySet; + this.active = active; + this.deliveryBackend = deliveryBackend; + this.deliveryState = deliveryState; this.additionalProperties = additionalProperties; } @@ -76,6 +88,21 @@ public boolean getSigningKeySet() { return signingKeySet; } + @JsonProperty("active") + public Optional getActive() { + return active; + } + + @JsonProperty("delivery_backend") + public Optional getDeliveryBackend() { + return deliveryBackend; + } + + @JsonProperty("delivery_state") + public Optional getDeliveryState() { + return deliveryState; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -91,12 +118,22 @@ private boolean equalTo(TriggerWebhook other) { return id.equals(other.id) && url.equals(other.url) && signingKey.equals(other.signingKey) - && signingKeySet == other.signingKeySet; + && signingKeySet == other.signingKeySet + && active.equals(other.active) + && deliveryBackend.equals(other.deliveryBackend) + && deliveryState.equals(other.deliveryState); } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.url, this.signingKey, this.signingKeySet); + return Objects.hash( + this.id, + this.url, + this.signingKey, + this.signingKeySet, + this.active, + this.deliveryBackend, + this.deliveryState); } @java.lang.Override @@ -144,6 +181,18 @@ public interface _FinalStage { _FinalStage signingKey(Optional signingKey); _FinalStage signingKey(String signingKey); + + _FinalStage active(Optional active); + + _FinalStage active(Boolean active); + + _FinalStage deliveryBackend(Optional deliveryBackend); + + _FinalStage deliveryBackend(TriggerWebhookDeliveryBackend deliveryBackend); + + _FinalStage deliveryState(Optional deliveryState); + + _FinalStage deliveryState(WebhookDeliveryState deliveryState); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -154,6 +203,12 @@ public static final class Builder implements IdStage, UrlStage, SigningKeySetSta private boolean signingKeySet; + private Optional deliveryState = Optional.empty(); + + private Optional deliveryBackend = Optional.empty(); + + private Optional active = Optional.empty(); + private Optional signingKey = Optional.empty(); @JsonAnySetter @@ -167,6 +222,9 @@ public Builder from(TriggerWebhook other) { url(other.getUrl()); signingKey(other.getSigningKey()); signingKeySet(other.getSigningKeySet()); + active(other.getActive()); + deliveryBackend(other.getDeliveryBackend()); + deliveryState(other.getDeliveryState()); return this; } @@ -206,6 +264,45 @@ public _FinalStage signingKeySet(boolean signingKeySet) { return this; } + @java.lang.Override + public _FinalStage deliveryState(WebhookDeliveryState deliveryState) { + this.deliveryState = Optional.ofNullable(deliveryState); + return this; + } + + @java.lang.Override + @JsonSetter(value = "delivery_state", nulls = Nulls.SKIP) + public _FinalStage deliveryState(Optional deliveryState) { + this.deliveryState = deliveryState; + return this; + } + + @java.lang.Override + public _FinalStage deliveryBackend(TriggerWebhookDeliveryBackend deliveryBackend) { + this.deliveryBackend = Optional.ofNullable(deliveryBackend); + return this; + } + + @java.lang.Override + @JsonSetter(value = "delivery_backend", nulls = Nulls.SKIP) + public _FinalStage deliveryBackend(Optional deliveryBackend) { + this.deliveryBackend = deliveryBackend; + return this; + } + + @java.lang.Override + public _FinalStage active(Boolean active) { + this.active = Optional.ofNullable(active); + return this; + } + + @java.lang.Override + @JsonSetter(value = "active", nulls = Nulls.SKIP) + public _FinalStage active(Optional active) { + this.active = active; + return this; + } + /** *

The webhook signing key, returned only for OAuth-authenticated requests

* @return Reference to {@code this} so that method calls can be chained together. @@ -228,7 +325,8 @@ public _FinalStage signingKey(Optional signingKey) { @java.lang.Override public TriggerWebhook build() { - return new TriggerWebhook(id, url, signingKey, signingKeySet, additionalProperties); + return new TriggerWebhook( + id, url, signingKey, signingKeySet, active, deliveryBackend, deliveryState, additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/pipedream/api/types/TriggerWebhookDeliveryBackend.java b/src/main/java/com/pipedream/api/types/TriggerWebhookDeliveryBackend.java new file mode 100644 index 0000000..c03d726 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/TriggerWebhookDeliveryBackend.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class TriggerWebhookDeliveryBackend { + public static final TriggerWebhookDeliveryBackend JVM = new TriggerWebhookDeliveryBackend(Value.JVM, "jvm"); + + public static final TriggerWebhookDeliveryBackend VALKEY = + new TriggerWebhookDeliveryBackend(Value.VALKEY, "valkey"); + + private final Value value; + + private final String string; + + TriggerWebhookDeliveryBackend(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof TriggerWebhookDeliveryBackend + && this.string.equals(((TriggerWebhookDeliveryBackend) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case JVM: + return visitor.visitJvm(); + case VALKEY: + return visitor.visitValkey(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static TriggerWebhookDeliveryBackend valueOf(String value) { + switch (value) { + case "jvm": + return JVM; + case "valkey": + return VALKEY; + default: + return new TriggerWebhookDeliveryBackend(Value.UNKNOWN, value); + } + } + + public enum Value { + JVM, + + VALKEY, + + UNKNOWN + } + + public interface Visitor { + T visitJvm(); + + T visitValkey(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/pipedream/api/types/UnauthorizedErrorBody.java b/src/main/java/com/pipedream/api/types/UnauthorizedErrorBody.java new file mode 100644 index 0000000..2cefe15 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/UnauthorizedErrorBody.java @@ -0,0 +1,118 @@ +/** + * 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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UnauthorizedErrorBody.Builder.class) +public final class UnauthorizedErrorBody { + private final String error; + + private final Map additionalProperties; + + private UnauthorizedErrorBody(String error, Map additionalProperties) { + this.error = error; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("error") + public String getError() { + return error; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UnauthorizedErrorBody && equalTo((UnauthorizedErrorBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UnauthorizedErrorBody other) { + return error.equals(other.error); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.error); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ErrorStage builder() { + return new Builder(); + } + + public interface ErrorStage { + _FinalStage error(@NotNull String error); + + Builder from(UnauthorizedErrorBody other); + } + + public interface _FinalStage { + UnauthorizedErrorBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ErrorStage, _FinalStage { + private String error; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UnauthorizedErrorBody other) { + error(other.getError()); + return this; + } + + @java.lang.Override + @JsonSetter("error") + public _FinalStage error(@NotNull String error) { + this.error = Objects.requireNonNull(error, "error must not be null"); + return this; + } + + @java.lang.Override + public UnauthorizedErrorBody build() { + return new UnauthorizedErrorBody(error, 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/WebhookDeliveryState.java b/src/main/java/com/pipedream/api/types/WebhookDeliveryState.java new file mode 100644 index 0000000..8971e74 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/WebhookDeliveryState.java @@ -0,0 +1,243 @@ +/** + * 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.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 = WebhookDeliveryState.Builder.class) +public final class WebhookDeliveryState { + private final WebhookDeliveryStateState state; + + private final Optional since; + + private final Optional lastError; + + private final int consecutiveFailures; + + private final int sheds; + + private final Map additionalProperties; + + private WebhookDeliveryState( + WebhookDeliveryStateState state, + Optional since, + Optional lastError, + int consecutiveFailures, + int sheds, + Map additionalProperties) { + this.state = state; + this.since = since; + this.lastError = lastError; + this.consecutiveFailures = consecutiveFailures; + this.sheds = sheds; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("state") + public WebhookDeliveryStateState getState() { + return state; + } + + /** + * @return Time the current state began, in epoch seconds + */ + @JsonProperty("since") + public Optional getSince() { + return since; + } + + @JsonProperty("last_error") + public Optional getLastError() { + return lastError; + } + + @JsonProperty("consecutive_failures") + public int getConsecutiveFailures() { + return consecutiveFailures; + } + + @JsonProperty("sheds") + public int getSheds() { + return sheds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WebhookDeliveryState && equalTo((WebhookDeliveryState) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(WebhookDeliveryState other) { + return state.equals(other.state) + && since.equals(other.since) + && lastError.equals(other.lastError) + && consecutiveFailures == other.consecutiveFailures + && sheds == other.sheds; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.state, this.since, this.lastError, this.consecutiveFailures, this.sheds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static StateStage builder() { + return new Builder(); + } + + public interface StateStage { + ConsecutiveFailuresStage state(@NotNull WebhookDeliveryStateState state); + + Builder from(WebhookDeliveryState other); + } + + public interface ConsecutiveFailuresStage { + ShedsStage consecutiveFailures(int consecutiveFailures); + } + + public interface ShedsStage { + _FinalStage sheds(int sheds); + } + + public interface _FinalStage { + WebhookDeliveryState build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Time the current state began, in epoch seconds

+ */ + _FinalStage since(Optional since); + + _FinalStage since(Integer since); + + _FinalStage lastError(Optional lastError); + + _FinalStage lastError(String lastError); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements StateStage, ConsecutiveFailuresStage, ShedsStage, _FinalStage { + private WebhookDeliveryStateState state; + + private int consecutiveFailures; + + private int sheds; + + private Optional lastError = Optional.empty(); + + private Optional since = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(WebhookDeliveryState other) { + state(other.getState()); + since(other.getSince()); + lastError(other.getLastError()); + consecutiveFailures(other.getConsecutiveFailures()); + sheds(other.getSheds()); + return this; + } + + @java.lang.Override + @JsonSetter("state") + public ConsecutiveFailuresStage state(@NotNull WebhookDeliveryStateState state) { + this.state = Objects.requireNonNull(state, "state must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("consecutive_failures") + public ShedsStage consecutiveFailures(int consecutiveFailures) { + this.consecutiveFailures = consecutiveFailures; + return this; + } + + @java.lang.Override + @JsonSetter("sheds") + public _FinalStage sheds(int sheds) { + this.sheds = sheds; + return this; + } + + @java.lang.Override + public _FinalStage lastError(String lastError) { + this.lastError = Optional.ofNullable(lastError); + return this; + } + + @java.lang.Override + @JsonSetter(value = "last_error", nulls = Nulls.SKIP) + public _FinalStage lastError(Optional lastError) { + this.lastError = lastError; + return this; + } + + /** + *

Time the current state began, in epoch seconds

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

Time the current state began, in epoch seconds

+ */ + @java.lang.Override + @JsonSetter(value = "since", nulls = Nulls.SKIP) + public _FinalStage since(Optional since) { + this.since = since; + return this; + } + + @java.lang.Override + public WebhookDeliveryState build() { + return new WebhookDeliveryState(state, since, lastError, consecutiveFailures, sheds, 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/WebhookDeliveryStateState.java b/src/main/java/com/pipedream/api/types/WebhookDeliveryStateState.java new file mode 100644 index 0000000..0af26e0 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/WebhookDeliveryStateState.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class WebhookDeliveryStateState { + public static final WebhookDeliveryStateState PENALTY = new WebhookDeliveryStateState(Value.PENALTY, "penalty"); + + public static final WebhookDeliveryStateState HAPPY = new WebhookDeliveryStateState(Value.HAPPY, "happy"); + + public static final WebhookDeliveryStateState LIFE_SUPPORT = + new WebhookDeliveryStateState(Value.LIFE_SUPPORT, "life_support"); + + public static final WebhookDeliveryStateState DEACTIVATED = + new WebhookDeliveryStateState(Value.DEACTIVATED, "deactivated"); + + private final Value value; + + private final String string; + + WebhookDeliveryStateState(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof WebhookDeliveryStateState + && this.string.equals(((WebhookDeliveryStateState) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENALTY: + return visitor.visitPenalty(); + case HAPPY: + return visitor.visitHappy(); + case LIFE_SUPPORT: + return visitor.visitLifeSupport(); + case DEACTIVATED: + return visitor.visitDeactivated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static WebhookDeliveryStateState valueOf(String value) { + switch (value) { + case "penalty": + return PENALTY; + case "happy": + return HAPPY; + case "life_support": + return LIFE_SUPPORT; + case "deactivated": + return DEACTIVATED; + default: + return new WebhookDeliveryStateState(Value.UNKNOWN, value); + } + } + + public enum Value { + HAPPY, + + PENALTY, + + LIFE_SUPPORT, + + DEACTIVATED, + + UNKNOWN + } + + public interface Visitor { + T visitHappy(); + + T visitPenalty(); + + T visitLifeSupport(); + + T visitDeactivated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/pipedream/api/types/WebhookWithSigningKey.java b/src/main/java/com/pipedream/api/types/WebhookWithSigningKey.java index 856f663..5825abe 100644 --- a/src/main/java/com/pipedream/api/types/WebhookWithSigningKey.java +++ b/src/main/java/com/pipedream/api/types/WebhookWithSigningKey.java @@ -9,11 +9,13 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.pipedream.api.core.ObjectMappers; import java.util.HashMap; import java.util.Map; import java.util.Objects; +import java.util.Optional; import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @@ -27,6 +29,12 @@ public final class WebhookWithSigningKey { private final boolean signingKeySet; + private final Optional active; + + private final Optional deliveryBackend; + + private final Optional deliveryState; + private final int createdAt; private final int updatedAt; @@ -38,6 +46,9 @@ private WebhookWithSigningKey( String url, String signingKey, boolean signingKeySet, + Optional active, + Optional deliveryBackend, + Optional deliveryState, int createdAt, int updatedAt, Map additionalProperties) { @@ -45,6 +56,9 @@ private WebhookWithSigningKey( this.url = url; this.signingKey = signingKey; this.signingKeySet = signingKeySet; + this.active = active; + this.deliveryBackend = deliveryBackend; + this.deliveryState = deliveryState; this.createdAt = createdAt; this.updatedAt = updatedAt; this.additionalProperties = additionalProperties; @@ -82,6 +96,21 @@ public boolean getSigningKeySet() { return signingKeySet; } + @JsonProperty("active") + public Optional getActive() { + return active; + } + + @JsonProperty("delivery_backend") + public Optional getDeliveryBackend() { + return deliveryBackend; + } + + @JsonProperty("delivery_state") + public Optional getDeliveryState() { + return deliveryState; + } + /** * @return The time the webhook was created, in epoch seconds */ @@ -114,13 +143,25 @@ private boolean equalTo(WebhookWithSigningKey other) { && url.equals(other.url) && signingKey.equals(other.signingKey) && signingKeySet == other.signingKeySet + && active.equals(other.active) + && deliveryBackend.equals(other.deliveryBackend) + && deliveryState.equals(other.deliveryState) && createdAt == other.createdAt && updatedAt == other.updatedAt; } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.url, this.signingKey, this.signingKeySet, this.createdAt, this.updatedAt); + return Objects.hash( + this.id, + this.url, + this.signingKey, + this.signingKeySet, + this.active, + this.deliveryBackend, + this.deliveryState, + this.createdAt, + this.updatedAt); } @java.lang.Override @@ -182,6 +223,18 @@ public interface _FinalStage { _FinalStage additionalProperty(String key, Object value); _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage active(Optional active); + + _FinalStage active(Boolean active); + + _FinalStage deliveryBackend(Optional deliveryBackend); + + _FinalStage deliveryBackend(WebhookWithSigningKeyDeliveryBackend deliveryBackend); + + _FinalStage deliveryState(Optional deliveryState); + + _FinalStage deliveryState(WebhookDeliveryState deliveryState); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -205,6 +258,12 @@ public static final class Builder private int updatedAt; + private Optional deliveryState = Optional.empty(); + + private Optional deliveryBackend = Optional.empty(); + + private Optional active = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -216,6 +275,9 @@ public Builder from(WebhookWithSigningKey other) { url(other.getUrl()); signingKey(other.getSigningKey()); signingKeySet(other.getSigningKeySet()); + active(other.getActive()); + deliveryBackend(other.getDeliveryBackend()); + deliveryState(other.getDeliveryState()); createdAt(other.getCreatedAt()); updatedAt(other.getUpdatedAt()); return this; @@ -293,10 +355,58 @@ public _FinalStage updatedAt(int updatedAt) { return this; } + @java.lang.Override + public _FinalStage deliveryState(WebhookDeliveryState deliveryState) { + this.deliveryState = Optional.ofNullable(deliveryState); + return this; + } + + @java.lang.Override + @JsonSetter(value = "delivery_state", nulls = Nulls.SKIP) + public _FinalStage deliveryState(Optional deliveryState) { + this.deliveryState = deliveryState; + return this; + } + + @java.lang.Override + public _FinalStage deliveryBackend(WebhookWithSigningKeyDeliveryBackend deliveryBackend) { + this.deliveryBackend = Optional.ofNullable(deliveryBackend); + return this; + } + + @java.lang.Override + @JsonSetter(value = "delivery_backend", nulls = Nulls.SKIP) + public _FinalStage deliveryBackend(Optional deliveryBackend) { + this.deliveryBackend = deliveryBackend; + return this; + } + + @java.lang.Override + public _FinalStage active(Boolean active) { + this.active = Optional.ofNullable(active); + return this; + } + + @java.lang.Override + @JsonSetter(value = "active", nulls = Nulls.SKIP) + public _FinalStage active(Optional active) { + this.active = active; + return this; + } + @java.lang.Override public WebhookWithSigningKey build() { return new WebhookWithSigningKey( - id, url, signingKey, signingKeySet, createdAt, updatedAt, additionalProperties); + id, + url, + signingKey, + signingKeySet, + active, + deliveryBackend, + deliveryState, + createdAt, + updatedAt, + additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/pipedream/api/types/WebhookWithSigningKeyDeliveryBackend.java b/src/main/java/com/pipedream/api/types/WebhookWithSigningKeyDeliveryBackend.java new file mode 100644 index 0000000..43b7d70 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/WebhookWithSigningKeyDeliveryBackend.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class WebhookWithSigningKeyDeliveryBackend { + public static final WebhookWithSigningKeyDeliveryBackend JVM = + new WebhookWithSigningKeyDeliveryBackend(Value.JVM, "jvm"); + + public static final WebhookWithSigningKeyDeliveryBackend VALKEY = + new WebhookWithSigningKeyDeliveryBackend(Value.VALKEY, "valkey"); + + private final Value value; + + private final String string; + + WebhookWithSigningKeyDeliveryBackend(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof WebhookWithSigningKeyDeliveryBackend + && this.string.equals(((WebhookWithSigningKeyDeliveryBackend) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case JVM: + return visitor.visitJvm(); + case VALKEY: + return visitor.visitValkey(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static WebhookWithSigningKeyDeliveryBackend valueOf(String value) { + switch (value) { + case "jvm": + return JVM; + case "valkey": + return VALKEY; + default: + return new WebhookWithSigningKeyDeliveryBackend(Value.UNKNOWN, value); + } + } + + public enum Value { + JVM, + + VALKEY, + + UNKNOWN + } + + public interface Visitor { + T visitJvm(); + + T visitValkey(); + + T visitUnknown(String unknownType); + } +}