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/actions/ActionsClient.java b/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java
index 18b750a..819dbed 100644
--- a/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java
+++ b/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java
@@ -40,6 +40,13 @@ public SyncPagingIterable list() {
return this.rawClient.list().body();
}
+ /**
+ * Retrieve available actions with optional search and app filtering
+ */
+ public SyncPagingIterable list(RequestOptions requestOptions) {
+ return this.rawClient.list(requestOptions).body();
+ }
+
/**
* Retrieve available actions with optional search and app filtering
*/
@@ -61,6 +68,13 @@ public Component retrieve(String componentId) {
return this.rawClient.retrieve(componentId).body();
}
+ /**
+ * Get detailed configuration for a specific action by its key
+ */
+ public Component retrieve(String componentId, RequestOptions requestOptions) {
+ return this.rawClient.retrieve(componentId, requestOptions).body();
+ }
+
/**
* Get detailed configuration for a specific action by its key
*/
diff --git a/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java b/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java
index 442f0b5..6f74724 100644
--- a/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java
+++ b/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java
@@ -41,6 +41,13 @@ public CompletableFuture> list() {
return this.rawClient.list().thenApply(response -> response.body());
}
+ /**
+ * Retrieve available actions with optional search and app filtering
+ */
+ public CompletableFuture> list(RequestOptions requestOptions) {
+ return this.rawClient.list(requestOptions).thenApply(response -> response.body());
+ }
+
/**
* Retrieve available actions with optional search and app filtering
*/
@@ -63,6 +70,13 @@ public CompletableFuture retrieve(String componentId) {
return this.rawClient.retrieve(componentId).thenApply(response -> response.body());
}
+ /**
+ * Get detailed configuration for a specific action by its key
+ */
+ public CompletableFuture retrieve(String componentId, RequestOptions requestOptions) {
+ return this.rawClient.retrieve(componentId, requestOptions).thenApply(response -> response.body());
+ }
+
/**
* Get detailed configuration for a specific action by its key
*/
diff --git a/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java b/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java
index db2d6db..4bcfac0 100644
--- a/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java
+++ b/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java
@@ -56,6 +56,14 @@ public CompletableFuture>>
return list(ActionsListRequest.builder().build());
}
+ /**
+ * Retrieve available actions with optional search and app filtering
+ */
+ public CompletableFuture>> list(
+ RequestOptions requestOptions) {
+ return list(ActionsListRequest.builder().build(), requestOptions);
+ }
+
/**
* Retrieve available actions with optional search and app filtering
*/
@@ -110,9 +118,10 @@ public CompletableFuture>>
@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()) {
GetComponentsResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentsResponse.class);
Optional startingAfter =
parsedResponse.getPageInfo().getEndCursor();
ActionsListRequest nextRequest = ActionsListRequest.builder()
@@ -134,7 +143,6 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
@@ -151,11 +159,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -177,6 +183,14 @@ public CompletableFuture> retrieve(String comp
return retrieve(componentId, ActionsRetrieveRequest.builder().build());
}
+ /**
+ * Get detailed configuration for a specific action by its key
+ */
+ public CompletableFuture> retrieve(
+ String componentId, RequestOptions requestOptions) {
+ return retrieve(componentId, ActionsRetrieveRequest.builder().build(), requestOptions);
+ }
+
/**
* Get detailed configuration for a specific action by its key
*/
@@ -215,13 +229,13 @@ public CompletableFuture> retrieve(
@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()) {
GetComponentResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentResponse.class);
future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -231,11 +245,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -266,7 +278,8 @@ public CompletableFuture> configur
.newBuilder()
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
- .addPathSegments("actions/configure")
+ .addPathSegments("actions")
+ .addPathSegments("configure")
.build();
RequestBody body;
try {
@@ -291,13 +304,13 @@ public CompletableFuture> configur
@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(responseBody.string(), ConfigurePropResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ConfigurePropResponse.class),
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -307,11 +320,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -342,7 +353,8 @@ public CompletableFuture> reloadProp
.newBuilder()
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
- .addPathSegments("actions/props")
+ .addPathSegments("actions")
+ .addPathSegments("props")
.build();
RequestBody body;
try {
@@ -367,13 +379,13 @@ public CompletableFuture> reloadProp
@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(responseBody.string(), ReloadPropsResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ReloadPropsResponse.class),
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -383,11 +395,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -418,7 +428,8 @@ public CompletableFuture> run(
.newBuilder()
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
- .addPathSegments("actions/run")
+ .addPathSegments("actions")
+ .addPathSegments("run")
.build();
RequestBody body;
try {
@@ -443,13 +454,13 @@ public CompletableFuture> run(
@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(responseBody.string(), RunActionResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RunActionResponse.class),
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -459,11 +470,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java b/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java
index 902614e..6058980 100644
--- a/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java
+++ b/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java
@@ -51,6 +51,13 @@ public BaseClientHttpResponse> list() {
return list(ActionsListRequest.builder().build());
}
+ /**
+ * Retrieve available actions with optional search and app filtering
+ */
+ public BaseClientHttpResponse> list(RequestOptions requestOptions) {
+ return list(ActionsListRequest.builder().build(), requestOptions);
+ }
+
/**
* Retrieve available actions with optional search and app filtering
*/
@@ -102,9 +109,10 @@ public BaseClientHttpResponse> list(
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
if (response.isSuccessful()) {
GetComponentsResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentsResponse.class);
Optional startingAfter = parsedResponse.getPageInfo().getEndCursor();
ActionsListRequest nextRequest = ActionsListRequest.builder()
.from(request)
@@ -117,7 +125,6 @@ public BaseClientHttpResponse> list(
.body()),
response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
@@ -130,11 +137,9 @@ public BaseClientHttpResponse> list(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -147,6 +152,13 @@ public BaseClientHttpResponse retrieve(String componentId) {
return retrieve(componentId, ActionsRetrieveRequest.builder().build());
}
+ /**
+ * Get detailed configuration for a specific action by its key
+ */
+ public BaseClientHttpResponse retrieve(String componentId, RequestOptions requestOptions) {
+ return retrieve(componentId, ActionsRetrieveRequest.builder().build(), requestOptions);
+ }
+
/**
* Get detailed configuration for a specific action by its key
*/
@@ -181,12 +193,12 @@ public BaseClientHttpResponse retrieve(
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
if (response.isSuccessful()) {
GetComponentResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentResponse.class);
return new BaseClientHttpResponse<>(parsedResponse.getData(), response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -195,11 +207,9 @@ public BaseClientHttpResponse retrieve(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -221,7 +231,8 @@ public BaseClientHttpResponse configureProp(
.newBuilder()
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
- .addPathSegments("actions/configure")
+ .addPathSegments("actions")
+ .addPathSegments("configure")
.build();
RequestBody body;
try {
@@ -243,12 +254,11 @@ public BaseClientHttpResponse configureProp(
}
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(responseBody.string(), ConfigurePropResponse.class),
- response);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ConfigurePropResponse.class), response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -257,11 +267,9 @@ public BaseClientHttpResponse configureProp(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -283,7 +291,8 @@ public BaseClientHttpResponse reloadProps(
.newBuilder()
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
- .addPathSegments("actions/props")
+ .addPathSegments("actions")
+ .addPathSegments("props")
.build();
RequestBody body;
try {
@@ -305,12 +314,11 @@ public BaseClientHttpResponse reloadProps(
}
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(responseBody.string(), ReloadPropsResponse.class),
- response);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ReloadPropsResponse.class), response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -319,11 +327,9 @@ public BaseClientHttpResponse reloadProps(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -344,7 +350,8 @@ public BaseClientHttpResponse run(RunActionOpts request, Requ
.newBuilder()
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
- .addPathSegments("actions/run")
+ .addPathSegments("actions")
+ .addPathSegments("run")
.build();
RequestBody body;
try {
@@ -366,11 +373,11 @@ public BaseClientHttpResponse run(RunActionOpts request, Requ
}
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(responseBody.string(), RunActionResponse.class), response);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RunActionResponse.class), response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -379,11 +386,9 @@ public BaseClientHttpResponse run(RunActionOpts request, Requ
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
diff --git a/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java b/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java
index ea828f1..a8e5d04 100644
--- a/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java
+++ b/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java
@@ -61,19 +61,17 @@ public CompletableFuture>> list(Request
@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(
- responseBody.string(), new TypeReference>() {}),
+ responseBodyString, new TypeReference>() {}),
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
future.completeExceptionally(new BaseClientApiException(
- "Error with status code " + response.code(),
- response.code(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -119,18 +117,15 @@ public CompletableFuture> retrieve(String id
@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(responseBody.string(), AppCategory.class),
- response));
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AppCategory.class), response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
future.completeExceptionally(new BaseClientApiException(
- "Error with status code " + response.code(),
- response.code(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java b/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java
index 401fd49..4a40980 100644
--- a/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java
+++ b/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java
@@ -54,18 +54,16 @@ public BaseClientHttpResponse> list(RequestOptions requestOpti
}
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(
- responseBody.string(), new TypeReference>() {}),
+ responseBodyString, new TypeReference>() {}),
response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
throw new BaseClientApiException(
- "Error with status code " + response.code(),
- response.code(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -99,16 +97,14 @@ public BaseClientHttpResponse retrieve(String id, RequestOptions re
}
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(responseBody.string(), AppCategory.class), response);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AppCategory.class), response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
throw new BaseClientApiException(
- "Error with status code " + response.code(),
- response.code(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
diff --git a/src/main/java/com/pipedream/api/resources/apps/AppsClient.java b/src/main/java/com/pipedream/api/resources/apps/AppsClient.java
index 5e5fa6a..bae9766 100644
--- a/src/main/java/com/pipedream/api/resources/apps/AppsClient.java
+++ b/src/main/java/com/pipedream/api/resources/apps/AppsClient.java
@@ -34,6 +34,13 @@ public SyncPagingIterable list() {
return this.rawClient.list().body();
}
+ /**
+ * Retrieve all available apps with optional filtering and sorting
+ */
+ public SyncPagingIterable list(RequestOptions requestOptions) {
+ return this.rawClient.list(requestOptions).body();
+ }
+
/**
* Retrieve all available apps with optional filtering and sorting
*/
diff --git a/src/main/java/com/pipedream/api/resources/apps/AsyncAppsClient.java b/src/main/java/com/pipedream/api/resources/apps/AsyncAppsClient.java
index a573411..65257a4 100644
--- a/src/main/java/com/pipedream/api/resources/apps/AsyncAppsClient.java
+++ b/src/main/java/com/pipedream/api/resources/apps/AsyncAppsClient.java
@@ -35,6 +35,13 @@ public CompletableFuture> list() {
return this.rawClient.list().thenApply(response -> response.body());
}
+ /**
+ * Retrieve all available apps with optional filtering and sorting
+ */
+ public CompletableFuture> list(RequestOptions requestOptions) {
+ return this.rawClient.list(requestOptions).thenApply(response -> response.body());
+ }
+
/**
* Retrieve all available apps with optional filtering and sorting
*/
diff --git a/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java b/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java
index 63900eb..8daebda 100644
--- a/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java
+++ b/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java
@@ -44,6 +44,13 @@ public CompletableFuture>> list()
return list(AppsListRequest.builder().build());
}
+ /**
+ * Retrieve all available apps with optional filtering and sorting
+ */
+ public CompletableFuture>> list(RequestOptions requestOptions) {
+ return list(AppsListRequest.builder().build(), requestOptions);
+ }
+
/**
* Retrieve all available apps with optional filtering and sorting
*/
@@ -113,9 +120,10 @@ public CompletableFuture>> list(
@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()) {
ListAppsResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAppsResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAppsResponse.class);
Optional startingAfter =
parsedResponse.getPageInfo().getEndCursor();
AppsListRequest nextRequest = AppsListRequest.builder()
@@ -136,12 +144,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
future.completeExceptionally(new BaseClientApiException(
- "Error with status code " + response.code(),
- response.code(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -188,18 +193,16 @@ public CompletableFuture> retrieve(
@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(responseBody.string(), GetAppResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetAppResponse.class),
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
future.completeExceptionally(new BaseClientApiException(
- "Error with status code " + response.code(),
- response.code(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java b/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java
index 403f724..5fe46dc 100644
--- a/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java
+++ b/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java
@@ -39,6 +39,13 @@ public BaseClientHttpResponse> list() {
return list(AppsListRequest.builder().build());
}
+ /**
+ * Retrieve all available apps with optional filtering and sorting
+ */
+ public BaseClientHttpResponse> list(RequestOptions requestOptions) {
+ return list(AppsListRequest.builder().build(), requestOptions);
+ }
+
/**
* Retrieve all available apps with optional filtering and sorting
*/
@@ -105,9 +112,10 @@ public BaseClientHttpResponse> list(
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
if (response.isSuccessful()) {
ListAppsResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAppsResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAppsResponse.class);
Optional startingAfter = parsedResponse.getPageInfo().getEndCursor();
AppsListRequest nextRequest = AppsListRequest.builder()
.from(request)
@@ -120,12 +128,9 @@ public BaseClientHttpResponse> list(
.body()),
response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
throw new BaseClientApiException(
- "Error with status code " + response.code(),
- response.code(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -159,16 +164,14 @@ public BaseClientHttpResponse retrieve(String appId, RequestOpti
}
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(responseBody.string(), GetAppResponse.class), response);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetAppResponse.class), response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
throw new BaseClientApiException(
- "Error with status code " + response.code(),
- response.code(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
diff --git a/src/main/java/com/pipedream/api/resources/components/AsyncComponentsClient.java b/src/main/java/com/pipedream/api/resources/components/AsyncComponentsClient.java
index fabb8cc..e2383af 100644
--- a/src/main/java/com/pipedream/api/resources/components/AsyncComponentsClient.java
+++ b/src/main/java/com/pipedream/api/resources/components/AsyncComponentsClient.java
@@ -39,6 +39,13 @@ public CompletableFuture> list() {
return this.rawClient.list().thenApply(response -> response.body());
}
+ /**
+ * Retrieve available components with optional search and app filtering
+ */
+ public CompletableFuture> list(RequestOptions requestOptions) {
+ return this.rawClient.list(requestOptions).thenApply(response -> response.body());
+ }
+
/**
* Retrieve available components with optional search and app filtering
*/
@@ -61,6 +68,13 @@ public CompletableFuture retrieve(String componentId) {
return this.rawClient.retrieve(componentId).thenApply(response -> response.body());
}
+ /**
+ * Get detailed configuration for a specific component by its key
+ */
+ public CompletableFuture retrieve(String componentId, RequestOptions requestOptions) {
+ return this.rawClient.retrieve(componentId, requestOptions).thenApply(response -> response.body());
+ }
+
/**
* Get detailed configuration for a specific component by its key
*/
diff --git a/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java b/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java
index 7ad7e19..48e1c7a 100644
--- a/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java
+++ b/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java
@@ -54,6 +54,14 @@ public CompletableFuture>>
return list(ComponentsListRequest.builder().build());
}
+ /**
+ * Retrieve available components with optional search and app filtering
+ */
+ public CompletableFuture>> list(
+ RequestOptions requestOptions) {
+ return list(ComponentsListRequest.builder().build(), requestOptions);
+ }
+
/**
* Retrieve available components with optional search and app filtering
*/
@@ -113,9 +121,10 @@ public CompletableFuture>>
@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()) {
GetComponentsResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentsResponse.class);
Optional startingAfter =
parsedResponse.getPageInfo().getEndCursor();
ComponentsListRequest nextRequest = ComponentsListRequest.builder()
@@ -137,7 +146,6 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
@@ -154,11 +162,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -180,6 +186,14 @@ public CompletableFuture> retrieve(String comp
return retrieve(componentId, ComponentsRetrieveRequest.builder().build());
}
+ /**
+ * Get detailed configuration for a specific component by its key
+ */
+ public CompletableFuture> retrieve(
+ String componentId, RequestOptions requestOptions) {
+ return retrieve(componentId, ComponentsRetrieveRequest.builder().build(), requestOptions);
+ }
+
/**
* Get detailed configuration for a specific component by its key
*/
@@ -218,13 +232,13 @@ public CompletableFuture> retrieve(
@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()) {
GetComponentResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentResponse.class);
future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -234,11 +248,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -269,7 +281,8 @@ public CompletableFuture> configur
.newBuilder()
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
- .addPathSegments("components/configure")
+ .addPathSegments("components")
+ .addPathSegments("configure")
.build();
RequestBody body;
try {
@@ -294,13 +307,13 @@ public CompletableFuture> configur
@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(responseBody.string(), ConfigurePropResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ConfigurePropResponse.class),
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -310,11 +323,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -345,7 +356,8 @@ public CompletableFuture> reloadProp
.newBuilder()
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
- .addPathSegments("components/props")
+ .addPathSegments("components")
+ .addPathSegments("props")
.build();
RequestBody body;
try {
@@ -370,13 +382,13 @@ public CompletableFuture> reloadProp
@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(responseBody.string(), ReloadPropsResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ReloadPropsResponse.class),
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -386,11 +398,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/pipedream/api/resources/components/ComponentsClient.java b/src/main/java/com/pipedream/api/resources/components/ComponentsClient.java
index 892f803..38f30c3 100644
--- a/src/main/java/com/pipedream/api/resources/components/ComponentsClient.java
+++ b/src/main/java/com/pipedream/api/resources/components/ComponentsClient.java
@@ -38,6 +38,13 @@ public SyncPagingIterable list() {
return this.rawClient.list().body();
}
+ /**
+ * Retrieve available components with optional search and app filtering
+ */
+ public SyncPagingIterable list(RequestOptions requestOptions) {
+ return this.rawClient.list(requestOptions).body();
+ }
+
/**
* Retrieve available components with optional search and app filtering
*/
@@ -59,6 +66,13 @@ public Component retrieve(String componentId) {
return this.rawClient.retrieve(componentId).body();
}
+ /**
+ * Get detailed configuration for a specific component by its key
+ */
+ public Component retrieve(String componentId, RequestOptions requestOptions) {
+ return this.rawClient.retrieve(componentId, requestOptions).body();
+ }
+
/**
* Get detailed configuration for a specific component by its key
*/
diff --git a/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java b/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java
index b5a237f..5de61dc 100644
--- a/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java
+++ b/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java
@@ -49,6 +49,13 @@ public BaseClientHttpResponse> list() {
return list(ComponentsListRequest.builder().build());
}
+ /**
+ * Retrieve available components with optional search and app filtering
+ */
+ public BaseClientHttpResponse> list(RequestOptions requestOptions) {
+ return list(ComponentsListRequest.builder().build(), requestOptions);
+ }
+
/**
* Retrieve available components with optional search and app filtering
*/
@@ -104,9 +111,10 @@ public BaseClientHttpResponse> list(
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
if (response.isSuccessful()) {
GetComponentsResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentsResponse.class);
Optional startingAfter = parsedResponse.getPageInfo().getEndCursor();
ComponentsListRequest nextRequest = ComponentsListRequest.builder()
.from(request)
@@ -119,7 +127,6 @@ public BaseClientHttpResponse> list(
.body()),
response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
@@ -132,11 +139,9 @@ public BaseClientHttpResponse> list(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -149,6 +154,13 @@ public BaseClientHttpResponse retrieve(String componentId) {
return retrieve(componentId, ComponentsRetrieveRequest.builder().build());
}
+ /**
+ * Get detailed configuration for a specific component by its key
+ */
+ public BaseClientHttpResponse retrieve(String componentId, RequestOptions requestOptions) {
+ return retrieve(componentId, ComponentsRetrieveRequest.builder().build(), requestOptions);
+ }
+
/**
* Get detailed configuration for a specific component by its key
*/
@@ -183,12 +195,12 @@ public BaseClientHttpResponse retrieve(
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
if (response.isSuccessful()) {
GetComponentResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentResponse.class);
return new BaseClientHttpResponse<>(parsedResponse.getData(), response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -197,11 +209,9 @@ public BaseClientHttpResponse retrieve(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -223,7 +233,8 @@ public BaseClientHttpResponse configureProp(
.newBuilder()
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
- .addPathSegments("components/configure")
+ .addPathSegments("components")
+ .addPathSegments("configure")
.build();
RequestBody body;
try {
@@ -245,12 +256,11 @@ public BaseClientHttpResponse configureProp(
}
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(responseBody.string(), ConfigurePropResponse.class),
- response);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ConfigurePropResponse.class), response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -259,11 +269,9 @@ public BaseClientHttpResponse configureProp(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -285,7 +293,8 @@ public BaseClientHttpResponse reloadProps(
.newBuilder()
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
- .addPathSegments("components/props")
+ .addPathSegments("components")
+ .addPathSegments("props")
.build();
RequestBody body;
try {
@@ -307,12 +316,11 @@ public BaseClientHttpResponse reloadProps(
}
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(responseBody.string(), ReloadPropsResponse.class),
- response);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ReloadPropsResponse.class), response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -321,11 +329,9 @@ public BaseClientHttpResponse reloadProps(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
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 faa8471..5fa7774 100644
--- a/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java
+++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java
@@ -106,9 +106,10 @@ public CompletableFuture>> li
@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()) {
GetTriggersResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggersResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggersResponse.class);
Optional startingAfter =
parsedResponse.getPageInfo().getEndCursor();
DeployedTriggersListRequest nextRequest = DeployedTriggersListRequest.builder()
@@ -130,7 +131,6 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -140,11 +140,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -194,13 +192,13 @@ public CompletableFuture> retrieve(
@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()) {
GetTriggerResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerResponse.class);
future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -210,11 +208,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -271,13 +267,13 @@ public CompletableFuture> update(
@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()) {
GetTriggerResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerResponse.class);
future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -287,11 +283,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -359,11 +353,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -417,13 +409,13 @@ public CompletableFuture>> listEvents(
@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()) {
- GetTriggerEventsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(
- responseBody.string(), GetTriggerEventsResponse.class);
+ GetTriggerEventsResponse parsedResponse =
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerEventsResponse.class);
future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -433,11 +425,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -488,14 +478,14 @@ public CompletableFuture> li
@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(
- responseBody.string(), GetTriggerWorkflowsResponse.class),
+ responseBodyString, GetTriggerWorkflowsResponse.class),
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -505,11 +495,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -568,14 +556,14 @@ public CompletableFuture> up
@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(
- responseBody.string(), GetTriggerWorkflowsResponse.class),
+ responseBodyString, GetTriggerWorkflowsResponse.class),
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -585,11 +573,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -640,14 +626,14 @@ public CompletableFuture> lis
@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(
- responseBody.string(), GetTriggerWebhooksResponse.class),
+ responseBodyString, GetTriggerWebhooksResponse.class),
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -657,11 +643,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -720,14 +704,14 @@ public CompletableFuture> upd
@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(
- responseBody.string(), GetTriggerWebhooksResponse.class),
+ responseBodyString, GetTriggerWebhooksResponse.class),
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -737,11 +721,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -796,14 +778,14 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBody.string(), GetWebhookWithSigningKeyResponse.class),
+ responseBodyString, GetWebhookWithSigningKeyResponse.class),
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -813,11 +795,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -873,14 +853,14 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBody.string(), GetWebhookWithSigningKeyResponse.class),
+ responseBodyString, GetWebhookWithSigningKeyResponse.class),
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -890,11 +870,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
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 f88f7d5..6192257 100644
--- a/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java
+++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java
@@ -97,9 +97,10 @@ public BaseClientHttpResponse> list(
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
if (response.isSuccessful()) {
GetTriggersResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggersResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggersResponse.class);
Optional startingAfter = parsedResponse.getPageInfo().getEndCursor();
DeployedTriggersListRequest nextRequest = DeployedTriggersListRequest.builder()
.from(request)
@@ -112,7 +113,6 @@ public BaseClientHttpResponse> list(
.body()),
response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -121,11 +121,9 @@ public BaseClientHttpResponse> list(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -162,12 +160,12 @@ public BaseClientHttpResponse retrieve(
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
if (response.isSuccessful()) {
GetTriggerResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerResponse.class);
return new BaseClientHttpResponse<>(parsedResponse.getData(), response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -176,11 +174,9 @@ public BaseClientHttpResponse retrieve(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -225,12 +221,12 @@ public BaseClientHttpResponse update(
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
if (response.isSuccessful()) {
GetTriggerResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerResponse.class);
return new BaseClientHttpResponse<>(parsedResponse.getData(), response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -239,11 +235,9 @@ public BaseClientHttpResponse update(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -296,11 +290,9 @@ public BaseClientHttpResponse delete(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -342,12 +334,12 @@ public BaseClientHttpResponse> listEvents(
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
if (response.isSuccessful()) {
GetTriggerEventsResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerEventsResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerEventsResponse.class);
return new BaseClientHttpResponse<>(parsedResponse.getData(), response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -356,11 +348,9 @@ public BaseClientHttpResponse> listEvents(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -399,12 +389,12 @@ public BaseClientHttpResponse listWorkflows(
}
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(responseBody.string(), GetTriggerWorkflowsResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerWorkflowsResponse.class),
response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -413,11 +403,9 @@ public BaseClientHttpResponse listWorkflows(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -464,12 +452,12 @@ public BaseClientHttpResponse updateWorkflows(
}
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(responseBody.string(), GetTriggerWorkflowsResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerWorkflowsResponse.class),
response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -478,11 +466,9 @@ public BaseClientHttpResponse updateWorkflows(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -521,12 +507,12 @@ public BaseClientHttpResponse listWebhooks(
}
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(responseBody.string(), GetTriggerWebhooksResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerWebhooksResponse.class),
response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -535,11 +521,9 @@ public BaseClientHttpResponse listWebhooks(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -586,12 +570,12 @@ public BaseClientHttpResponse updateWebhooks(
}
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(responseBody.string(), GetTriggerWebhooksResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerWebhooksResponse.class),
response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -600,11 +584,9 @@ public BaseClientHttpResponse updateWebhooks(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -647,13 +629,12 @@ public BaseClientHttpResponse retrieveWebhook(
}
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(
- responseBody.string(), GetWebhookWithSigningKeyResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetWebhookWithSigningKeyResponse.class),
response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -662,11 +643,9 @@ public BaseClientHttpResponse retrieveWebhook(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -710,13 +689,12 @@ public BaseClientHttpResponse regenerateWebhoo
}
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(
- responseBody.string(), GetWebhookWithSigningKeyResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetWebhookWithSigningKeyResponse.class),
response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -725,11 +703,9 @@ public BaseClientHttpResponse regenerateWebhoo
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
diff --git a/src/main/java/com/pipedream/api/resources/filestash/AsyncRawFileStashClient.java b/src/main/java/com/pipedream/api/resources/filestash/AsyncRawFileStashClient.java
index aa73f5d..af09992 100644
--- a/src/main/java/com/pipedream/api/resources/filestash/AsyncRawFileStashClient.java
+++ b/src/main/java/com/pipedream/api/resources/filestash/AsyncRawFileStashClient.java
@@ -50,7 +50,8 @@ public CompletableFuture> downloadFile(
.newBuilder()
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
- .addPathSegments("file_stash/download");
+ .addPathSegments("file_stash")
+ .addPathSegments("download");
QueryStringMapper.addQueryParameter(httpUrl, "s3_key", request.getS3Key(), false);
Request.Builder _requestBuilder = new Request.Builder()
.url(httpUrl.build())
@@ -82,11 +83,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/pipedream/api/resources/filestash/RawFileStashClient.java b/src/main/java/com/pipedream/api/resources/filestash/RawFileStashClient.java
index 2bd5052..e8dd8e7 100644
--- a/src/main/java/com/pipedream/api/resources/filestash/RawFileStashClient.java
+++ b/src/main/java/com/pipedream/api/resources/filestash/RawFileStashClient.java
@@ -46,7 +46,8 @@ public BaseClientHttpResponse downloadFile(
.newBuilder()
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
- .addPathSegments("file_stash/download");
+ .addPathSegments("file_stash")
+ .addPathSegments("download");
QueryStringMapper.addQueryParameter(httpUrl, "s3_key", request.getS3Key(), false);
Request.Builder _requestBuilder = new Request.Builder()
.url(httpUrl.build())
@@ -73,11 +74,9 @@ public BaseClientHttpResponse downloadFile(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
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 a922464..1632abd 100644
--- a/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java
+++ b/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java
@@ -72,19 +72,16 @@ public CompletableFuture> creat
@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(
- responseBody.string(), CreateOAuthTokenResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateOAuthTokenResponse.class),
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
future.completeExceptionally(new BaseClientApiException(
- "Error with status code " + response.code(),
- response.code(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
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 23a1d85..9e8e254 100644
--- a/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java
+++ b/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java
@@ -65,17 +65,15 @@ public BaseClientHttpResponse create(
}
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(responseBody.string(), CreateOAuthTokenResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateOAuthTokenResponse.class),
response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
throw new BaseClientApiException(
- "Error with status code " + response.code(),
- response.code(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
diff --git a/src/main/java/com/pipedream/api/resources/projectenvironment/AsyncRawProjectEnvironmentClient.java b/src/main/java/com/pipedream/api/resources/projectenvironment/AsyncRawProjectEnvironmentClient.java
index 8d67caa..c80c77d 100644
--- a/src/main/java/com/pipedream/api/resources/projectenvironment/AsyncRawProjectEnvironmentClient.java
+++ b/src/main/java/com/pipedream/api/resources/projectenvironment/AsyncRawProjectEnvironmentClient.java
@@ -69,13 +69,13 @@ public CompletableFuture> retrieveWeb
@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(responseBody.string(), GetWebhookResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetWebhookResponse.class),
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -85,11 +85,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -145,13 +143,13 @@ public CompletableFuture> updateWebho
@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(responseBody.string(), SetWebhookResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SetWebhookResponse.class),
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -161,11 +159,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -226,11 +222,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -261,7 +255,8 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBody.string(), GetWebhookWithSigningKeyResponse.class),
+ responseBodyString, GetWebhookWithSigningKeyResponse.class),
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -295,11 +290,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/pipedream/api/resources/projectenvironment/RawProjectEnvironmentClient.java b/src/main/java/com/pipedream/api/resources/projectenvironment/RawProjectEnvironmentClient.java
index 986b8c5..f4a31f2 100644
--- a/src/main/java/com/pipedream/api/resources/projectenvironment/RawProjectEnvironmentClient.java
+++ b/src/main/java/com/pipedream/api/resources/projectenvironment/RawProjectEnvironmentClient.java
@@ -61,11 +61,11 @@ public BaseClientHttpResponse retrieveWebhook(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(responseBody.string(), GetWebhookResponse.class), response);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetWebhookResponse.class), response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -74,11 +74,9 @@ public BaseClientHttpResponse retrieveWebhook(RequestOptions
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -122,11 +120,11 @@ public BaseClientHttpResponse updateWebhook(
}
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(responseBody.string(), SetWebhookResponse.class), response);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SetWebhookResponse.class), response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -135,11 +133,9 @@ public BaseClientHttpResponse updateWebhook(
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -186,11 +182,9 @@ public BaseClientHttpResponse deleteWebhook(RequestOptions requestOptions)
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
@@ -212,7 +206,8 @@ public BaseClientHttpResponse regenerateWebhoo
.newBuilder()
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
- .addPathSegments("webhook/regenerate_signing_key")
+ .addPathSegments("webhook")
+ .addPathSegments("regenerate_signing_key")
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
@@ -226,13 +221,12 @@ public BaseClientHttpResponse regenerateWebhoo
}
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(
- responseBody.string(), GetWebhookWithSigningKeyResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetWebhookWithSigningKeyResponse.class),
response);
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
throw new TooManyRequestsError(
@@ -241,11 +235,9 @@ public BaseClientHttpResponse regenerateWebhoo
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response);
+ "Error with status code " + response.code(), response.code(), errorBody, response);
} catch (IOException e) {
throw new BaseClientException("Network error executing HTTP request", e);
}
diff --git a/src/main/java/com/pipedream/api/resources/projects/AsyncProjectsClient.java b/src/main/java/com/pipedream/api/resources/projects/AsyncProjectsClient.java
index 6f4eecf..245cb26 100644
--- a/src/main/java/com/pipedream/api/resources/projects/AsyncProjectsClient.java
+++ b/src/main/java/com/pipedream/api/resources/projects/AsyncProjectsClient.java
@@ -38,6 +38,13 @@ public CompletableFuture> list() {
return this.rawClient.list().thenApply(response -> response.body());
}
+ /**
+ * List the projects that are available to the authenticated Connect client
+ */
+ public CompletableFuture> list(RequestOptions requestOptions) {
+ return this.rawClient.list(requestOptions).thenApply(response -> response.body());
+ }
+
/**
* List the projects that are available to the authenticated Connect client
*/
@@ -102,6 +109,13 @@ public CompletableFuture update(String projectId) {
return this.rawClient.update(projectId).thenApply(response -> response.body());
}
+ /**
+ * Update project details or application information
+ */
+ public CompletableFuture update(String projectId, RequestOptions requestOptions) {
+ return this.rawClient.update(projectId, requestOptions).thenApply(response -> response.body());
+ }
+
/**
* Update project details or application information
*/
diff --git a/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java b/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java
index 2c9dffd..f820ab5 100644
--- a/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java
+++ b/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java
@@ -53,6 +53,13 @@ public CompletableFuture>> li
return list(ProjectsListRequest.builder().build());
}
+ /**
+ * List the projects that are available to the authenticated Connect client
+ */
+ public CompletableFuture>> list(RequestOptions requestOptions) {
+ return list(ProjectsListRequest.builder().build(), requestOptions);
+ }
+
/**
* List the projects that are available to the authenticated Connect client
*/
@@ -98,9 +105,10 @@ public CompletableFuture>> li
@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()) {
ListProjectsResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListProjectsResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListProjectsResponse.class);
Optional startingAfter =
parsedResponse.getPageInfo().getEndCursor();
ProjectsListRequest nextRequest = ProjectsListRequest.builder()
@@ -122,7 +130,6 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 404:
@@ -139,11 +146,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -197,12 +202,12 @@ public CompletableFuture> create(
@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(responseBody.string(), Project.class), response));
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Project.class), response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -212,11 +217,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -263,12 +266,12 @@ public CompletableFuture> retrieve(
@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(responseBody.string(), Project.class), response));
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Project.class), response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -278,11 +281,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -342,11 +343,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -368,6 +367,13 @@ public CompletableFuture> update(String projectI
return update(projectId, UpdateProjectOpts.builder().build());
}
+ /**
+ * Update project details or application information
+ */
+ public CompletableFuture> update(String projectId, RequestOptions requestOptions) {
+ return update(projectId, UpdateProjectOpts.builder().build(), requestOptions);
+ }
+
/**
* Update project details or application information
*/
@@ -408,12 +414,12 @@ public CompletableFuture> update(
@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(responseBody.string(), Project.class), response));
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Project.class), response));
return;
}
- String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
if (response.code() == 429) {
future.completeExceptionally(new TooManyRequestsError(
@@ -423,11 +429,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -504,11 +508,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
} 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(),
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
- response));
+ "Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e));
@@ -538,7 +540,8 @@ public CompletableFuture