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);
}
}
}