diff --git a/README.md b/README.md index cfa97c3..b7948a4 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Add the dependency in your `build.gradle` file: ```groovy dependencies { - implementation 'com.pipedream:pipedream:1.1.13' + implementation 'com.pipedream:pipedream:1.1.14' } ``` @@ -40,7 +40,7 @@ Add the dependency in your `pom.xml` file: com.pipedream pipedream - 1.1.13 + 1.1.14 ``` diff --git a/build.gradle b/build.gradle index 566b8cf..3abae1e 100644 --- a/build.gradle +++ b/build.gradle @@ -49,7 +49,7 @@ java { group = 'com.pipedream' -version = '1.1.13' +version = '1.1.14' jar { dependsOn(":generatePomFileForMavenPublication") @@ -80,7 +80,7 @@ publishing { maven(MavenPublication) { groupId = 'com.pipedream' artifactId = 'pipedream' - version = '1.1.13' + version = '1.1.14' 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 f9585df..07641d0 100644 --- a/src/main/java/com/pipedream/api/core/ClientOptions.java +++ b/src/main/java/com/pipedream/api/core/ClientOptions.java @@ -35,10 +35,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.pipedream:pipedream/1.1.13"); + put("User-Agent", "com.pipedream:pipedream/1.1.14"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.pipedream.fern:api-sdk"); - put("X-Fern-SDK-Version", "1.1.13"); + put("X-Fern-SDK-Version", "1.1.14"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountOpts.java b/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountOpts.java index d168d25..65bb755 100644 --- a/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountOpts.java +++ b/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountOpts.java @@ -33,6 +33,8 @@ public final class CreateAccountOpts { private final Optional name; + private final Optional accountId; + private final Map additionalProperties; private CreateAccountOpts( @@ -42,6 +44,7 @@ private CreateAccountOpts( String cfmapJson, String connectToken, Optional name, + Optional accountId, Map additionalProperties) { this.externalUserId = externalUserId; this.oauthAppId = oauthAppId; @@ -49,6 +52,7 @@ private CreateAccountOpts( this.cfmapJson = cfmapJson; this.connectToken = connectToken; this.name = name; + this.accountId = accountId; this.additionalProperties = additionalProperties; } @@ -97,6 +101,14 @@ public Optional getName() { return name; } + /** + * @return An existing account ID to reconnect. When provided, the account's credentials are updated instead of creating a new account. Must belong to the same external user and project environment as the connect token, and match the app identified by app_slug. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -114,13 +126,20 @@ private boolean equalTo(CreateAccountOpts other) { && appSlug.equals(other.appSlug) && cfmapJson.equals(other.cfmapJson) && connectToken.equals(other.connectToken) - && name.equals(other.name); + && name.equals(other.name) + && accountId.equals(other.accountId); } @java.lang.Override public int hashCode() { return Objects.hash( - this.externalUserId, this.oauthAppId, this.appSlug, this.cfmapJson, this.connectToken, this.name); + this.externalUserId, + this.oauthAppId, + this.appSlug, + this.cfmapJson, + this.connectToken, + this.name, + this.accountId); } @java.lang.Override @@ -175,6 +194,13 @@ public interface _FinalStage { _FinalStage name(Optional name); _FinalStage name(String name); + + /** + *

An existing account ID to reconnect. When provided, the account's credentials are updated instead of creating a new account. Must belong to the same external user and project environment as the connect token, and match the app identified by app_slug.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -185,6 +211,8 @@ public static final class Builder implements AppSlugStage, CfmapJsonStage, Conne private String connectToken; + private Optional accountId = Optional.empty(); + private Optional name = Optional.empty(); private Optional oauthAppId = Optional.empty(); @@ -204,6 +232,7 @@ public Builder from(CreateAccountOpts other) { cfmapJson(other.getCfmapJson()); connectToken(other.getConnectToken()); name(other.getName()); + accountId(other.getAccountId()); return this; } @@ -243,6 +272,26 @@ public _FinalStage connectToken(@NotNull String connectToken) { return this; } + /** + *

An existing account ID to reconnect. When provided, the account's credentials are updated instead of creating a new account. Must belong to the same external user and project environment as the connect token, and match the app identified by app_slug.

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

An existing account ID to reconnect. When provided, the account's credentials are updated instead of creating a new account. Must belong to the same external user and project environment as the connect token, and match the app identified by app_slug.

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

Optional name for the account

* @return Reference to {@code this} so that method calls can be chained together. @@ -299,7 +348,14 @@ public _FinalStage externalUserId(Optional externalUserId) { @java.lang.Override public CreateAccountOpts build() { return new CreateAccountOpts( - externalUserId, oauthAppId, appSlug, cfmapJson, connectToken, name, additionalProperties); + externalUserId, + oauthAppId, + appSlug, + cfmapJson, + connectToken, + name, + accountId, + additionalProperties); } } } diff --git a/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java b/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java index 5ab836b..9d3c5c0 100644 --- a/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java +++ b/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java @@ -132,6 +132,10 @@ public CompletableFuture> validate .addPathSegment(ctok) .addPathSegments("validate"); QueryStringMapper.addQueryParameter(httpUrl, "app_id", request.getAppId(), false); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } if (request.getOauthAppId().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "oauth_app_id", request.getOauthAppId().get(), false); diff --git a/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java b/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java index f9414f5..82755a0 100644 --- a/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java +++ b/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java @@ -112,6 +112,10 @@ public BaseClientHttpResponse validate( .addPathSegment(ctok) .addPathSegments("validate"); QueryStringMapper.addQueryParameter(httpUrl, "app_id", request.getAppId(), false); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } if (request.getOauthAppId().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "oauth_app_id", request.getOauthAppId().get(), false); diff --git a/src/main/java/com/pipedream/api/resources/tokens/requests/TokensValidateRequest.java b/src/main/java/com/pipedream/api/resources/tokens/requests/TokensValidateRequest.java index dd18fed..db3617e 100644 --- a/src/main/java/com/pipedream/api/resources/tokens/requests/TokensValidateRequest.java +++ b/src/main/java/com/pipedream/api/resources/tokens/requests/TokensValidateRequest.java @@ -23,12 +23,19 @@ public final class TokensValidateRequest { private final String appId; + private final Optional accountId; + private final Optional oauthAppId; private final Map additionalProperties; - private TokensValidateRequest(String appId, Optional oauthAppId, Map additionalProperties) { + private TokensValidateRequest( + String appId, + Optional accountId, + Optional oauthAppId, + Map additionalProperties) { this.appId = appId; + this.accountId = accountId; this.oauthAppId = oauthAppId; this.additionalProperties = additionalProperties; } @@ -41,6 +48,14 @@ public String getAppId() { return appId; } + /** + * @return An existing account ID to reconnect. Must belong to the app identified by app_id. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + /** * @return The OAuth app ID to validate against (if the token is for an OAuth app) */ @@ -61,12 +76,12 @@ public Map getAdditionalProperties() { } private boolean equalTo(TokensValidateRequest other) { - return appId.equals(other.appId) && oauthAppId.equals(other.oauthAppId); + return appId.equals(other.appId) && accountId.equals(other.accountId) && oauthAppId.equals(other.oauthAppId); } @java.lang.Override public int hashCode() { - return Objects.hash(this.appId, this.oauthAppId); + return Objects.hash(this.appId, this.accountId, this.oauthAppId); } @java.lang.Override @@ -90,6 +105,13 @@ public interface AppIdStage { public interface _FinalStage { TokensValidateRequest build(); + /** + *

An existing account ID to reconnect. Must belong to the app identified by app_id.

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

The OAuth app ID to validate against (if the token is for an OAuth app)

*/ @@ -104,6 +126,8 @@ public static final class Builder implements AppIdStage, _FinalStage { private Optional oauthAppId = Optional.empty(); + private Optional accountId = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -112,6 +136,7 @@ private Builder() {} @java.lang.Override public Builder from(TokensValidateRequest other) { appId(other.getAppId()); + accountId(other.getAccountId()); oauthAppId(other.getOauthAppId()); return this; } @@ -148,9 +173,29 @@ public _FinalStage oauthAppId(Optional oauthAppId) { return this; } + /** + *

An existing account ID to reconnect. Must belong to the app identified by app_id.

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

An existing account ID to reconnect. Must belong to the app identified by app_id.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + @java.lang.Override public TokensValidateRequest build() { - return new TokensValidateRequest(appId, oauthAppId, additionalProperties); + return new TokensValidateRequest(appId, accountId, oauthAppId, additionalProperties); } } }