Skip to content

Commit af79877

Browse files
feat: support for reconnecting accounts
Co-authored-by: fern-api[bot] <115122769+fern-api[bot]@users.noreply.github.com>
1 parent aff87e8 commit af79877

7 files changed

Lines changed: 122 additions & 13 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Add the dependency in your `build.gradle` file:
2828

2929
```groovy
3030
dependencies {
31-
implementation 'com.pipedream:pipedream:1.1.13'
31+
implementation 'com.pipedream:pipedream:1.1.14'
3232
}
3333
```
3434

@@ -40,7 +40,7 @@ Add the dependency in your `pom.xml` file:
4040
<dependency>
4141
<groupId>com.pipedream</groupId>
4242
<artifactId>pipedream</artifactId>
43-
<version>1.1.13</version>
43+
<version>1.1.14</version>
4444
</dependency>
4545
```
4646

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ java {
4949

5050
group = 'com.pipedream'
5151

52-
version = '1.1.13'
52+
version = '1.1.14'
5353

5454
jar {
5555
dependsOn(":generatePomFileForMavenPublication")
@@ -80,7 +80,7 @@ publishing {
8080
maven(MavenPublication) {
8181
groupId = 'com.pipedream'
8282
artifactId = 'pipedream'
83-
version = '1.1.13'
83+
version = '1.1.14'
8484
from components.java
8585
pom {
8686
name = 'pipedream'

src/main/java/com/pipedream/api/core/ClientOptions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ private ClientOptions(
3535
this.headers.putAll(headers);
3636
this.headers.putAll(new HashMap<String, String>() {
3737
{
38-
put("User-Agent", "com.pipedream:pipedream/1.1.13");
38+
put("User-Agent", "com.pipedream:pipedream/1.1.14");
3939
put("X-Fern-Language", "JAVA");
4040
put("X-Fern-SDK-Name", "com.pipedream.fern:api-sdk");
41-
put("X-Fern-SDK-Version", "1.1.13");
41+
put("X-Fern-SDK-Version", "1.1.14");
4242
}
4343
});
4444
this.headerSuppliers = headerSuppliers;

src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountOpts.java

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public final class CreateAccountOpts {
3333

3434
private final Optional<String> name;
3535

36+
private final Optional<String> accountId;
37+
3638
private final Map<String, Object> additionalProperties;
3739

3840
private CreateAccountOpts(
@@ -42,13 +44,15 @@ private CreateAccountOpts(
4244
String cfmapJson,
4345
String connectToken,
4446
Optional<String> name,
47+
Optional<String> accountId,
4548
Map<String, Object> additionalProperties) {
4649
this.externalUserId = externalUserId;
4750
this.oauthAppId = oauthAppId;
4851
this.appSlug = appSlug;
4952
this.cfmapJson = cfmapJson;
5053
this.connectToken = connectToken;
5154
this.name = name;
55+
this.accountId = accountId;
5256
this.additionalProperties = additionalProperties;
5357
}
5458

@@ -97,6 +101,14 @@ public Optional<String> getName() {
97101
return name;
98102
}
99103

104+
/**
105+
* @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.
106+
*/
107+
@JsonProperty("account_id")
108+
public Optional<String> getAccountId() {
109+
return accountId;
110+
}
111+
100112
@java.lang.Override
101113
public boolean equals(Object other) {
102114
if (this == other) return true;
@@ -114,13 +126,20 @@ private boolean equalTo(CreateAccountOpts other) {
114126
&& appSlug.equals(other.appSlug)
115127
&& cfmapJson.equals(other.cfmapJson)
116128
&& connectToken.equals(other.connectToken)
117-
&& name.equals(other.name);
129+
&& name.equals(other.name)
130+
&& accountId.equals(other.accountId);
118131
}
119132

120133
@java.lang.Override
121134
public int hashCode() {
122135
return Objects.hash(
123-
this.externalUserId, this.oauthAppId, this.appSlug, this.cfmapJson, this.connectToken, this.name);
136+
this.externalUserId,
137+
this.oauthAppId,
138+
this.appSlug,
139+
this.cfmapJson,
140+
this.connectToken,
141+
this.name,
142+
this.accountId);
124143
}
125144

126145
@java.lang.Override
@@ -175,6 +194,13 @@ public interface _FinalStage {
175194
_FinalStage name(Optional<String> name);
176195

177196
_FinalStage name(String name);
197+
198+
/**
199+
* <p>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.</p>
200+
*/
201+
_FinalStage accountId(Optional<String> accountId);
202+
203+
_FinalStage accountId(String accountId);
178204
}
179205

180206
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -185,6 +211,8 @@ public static final class Builder implements AppSlugStage, CfmapJsonStage, Conne
185211

186212
private String connectToken;
187213

214+
private Optional<String> accountId = Optional.empty();
215+
188216
private Optional<String> name = Optional.empty();
189217

190218
private Optional<String> oauthAppId = Optional.empty();
@@ -204,6 +232,7 @@ public Builder from(CreateAccountOpts other) {
204232
cfmapJson(other.getCfmapJson());
205233
connectToken(other.getConnectToken());
206234
name(other.getName());
235+
accountId(other.getAccountId());
207236
return this;
208237
}
209238

@@ -243,6 +272,26 @@ public _FinalStage connectToken(@NotNull String connectToken) {
243272
return this;
244273
}
245274

275+
/**
276+
* <p>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.</p>
277+
* @return Reference to {@code this} so that method calls can be chained together.
278+
*/
279+
@java.lang.Override
280+
public _FinalStage accountId(String accountId) {
281+
this.accountId = Optional.ofNullable(accountId);
282+
return this;
283+
}
284+
285+
/**
286+
* <p>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.</p>
287+
*/
288+
@java.lang.Override
289+
@JsonSetter(value = "account_id", nulls = Nulls.SKIP)
290+
public _FinalStage accountId(Optional<String> accountId) {
291+
this.accountId = accountId;
292+
return this;
293+
}
294+
246295
/**
247296
* <p>Optional name for the account</p>
248297
* @return Reference to {@code this} so that method calls can be chained together.
@@ -299,7 +348,14 @@ public _FinalStage externalUserId(Optional<String> externalUserId) {
299348
@java.lang.Override
300349
public CreateAccountOpts build() {
301350
return new CreateAccountOpts(
302-
externalUserId, oauthAppId, appSlug, cfmapJson, connectToken, name, additionalProperties);
351+
externalUserId,
352+
oauthAppId,
353+
appSlug,
354+
cfmapJson,
355+
connectToken,
356+
name,
357+
accountId,
358+
additionalProperties);
303359
}
304360
}
305361
}

src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ public CompletableFuture<BaseClientHttpResponse<ValidateTokenResponse>> validate
132132
.addPathSegment(ctok)
133133
.addPathSegments("validate");
134134
QueryStringMapper.addQueryParameter(httpUrl, "app_id", request.getAppId(), false);
135+
if (request.getAccountId().isPresent()) {
136+
QueryStringMapper.addQueryParameter(
137+
httpUrl, "account_id", request.getAccountId().get(), false);
138+
}
135139
if (request.getOauthAppId().isPresent()) {
136140
QueryStringMapper.addQueryParameter(
137141
httpUrl, "oauth_app_id", request.getOauthAppId().get(), false);

src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ public BaseClientHttpResponse<ValidateTokenResponse> validate(
112112
.addPathSegment(ctok)
113113
.addPathSegments("validate");
114114
QueryStringMapper.addQueryParameter(httpUrl, "app_id", request.getAppId(), false);
115+
if (request.getAccountId().isPresent()) {
116+
QueryStringMapper.addQueryParameter(
117+
httpUrl, "account_id", request.getAccountId().get(), false);
118+
}
115119
if (request.getOauthAppId().isPresent()) {
116120
QueryStringMapper.addQueryParameter(
117121
httpUrl, "oauth_app_id", request.getOauthAppId().get(), false);

src/main/java/com/pipedream/api/resources/tokens/requests/TokensValidateRequest.java

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,19 @@
2323
public final class TokensValidateRequest {
2424
private final String appId;
2525

26+
private final Optional<String> accountId;
27+
2628
private final Optional<String> oauthAppId;
2729

2830
private final Map<String, Object> additionalProperties;
2931

30-
private TokensValidateRequest(String appId, Optional<String> oauthAppId, Map<String, Object> additionalProperties) {
32+
private TokensValidateRequest(
33+
String appId,
34+
Optional<String> accountId,
35+
Optional<String> oauthAppId,
36+
Map<String, Object> additionalProperties) {
3137
this.appId = appId;
38+
this.accountId = accountId;
3239
this.oauthAppId = oauthAppId;
3340
this.additionalProperties = additionalProperties;
3441
}
@@ -41,6 +48,14 @@ public String getAppId() {
4148
return appId;
4249
}
4350

51+
/**
52+
* @return An existing account ID to reconnect. Must belong to the app identified by app_id.
53+
*/
54+
@JsonProperty("account_id")
55+
public Optional<String> getAccountId() {
56+
return accountId;
57+
}
58+
4459
/**
4560
* @return The OAuth app ID to validate against (if the token is for an OAuth app)
4661
*/
@@ -61,12 +76,12 @@ public Map<String, Object> getAdditionalProperties() {
6176
}
6277

6378
private boolean equalTo(TokensValidateRequest other) {
64-
return appId.equals(other.appId) && oauthAppId.equals(other.oauthAppId);
79+
return appId.equals(other.appId) && accountId.equals(other.accountId) && oauthAppId.equals(other.oauthAppId);
6580
}
6681

6782
@java.lang.Override
6883
public int hashCode() {
69-
return Objects.hash(this.appId, this.oauthAppId);
84+
return Objects.hash(this.appId, this.accountId, this.oauthAppId);
7085
}
7186

7287
@java.lang.Override
@@ -90,6 +105,13 @@ public interface AppIdStage {
90105
public interface _FinalStage {
91106
TokensValidateRequest build();
92107

108+
/**
109+
* <p>An existing account ID to reconnect. Must belong to the app identified by app_id.</p>
110+
*/
111+
_FinalStage accountId(Optional<String> accountId);
112+
113+
_FinalStage accountId(String accountId);
114+
93115
/**
94116
* <p>The OAuth app ID to validate against (if the token is for an OAuth app)</p>
95117
*/
@@ -104,6 +126,8 @@ public static final class Builder implements AppIdStage, _FinalStage {
104126

105127
private Optional<String> oauthAppId = Optional.empty();
106128

129+
private Optional<String> accountId = Optional.empty();
130+
107131
@JsonAnySetter
108132
private Map<String, Object> additionalProperties = new HashMap<>();
109133

@@ -112,6 +136,7 @@ private Builder() {}
112136
@java.lang.Override
113137
public Builder from(TokensValidateRequest other) {
114138
appId(other.getAppId());
139+
accountId(other.getAccountId());
115140
oauthAppId(other.getOauthAppId());
116141
return this;
117142
}
@@ -148,9 +173,29 @@ public _FinalStage oauthAppId(Optional<String> oauthAppId) {
148173
return this;
149174
}
150175

176+
/**
177+
* <p>An existing account ID to reconnect. Must belong to the app identified by app_id.</p>
178+
* @return Reference to {@code this} so that method calls can be chained together.
179+
*/
180+
@java.lang.Override
181+
public _FinalStage accountId(String accountId) {
182+
this.accountId = Optional.ofNullable(accountId);
183+
return this;
184+
}
185+
186+
/**
187+
* <p>An existing account ID to reconnect. Must belong to the app identified by app_id.</p>
188+
*/
189+
@java.lang.Override
190+
@JsonSetter(value = "account_id", nulls = Nulls.SKIP)
191+
public _FinalStage accountId(Optional<String> accountId) {
192+
this.accountId = accountId;
193+
return this;
194+
}
195+
151196
@java.lang.Override
152197
public TokensValidateRequest build() {
153-
return new TokensValidateRequest(appId, oauthAppId, additionalProperties);
198+
return new TokensValidateRequest(appId, accountId, oauthAppId, additionalProperties);
154199
}
155200
}
156201
}

0 commit comments

Comments
 (0)