Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
],
"retry-status-codes": "legacy"
},
"originGitCommit": "b399bbbdcc0ed7ed414d0fcc795c5c6b6dea46eb",
"originGitCommit": "267ec323a4305eba2c41bd93e26686a26e329107",
"originGitCommitIsDirty": false,
"invokedBy": "ci",
"ciProvider": "github",
"sdkVersion": "2.0.1"
"sdkVersion": "2.0.2"
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Add the dependency in your `build.gradle` file:

```groovy
dependencies {
implementation 'com.pipedream:pipedream:2.0.1'
implementation 'com.pipedream:pipedream:2.0.2'
}
```

Expand All @@ -42,7 +42,7 @@ Add the dependency in your `pom.xml` file:
<dependency>
<groupId>com.pipedream</groupId>
<artifactId>pipedream</artifactId>
<version>2.0.1</version>
<version>2.0.2</version>
</dependency>
```

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ java {

group = 'com.pipedream'

version = '2.0.1'
version = '2.0.2'

jar {
dependsOn(":generatePomFileForMavenPublication")
Expand Down Expand Up @@ -79,7 +79,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.pipedream'
artifactId = 'pipedream'
version = '2.0.1'
version = '2.0.2'
from components.java
pom {
name = 'pipedream'
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/pipedream/api/core/ClientOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ private ClientOptions(
this.headers.putAll(headers);
this.headers.putAll(new HashMap<String, String>() {
{
put("User-Agent", "com.pipedream:pipedream/2.0.1");
put("User-Agent", "com.pipedream:pipedream/2.0.2");
put("X-Fern-Language", "JAVA");
put("X-Fern-SDK-Name", "com.pipedream.fern:api-sdk");
put("X-Fern-SDK-Version", "2.0.1");
put("X-Fern-SDK-Version", "2.0.2");
}
});
this.headerSuppliers = headerSuppliers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import com.pipedream.api.core.ClientOptions;
import com.pipedream.api.core.RequestOptions;
import com.pipedream.api.core.pagination.SyncPagingIterable;
import com.pipedream.api.resources.accounts.requests.AccountsListByExternalUserRequest;
import com.pipedream.api.resources.accounts.requests.AccountsListRequest;
import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest;
import com.pipedream.api.resources.accounts.requests.CreateAccountOpts;
import com.pipedream.api.types.Account;
import java.util.List;

public class AccountsClient {
protected final ClientOptions clientOptions;
Expand Down Expand Up @@ -125,4 +127,35 @@ public void deleteByApp(String appId) {
public void deleteByApp(String appId, RequestOptions requestOptions) {
this.rawClient.deleteByApp(appId, requestOptions).body();
}

/**
* List all connected accounts for a specific external user. Equivalent to GET /accounts with external_user_id filter but uses path-based routing.
*/
public List<Account> listByExternalUser(String externalUserId) {
return this.rawClient.listByExternalUser(externalUserId).body();
}

/**
* List all connected accounts for a specific external user. Equivalent to GET /accounts with external_user_id filter but uses path-based routing.
*/
public List<Account> listByExternalUser(String externalUserId, RequestOptions requestOptions) {
return this.rawClient.listByExternalUser(externalUserId, requestOptions).body();
}

/**
* List all connected accounts for a specific external user. Equivalent to GET /accounts with external_user_id filter but uses path-based routing.
*/
public List<Account> listByExternalUser(String externalUserId, AccountsListByExternalUserRequest request) {
return this.rawClient.listByExternalUser(externalUserId, request).body();
}

/**
* List all connected accounts for a specific external user. Equivalent to GET /accounts with external_user_id filter but uses path-based routing.
*/
public List<Account> listByExternalUser(
String externalUserId, AccountsListByExternalUserRequest request, RequestOptions requestOptions) {
return this.rawClient
.listByExternalUser(externalUserId, request, requestOptions)
.body();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import com.pipedream.api.core.ClientOptions;
import com.pipedream.api.core.RequestOptions;
import com.pipedream.api.core.pagination.SyncPagingIterable;
import com.pipedream.api.resources.accounts.requests.AccountsListByExternalUserRequest;
import com.pipedream.api.resources.accounts.requests.AccountsListRequest;
import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest;
import com.pipedream.api.resources.accounts.requests.CreateAccountOpts;
import com.pipedream.api.types.Account;
import java.util.List;
import java.util.concurrent.CompletableFuture;

public class AsyncAccountsClient {
Expand Down Expand Up @@ -128,4 +130,36 @@ public CompletableFuture<Void> deleteByApp(String appId) {
public CompletableFuture<Void> deleteByApp(String appId, RequestOptions requestOptions) {
return this.rawClient.deleteByApp(appId, requestOptions).thenApply(response -> response.body());
}

/**
* List all connected accounts for a specific external user. Equivalent to GET /accounts with external_user_id filter but uses path-based routing.
*/
public CompletableFuture<List<Account>> listByExternalUser(String externalUserId) {
return this.rawClient.listByExternalUser(externalUserId).thenApply(response -> response.body());
}

/**
* List all connected accounts for a specific external user. Equivalent to GET /accounts with external_user_id filter but uses path-based routing.
*/
public CompletableFuture<List<Account>> listByExternalUser(String externalUserId, RequestOptions requestOptions) {
return this.rawClient.listByExternalUser(externalUserId, requestOptions).thenApply(response -> response.body());
}

/**
* List all connected accounts for a specific external user. Equivalent to GET /accounts with external_user_id filter but uses path-based routing.
*/
public CompletableFuture<List<Account>> listByExternalUser(
String externalUserId, AccountsListByExternalUserRequest request) {
return this.rawClient.listByExternalUser(externalUserId, request).thenApply(response -> response.body());
}

/**
* List all connected accounts for a specific external user. Equivalent to GET /accounts with external_user_id filter but uses path-based routing.
*/
public CompletableFuture<List<Account>> listByExternalUser(
String externalUserId, AccountsListByExternalUserRequest request, RequestOptions requestOptions) {
return this.rawClient
.listByExternalUser(externalUserId, request, requestOptions)
.thenApply(response -> response.body());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package com.pipedream.api.resources.accounts;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.pipedream.api.core.BaseClientApiException;
import com.pipedream.api.core.BaseClientException;
import com.pipedream.api.core.BaseClientHttpResponse;
Expand All @@ -14,6 +15,7 @@
import com.pipedream.api.core.RequestOptions;
import com.pipedream.api.core.pagination.SyncPagingIterable;
import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.resources.accounts.requests.AccountsListByExternalUserRequest;
import com.pipedream.api.resources.accounts.requests.AccountsListRequest;
import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest;
import com.pipedream.api.resources.accounts.requests.CreateAccountOpts;
Expand Down Expand Up @@ -488,4 +490,105 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
});
return future;
}

/**
* List all connected accounts for a specific external user. Equivalent to GET /accounts with external_user_id filter but uses path-based routing.
*/
public CompletableFuture<BaseClientHttpResponse<List<Account>>> listByExternalUser(String externalUserId) {
return listByExternalUser(
externalUserId, AccountsListByExternalUserRequest.builder().build());
}

/**
* List all connected accounts for a specific external user. Equivalent to GET /accounts with external_user_id filter but uses path-based routing.
*/
public CompletableFuture<BaseClientHttpResponse<List<Account>>> listByExternalUser(
String externalUserId, RequestOptions requestOptions) {
return listByExternalUser(
externalUserId, AccountsListByExternalUserRequest.builder().build(), requestOptions);
}

/**
* List all connected accounts for a specific external user. Equivalent to GET /accounts with external_user_id filter but uses path-based routing.
*/
public CompletableFuture<BaseClientHttpResponse<List<Account>>> listByExternalUser(
String externalUserId, AccountsListByExternalUserRequest request) {
return listByExternalUser(externalUserId, request, null);
}

/**
* List all connected accounts for a specific external user. Equivalent to GET /accounts with external_user_id filter but uses path-based routing.
*/
public CompletableFuture<BaseClientHttpResponse<List<Account>>> listByExternalUser(
String externalUserId, AccountsListByExternalUserRequest request, RequestOptions requestOptions) {
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
.addPathSegments("users")
.addPathSegment(externalUserId)
.addPathSegments("accounts");
if (request.getIncludeCredentials().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl,
"include_credentials",
request.getIncludeCredentials().get(),
false);
}
if (request.getApp().isPresent()) {
QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false);
}
if (requestOptions != null) {
requestOptions.getQueryParameters().forEach((_key, _value) -> {
httpUrl.addQueryParameter(_key, _value);
});
}
Request.Builder _requestBuilder = new Request.Builder()
.url(httpUrl.build())
.method("GET", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json");
Request okhttpRequest = _requestBuilder.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<BaseClientHttpResponse<List<Account>>> 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, new TypeReference<List<Account>>() {}),
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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package com.pipedream.api.resources.accounts;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.pipedream.api.core.BaseClientApiException;
import com.pipedream.api.core.BaseClientException;
import com.pipedream.api.core.BaseClientHttpResponse;
Expand All @@ -14,6 +15,7 @@
import com.pipedream.api.core.RequestOptions;
import com.pipedream.api.core.pagination.SyncPagingIterable;
import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.resources.accounts.requests.AccountsListByExternalUserRequest;
import com.pipedream.api.resources.accounts.requests.AccountsListRequest;
import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest;
import com.pipedream.api.resources.accounts.requests.CreateAccountOpts;
Expand Down Expand Up @@ -402,4 +404,90 @@ public BaseClientHttpResponse<Void> deleteByApp(String appId, RequestOptions req
throw new BaseClientException("Network error executing HTTP request", e);
}
}

/**
* List all connected accounts for a specific external user. Equivalent to GET /accounts with external_user_id filter but uses path-based routing.
*/
public BaseClientHttpResponse<List<Account>> listByExternalUser(String externalUserId) {
return listByExternalUser(
externalUserId, AccountsListByExternalUserRequest.builder().build());
}

/**
* List all connected accounts for a specific external user. Equivalent to GET /accounts with external_user_id filter but uses path-based routing.
*/
public BaseClientHttpResponse<List<Account>> listByExternalUser(
String externalUserId, RequestOptions requestOptions) {
return listByExternalUser(
externalUserId, AccountsListByExternalUserRequest.builder().build(), requestOptions);
}

/**
* List all connected accounts for a specific external user. Equivalent to GET /accounts with external_user_id filter but uses path-based routing.
*/
public BaseClientHttpResponse<List<Account>> listByExternalUser(
String externalUserId, AccountsListByExternalUserRequest request) {
return listByExternalUser(externalUserId, request, null);
}

/**
* List all connected accounts for a specific external user. Equivalent to GET /accounts with external_user_id filter but uses path-based routing.
*/
public BaseClientHttpResponse<List<Account>> listByExternalUser(
String externalUserId, AccountsListByExternalUserRequest request, RequestOptions requestOptions) {
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
.addPathSegments("users")
.addPathSegment(externalUserId)
.addPathSegments("accounts");
if (request.getIncludeCredentials().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl,
"include_credentials",
request.getIncludeCredentials().get(),
false);
}
if (request.getApp().isPresent()) {
QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false);
}
if (requestOptions != null) {
requestOptions.getQueryParameters().forEach((_key, _value) -> {
httpUrl.addQueryParameter(_key, _value);
});
}
Request.Builder _requestBuilder = new Request.Builder()
.url(httpUrl.build())
.method("GET", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json");
Request okhttpRequest = _requestBuilder.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
if (response.isSuccessful()) {
return new BaseClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, new TypeReference<List<Account>>() {}),
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);
}
}
}
Loading
Loading