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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Add the dependency in your `pom.xml` file:
<dependency>
<groupId>com.pipedream</groupId>
<artifactId>pipedream</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</dependency>
```

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

group = 'com.pipedream'

version = '1.0.3'
version = '1.0.4'

jar {
dependsOn(":generatePomFileForMavenPublication")
Expand Down Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/pipedream/api/core/ClientOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ private ClientOptions(
this.headers.putAll(headers);
this.headers.putAll(new HashMap<String, String>() {
{
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;
Expand Down
32 changes: 32 additions & 0 deletions src/main/java/com/pipedream/api/errors/TooManyRequestsError.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -334,6 +363,7 @@ public CompletableFuture<BaseClientHttpResponse<Void>> 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()) {
Expand All @@ -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(),
Expand Down Expand Up @@ -391,6 +430,7 @@ public CompletableFuture<BaseClientHttpResponse<Void>> 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()) {
Expand All @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -120,6 +122,14 @@ public BaseClientHttpResponse<SyncPagingIterable<Account>> 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(),
Expand Down Expand Up @@ -190,6 +200,14 @@ public BaseClientHttpResponse<Account> 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(),
Expand Down Expand Up @@ -249,6 +267,14 @@ public BaseClientHttpResponse<Account> 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(),
Expand Down Expand Up @@ -281,6 +307,7 @@ public BaseClientHttpResponse<Void> 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()) {
Expand All @@ -292,6 +319,14 @@ public BaseClientHttpResponse<Void> 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(),
Expand Down Expand Up @@ -325,6 +360,7 @@ public BaseClientHttpResponse<Void> 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()) {
Expand All @@ -336,6 +372,14 @@ public BaseClientHttpResponse<Void> 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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down
Loading