diff --git a/README.md b/README.md
index fe252b7..3861922 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ Add the dependency in your `pom.xml` file:
com.pipedream
pipedream
- 1.0.3
+ 1.0.4
```
diff --git a/build.gradle b/build.gradle
index a6ec3d5..40f9a59 100644
--- a/build.gradle
+++ b/build.gradle
@@ -48,7 +48,7 @@ java {
group = 'com.pipedream'
-version = '1.0.3'
+version = '1.0.4'
jar {
dependsOn(":generatePomFileForMavenPublication")
@@ -79,7 +79,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.pipedream'
artifactId = 'pipedream'
- version = '1.0.3'
+ version = '1.0.4'
from components.java
pom {
name = 'pipedream'
diff --git a/src/main/java/com/pipedream/api/core/ClientOptions.java b/src/main/java/com/pipedream/api/core/ClientOptions.java
index 390ad5a..5e483e4 100644
--- a/src/main/java/com/pipedream/api/core/ClientOptions.java
+++ b/src/main/java/com/pipedream/api/core/ClientOptions.java
@@ -35,10 +35,10 @@ private ClientOptions(
this.headers.putAll(headers);
this.headers.putAll(new HashMap() {
{
- put("User-Agent", "com.pipedream:pipedream/1.0.3");
+ put("User-Agent", "com.pipedream:pipedream/1.0.4");
put("X-Fern-Language", "JAVA");
put("X-Fern-SDK-Name", "com.pipedream.fern:api-sdk");
- put("X-Fern-SDK-Version", "1.0.3");
+ put("X-Fern-SDK-Version", "1.0.4");
}
});
this.headerSuppliers = headerSuppliers;
diff --git a/src/main/java/com/pipedream/api/errors/TooManyRequestsError.java b/src/main/java/com/pipedream/api/errors/TooManyRequestsError.java
new file mode 100644
index 0000000..9ecbab4
--- /dev/null
+++ b/src/main/java/com/pipedream/api/errors/TooManyRequestsError.java
@@ -0,0 +1,32 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.pipedream.api.errors;
+
+import com.pipedream.api.core.BaseClientApiException;
+import okhttp3.Response;
+
+public final class TooManyRequestsError extends BaseClientApiException {
+ /**
+ * The body of the response that triggered the exception.
+ */
+ private final Object body;
+
+ public TooManyRequestsError(Object body) {
+ super("TooManyRequestsError", 429, body);
+ this.body = body;
+ }
+
+ public TooManyRequestsError(Object body, Response rawResponse) {
+ super("TooManyRequestsError", 429, body, rawResponse);
+ this.body = body;
+ }
+
+ /**
+ * @return the body
+ */
+ @java.lang.Override
+ public Object body() {
+ return this.body;
+ }
+}
diff --git a/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java b/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java
index fd3c4c7..3aff3e1 100644
--- a/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java
+++ b/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java
@@ -3,6 +3,7 @@
*/
package com.pipedream.api.resources.accounts;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.pipedream.api.core.BaseClientApiException;
import com.pipedream.api.core.BaseClientException;
import com.pipedream.api.core.BaseClientHttpResponse;
@@ -12,6 +13,7 @@
import com.pipedream.api.core.QueryStringMapper;
import com.pipedream.api.core.RequestOptions;
import com.pipedream.api.core.pagination.SyncPagingIterable;
+import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.resources.accounts.requests.AccountsListRequest;
import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest;
import com.pipedream.api.resources.accounts.requests.CreateAccountOpts;
@@ -136,6 +138,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -220,6 +231,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -293,6 +313,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -334,6 +363,7 @@ public CompletableFuture> delete(String accountId,
.url(httpUrl)
.method("DELETE", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
@@ -349,6 +379,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -391,6 +430,7 @@ public CompletableFuture> deleteByApp(String appId,
.url(httpUrl)
.method("DELETE", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
@@ -406,6 +446,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
diff --git a/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java b/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java
index b3bc94c..9692016 100644
--- a/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java
+++ b/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java
@@ -3,6 +3,7 @@
*/
package com.pipedream.api.resources.accounts;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.pipedream.api.core.BaseClientApiException;
import com.pipedream.api.core.BaseClientException;
import com.pipedream.api.core.BaseClientHttpResponse;
@@ -12,6 +13,7 @@
import com.pipedream.api.core.QueryStringMapper;
import com.pipedream.api.core.RequestOptions;
import com.pipedream.api.core.pagination.SyncPagingIterable;
+import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.resources.accounts.requests.AccountsListRequest;
import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest;
import com.pipedream.api.resources.accounts.requests.CreateAccountOpts;
@@ -120,6 +122,14 @@ public BaseClientHttpResponse> list(
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -190,6 +200,14 @@ public BaseClientHttpResponse create(CreateAccountOpts request, Request
ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -249,6 +267,14 @@ public BaseClientHttpResponse retrieve(
ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -281,6 +307,7 @@ public BaseClientHttpResponse delete(String accountId, RequestOptions requ
.url(httpUrl)
.method("DELETE", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
@@ -292,6 +319,14 @@ public BaseClientHttpResponse delete(String accountId, RequestOptions requ
return new BaseClientHttpResponse<>(null, response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -325,6 +360,7 @@ public BaseClientHttpResponse deleteByApp(String appId, RequestOptions req
.url(httpUrl)
.method("DELETE", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
@@ -336,6 +372,14 @@ public BaseClientHttpResponse deleteByApp(String appId, RequestOptions req
return new BaseClientHttpResponse<>(null, response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
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 7632c50..cd9c018 100644
--- a/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java
+++ b/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java
@@ -13,6 +13,7 @@
import com.pipedream.api.core.QueryStringMapper;
import com.pipedream.api.core.RequestOptions;
import com.pipedream.api.core.pagination.SyncPagingIterable;
+import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.resources.actions.requests.ActionsListRequest;
import com.pipedream.api.resources.actions.requests.RunActionOpts;
import com.pipedream.api.types.Component;
@@ -127,6 +128,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -187,6 +197,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -254,6 +273,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -321,6 +349,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -388,6 +425,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
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 77f0ff3..8fb543b 100644
--- a/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java
+++ b/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java
@@ -13,6 +13,7 @@
import com.pipedream.api.core.QueryStringMapper;
import com.pipedream.api.core.RequestOptions;
import com.pipedream.api.core.pagination.SyncPagingIterable;
+import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.resources.actions.requests.ActionsListRequest;
import com.pipedream.api.resources.actions.requests.RunActionOpts;
import com.pipedream.api.types.Component;
@@ -111,6 +112,14 @@ public BaseClientHttpResponse> list(
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -157,6 +166,14 @@ public BaseClientHttpResponse retrieve(String componentId, RequestOpt
return new BaseClientHttpResponse<>(parsedResponse.getData(), response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -211,6 +228,14 @@ public BaseClientHttpResponse configureProp(
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -265,6 +290,14 @@ public BaseClientHttpResponse reloadProps(
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -317,6 +350,14 @@ public BaseClientHttpResponse run(RunActionOpts request, Requ
ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), RunActionResponse.class), response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
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 39c74b4..f9290c2 100644
--- a/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java
+++ b/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java
@@ -13,6 +13,7 @@
import com.pipedream.api.core.QueryStringMapper;
import com.pipedream.api.core.RequestOptions;
import com.pipedream.api.core.pagination.SyncPagingIterable;
+import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.resources.components.requests.ComponentsListRequest;
import com.pipedream.api.types.Component;
import com.pipedream.api.types.ConfigurePropOpts;
@@ -130,6 +131,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -190,6 +200,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -257,6 +276,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -324,6 +352,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
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 b015860..d9debeb 100644
--- a/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java
+++ b/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java
@@ -13,6 +13,7 @@
import com.pipedream.api.core.QueryStringMapper;
import com.pipedream.api.core.RequestOptions;
import com.pipedream.api.core.pagination.SyncPagingIterable;
+import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.resources.components.requests.ComponentsListRequest;
import com.pipedream.api.types.Component;
import com.pipedream.api.types.ConfigurePropOpts;
@@ -113,6 +114,14 @@ public BaseClientHttpResponse> list(
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -159,6 +168,14 @@ public BaseClientHttpResponse retrieve(String componentId, RequestOpt
return new BaseClientHttpResponse<>(parsedResponse.getData(), response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -213,6 +230,14 @@ public BaseClientHttpResponse configureProp(
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -267,6 +292,14 @@ public BaseClientHttpResponse reloadProps(
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
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 5868831..d350311 100644
--- a/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java
+++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java
@@ -3,6 +3,7 @@
*/
package com.pipedream.api.resources.deployedtriggers;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.pipedream.api.core.BaseClientApiException;
import com.pipedream.api.core.BaseClientException;
import com.pipedream.api.core.BaseClientHttpResponse;
@@ -12,6 +13,7 @@
import com.pipedream.api.core.QueryStringMapper;
import com.pipedream.api.core.RequestOptions;
import com.pipedream.api.core.pagination.SyncPagingIterable;
+import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersDeleteRequest;
import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListEventsRequest;
import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListRequest;
@@ -124,6 +126,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -185,6 +196,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -264,6 +284,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -310,7 +339,8 @@ public CompletableFuture> delete(
Request.Builder _requestBuilder = new Request.Builder()
.url(httpUrl.build())
.method("DELETE", null)
- .headers(Headers.of(clientOptions.headers(requestOptions)));
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json");
Request okhttpRequest = _requestBuilder.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
@@ -326,6 +356,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -391,6 +430,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -454,6 +502,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -527,6 +584,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -590,6 +656,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -663,6 +738,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
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 1e58101..3134f2c 100644
--- a/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java
+++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java
@@ -3,6 +3,7 @@
*/
package com.pipedream.api.resources.deployedtriggers;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.pipedream.api.core.BaseClientApiException;
import com.pipedream.api.core.BaseClientException;
import com.pipedream.api.core.BaseClientHttpResponse;
@@ -12,6 +13,7 @@
import com.pipedream.api.core.QueryStringMapper;
import com.pipedream.api.core.RequestOptions;
import com.pipedream.api.core.pagination.SyncPagingIterable;
+import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersDeleteRequest;
import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListEventsRequest;
import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListRequest;
@@ -106,6 +108,14 @@ public BaseClientHttpResponse> list(
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -154,6 +164,14 @@ public BaseClientHttpResponse retrieve(
return new BaseClientHttpResponse<>(parsedResponse.getData(), response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -219,6 +237,14 @@ public BaseClientHttpResponse update(
return new BaseClientHttpResponse<>(parsedResponse.getData(), response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -255,7 +281,8 @@ public BaseClientHttpResponse delete(
Request.Builder _requestBuilder = new Request.Builder()
.url(httpUrl.build())
.method("DELETE", null)
- .headers(Headers.of(clientOptions.headers(requestOptions)));
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json");
Request okhttpRequest = _requestBuilder.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
@@ -267,6 +294,14 @@ public BaseClientHttpResponse delete(
return new BaseClientHttpResponse<>(null, response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -319,6 +354,14 @@ public BaseClientHttpResponse> listEvents(
return new BaseClientHttpResponse<>(parsedResponse.getData(), response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -368,6 +411,14 @@ public BaseClientHttpResponse listWorkflows(
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -427,6 +478,14 @@ public BaseClientHttpResponse updateWorkflows(
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -476,6 +535,14 @@ public BaseClientHttpResponse listWebhooks(
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -535,6 +602,14 @@ public BaseClientHttpResponse updateWebhooks(
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
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 45cbae9..f3e1636 100644
--- a/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java
+++ b/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java
@@ -3,12 +3,14 @@
*/
package com.pipedream.api.resources.projects;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.pipedream.api.core.BaseClientApiException;
import com.pipedream.api.core.BaseClientException;
import com.pipedream.api.core.BaseClientHttpResponse;
import com.pipedream.api.core.ClientOptions;
import com.pipedream.api.core.ObjectMappers;
import com.pipedream.api.core.RequestOptions;
+import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.types.ProjectInfoResponse;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
@@ -68,6 +70,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
diff --git a/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java b/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java
index f5cf225..d067eb7 100644
--- a/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java
+++ b/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java
@@ -3,12 +3,14 @@
*/
package com.pipedream.api.resources.projects;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.pipedream.api.core.BaseClientApiException;
import com.pipedream.api.core.BaseClientException;
import com.pipedream.api.core.BaseClientHttpResponse;
import com.pipedream.api.core.ClientOptions;
import com.pipedream.api.core.ObjectMappers;
import com.pipedream.api.core.RequestOptions;
+import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.types.ProjectInfoResponse;
import java.io.IOException;
import okhttp3.Headers;
@@ -60,6 +62,14 @@ public BaseClientHttpResponse retrieveInfo(RequestOptions r
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
diff --git a/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java b/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java
index 5bebf19..5ab836b 100644
--- a/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java
+++ b/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java
@@ -12,6 +12,7 @@
import com.pipedream.api.core.ObjectMappers;
import com.pipedream.api.core.QueryStringMapper;
import com.pipedream.api.core.RequestOptions;
+import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.resources.tokens.requests.CreateTokenOpts;
import com.pipedream.api.resources.tokens.requests.TokensValidateRequest;
import com.pipedream.api.types.CreateTokenResponse;
@@ -84,6 +85,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -148,6 +158,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
diff --git a/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java b/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java
index d50d3db..f9414f5 100644
--- a/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java
+++ b/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java
@@ -12,6 +12,7 @@
import com.pipedream.api.core.ObjectMappers;
import com.pipedream.api.core.QueryStringMapper;
import com.pipedream.api.core.RequestOptions;
+import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.resources.tokens.requests.CreateTokenOpts;
import com.pipedream.api.resources.tokens.requests.TokensValidateRequest;
import com.pipedream.api.types.CreateTokenResponse;
@@ -75,6 +76,14 @@ public BaseClientHttpResponse create(CreateTokenOpts reques
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -125,6 +134,14 @@ public BaseClientHttpResponse validate(
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
diff --git a/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java b/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java
index 97fbff6..02b9ac8 100644
--- a/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java
+++ b/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java
@@ -13,6 +13,7 @@
import com.pipedream.api.core.QueryStringMapper;
import com.pipedream.api.core.RequestOptions;
import com.pipedream.api.core.pagination.SyncPagingIterable;
+import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.resources.triggers.requests.DeployTriggerOpts;
import com.pipedream.api.resources.triggers.requests.TriggersListRequest;
import com.pipedream.api.types.Component;
@@ -128,6 +129,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -188,6 +198,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -255,6 +274,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -322,6 +350,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -389,6 +426,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
diff --git a/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java b/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java
index bb37d99..a60a957 100644
--- a/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java
+++ b/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java
@@ -13,6 +13,7 @@
import com.pipedream.api.core.QueryStringMapper;
import com.pipedream.api.core.RequestOptions;
import com.pipedream.api.core.pagination.SyncPagingIterable;
+import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.resources.triggers.requests.DeployTriggerOpts;
import com.pipedream.api.resources.triggers.requests.TriggersListRequest;
import com.pipedream.api.types.Component;
@@ -112,6 +113,14 @@ public BaseClientHttpResponse> list(
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -158,6 +167,14 @@ public BaseClientHttpResponse retrieve(String componentId, RequestOpt
return new BaseClientHttpResponse<>(parsedResponse.getData(), response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -212,6 +229,14 @@ public BaseClientHttpResponse configureProp(
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -266,6 +291,14 @@ public BaseClientHttpResponse reloadProps(
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
@@ -319,6 +352,14 @@ public BaseClientHttpResponse deploy(DeployTriggerOpts reques
return new BaseClientHttpResponse<>(parsedResponse.getData(), response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
diff --git a/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java b/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java
index 998d232..c41f6f1 100644
--- a/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java
+++ b/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java
@@ -3,12 +3,14 @@
*/
package com.pipedream.api.resources.users;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.pipedream.api.core.BaseClientApiException;
import com.pipedream.api.core.BaseClientException;
import com.pipedream.api.core.BaseClientHttpResponse;
import com.pipedream.api.core.ClientOptions;
import com.pipedream.api.core.ObjectMappers;
import com.pipedream.api.core.RequestOptions;
+import com.pipedream.api.errors.TooManyRequestsError;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
import okhttp3.Call;
@@ -51,6 +53,7 @@ public CompletableFuture> deleteExternalUser(
.url(httpUrl)
.method("DELETE", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
@@ -66,6 +69,15 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ future.completeExceptionally(new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
future.completeExceptionally(new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
diff --git a/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java b/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java
index 9ace139..097eaaf 100644
--- a/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java
+++ b/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java
@@ -3,12 +3,14 @@
*/
package com.pipedream.api.resources.users;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.pipedream.api.core.BaseClientApiException;
import com.pipedream.api.core.BaseClientException;
import com.pipedream.api.core.BaseClientHttpResponse;
import com.pipedream.api.core.ClientOptions;
import com.pipedream.api.core.ObjectMappers;
import com.pipedream.api.core.RequestOptions;
+import com.pipedream.api.errors.TooManyRequestsError;
import java.io.IOException;
import okhttp3.Headers;
import okhttp3.HttpUrl;
@@ -46,6 +48,7 @@ public BaseClientHttpResponse deleteExternalUser(String externalUserId, Re
.url(httpUrl)
.method("DELETE", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
@@ -57,6 +60,14 @@ public BaseClientHttpResponse deleteExternalUser(String externalUserId, Re
return new BaseClientHttpResponse<>(null, response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ if (response.code() == 429) {
+ throw new TooManyRequestsError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
throw new BaseClientApiException(
"Error with status code " + response.code(),
response.code(),
diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropType.java b/src/main/java/com/pipedream/api/types/ConfigurablePropType.java
index 3962ae4..ed58e25 100644
--- a/src/main/java/com/pipedream/api/types/ConfigurablePropType.java
+++ b/src/main/java/com/pipedream/api/types/ConfigurablePropType.java
@@ -16,6 +16,8 @@ public enum ConfigurablePropType {
DISCORD_CHANNEL("$.discord.channel"),
+ DISCORD_CHANNEL_ARRAY("$.discord.channel[]"),
+
INTERFACE_APPHOOK("$.interface.apphook"),
INTERFACE_HTTP("$.interface.http"),
@@ -40,11 +42,15 @@ public enum ConfigurablePropType {
INTEGER("integer"),
+ INTEGER_ARRAY("integer[]"),
+
OBJECT("object"),
SQL("sql"),
- STRING("string");
+ STRING("string"),
+
+ STRING_ARRAY("string[]");
private final String value;
diff --git a/src/main/java/com/pipedream/api/types/TooManyRequestsErrorBody.java b/src/main/java/com/pipedream/api/types/TooManyRequestsErrorBody.java
new file mode 100644
index 0000000..ceea0f7
--- /dev/null
+++ b/src/main/java/com/pipedream/api/types/TooManyRequestsErrorBody.java
@@ -0,0 +1,95 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.pipedream.api.types;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.annotation.Nulls;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.pipedream.api.core.ObjectMappers;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = TooManyRequestsErrorBody.Builder.class)
+public final class TooManyRequestsErrorBody {
+ private final Optional error;
+
+ private final Map additionalProperties;
+
+ private TooManyRequestsErrorBody(Optional error, Map additionalProperties) {
+ this.error = error;
+ this.additionalProperties = additionalProperties;
+ }
+
+ @JsonProperty("error")
+ public Optional getError() {
+ return error;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof TooManyRequestsErrorBody && equalTo((TooManyRequestsErrorBody) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(TooManyRequestsErrorBody other) {
+ return error.equals(other.error);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.error);
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return ObjectMappers.stringify(this);
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static final class Builder {
+ private Optional error = Optional.empty();
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ public Builder from(TooManyRequestsErrorBody other) {
+ error(other.getError());
+ return this;
+ }
+
+ @JsonSetter(value = "error", nulls = Nulls.SKIP)
+ public Builder error(Optional error) {
+ this.error = error;
+ return this;
+ }
+
+ public Builder error(String error) {
+ this.error = Optional.ofNullable(error);
+ return this;
+ }
+
+ public TooManyRequestsErrorBody build() {
+ return new TooManyRequestsErrorBody(error, additionalProperties);
+ }
+ }
+}