diff --git a/.gradle/8.14.3/checksums/checksums.lock b/.gradle/8.14.3/checksums/checksums.lock index 93b1509..f92ce79 100644 Binary files a/.gradle/8.14.3/checksums/checksums.lock and b/.gradle/8.14.3/checksums/checksums.lock differ diff --git a/.gradle/8.14.3/checksums/md5-checksums.bin b/.gradle/8.14.3/checksums/md5-checksums.bin index 2eb3edf..c12fa5b 100644 Binary files a/.gradle/8.14.3/checksums/md5-checksums.bin and b/.gradle/8.14.3/checksums/md5-checksums.bin differ diff --git a/.gradle/8.14.3/checksums/sha1-checksums.bin b/.gradle/8.14.3/checksums/sha1-checksums.bin index ce69d43..805b27d 100644 Binary files a/.gradle/8.14.3/checksums/sha1-checksums.bin and b/.gradle/8.14.3/checksums/sha1-checksums.bin differ diff --git a/.gradle/8.14.3/executionHistory/executionHistory.bin b/.gradle/8.14.3/executionHistory/executionHistory.bin index 6eeeed4..b3bf80b 100644 Binary files a/.gradle/8.14.3/executionHistory/executionHistory.bin and b/.gradle/8.14.3/executionHistory/executionHistory.bin differ diff --git a/.gradle/8.14.3/executionHistory/executionHistory.lock b/.gradle/8.14.3/executionHistory/executionHistory.lock index 8583823..faa5087 100644 Binary files a/.gradle/8.14.3/executionHistory/executionHistory.lock and b/.gradle/8.14.3/executionHistory/executionHistory.lock differ diff --git a/.gradle/8.14.3/fileHashes/fileHashes.bin b/.gradle/8.14.3/fileHashes/fileHashes.bin index f107b60..9c82e97 100644 Binary files a/.gradle/8.14.3/fileHashes/fileHashes.bin and b/.gradle/8.14.3/fileHashes/fileHashes.bin differ diff --git a/.gradle/8.14.3/fileHashes/fileHashes.lock b/.gradle/8.14.3/fileHashes/fileHashes.lock index 19c09e3..66aabf5 100644 Binary files a/.gradle/8.14.3/fileHashes/fileHashes.lock and b/.gradle/8.14.3/fileHashes/fileHashes.lock differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 648ed1a..474b796 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties index 1fc2916..2da21b1 100644 --- a/.gradle/buildOutputCleanup/cache.properties +++ b/.gradle/buildOutputCleanup/cache.properties @@ -1,2 +1,2 @@ -#Fri Jul 18 22:37:14 UTC 2025 +#Wed Jul 23 18:16:20 UTC 2025 gradle.version=8.14.3 diff --git a/README.md b/README.md index fa9baaa..8a4d279 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Add the dependency in your `pom.xml` file: com.pipedream pipedream - 0.0.220 + 0.0.236 ``` @@ -36,12 +36,12 @@ Instantiate and use the client with the following: ```java package com.example.usage; -import com.pipedream.api.BaseClient; +import com.pipedream.api.PipedreamClient; import com.pipedream.api.resources.accounts.requests.CreateAccountRequest; public class Example { public static void main(String[] args) { - BaseClient client = BaseClient + PipedreamClient client = PipedreamClient .builder() .clientId("") .clientSecret("") @@ -65,10 +65,10 @@ public class Example { This SDK allows you to configure different environments for API requests. ```java -import com.pipedream.api.BaseClient; +import com.pipedream.api.PipedreamClient; import com.pipedream.api.core.Environment; -BaseClient client = BaseClient +PipedreamClient client = PipedreamClient .builder() .environment(Environment.Prod) .build(); @@ -79,9 +79,9 @@ BaseClient client = BaseClient You can set a custom base URL when constructing the client. ```java -import com.pipedream.api.BaseClient; +import com.pipedream.api.PipedreamClient; -BaseClient client = BaseClient +PipedreamClient client = PipedreamClient .builder() .url("https://example.com") .build(); @@ -109,12 +109,12 @@ This SDK is built to work with any instance of `OkHttpClient`. By default, if no However, you can pass your own client like so: ```java -import com.pipedream.api.BaseClient; +import com.pipedream.api.PipedreamClient; import okhttp3.OkHttpClient; OkHttpClient customClient = ...; -BaseClient client = BaseClient +PipedreamClient client = PipedreamClient .builder() .httpClient(customClient) .build(); @@ -135,9 +135,9 @@ A request is deemed retryable when any of the following HTTP status codes is ret Use the `maxRetries` client option to configure this behavior. ```java -import com.pipedream.api.BaseClient; +import com.pipedream.api.PipedreamClient; -BaseClient client = BaseClient +PipedreamClient client = PipedreamClient .builder() .maxRetries(1) .build(); @@ -148,11 +148,11 @@ BaseClient client = BaseClient The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level. ```java -import com.pipedream.api.BaseClient; +import com.pipedream.api.PipedreamClient; import com.pipedream.api.core.RequestOptions; // Client level -BaseClient client = BaseClient +PipedreamClient client = PipedreamClient .builder() .timeout(10) .build(); diff --git a/build.gradle b/build.gradle index 5744bd5..1cd5bca 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,7 @@ java { group = 'com.pipedream' -version = '0.0.220' +version = '0.0.236' jar { dependsOn(":generatePomFileForMavenPublication") @@ -79,7 +79,7 @@ publishing { maven(MavenPublication) { groupId = 'com.pipedream' artifactId = 'pipedream' - version = '0.0.220' + version = '0.0.236' from components.java pom { name = 'pipedream' diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncBaseClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamClient.java similarity index 95% rename from build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncBaseClient.java rename to build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamClient.java index 39ecdab..18c971a 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncBaseClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamClient.java @@ -19,7 +19,7 @@ import com.pipedream.api.resources.users.AsyncUsersClient; import java.util.function.Supplier; -public class AsyncBaseClient { +public class AsyncPipedreamClient { protected final ClientOptions clientOptions; protected final Supplier appCategoriesClient; @@ -46,7 +46,7 @@ public class AsyncBaseClient { protected final Supplier oauthTokensClient; - public AsyncBaseClient(ClientOptions clientOptions) { + public AsyncPipedreamClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; this.appCategoriesClient = Suppliers.memoize(() -> new AsyncAppCategoriesClient(clientOptions)); this.appsClient = Suppliers.memoize(() -> new AsyncAppsClient(clientOptions)); @@ -110,7 +110,7 @@ public AsyncOauthTokensClient oauthTokens() { return this.oauthTokensClient.get(); } - public static AsyncBaseClientBuilder builder() { - return new AsyncBaseClientBuilder(); + public static AsyncPipedreamClientBuilder builder() { + return new AsyncPipedreamClientBuilder(); } } diff --git a/src/main/java/com/pipedream/api/BaseClientBuilder.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamClientBuilder.java similarity index 75% rename from src/main/java/com/pipedream/api/BaseClientBuilder.java rename to build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamClientBuilder.java index 59ed177..69fa31a 100644 --- a/src/main/java/com/pipedream/api/BaseClientBuilder.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamClientBuilder.java @@ -9,7 +9,7 @@ import com.pipedream.api.resources.oauthtokens.OauthTokensClient; import okhttp3.OkHttpClient; -public final class BaseClientBuilder { +public final class AsyncPipedreamClientBuilder { private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); private String clientId = System.getenv("PIPEDREAM_CLIENT_ID"); @@ -24,7 +24,7 @@ public final class BaseClientBuilder { * Sets clientId. * Defaults to the PIPEDREAM_CLIENT_ID environment variable. */ - public BaseClientBuilder clientId(String clientId) { + public AsyncPipedreamClientBuilder clientId(String clientId) { this.clientId = clientId; return this; } @@ -33,7 +33,7 @@ public BaseClientBuilder clientId(String clientId) { * Sets clientSecret. * Defaults to the PIPEDREAM_CLIENT_SECRET environment variable. */ - public BaseClientBuilder clientSecret(String clientSecret) { + public AsyncPipedreamClientBuilder clientSecret(String clientSecret) { this.clientSecret = clientSecret; return this; } @@ -41,17 +41,17 @@ public BaseClientBuilder clientSecret(String clientSecret) { /** * Sets projectEnvironment */ - public BaseClientBuilder projectEnvironment(String projectEnvironment) { + public AsyncPipedreamClientBuilder projectEnvironment(String projectEnvironment) { this.projectEnvironment = projectEnvironment; return this; } - public BaseClientBuilder environment(Environment environment) { + public AsyncPipedreamClientBuilder environment(Environment environment) { this.environment = environment; return this; } - public BaseClientBuilder url(String url) { + public AsyncPipedreamClientBuilder url(String url) { this.environment = Environment.custom(url); return this; } @@ -59,7 +59,7 @@ public BaseClientBuilder url(String url) { /** * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. */ - public BaseClientBuilder timeout(int timeout) { + public AsyncPipedreamClientBuilder timeout(int timeout) { this.clientOptionsBuilder.timeout(timeout); return this; } @@ -67,7 +67,7 @@ public BaseClientBuilder timeout(int timeout) { /** * Sets the maximum number of retries for the client. Defaults to 2 retries. */ - public BaseClientBuilder maxRetries(int maxRetries) { + public AsyncPipedreamClientBuilder maxRetries(int maxRetries) { this.clientOptionsBuilder.maxRetries(maxRetries); return this; } @@ -75,17 +75,17 @@ public BaseClientBuilder maxRetries(int maxRetries) { /** * Sets the underlying OkHttp client */ - public BaseClientBuilder httpClient(OkHttpClient httpClient) { + public AsyncPipedreamClientBuilder httpClient(OkHttpClient httpClient) { this.clientOptionsBuilder.httpClient(httpClient); return this; } - public BaseClientBuilder projectId(String projectId) { + public AsyncPipedreamClientBuilder projectId(String projectId) { clientOptionsBuilder.projectId(projectId); return this; } - public BaseClient build() { + public AsyncPipedreamClient build() { OauthTokensClient authClient = new OauthTokensClient( ClientOptions.builder().environment(this.environment).build()); OAuthTokenSupplier oAuthTokenSupplier = new OAuthTokenSupplier(clientId, clientSecret, authClient); @@ -94,6 +94,6 @@ public BaseClient build() { this.clientOptionsBuilder.addHeader("x-pd-environment", this.projectEnvironment); } clientOptionsBuilder.environment(this.environment); - return new BaseClient(clientOptionsBuilder.build()); + return new AsyncPipedreamClient(clientOptionsBuilder.build()); } } diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/BaseClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamClient.java similarity index 95% rename from build/spotless/spotlessJava/src/main/java/com/pipedream/api/BaseClient.java rename to build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamClient.java index 69e5677..29ff449 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/BaseClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamClient.java @@ -19,7 +19,7 @@ import com.pipedream.api.resources.users.UsersClient; import java.util.function.Supplier; -public class BaseClient { +public class PipedreamClient { protected final ClientOptions clientOptions; protected final Supplier appCategoriesClient; @@ -46,7 +46,7 @@ public class BaseClient { protected final Supplier oauthTokensClient; - public BaseClient(ClientOptions clientOptions) { + public PipedreamClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; this.appCategoriesClient = Suppliers.memoize(() -> new AppCategoriesClient(clientOptions)); this.appsClient = Suppliers.memoize(() -> new AppsClient(clientOptions)); @@ -110,7 +110,7 @@ public OauthTokensClient oauthTokens() { return this.oauthTokensClient.get(); } - public static BaseClientBuilder builder() { - return new BaseClientBuilder(); + public static PipedreamClientBuilder builder() { + return new PipedreamClientBuilder(); } } diff --git a/src/main/java/com/pipedream/api/AsyncBaseClientBuilder.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamClientBuilder.java similarity index 77% rename from src/main/java/com/pipedream/api/AsyncBaseClientBuilder.java rename to build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamClientBuilder.java index 5759e8b..c8307da 100644 --- a/src/main/java/com/pipedream/api/AsyncBaseClientBuilder.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamClientBuilder.java @@ -9,7 +9,7 @@ import com.pipedream.api.resources.oauthtokens.OauthTokensClient; import okhttp3.OkHttpClient; -public final class AsyncBaseClientBuilder { +public final class PipedreamClientBuilder { private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); private String clientId = System.getenv("PIPEDREAM_CLIENT_ID"); @@ -24,7 +24,7 @@ public final class AsyncBaseClientBuilder { * Sets clientId. * Defaults to the PIPEDREAM_CLIENT_ID environment variable. */ - public AsyncBaseClientBuilder clientId(String clientId) { + public PipedreamClientBuilder clientId(String clientId) { this.clientId = clientId; return this; } @@ -33,7 +33,7 @@ public AsyncBaseClientBuilder clientId(String clientId) { * Sets clientSecret. * Defaults to the PIPEDREAM_CLIENT_SECRET environment variable. */ - public AsyncBaseClientBuilder clientSecret(String clientSecret) { + public PipedreamClientBuilder clientSecret(String clientSecret) { this.clientSecret = clientSecret; return this; } @@ -41,17 +41,17 @@ public AsyncBaseClientBuilder clientSecret(String clientSecret) { /** * Sets projectEnvironment */ - public AsyncBaseClientBuilder projectEnvironment(String projectEnvironment) { + public PipedreamClientBuilder projectEnvironment(String projectEnvironment) { this.projectEnvironment = projectEnvironment; return this; } - public AsyncBaseClientBuilder environment(Environment environment) { + public PipedreamClientBuilder environment(Environment environment) { this.environment = environment; return this; } - public AsyncBaseClientBuilder url(String url) { + public PipedreamClientBuilder url(String url) { this.environment = Environment.custom(url); return this; } @@ -59,7 +59,7 @@ public AsyncBaseClientBuilder url(String url) { /** * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. */ - public AsyncBaseClientBuilder timeout(int timeout) { + public PipedreamClientBuilder timeout(int timeout) { this.clientOptionsBuilder.timeout(timeout); return this; } @@ -67,7 +67,7 @@ public AsyncBaseClientBuilder timeout(int timeout) { /** * Sets the maximum number of retries for the client. Defaults to 2 retries. */ - public AsyncBaseClientBuilder maxRetries(int maxRetries) { + public PipedreamClientBuilder maxRetries(int maxRetries) { this.clientOptionsBuilder.maxRetries(maxRetries); return this; } @@ -75,17 +75,17 @@ public AsyncBaseClientBuilder maxRetries(int maxRetries) { /** * Sets the underlying OkHttp client */ - public AsyncBaseClientBuilder httpClient(OkHttpClient httpClient) { + public PipedreamClientBuilder httpClient(OkHttpClient httpClient) { this.clientOptionsBuilder.httpClient(httpClient); return this; } - public AsyncBaseClientBuilder projectId(String projectId) { + public PipedreamClientBuilder projectId(String projectId) { clientOptionsBuilder.projectId(projectId); return this; } - public AsyncBaseClient build() { + public PipedreamClient build() { OauthTokensClient authClient = new OauthTokensClient( ClientOptions.builder().environment(this.environment).build()); OAuthTokenSupplier oAuthTokenSupplier = new OAuthTokenSupplier(clientId, clientSecret, authClient); @@ -94,6 +94,6 @@ public AsyncBaseClient build() { this.clientOptionsBuilder.addHeader("x-pd-environment", this.projectEnvironment); } clientOptionsBuilder.environment(this.environment); - return new AsyncBaseClient(clientOptionsBuilder.build()); + return new PipedreamClient(clientOptionsBuilder.build()); } } diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ClientOptions.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ClientOptions.java index 879c0aa..5226e33 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ClientOptions.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ClientOptions.java @@ -37,7 +37,7 @@ private ClientOptions( { put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.pipedream.fern:api-sdk"); - put("X-Fern-SDK-Version", "0.0.220"); + put("X-Fern-SDK-Version", "0.0.236"); } }); this.headerSuppliers = headerSuppliers; diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/BaseClientApiException.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamClientApiException.java similarity index 79% rename from build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/BaseClientApiException.java rename to build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamClientApiException.java index a2680b0..66c5c11 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/BaseClientApiException.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamClientApiException.java @@ -12,7 +12,7 @@ /** * This exception type will be thrown for any non-2XX API responses. */ -public class BaseClientApiException extends BaseClientException { +public class PipedreamClientApiException extends PipedreamClientException { /** * The error code of the response that triggered the exception. */ @@ -25,14 +25,14 @@ public class BaseClientApiException extends BaseClientException { private final Map> headers; - public BaseClientApiException(String message, int statusCode, Object body) { + public PipedreamClientApiException(String message, int statusCode, Object body) { super(message); this.statusCode = statusCode; this.body = body; this.headers = new HashMap<>(); } - public BaseClientApiException(String message, int statusCode, Object body, Response rawResponse) { + public PipedreamClientApiException(String message, int statusCode, Object body, Response rawResponse) { super(message); this.statusCode = statusCode; this.body = body; @@ -67,7 +67,7 @@ public Map> headers() { @java.lang.Override public String toString() { - return "BaseClientApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " + return "PipedreamClientApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " + body + "}"; } } diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/BaseClientException.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamClientException.java similarity index 57% rename from build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/BaseClientException.java rename to build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamClientException.java index e034e68..889b5f3 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/BaseClientException.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamClientException.java @@ -6,12 +6,12 @@ /** * This class serves as the base exception for all errors in the SDK. */ -public class BaseClientException extends RuntimeException { - public BaseClientException(String message) { +public class PipedreamClientException extends RuntimeException { + public PipedreamClientException(String message) { super(message); } - public BaseClientException(String message, Exception e) { + public PipedreamClientException(String message, Exception e) { super(message, e); } } diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/BaseClientHttpResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamClientHttpResponse.java similarity index 86% rename from build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/BaseClientHttpResponse.java rename to build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamClientHttpResponse.java index 68376ae..9e774e6 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/BaseClientHttpResponse.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamClientHttpResponse.java @@ -9,13 +9,13 @@ import java.util.Map; import okhttp3.Response; -public final class BaseClientHttpResponse { +public final class PipedreamClientHttpResponse { private final T body; private final Map> headers; - public BaseClientHttpResponse(T body, Response rawResponse) { + public PipedreamClientHttpResponse(T body, Response rawResponse) { this.body = body; Map> headers = new HashMap<>(); diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java index 59601c1..5d6c677 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java @@ -3,12 +3,12 @@ */ package com.pipedream.api.resources.accounts; -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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -42,15 +42,16 @@ public AsyncRawAccountsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture>> list() { + public CompletableFuture>> list() { return list(AccountsListRequest.builder().build()); } - public CompletableFuture>> list(AccountsListRequest request) { + public CompletableFuture>> list( + AccountsListRequest request) { return list(request, null); } - public CompletableFuture>> list( + public CompletableFuture>> list( AccountsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -98,7 +99,7 @@ public CompletableFuture>> li if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -113,7 +114,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO .after(startingAfter) .build(); List result = parsedResponse.getData(); - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( new SyncPagingIterable(startingAfter.isPresent(), result, () -> { try { return list(nextRequest, requestOptions) @@ -127,30 +128,31 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> create(CreateAccountRequest request) { + public CompletableFuture> create(CreateAccountRequest request) { return create(request, null); } - public CompletableFuture> create( + public CompletableFuture> create( CreateAccountRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -194,46 +196,47 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> retrieve(String accountId) { + public CompletableFuture> retrieve(String accountId) { return retrieve(accountId, AccountsRetrieveRequest.builder().build()); } - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String accountId, AccountsRetrieveRequest request) { return retrieve(accountId, request, null); } - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -258,41 +261,43 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> delete(String accountId) { + public CompletableFuture> delete(String accountId) { return delete(accountId, null); } - public CompletableFuture> delete(String accountId, RequestOptions requestOptions) { + public CompletableFuture> delete( + String accountId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -309,40 +314,42 @@ public CompletableFuture> delete(String accountId, if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>(null, response)); + future.complete(new PipedreamClientHttpResponse<>(null, response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> deleteByApp(String appId) { + public CompletableFuture> deleteByApp(String appId) { return deleteByApp(appId, null); } - public CompletableFuture> deleteByApp(String appId, RequestOptions requestOptions) { + public CompletableFuture> deleteByApp( + String appId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -360,30 +367,31 @@ public CompletableFuture> deleteByApp(String appId, if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>(null, response)); + future.complete(new PipedreamClientHttpResponse<>(null, response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java index e90fe31..c85e1e3 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java @@ -3,12 +3,12 @@ */ package com.pipedream.api.resources.accounts; -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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -37,15 +37,15 @@ public RawAccountsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse> list() { + public PipedreamClientHttpResponse> list() { return list(AccountsListRequest.builder().build()); } - public BaseClientHttpResponse> list(AccountsListRequest request) { + public PipedreamClientHttpResponse> list(AccountsListRequest request) { return list(request, null); } - public BaseClientHttpResponse> list( + public PipedreamClientHttpResponse> list( AccountsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -104,28 +104,28 @@ public BaseClientHttpResponse> list( .after(startingAfter) .build(); List result = parsedResponse.getData(); - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( new SyncPagingIterable( startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) .body()), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse create(CreateAccountRequest request) { + public PipedreamClientHttpResponse create(CreateAccountRequest request) { return create(request, null); } - public BaseClientHttpResponse create(CreateAccountRequest request, RequestOptions requestOptions) { + public PipedreamClientHttpResponse create(CreateAccountRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -171,29 +171,29 @@ public BaseClientHttpResponse create(CreateAccountRequest request, Requ try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse retrieve(String accountId) { + public PipedreamClientHttpResponse retrieve(String accountId) { return retrieve(accountId, AccountsRetrieveRequest.builder().build()); } - public BaseClientHttpResponse retrieve(String accountId, AccountsRetrieveRequest request) { + public PipedreamClientHttpResponse retrieve(String accountId, AccountsRetrieveRequest request) { return retrieve(accountId, request, null); } - public BaseClientHttpResponse retrieve( + public PipedreamClientHttpResponse retrieve( String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -221,25 +221,25 @@ public BaseClientHttpResponse retrieve( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse delete(String accountId) { + public PipedreamClientHttpResponse delete(String accountId) { return delete(accountId, null); } - public BaseClientHttpResponse delete(String accountId, RequestOptions requestOptions) { + public PipedreamClientHttpResponse delete(String accountId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -259,24 +259,24 @@ public BaseClientHttpResponse delete(String accountId, RequestOptions requ try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>(null, response); + return new PipedreamClientHttpResponse<>(null, response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse deleteByApp(String appId) { + public PipedreamClientHttpResponse deleteByApp(String appId) { return deleteByApp(appId, null); } - public BaseClientHttpResponse deleteByApp(String appId, RequestOptions requestOptions) { + public PipedreamClientHttpResponse deleteByApp(String appId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -297,16 +297,16 @@ public BaseClientHttpResponse deleteByApp(String appId, RequestOptions req try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>(null, response); + return new PipedreamClientHttpResponse<>(null, response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java index 8b1ab94..77a4e86 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java @@ -3,12 +3,12 @@ */ package com.pipedream.api.resources.actions; -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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -47,15 +47,16 @@ public AsyncRawActionsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture>> list() { + public CompletableFuture>> list() { return list(ActionsListRequest.builder().build()); } - public CompletableFuture>> list(ActionsListRequest request) { + public CompletableFuture>> list( + ActionsListRequest request) { return list(request, null); } - public CompletableFuture>> list( + public CompletableFuture>> list( ActionsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -90,7 +91,8 @@ public CompletableFuture>> if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = + new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -105,7 +107,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO .after(startingAfter) .build(); List result = parsedResponse.getData(); - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( new SyncPagingIterable(startingAfter.isPresent(), result, () -> { try { return list(nextRequest, requestOptions) @@ -119,30 +121,31 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> retrieve(String componentId) { + public CompletableFuture> retrieve(String componentId) { return retrieve(componentId, null); } - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String componentId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -161,7 +164,7 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -169,35 +172,36 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { GetComponentResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); - future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); + future.complete(new PipedreamClientHttpResponse<>(parsedResponse.getData(), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> configureProp( + public CompletableFuture> configureProp( ActionsConfigurePropRequest request) { return configureProp(request, null); } - public CompletableFuture> configureProp( + public CompletableFuture> configureProp( ActionsConfigurePropRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -226,43 +230,44 @@ public CompletableFuture> configur if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> reloadProps( + public CompletableFuture> reloadProps( ActionsReloadPropsRequest request) { return reloadProps(request, null); } - public CompletableFuture> reloadProps( + public CompletableFuture> reloadProps( ActionsReloadPropsRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -291,42 +296,43 @@ public CompletableFuture> reloadProp if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> run(RunActionOpts request) { + public CompletableFuture> run(RunActionOpts request) { return run(request, null); } - public CompletableFuture> run( + public CompletableFuture> run( RunActionOpts request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -364,32 +370,33 @@ public CompletableFuture> run( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), RunActionResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java index 1dbf30b..b7275fe 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java @@ -3,12 +3,12 @@ */ package com.pipedream.api.resources.actions; -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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -42,15 +42,15 @@ public RawActionsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse> list() { + public PipedreamClientHttpResponse> list() { return list(ActionsListRequest.builder().build()); } - public BaseClientHttpResponse> list(ActionsListRequest request) { + public PipedreamClientHttpResponse> list(ActionsListRequest request) { return list(request, null); } - public BaseClientHttpResponse> list( + public PipedreamClientHttpResponse> list( ActionsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -96,28 +96,28 @@ public BaseClientHttpResponse> list( .after(startingAfter) .build(); List result = parsedResponse.getData(); - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( new SyncPagingIterable( startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) .body()), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse retrieve(String componentId) { + public PipedreamClientHttpResponse retrieve(String componentId) { return retrieve(componentId, null); } - public BaseClientHttpResponse retrieve(String componentId, RequestOptions requestOptions) { + public PipedreamClientHttpResponse retrieve(String componentId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -140,24 +140,24 @@ public BaseClientHttpResponse retrieve(String componentId, RequestOpt if (response.isSuccessful()) { GetComponentResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); - return new BaseClientHttpResponse<>(parsedResponse.getData(), response); + return new PipedreamClientHttpResponse<>(parsedResponse.getData(), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse configureProp(ActionsConfigurePropRequest request) { + public PipedreamClientHttpResponse configureProp(ActionsConfigurePropRequest request) { return configureProp(request, null); } - public BaseClientHttpResponse configureProp( + public PipedreamClientHttpResponse configureProp( ActionsConfigurePropRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -189,26 +189,26 @@ public BaseClientHttpResponse configureProp( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse reloadProps(ActionsReloadPropsRequest request) { + public PipedreamClientHttpResponse reloadProps(ActionsReloadPropsRequest request) { return reloadProps(request, null); } - public BaseClientHttpResponse reloadProps( + public PipedreamClientHttpResponse reloadProps( ActionsReloadPropsRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -240,26 +240,26 @@ public BaseClientHttpResponse reloadProps( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse run(RunActionOpts request) { + public PipedreamClientHttpResponse run(RunActionOpts request) { return run(request, null); } - public BaseClientHttpResponse run(RunActionOpts request, RequestOptions requestOptions) { + public PipedreamClientHttpResponse run(RunActionOpts request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -299,17 +299,17 @@ public BaseClientHttpResponse run(RunActionOpts request, Requ try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), RunActionResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java index ebaf619..0c8db06 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java @@ -4,11 +4,11 @@ package com.pipedream.api.resources.appcategories; import com.fasterxml.jackson.core.type.TypeReference; -import com.pipedream.api.core.BaseClientApiException; -import com.pipedream.api.core.BaseClientException; -import com.pipedream.api.core.BaseClientHttpResponse; import com.pipedream.api.core.ClientOptions; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.types.AppCategory; import java.io.IOException; @@ -31,11 +31,11 @@ public AsyncRawAppCategoriesClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture>> list() { + public CompletableFuture>> list() { return list(null); } - public CompletableFuture>> list(RequestOptions requestOptions) { + public CompletableFuture>> list(RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect/app_categories") @@ -50,43 +50,45 @@ public CompletableFuture>> list(Request if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> retrieve(String id) { + public CompletableFuture> retrieve(String id) { return retrieve(id, null); } - public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect/app_categories") @@ -102,32 +104,33 @@ public CompletableFuture> retrieve(String id if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), AppCategory.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java index 9fb1c24..e6a00ee 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java @@ -4,11 +4,11 @@ package com.pipedream.api.resources.appcategories; import com.fasterxml.jackson.core.type.TypeReference; -import com.pipedream.api.core.BaseClientApiException; -import com.pipedream.api.core.BaseClientException; -import com.pipedream.api.core.BaseClientHttpResponse; import com.pipedream.api.core.ClientOptions; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.types.AppCategory; import java.io.IOException; @@ -27,11 +27,11 @@ public RawAppCategoriesClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse> list() { + public PipedreamClientHttpResponse> list() { return list(null); } - public BaseClientHttpResponse> list(RequestOptions requestOptions) { + public PipedreamClientHttpResponse> list(RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect/app_categories") @@ -49,27 +49,27 @@ public BaseClientHttpResponse> list(RequestOptions requestOpti try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse retrieve(String id) { + public PipedreamClientHttpResponse retrieve(String id) { return retrieve(id, null); } - public BaseClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + public PipedreamClientHttpResponse retrieve(String id, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect/app_categories") @@ -88,17 +88,17 @@ public BaseClientHttpResponse retrieve(String id, RequestOptions re try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), AppCategory.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java index bd53d7d..d844d04 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java @@ -3,11 +3,11 @@ */ package com.pipedream.api.resources.apps; -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.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -37,15 +37,15 @@ public AsyncRawAppsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture>> list() { + public CompletableFuture>> list() { return list(AppsListRequest.builder().build()); } - public CompletableFuture>> list(AppsListRequest request) { + public CompletableFuture>> list(AppsListRequest request) { return list(request, null); } - public CompletableFuture>> list( + public CompletableFuture>> list( AppsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -87,7 +87,7 @@ public CompletableFuture>> list( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -102,7 +102,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO .after(startingAfter) .build(); List result = parsedResponse.getData(); - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( new SyncPagingIterable(startingAfter.isPresent(), result, () -> { try { return list(nextRequest, requestOptions) @@ -116,30 +116,31 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> retrieve(String appId) { + public CompletableFuture> retrieve(String appId) { return retrieve(appId, null); } - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String appId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -156,32 +157,33 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetAppResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java index 8b4a892..936baa1 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java @@ -3,11 +3,11 @@ */ package com.pipedream.api.resources.apps; -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.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -32,15 +32,15 @@ public RawAppsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse> list() { + public PipedreamClientHttpResponse> list() { return list(AppsListRequest.builder().build()); } - public BaseClientHttpResponse> list(AppsListRequest request) { + public PipedreamClientHttpResponse> list(AppsListRequest request) { return list(request, null); } - public BaseClientHttpResponse> list( + public PipedreamClientHttpResponse> list( AppsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -93,28 +93,28 @@ public BaseClientHttpResponse> list( .after(startingAfter) .build(); List result = parsedResponse.getData(); - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( new SyncPagingIterable( startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) .body()), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse retrieve(String appId) { + public PipedreamClientHttpResponse retrieve(String appId) { return retrieve(appId, null); } - public BaseClientHttpResponse retrieve(String appId, RequestOptions requestOptions) { + public PipedreamClientHttpResponse retrieve(String appId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect/apps") @@ -133,17 +133,17 @@ public BaseClientHttpResponse retrieve(String appId, RequestOpti try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetAppResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java index f0e05a6..5cfd7d0 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java @@ -3,12 +3,12 @@ */ package com.pipedream.api.resources.components; -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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -43,16 +43,16 @@ public AsyncRawComponentsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture>> list() { + public CompletableFuture>> list() { return list(ComponentsListRequest.builder().build()); } - public CompletableFuture>> list( + public CompletableFuture>> list( ComponentsListRequest request) { return list(request, null); } - public CompletableFuture>> list( + public CompletableFuture>> list( ComponentsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -87,7 +87,8 @@ public CompletableFuture>> if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = + new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -102,7 +103,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO .after(startingAfter) .build(); List result = parsedResponse.getData(); - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( new SyncPagingIterable(startingAfter.isPresent(), result, () -> { try { return list(nextRequest, requestOptions) @@ -116,30 +117,31 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> retrieve(String componentId) { + public CompletableFuture> retrieve(String componentId) { return retrieve(componentId, null); } - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String componentId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -158,7 +160,7 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -166,35 +168,36 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { GetComponentResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); - future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); + future.complete(new PipedreamClientHttpResponse<>(parsedResponse.getData(), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> configureProp( + public CompletableFuture> configureProp( ComponentsConfigurePropRequest request) { return configureProp(request, null); } - public CompletableFuture> configureProp( + public CompletableFuture> configureProp( ComponentsConfigurePropRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -223,43 +226,44 @@ public CompletableFuture> configur if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> reloadProps( + public CompletableFuture> reloadProps( ComponentsReloadPropsRequest request) { return reloadProps(request, null); } - public CompletableFuture> reloadProps( + public CompletableFuture> reloadProps( ComponentsReloadPropsRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -288,32 +292,33 @@ public CompletableFuture> reloadProp if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java index 9cd5a6f..915b9e1 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java @@ -3,12 +3,12 @@ */ package com.pipedream.api.resources.components; -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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -38,15 +38,15 @@ public RawComponentsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse> list() { + public PipedreamClientHttpResponse> list() { return list(ComponentsListRequest.builder().build()); } - public BaseClientHttpResponse> list(ComponentsListRequest request) { + public PipedreamClientHttpResponse> list(ComponentsListRequest request) { return list(request, null); } - public BaseClientHttpResponse> list( + public PipedreamClientHttpResponse> list( ComponentsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -92,28 +92,28 @@ public BaseClientHttpResponse> list( .after(startingAfter) .build(); List result = parsedResponse.getData(); - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( new SyncPagingIterable( startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) .body()), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse retrieve(String componentId) { + public PipedreamClientHttpResponse retrieve(String componentId) { return retrieve(componentId, null); } - public BaseClientHttpResponse retrieve(String componentId, RequestOptions requestOptions) { + public PipedreamClientHttpResponse retrieve(String componentId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -136,24 +136,24 @@ public BaseClientHttpResponse retrieve(String componentId, RequestOpt if (response.isSuccessful()) { GetComponentResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); - return new BaseClientHttpResponse<>(parsedResponse.getData(), response); + return new PipedreamClientHttpResponse<>(parsedResponse.getData(), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse configureProp(ComponentsConfigurePropRequest request) { + public PipedreamClientHttpResponse configureProp(ComponentsConfigurePropRequest request) { return configureProp(request, null); } - public BaseClientHttpResponse configureProp( + public PipedreamClientHttpResponse configureProp( ComponentsConfigurePropRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -185,26 +185,26 @@ public BaseClientHttpResponse configureProp( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse reloadProps(ComponentsReloadPropsRequest request) { + public PipedreamClientHttpResponse reloadProps(ComponentsReloadPropsRequest request) { return reloadProps(request, null); } - public BaseClientHttpResponse reloadProps( + public PipedreamClientHttpResponse reloadProps( ComponentsReloadPropsRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -236,18 +236,18 @@ public BaseClientHttpResponse reloadProps( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java index e91dca3..fcec7ce 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java @@ -3,12 +3,12 @@ */ package com.pipedream.api.resources.deployedtriggers; -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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -53,12 +53,12 @@ public AsyncRawDeployedTriggersClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture>> list( + public CompletableFuture>> list( DeployedTriggersListRequest request) { return list(request, null); } - public CompletableFuture>> list( + public CompletableFuture>> list( DeployedTriggersListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -88,7 +88,7 @@ public CompletableFuture>> future = + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -104,7 +104,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO .after(startingAfter) .build(); List result = parsedResponse.getData(); - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( new SyncPagingIterable(startingAfter.isPresent(), result, () -> { try { return list(nextRequest, requestOptions) @@ -118,31 +118,32 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String triggerId, DeployedTriggersRetrieveRequest request) { return retrieve(triggerId, request, null); } - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -161,7 +162,7 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -169,35 +170,36 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { GetTriggerResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); - future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); + future.complete(new PipedreamClientHttpResponse<>(parsedResponse.getData(), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> update( + public CompletableFuture> update( String triggerId, UpdateTriggerOpts request) { return update(triggerId, request, null); } - public CompletableFuture> update( + public CompletableFuture> update( String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -234,7 +236,7 @@ public CompletableFuture> update( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -242,35 +244,36 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { GetTriggerResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); - future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); + future.complete(new PipedreamClientHttpResponse<>(parsedResponse.getData(), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> delete( + public CompletableFuture> delete( String triggerId, DeployedTriggersDeleteRequest request) { return delete(triggerId, request, null); } - public CompletableFuture> delete( + public CompletableFuture> delete( String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -292,41 +295,42 @@ public CompletableFuture> delete( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>(null, response)); + future.complete(new PipedreamClientHttpResponse<>(null, response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture>> listEvents( + public CompletableFuture>> listEvents( String triggerId, DeployedTriggersListEventsRequest request) { return listEvents(triggerId, request, null); } - public CompletableFuture>> listEvents( + public CompletableFuture>> listEvents( String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -349,7 +353,7 @@ public CompletableFuture>> listEvents( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -357,35 +361,36 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { GetTriggerEventsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), GetTriggerEventsResponse.class); - future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); + future.complete(new PipedreamClientHttpResponse<>(parsedResponse.getData(), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> listWorkflows( + public CompletableFuture> listWorkflows( String triggerId, DeployedTriggersListWorkflowsRequest request) { return listWorkflows(triggerId, request, null); } - public CompletableFuture> listWorkflows( + public CompletableFuture> listWorkflows( String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -405,44 +410,45 @@ public CompletableFuture> li if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), GetTriggerWorkflowsResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> updateWorkflows( + public CompletableFuture> updateWorkflows( String triggerId, UpdateTriggerWorkflowsOpts request) { return updateWorkflows(triggerId, request, null); } - public CompletableFuture> updateWorkflows( + public CompletableFuture> updateWorkflows( String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -472,44 +478,45 @@ public CompletableFuture> up if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), GetTriggerWorkflowsResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> listWebhooks( + public CompletableFuture> listWebhooks( String triggerId, DeployedTriggersListWebhooksRequest request) { return listWebhooks(triggerId, request, null); } - public CompletableFuture> listWebhooks( + public CompletableFuture> listWebhooks( String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -529,44 +536,45 @@ public CompletableFuture> lis if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), GetTriggerWebhooksResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> updateWebhooks( + public CompletableFuture> updateWebhooks( String triggerId, UpdateTriggerWebhooksOpts request) { return updateWebhooks(triggerId, request, null); } - public CompletableFuture> updateWebhooks( + public CompletableFuture> updateWebhooks( String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -596,33 +604,34 @@ public CompletableFuture> upd if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), GetTriggerWebhooksResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java index 837d672..c14c963 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java @@ -3,12 +3,12 @@ */ package com.pipedream.api.resources.deployedtriggers; -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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -48,11 +48,12 @@ public RawDeployedTriggersClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse> list(DeployedTriggersListRequest request) { + public PipedreamClientHttpResponse> list( + DeployedTriggersListRequest request) { return list(request, null); } - public BaseClientHttpResponse> list( + public PipedreamClientHttpResponse> list( DeployedTriggersListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -93,29 +94,29 @@ public BaseClientHttpResponse> list( .after(startingAfter) .build(); List result = parsedResponse.getData(); - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( new SyncPagingIterable( startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) .body()), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse retrieve( + public PipedreamClientHttpResponse retrieve( String triggerId, DeployedTriggersRetrieveRequest request) { return retrieve(triggerId, request, null); } - public BaseClientHttpResponse retrieve( + public PipedreamClientHttpResponse retrieve( String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -139,24 +140,24 @@ public BaseClientHttpResponse retrieve( if (response.isSuccessful()) { GetTriggerResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); - return new BaseClientHttpResponse<>(parsedResponse.getData(), response); + return new PipedreamClientHttpResponse<>(parsedResponse.getData(), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse update(String triggerId, UpdateTriggerOpts request) { + public PipedreamClientHttpResponse update(String triggerId, UpdateTriggerOpts request) { return update(triggerId, request, null); } - public BaseClientHttpResponse update( + public PipedreamClientHttpResponse update( String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -198,24 +199,24 @@ public BaseClientHttpResponse update( if (response.isSuccessful()) { GetTriggerResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); - return new BaseClientHttpResponse<>(parsedResponse.getData(), response); + return new PipedreamClientHttpResponse<>(parsedResponse.getData(), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse delete(String triggerId, DeployedTriggersDeleteRequest request) { + public PipedreamClientHttpResponse delete(String triggerId, DeployedTriggersDeleteRequest request) { return delete(triggerId, request, null); } - public BaseClientHttpResponse delete( + public PipedreamClientHttpResponse delete( String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -240,25 +241,25 @@ public BaseClientHttpResponse delete( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>(null, response); + return new PipedreamClientHttpResponse<>(null, response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse> listEvents( + public PipedreamClientHttpResponse> listEvents( String triggerId, DeployedTriggersListEventsRequest request) { return listEvents(triggerId, request, null); } - public BaseClientHttpResponse> listEvents( + public PipedreamClientHttpResponse> listEvents( String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -286,25 +287,25 @@ public BaseClientHttpResponse> listEvents( if (response.isSuccessful()) { GetTriggerEventsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerEventsResponse.class); - return new BaseClientHttpResponse<>(parsedResponse.getData(), response); + return new PipedreamClientHttpResponse<>(parsedResponse.getData(), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse listWorkflows( + public PipedreamClientHttpResponse listWorkflows( String triggerId, DeployedTriggersListWorkflowsRequest request) { return listWorkflows(triggerId, request, null); } - public BaseClientHttpResponse listWorkflows( + public PipedreamClientHttpResponse listWorkflows( String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -327,27 +328,27 @@ public BaseClientHttpResponse listWorkflows( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWorkflowsResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse updateWorkflows( + public PipedreamClientHttpResponse updateWorkflows( String triggerId, UpdateTriggerWorkflowsOpts request) { return updateWorkflows(triggerId, request, null); } - public BaseClientHttpResponse updateWorkflows( + public PipedreamClientHttpResponse updateWorkflows( String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -380,27 +381,27 @@ public BaseClientHttpResponse updateWorkflows( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWorkflowsResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse listWebhooks( + public PipedreamClientHttpResponse listWebhooks( String triggerId, DeployedTriggersListWebhooksRequest request) { return listWebhooks(triggerId, request, null); } - public BaseClientHttpResponse listWebhooks( + public PipedreamClientHttpResponse listWebhooks( String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -423,27 +424,27 @@ public BaseClientHttpResponse listWebhooks( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWebhooksResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse updateWebhooks( + public PipedreamClientHttpResponse updateWebhooks( String triggerId, UpdateTriggerWebhooksOpts request) { return updateWebhooks(triggerId, request, null); } - public BaseClientHttpResponse updateWebhooks( + public PipedreamClientHttpResponse updateWebhooks( String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -476,18 +477,18 @@ public BaseClientHttpResponse updateWebhooks( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWebhooksResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java index 1e0479b..0f9feec 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java @@ -4,12 +4,12 @@ package com.pipedream.api.resources.oauthtokens; 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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; import com.pipedream.api.types.CreateOAuthTokenResponse; @@ -33,11 +33,12 @@ public AsyncRawOauthTokensClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture> create(CreateOAuthTokenOpts request) { + public CompletableFuture> create( + CreateOAuthTokenOpts request) { return create(request, null); } - public CompletableFuture> create( + public CompletableFuture> create( CreateOAuthTokenOpts request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -48,7 +49,7 @@ public CompletableFuture> creat body = RequestBody.create( ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); } catch (JsonProcessingException e) { - throw new BaseClientException("Failed to serialize request", e); + throw new PipedreamClientException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() .url(httpUrl) @@ -61,33 +62,34 @@ public CompletableFuture> creat if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), CreateOAuthTokenResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java index 6dd34fb..46f0f2c 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java @@ -4,12 +4,12 @@ package com.pipedream.api.resources.oauthtokens; 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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; import com.pipedream.api.types.CreateOAuthTokenResponse; @@ -29,11 +29,11 @@ public RawOauthTokensClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse create(CreateOAuthTokenOpts request) { + public PipedreamClientHttpResponse create(CreateOAuthTokenOpts request) { return create(request, null); } - public BaseClientHttpResponse create( + public PipedreamClientHttpResponse create( CreateOAuthTokenOpts request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -44,7 +44,7 @@ public BaseClientHttpResponse create( body = RequestBody.create( ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); } catch (JsonProcessingException e) { - throw new BaseClientException("Failed to serialize request", e); + throw new PipedreamClientException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() .url(httpUrl) @@ -60,18 +60,18 @@ public BaseClientHttpResponse create( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateOAuthTokenResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java index 89c9ec3..1257726 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java @@ -3,11 +3,11 @@ */ package com.pipedream.api.resources.projects; -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.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.types.ProjectInfoResponse; import java.io.IOException; @@ -29,11 +29,12 @@ public AsyncRawProjectsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture> retrieveInfo() { + public CompletableFuture> retrieveInfo() { return retrieveInfo(null); } - public CompletableFuture> retrieveInfo(RequestOptions requestOptions) { + public CompletableFuture> retrieveInfo( + RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -50,32 +51,33 @@ public CompletableFuture> retrieveIn if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProjectInfoResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java index c927bf5..0812d7d 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java @@ -3,11 +3,11 @@ */ package com.pipedream.api.resources.projects; -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.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.types.ProjectInfoResponse; import java.io.IOException; @@ -25,11 +25,11 @@ public RawProjectsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse retrieveInfo() { + public PipedreamClientHttpResponse retrieveInfo() { return retrieveInfo(null); } - public BaseClientHttpResponse retrieveInfo(RequestOptions requestOptions) { + public PipedreamClientHttpResponse retrieveInfo(RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -49,18 +49,18 @@ public BaseClientHttpResponse retrieveInfo(RequestOptions r try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProjectInfoResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java index 30ca813..eed96c5 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java @@ -4,12 +4,12 @@ package com.pipedream.api.resources.proxy; import com.fasterxml.jackson.core.type.TypeReference; -import com.pipedream.api.core.BaseClientApiException; -import com.pipedream.api.core.BaseClientException; -import com.pipedream.api.core.BaseClientHttpResponse; import com.pipedream.api.core.ClientOptions; import com.pipedream.api.core.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; @@ -38,11 +38,12 @@ public AsyncRawProxyClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture>> get(String url64, ProxyGetRequest request) { + public CompletableFuture>> get( + String url64, ProxyGetRequest request) { return get(url64, request, null); } - public CompletableFuture>> get( + public CompletableFuture>> get( String url64, ProxyGetRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -62,43 +63,45 @@ public CompletableFuture>> get( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture>> post(String url64, ProxyPostRequest request) { + public CompletableFuture>> post( + String url64, ProxyPostRequest request) { return post(url64, request, null); } - public CompletableFuture>> post( + public CompletableFuture>> post( String url64, ProxyPostRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -126,43 +129,45 @@ public CompletableFuture>> post( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture>> put(String url64, ProxyPutRequest request) { + public CompletableFuture>> put( + String url64, ProxyPutRequest request) { return put(url64, request, null); } - public CompletableFuture>> put( + public CompletableFuture>> put( String url64, ProxyPutRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -190,44 +195,45 @@ public CompletableFuture>> put( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture>> delete( + public CompletableFuture>> delete( String url64, ProxyDeleteRequest request) { return delete(url64, request, null); } - public CompletableFuture>> delete( + public CompletableFuture>> delete( String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -247,44 +253,45 @@ public CompletableFuture>> delete( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture>> patch( + public CompletableFuture>> patch( String url64, ProxyPatchRequest request) { return patch(url64, request, null); } - public CompletableFuture>> patch( + public CompletableFuture>> patch( String url64, ProxyPatchRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -312,33 +319,34 @@ public CompletableFuture>> patch( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java index fb9c5bf..474415d 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java @@ -4,12 +4,12 @@ package com.pipedream.api.resources.proxy; import com.fasterxml.jackson.core.type.TypeReference; -import com.pipedream.api.core.BaseClientApiException; -import com.pipedream.api.core.BaseClientException; -import com.pipedream.api.core.BaseClientHttpResponse; import com.pipedream.api.core.ClientOptions; import com.pipedream.api.core.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; @@ -34,11 +34,11 @@ public RawProxyClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse> get(String url64, ProxyGetRequest request) { + public PipedreamClientHttpResponse> get(String url64, ProxyGetRequest request) { return get(url64, request, null); } - public BaseClientHttpResponse> get( + public PipedreamClientHttpResponse> get( String url64, ProxyGetRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -61,27 +61,27 @@ public BaseClientHttpResponse> get( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse> post(String url64, ProxyPostRequest request) { + public PipedreamClientHttpResponse> post(String url64, ProxyPostRequest request) { return post(url64, request, null); } - public BaseClientHttpResponse> post( + public PipedreamClientHttpResponse> post( String url64, ProxyPostRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -112,27 +112,27 @@ public BaseClientHttpResponse> post( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse> put(String url64, ProxyPutRequest request) { + public PipedreamClientHttpResponse> put(String url64, ProxyPutRequest request) { return put(url64, request, null); } - public BaseClientHttpResponse> put( + public PipedreamClientHttpResponse> put( String url64, ProxyPutRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -163,27 +163,27 @@ public BaseClientHttpResponse> put( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse> delete(String url64, ProxyDeleteRequest request) { + public PipedreamClientHttpResponse> delete(String url64, ProxyDeleteRequest request) { return delete(url64, request, null); } - public BaseClientHttpResponse> delete( + public PipedreamClientHttpResponse> delete( String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -206,27 +206,27 @@ public BaseClientHttpResponse> delete( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse> patch(String url64, ProxyPatchRequest request) { + public PipedreamClientHttpResponse> patch(String url64, ProxyPatchRequest request) { return patch(url64, request, null); } - public BaseClientHttpResponse> patch( + public PipedreamClientHttpResponse> patch( String url64, ProxyPatchRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -257,19 +257,19 @@ public BaseClientHttpResponse> patch( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java index 84570a9..080ffc5 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java @@ -4,12 +4,12 @@ package com.pipedream.api.resources.tokens; 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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; @@ -36,11 +36,11 @@ public AsyncRawTokensClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture> create(CreateTokenRequest request) { + public CompletableFuture> create(CreateTokenRequest request) { return create(request, null); } - public CompletableFuture> create( + public CompletableFuture> create( CreateTokenRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -51,7 +51,7 @@ public CompletableFuture> create( body = RequestBody.create( ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); } catch (JsonProcessingException e) { - throw new BaseClientException("Failed to serialize request", e); + throw new PipedreamClientException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() .url(httpUrl) @@ -64,47 +64,48 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateTokenResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> validate(String ctok) { + public CompletableFuture> validate(String ctok) { return validate(ctok, TokensValidateRequest.builder().build()); } - public CompletableFuture> validate( + public CompletableFuture> validate( String ctok, TokensValidateRequest request) { return validate(ctok, request, null); } - public CompletableFuture> validate( + public CompletableFuture> validate( String ctok, TokensValidateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -125,32 +126,33 @@ public CompletableFuture> validate if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ValidateTokenResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java index b18022c..5b65962 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java @@ -4,12 +4,12 @@ package com.pipedream.api.resources.tokens; 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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; @@ -32,11 +32,11 @@ public RawTokensClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse create(CreateTokenRequest request) { + public PipedreamClientHttpResponse create(CreateTokenRequest request) { return create(request, null); } - public BaseClientHttpResponse create( + public PipedreamClientHttpResponse create( CreateTokenRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -47,7 +47,7 @@ public BaseClientHttpResponse create( body = RequestBody.create( ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); } catch (JsonProcessingException e) { - throw new BaseClientException("Failed to serialize request", e); + throw new PipedreamClientException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() .url(httpUrl) @@ -63,30 +63,30 @@ public BaseClientHttpResponse create( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateTokenResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse validate(String ctok) { + public PipedreamClientHttpResponse validate(String ctok) { return validate(ctok, TokensValidateRequest.builder().build()); } - public BaseClientHttpResponse validate(String ctok, TokensValidateRequest request) { + public PipedreamClientHttpResponse validate(String ctok, TokensValidateRequest request) { return validate(ctok, request, null); } - public BaseClientHttpResponse validate( + public PipedreamClientHttpResponse validate( String ctok, TokensValidateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -110,18 +110,18 @@ public BaseClientHttpResponse validate( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ValidateTokenResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java index ddc9aff..4b4a28d 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java @@ -4,12 +4,12 @@ package com.pipedream.api.resources.triggers; 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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -47,15 +47,16 @@ public AsyncRawTriggersClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture>> list() { + public CompletableFuture>> list() { return list(TriggersListRequest.builder().build()); } - public CompletableFuture>> list(TriggersListRequest request) { + public CompletableFuture>> list( + TriggersListRequest request) { return list(request, null); } - public CompletableFuture>> list( + public CompletableFuture>> list( TriggersListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -90,7 +91,8 @@ public CompletableFuture>> if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = + new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -105,7 +107,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO .after(startingAfter) .build(); List result = parsedResponse.getData(); - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( new SyncPagingIterable(startingAfter.isPresent(), result, () -> { try { return list(nextRequest, requestOptions) @@ -119,30 +121,31 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> retrieve(String componentId) { + public CompletableFuture> retrieve(String componentId) { return retrieve(componentId, null); } - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String componentId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -161,7 +164,7 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -169,35 +172,36 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { GetComponentResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); - future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); + future.complete(new PipedreamClientHttpResponse<>(parsedResponse.getData(), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> configureProp( + public CompletableFuture> configureProp( TriggersConfigurePropRequest request) { return configureProp(request, null); } - public CompletableFuture> configureProp( + public CompletableFuture> configureProp( TriggersConfigurePropRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -226,43 +230,44 @@ public CompletableFuture> configur if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> reloadProps( + public CompletableFuture> reloadProps( TriggersReloadPropsRequest request) { return reloadProps(request, null); } - public CompletableFuture> reloadProps( + public CompletableFuture> reloadProps( TriggersReloadPropsRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -291,42 +296,43 @@ public CompletableFuture> reloadProp if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> deploy(DeployTriggerOpts request) { + public CompletableFuture> deploy(DeployTriggerOpts request) { return deploy(request, null); } - public CompletableFuture> deploy( + public CompletableFuture> deploy( DeployTriggerOpts request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -339,7 +345,7 @@ public CompletableFuture> deploy( body = RequestBody.create( ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); } catch (JsonProcessingException e) { - throw new BaseClientException("Failed to serialize request", e); + throw new PipedreamClientException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() .url(httpUrl) @@ -352,7 +358,7 @@ public CompletableFuture> deploy( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -360,24 +366,25 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { DeployTriggerResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeployTriggerResponse.class); - future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); + future.complete(new PipedreamClientHttpResponse<>(parsedResponse.getData(), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java index 192686d..b31c677 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java @@ -4,12 +4,12 @@ package com.pipedream.api.resources.triggers; 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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -42,15 +42,15 @@ public RawTriggersClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse> list() { + public PipedreamClientHttpResponse> list() { return list(TriggersListRequest.builder().build()); } - public BaseClientHttpResponse> list(TriggersListRequest request) { + public PipedreamClientHttpResponse> list(TriggersListRequest request) { return list(request, null); } - public BaseClientHttpResponse> list( + public PipedreamClientHttpResponse> list( TriggersListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -96,28 +96,28 @@ public BaseClientHttpResponse> list( .after(startingAfter) .build(); List result = parsedResponse.getData(); - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( new SyncPagingIterable( startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) .body()), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse retrieve(String componentId) { + public PipedreamClientHttpResponse retrieve(String componentId) { return retrieve(componentId, null); } - public BaseClientHttpResponse retrieve(String componentId, RequestOptions requestOptions) { + public PipedreamClientHttpResponse retrieve(String componentId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -140,24 +140,24 @@ public BaseClientHttpResponse retrieve(String componentId, RequestOpt if (response.isSuccessful()) { GetComponentResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); - return new BaseClientHttpResponse<>(parsedResponse.getData(), response); + return new PipedreamClientHttpResponse<>(parsedResponse.getData(), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse configureProp(TriggersConfigurePropRequest request) { + public PipedreamClientHttpResponse configureProp(TriggersConfigurePropRequest request) { return configureProp(request, null); } - public BaseClientHttpResponse configureProp( + public PipedreamClientHttpResponse configureProp( TriggersConfigurePropRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -189,26 +189,26 @@ public BaseClientHttpResponse configureProp( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse reloadProps(TriggersReloadPropsRequest request) { + public PipedreamClientHttpResponse reloadProps(TriggersReloadPropsRequest request) { return reloadProps(request, null); } - public BaseClientHttpResponse reloadProps( + public PipedreamClientHttpResponse reloadProps( TriggersReloadPropsRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -240,26 +240,27 @@ public BaseClientHttpResponse reloadProps( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse deploy(DeployTriggerOpts request) { + public PipedreamClientHttpResponse deploy(DeployTriggerOpts request) { return deploy(request, null); } - public BaseClientHttpResponse deploy(DeployTriggerOpts request, RequestOptions requestOptions) { + public PipedreamClientHttpResponse deploy( + DeployTriggerOpts request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -271,7 +272,7 @@ public BaseClientHttpResponse deploy(DeployTriggerOpts reques body = RequestBody.create( ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); } catch (JsonProcessingException e) { - throw new BaseClientException("Failed to serialize request", e); + throw new PipedreamClientException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() .url(httpUrl) @@ -289,16 +290,16 @@ public BaseClientHttpResponse deploy(DeployTriggerOpts reques if (response.isSuccessful()) { DeployTriggerResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeployTriggerResponse.class); - return new BaseClientHttpResponse<>(parsedResponse.getData(), response); + return new PipedreamClientHttpResponse<>(parsedResponse.getData(), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java index 53d886e..79210d1 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java @@ -3,11 +3,11 @@ */ package com.pipedream.api.resources.users; -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.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.RequestOptions; import java.io.IOException; import java.util.concurrent.CompletableFuture; @@ -28,11 +28,11 @@ public AsyncRawUsersClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture> deleteExternalUser(String externalUserId) { + public CompletableFuture> deleteExternalUser(String externalUserId) { return deleteExternalUser(externalUserId, null); } - public CompletableFuture> deleteExternalUser( + public CompletableFuture> deleteExternalUser( String externalUserId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -50,30 +50,31 @@ public CompletableFuture> deleteExternalUser( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>(null, response)); + future.complete(new PipedreamClientHttpResponse<>(null, response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java index 69011b7..d033ab1 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java @@ -3,11 +3,11 @@ */ package com.pipedream.api.resources.users; -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.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.RequestOptions; import java.io.IOException; import okhttp3.Headers; @@ -24,11 +24,11 @@ public RawUsersClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse deleteExternalUser(String externalUserId) { + public PipedreamClientHttpResponse deleteExternalUser(String externalUserId) { return deleteExternalUser(externalUserId, null); } - public BaseClientHttpResponse deleteExternalUser(String externalUserId, RequestOptions requestOptions) { + public PipedreamClientHttpResponse deleteExternalUser(String externalUserId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -48,16 +48,16 @@ public BaseClientHttpResponse deleteExternalUser(String externalUserId, Re try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>(null, response); + return new PipedreamClientHttpResponse<>(null, response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } diff --git a/sample-app/src/main/java/sample/App.java b/sample-app/src/main/java/sample/App.java index 103615f..e186956 100644 --- a/sample-app/src/main/java/sample/App.java +++ b/sample-app/src/main/java/sample/App.java @@ -8,6 +8,6 @@ public final class App { public static void main(String[] args) { - // import com.pipedream.api.AsyncBaseClient + // import com.pipedream.api.AsyncPipedreamClient } } diff --git a/src/main/java/com/pipedream/api/AsyncBaseClient.java b/src/main/java/com/pipedream/api/AsyncPipedreamClient.java similarity index 95% rename from src/main/java/com/pipedream/api/AsyncBaseClient.java rename to src/main/java/com/pipedream/api/AsyncPipedreamClient.java index 39ecdab..18c971a 100644 --- a/src/main/java/com/pipedream/api/AsyncBaseClient.java +++ b/src/main/java/com/pipedream/api/AsyncPipedreamClient.java @@ -19,7 +19,7 @@ import com.pipedream.api.resources.users.AsyncUsersClient; import java.util.function.Supplier; -public class AsyncBaseClient { +public class AsyncPipedreamClient { protected final ClientOptions clientOptions; protected final Supplier appCategoriesClient; @@ -46,7 +46,7 @@ public class AsyncBaseClient { protected final Supplier oauthTokensClient; - public AsyncBaseClient(ClientOptions clientOptions) { + public AsyncPipedreamClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; this.appCategoriesClient = Suppliers.memoize(() -> new AsyncAppCategoriesClient(clientOptions)); this.appsClient = Suppliers.memoize(() -> new AsyncAppsClient(clientOptions)); @@ -110,7 +110,7 @@ public AsyncOauthTokensClient oauthTokens() { return this.oauthTokensClient.get(); } - public static AsyncBaseClientBuilder builder() { - return new AsyncBaseClientBuilder(); + public static AsyncPipedreamClientBuilder builder() { + return new AsyncPipedreamClientBuilder(); } } diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/BaseClientBuilder.java b/src/main/java/com/pipedream/api/AsyncPipedreamClientBuilder.java similarity index 75% rename from build/spotless/spotlessJava/src/main/java/com/pipedream/api/BaseClientBuilder.java rename to src/main/java/com/pipedream/api/AsyncPipedreamClientBuilder.java index 59ed177..69fa31a 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/BaseClientBuilder.java +++ b/src/main/java/com/pipedream/api/AsyncPipedreamClientBuilder.java @@ -9,7 +9,7 @@ import com.pipedream.api.resources.oauthtokens.OauthTokensClient; import okhttp3.OkHttpClient; -public final class BaseClientBuilder { +public final class AsyncPipedreamClientBuilder { private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); private String clientId = System.getenv("PIPEDREAM_CLIENT_ID"); @@ -24,7 +24,7 @@ public final class BaseClientBuilder { * Sets clientId. * Defaults to the PIPEDREAM_CLIENT_ID environment variable. */ - public BaseClientBuilder clientId(String clientId) { + public AsyncPipedreamClientBuilder clientId(String clientId) { this.clientId = clientId; return this; } @@ -33,7 +33,7 @@ public BaseClientBuilder clientId(String clientId) { * Sets clientSecret. * Defaults to the PIPEDREAM_CLIENT_SECRET environment variable. */ - public BaseClientBuilder clientSecret(String clientSecret) { + public AsyncPipedreamClientBuilder clientSecret(String clientSecret) { this.clientSecret = clientSecret; return this; } @@ -41,17 +41,17 @@ public BaseClientBuilder clientSecret(String clientSecret) { /** * Sets projectEnvironment */ - public BaseClientBuilder projectEnvironment(String projectEnvironment) { + public AsyncPipedreamClientBuilder projectEnvironment(String projectEnvironment) { this.projectEnvironment = projectEnvironment; return this; } - public BaseClientBuilder environment(Environment environment) { + public AsyncPipedreamClientBuilder environment(Environment environment) { this.environment = environment; return this; } - public BaseClientBuilder url(String url) { + public AsyncPipedreamClientBuilder url(String url) { this.environment = Environment.custom(url); return this; } @@ -59,7 +59,7 @@ public BaseClientBuilder url(String url) { /** * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. */ - public BaseClientBuilder timeout(int timeout) { + public AsyncPipedreamClientBuilder timeout(int timeout) { this.clientOptionsBuilder.timeout(timeout); return this; } @@ -67,7 +67,7 @@ public BaseClientBuilder timeout(int timeout) { /** * Sets the maximum number of retries for the client. Defaults to 2 retries. */ - public BaseClientBuilder maxRetries(int maxRetries) { + public AsyncPipedreamClientBuilder maxRetries(int maxRetries) { this.clientOptionsBuilder.maxRetries(maxRetries); return this; } @@ -75,17 +75,17 @@ public BaseClientBuilder maxRetries(int maxRetries) { /** * Sets the underlying OkHttp client */ - public BaseClientBuilder httpClient(OkHttpClient httpClient) { + public AsyncPipedreamClientBuilder httpClient(OkHttpClient httpClient) { this.clientOptionsBuilder.httpClient(httpClient); return this; } - public BaseClientBuilder projectId(String projectId) { + public AsyncPipedreamClientBuilder projectId(String projectId) { clientOptionsBuilder.projectId(projectId); return this; } - public BaseClient build() { + public AsyncPipedreamClient build() { OauthTokensClient authClient = new OauthTokensClient( ClientOptions.builder().environment(this.environment).build()); OAuthTokenSupplier oAuthTokenSupplier = new OAuthTokenSupplier(clientId, clientSecret, authClient); @@ -94,6 +94,6 @@ public BaseClient build() { this.clientOptionsBuilder.addHeader("x-pd-environment", this.projectEnvironment); } clientOptionsBuilder.environment(this.environment); - return new BaseClient(clientOptionsBuilder.build()); + return new AsyncPipedreamClient(clientOptionsBuilder.build()); } } diff --git a/src/main/java/com/pipedream/api/BaseClient.java b/src/main/java/com/pipedream/api/PipedreamClient.java similarity index 95% rename from src/main/java/com/pipedream/api/BaseClient.java rename to src/main/java/com/pipedream/api/PipedreamClient.java index 69e5677..29ff449 100644 --- a/src/main/java/com/pipedream/api/BaseClient.java +++ b/src/main/java/com/pipedream/api/PipedreamClient.java @@ -19,7 +19,7 @@ import com.pipedream.api.resources.users.UsersClient; import java.util.function.Supplier; -public class BaseClient { +public class PipedreamClient { protected final ClientOptions clientOptions; protected final Supplier appCategoriesClient; @@ -46,7 +46,7 @@ public class BaseClient { protected final Supplier oauthTokensClient; - public BaseClient(ClientOptions clientOptions) { + public PipedreamClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; this.appCategoriesClient = Suppliers.memoize(() -> new AppCategoriesClient(clientOptions)); this.appsClient = Suppliers.memoize(() -> new AppsClient(clientOptions)); @@ -110,7 +110,7 @@ public OauthTokensClient oauthTokens() { return this.oauthTokensClient.get(); } - public static BaseClientBuilder builder() { - return new BaseClientBuilder(); + public static PipedreamClientBuilder builder() { + return new PipedreamClientBuilder(); } } diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncBaseClientBuilder.java b/src/main/java/com/pipedream/api/PipedreamClientBuilder.java similarity index 77% rename from build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncBaseClientBuilder.java rename to src/main/java/com/pipedream/api/PipedreamClientBuilder.java index 5759e8b..c8307da 100644 --- a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncBaseClientBuilder.java +++ b/src/main/java/com/pipedream/api/PipedreamClientBuilder.java @@ -9,7 +9,7 @@ import com.pipedream.api.resources.oauthtokens.OauthTokensClient; import okhttp3.OkHttpClient; -public final class AsyncBaseClientBuilder { +public final class PipedreamClientBuilder { private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); private String clientId = System.getenv("PIPEDREAM_CLIENT_ID"); @@ -24,7 +24,7 @@ public final class AsyncBaseClientBuilder { * Sets clientId. * Defaults to the PIPEDREAM_CLIENT_ID environment variable. */ - public AsyncBaseClientBuilder clientId(String clientId) { + public PipedreamClientBuilder clientId(String clientId) { this.clientId = clientId; return this; } @@ -33,7 +33,7 @@ public AsyncBaseClientBuilder clientId(String clientId) { * Sets clientSecret. * Defaults to the PIPEDREAM_CLIENT_SECRET environment variable. */ - public AsyncBaseClientBuilder clientSecret(String clientSecret) { + public PipedreamClientBuilder clientSecret(String clientSecret) { this.clientSecret = clientSecret; return this; } @@ -41,17 +41,17 @@ public AsyncBaseClientBuilder clientSecret(String clientSecret) { /** * Sets projectEnvironment */ - public AsyncBaseClientBuilder projectEnvironment(String projectEnvironment) { + public PipedreamClientBuilder projectEnvironment(String projectEnvironment) { this.projectEnvironment = projectEnvironment; return this; } - public AsyncBaseClientBuilder environment(Environment environment) { + public PipedreamClientBuilder environment(Environment environment) { this.environment = environment; return this; } - public AsyncBaseClientBuilder url(String url) { + public PipedreamClientBuilder url(String url) { this.environment = Environment.custom(url); return this; } @@ -59,7 +59,7 @@ public AsyncBaseClientBuilder url(String url) { /** * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. */ - public AsyncBaseClientBuilder timeout(int timeout) { + public PipedreamClientBuilder timeout(int timeout) { this.clientOptionsBuilder.timeout(timeout); return this; } @@ -67,7 +67,7 @@ public AsyncBaseClientBuilder timeout(int timeout) { /** * Sets the maximum number of retries for the client. Defaults to 2 retries. */ - public AsyncBaseClientBuilder maxRetries(int maxRetries) { + public PipedreamClientBuilder maxRetries(int maxRetries) { this.clientOptionsBuilder.maxRetries(maxRetries); return this; } @@ -75,17 +75,17 @@ public AsyncBaseClientBuilder maxRetries(int maxRetries) { /** * Sets the underlying OkHttp client */ - public AsyncBaseClientBuilder httpClient(OkHttpClient httpClient) { + public PipedreamClientBuilder httpClient(OkHttpClient httpClient) { this.clientOptionsBuilder.httpClient(httpClient); return this; } - public AsyncBaseClientBuilder projectId(String projectId) { + public PipedreamClientBuilder projectId(String projectId) { clientOptionsBuilder.projectId(projectId); return this; } - public AsyncBaseClient build() { + public PipedreamClient build() { OauthTokensClient authClient = new OauthTokensClient( ClientOptions.builder().environment(this.environment).build()); OAuthTokenSupplier oAuthTokenSupplier = new OAuthTokenSupplier(clientId, clientSecret, authClient); @@ -94,6 +94,6 @@ public AsyncBaseClient build() { this.clientOptionsBuilder.addHeader("x-pd-environment", this.projectEnvironment); } clientOptionsBuilder.environment(this.environment); - return new AsyncBaseClient(clientOptionsBuilder.build()); + return new PipedreamClient(clientOptionsBuilder.build()); } } diff --git a/src/main/java/com/pipedream/api/core/ClientOptions.java b/src/main/java/com/pipedream/api/core/ClientOptions.java index 879c0aa..5226e33 100644 --- a/src/main/java/com/pipedream/api/core/ClientOptions.java +++ b/src/main/java/com/pipedream/api/core/ClientOptions.java @@ -37,7 +37,7 @@ private ClientOptions( { put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.pipedream.fern:api-sdk"); - put("X-Fern-SDK-Version", "0.0.220"); + put("X-Fern-SDK-Version", "0.0.236"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/pipedream/api/core/BaseClientApiException.java b/src/main/java/com/pipedream/api/core/PipedreamClientApiException.java similarity index 79% rename from src/main/java/com/pipedream/api/core/BaseClientApiException.java rename to src/main/java/com/pipedream/api/core/PipedreamClientApiException.java index a2680b0..66c5c11 100644 --- a/src/main/java/com/pipedream/api/core/BaseClientApiException.java +++ b/src/main/java/com/pipedream/api/core/PipedreamClientApiException.java @@ -12,7 +12,7 @@ /** * This exception type will be thrown for any non-2XX API responses. */ -public class BaseClientApiException extends BaseClientException { +public class PipedreamClientApiException extends PipedreamClientException { /** * The error code of the response that triggered the exception. */ @@ -25,14 +25,14 @@ public class BaseClientApiException extends BaseClientException { private final Map> headers; - public BaseClientApiException(String message, int statusCode, Object body) { + public PipedreamClientApiException(String message, int statusCode, Object body) { super(message); this.statusCode = statusCode; this.body = body; this.headers = new HashMap<>(); } - public BaseClientApiException(String message, int statusCode, Object body, Response rawResponse) { + public PipedreamClientApiException(String message, int statusCode, Object body, Response rawResponse) { super(message); this.statusCode = statusCode; this.body = body; @@ -67,7 +67,7 @@ public Map> headers() { @java.lang.Override public String toString() { - return "BaseClientApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " + return "PipedreamClientApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " + body + "}"; } } diff --git a/src/main/java/com/pipedream/api/core/BaseClientException.java b/src/main/java/com/pipedream/api/core/PipedreamClientException.java similarity index 57% rename from src/main/java/com/pipedream/api/core/BaseClientException.java rename to src/main/java/com/pipedream/api/core/PipedreamClientException.java index e034e68..889b5f3 100644 --- a/src/main/java/com/pipedream/api/core/BaseClientException.java +++ b/src/main/java/com/pipedream/api/core/PipedreamClientException.java @@ -6,12 +6,12 @@ /** * This class serves as the base exception for all errors in the SDK. */ -public class BaseClientException extends RuntimeException { - public BaseClientException(String message) { +public class PipedreamClientException extends RuntimeException { + public PipedreamClientException(String message) { super(message); } - public BaseClientException(String message, Exception e) { + public PipedreamClientException(String message, Exception e) { super(message, e); } } diff --git a/src/main/java/com/pipedream/api/core/BaseClientHttpResponse.java b/src/main/java/com/pipedream/api/core/PipedreamClientHttpResponse.java similarity index 86% rename from src/main/java/com/pipedream/api/core/BaseClientHttpResponse.java rename to src/main/java/com/pipedream/api/core/PipedreamClientHttpResponse.java index 68376ae..9e774e6 100644 --- a/src/main/java/com/pipedream/api/core/BaseClientHttpResponse.java +++ b/src/main/java/com/pipedream/api/core/PipedreamClientHttpResponse.java @@ -9,13 +9,13 @@ import java.util.Map; import okhttp3.Response; -public final class BaseClientHttpResponse { +public final class PipedreamClientHttpResponse { private final T body; private final Map> headers; - public BaseClientHttpResponse(T body, Response rawResponse) { + public PipedreamClientHttpResponse(T body, Response rawResponse) { this.body = body; Map> headers = new HashMap<>(); 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 59601c1..5d6c677 100644 --- a/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java +++ b/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java @@ -3,12 +3,12 @@ */ package com.pipedream.api.resources.accounts; -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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -42,15 +42,16 @@ public AsyncRawAccountsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture>> list() { + public CompletableFuture>> list() { return list(AccountsListRequest.builder().build()); } - public CompletableFuture>> list(AccountsListRequest request) { + public CompletableFuture>> list( + AccountsListRequest request) { return list(request, null); } - public CompletableFuture>> list( + public CompletableFuture>> list( AccountsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -98,7 +99,7 @@ public CompletableFuture>> li if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -113,7 +114,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO .after(startingAfter) .build(); List result = parsedResponse.getData(); - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( new SyncPagingIterable(startingAfter.isPresent(), result, () -> { try { return list(nextRequest, requestOptions) @@ -127,30 +128,31 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> create(CreateAccountRequest request) { + public CompletableFuture> create(CreateAccountRequest request) { return create(request, null); } - public CompletableFuture> create( + public CompletableFuture> create( CreateAccountRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -194,46 +196,47 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> retrieve(String accountId) { + public CompletableFuture> retrieve(String accountId) { return retrieve(accountId, AccountsRetrieveRequest.builder().build()); } - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String accountId, AccountsRetrieveRequest request) { return retrieve(accountId, request, null); } - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -258,41 +261,43 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> delete(String accountId) { + public CompletableFuture> delete(String accountId) { return delete(accountId, null); } - public CompletableFuture> delete(String accountId, RequestOptions requestOptions) { + public CompletableFuture> delete( + String accountId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -309,40 +314,42 @@ public CompletableFuture> delete(String accountId, if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>(null, response)); + future.complete(new PipedreamClientHttpResponse<>(null, response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> deleteByApp(String appId) { + public CompletableFuture> deleteByApp(String appId) { return deleteByApp(appId, null); } - public CompletableFuture> deleteByApp(String appId, RequestOptions requestOptions) { + public CompletableFuture> deleteByApp( + String appId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -360,30 +367,31 @@ public CompletableFuture> deleteByApp(String appId, if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>(null, response)); + future.complete(new PipedreamClientHttpResponse<>(null, response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; 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 e90fe31..c85e1e3 100644 --- a/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java +++ b/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java @@ -3,12 +3,12 @@ */ package com.pipedream.api.resources.accounts; -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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -37,15 +37,15 @@ public RawAccountsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse> list() { + public PipedreamClientHttpResponse> list() { return list(AccountsListRequest.builder().build()); } - public BaseClientHttpResponse> list(AccountsListRequest request) { + public PipedreamClientHttpResponse> list(AccountsListRequest request) { return list(request, null); } - public BaseClientHttpResponse> list( + public PipedreamClientHttpResponse> list( AccountsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -104,28 +104,28 @@ public BaseClientHttpResponse> list( .after(startingAfter) .build(); List result = parsedResponse.getData(); - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( new SyncPagingIterable( startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) .body()), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse create(CreateAccountRequest request) { + public PipedreamClientHttpResponse create(CreateAccountRequest request) { return create(request, null); } - public BaseClientHttpResponse create(CreateAccountRequest request, RequestOptions requestOptions) { + public PipedreamClientHttpResponse create(CreateAccountRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -171,29 +171,29 @@ public BaseClientHttpResponse create(CreateAccountRequest request, Requ try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse retrieve(String accountId) { + public PipedreamClientHttpResponse retrieve(String accountId) { return retrieve(accountId, AccountsRetrieveRequest.builder().build()); } - public BaseClientHttpResponse retrieve(String accountId, AccountsRetrieveRequest request) { + public PipedreamClientHttpResponse retrieve(String accountId, AccountsRetrieveRequest request) { return retrieve(accountId, request, null); } - public BaseClientHttpResponse retrieve( + public PipedreamClientHttpResponse retrieve( String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -221,25 +221,25 @@ public BaseClientHttpResponse retrieve( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse delete(String accountId) { + public PipedreamClientHttpResponse delete(String accountId) { return delete(accountId, null); } - public BaseClientHttpResponse delete(String accountId, RequestOptions requestOptions) { + public PipedreamClientHttpResponse delete(String accountId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -259,24 +259,24 @@ public BaseClientHttpResponse delete(String accountId, RequestOptions requ try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>(null, response); + return new PipedreamClientHttpResponse<>(null, response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse deleteByApp(String appId) { + public PipedreamClientHttpResponse deleteByApp(String appId) { return deleteByApp(appId, null); } - public BaseClientHttpResponse deleteByApp(String appId, RequestOptions requestOptions) { + public PipedreamClientHttpResponse deleteByApp(String appId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -297,16 +297,16 @@ public BaseClientHttpResponse deleteByApp(String appId, RequestOptions req try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>(null, response); + return new PipedreamClientHttpResponse<>(null, response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } 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 8b1ab94..77a4e86 100644 --- a/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java +++ b/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java @@ -3,12 +3,12 @@ */ package com.pipedream.api.resources.actions; -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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -47,15 +47,16 @@ public AsyncRawActionsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture>> list() { + public CompletableFuture>> list() { return list(ActionsListRequest.builder().build()); } - public CompletableFuture>> list(ActionsListRequest request) { + public CompletableFuture>> list( + ActionsListRequest request) { return list(request, null); } - public CompletableFuture>> list( + public CompletableFuture>> list( ActionsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -90,7 +91,8 @@ public CompletableFuture>> if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = + new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -105,7 +107,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO .after(startingAfter) .build(); List result = parsedResponse.getData(); - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( new SyncPagingIterable(startingAfter.isPresent(), result, () -> { try { return list(nextRequest, requestOptions) @@ -119,30 +121,31 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> retrieve(String componentId) { + public CompletableFuture> retrieve(String componentId) { return retrieve(componentId, null); } - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String componentId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -161,7 +164,7 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -169,35 +172,36 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { GetComponentResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); - future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); + future.complete(new PipedreamClientHttpResponse<>(parsedResponse.getData(), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> configureProp( + public CompletableFuture> configureProp( ActionsConfigurePropRequest request) { return configureProp(request, null); } - public CompletableFuture> configureProp( + public CompletableFuture> configureProp( ActionsConfigurePropRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -226,43 +230,44 @@ public CompletableFuture> configur if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> reloadProps( + public CompletableFuture> reloadProps( ActionsReloadPropsRequest request) { return reloadProps(request, null); } - public CompletableFuture> reloadProps( + public CompletableFuture> reloadProps( ActionsReloadPropsRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -291,42 +296,43 @@ public CompletableFuture> reloadProp if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> run(RunActionOpts request) { + public CompletableFuture> run(RunActionOpts request) { return run(request, null); } - public CompletableFuture> run( + public CompletableFuture> run( RunActionOpts request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -364,32 +370,33 @@ public CompletableFuture> run( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), RunActionResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; 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 1dbf30b..b7275fe 100644 --- a/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java +++ b/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java @@ -3,12 +3,12 @@ */ package com.pipedream.api.resources.actions; -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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -42,15 +42,15 @@ public RawActionsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse> list() { + public PipedreamClientHttpResponse> list() { return list(ActionsListRequest.builder().build()); } - public BaseClientHttpResponse> list(ActionsListRequest request) { + public PipedreamClientHttpResponse> list(ActionsListRequest request) { return list(request, null); } - public BaseClientHttpResponse> list( + public PipedreamClientHttpResponse> list( ActionsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -96,28 +96,28 @@ public BaseClientHttpResponse> list( .after(startingAfter) .build(); List result = parsedResponse.getData(); - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( new SyncPagingIterable( startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) .body()), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse retrieve(String componentId) { + public PipedreamClientHttpResponse retrieve(String componentId) { return retrieve(componentId, null); } - public BaseClientHttpResponse retrieve(String componentId, RequestOptions requestOptions) { + public PipedreamClientHttpResponse retrieve(String componentId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -140,24 +140,24 @@ public BaseClientHttpResponse retrieve(String componentId, RequestOpt if (response.isSuccessful()) { GetComponentResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); - return new BaseClientHttpResponse<>(parsedResponse.getData(), response); + return new PipedreamClientHttpResponse<>(parsedResponse.getData(), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse configureProp(ActionsConfigurePropRequest request) { + public PipedreamClientHttpResponse configureProp(ActionsConfigurePropRequest request) { return configureProp(request, null); } - public BaseClientHttpResponse configureProp( + public PipedreamClientHttpResponse configureProp( ActionsConfigurePropRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -189,26 +189,26 @@ public BaseClientHttpResponse configureProp( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse reloadProps(ActionsReloadPropsRequest request) { + public PipedreamClientHttpResponse reloadProps(ActionsReloadPropsRequest request) { return reloadProps(request, null); } - public BaseClientHttpResponse reloadProps( + public PipedreamClientHttpResponse reloadProps( ActionsReloadPropsRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -240,26 +240,26 @@ public BaseClientHttpResponse reloadProps( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse run(RunActionOpts request) { + public PipedreamClientHttpResponse run(RunActionOpts request) { return run(request, null); } - public BaseClientHttpResponse run(RunActionOpts request, RequestOptions requestOptions) { + public PipedreamClientHttpResponse run(RunActionOpts request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -299,17 +299,17 @@ public BaseClientHttpResponse run(RunActionOpts request, Requ try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), RunActionResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("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 ebaf619..0c8db06 100644 --- a/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java +++ b/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java @@ -4,11 +4,11 @@ package com.pipedream.api.resources.appcategories; import com.fasterxml.jackson.core.type.TypeReference; -import com.pipedream.api.core.BaseClientApiException; -import com.pipedream.api.core.BaseClientException; -import com.pipedream.api.core.BaseClientHttpResponse; import com.pipedream.api.core.ClientOptions; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.types.AppCategory; import java.io.IOException; @@ -31,11 +31,11 @@ public AsyncRawAppCategoriesClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture>> list() { + public CompletableFuture>> list() { return list(null); } - public CompletableFuture>> list(RequestOptions requestOptions) { + public CompletableFuture>> list(RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect/app_categories") @@ -50,43 +50,45 @@ public CompletableFuture>> list(Request if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> retrieve(String id) { + public CompletableFuture> retrieve(String id) { return retrieve(id, null); } - public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect/app_categories") @@ -102,32 +104,33 @@ public CompletableFuture> retrieve(String id if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), AppCategory.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; 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 9fb1c24..e6a00ee 100644 --- a/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java +++ b/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java @@ -4,11 +4,11 @@ package com.pipedream.api.resources.appcategories; import com.fasterxml.jackson.core.type.TypeReference; -import com.pipedream.api.core.BaseClientApiException; -import com.pipedream.api.core.BaseClientException; -import com.pipedream.api.core.BaseClientHttpResponse; import com.pipedream.api.core.ClientOptions; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.types.AppCategory; import java.io.IOException; @@ -27,11 +27,11 @@ public RawAppCategoriesClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse> list() { + public PipedreamClientHttpResponse> list() { return list(null); } - public BaseClientHttpResponse> list(RequestOptions requestOptions) { + public PipedreamClientHttpResponse> list(RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect/app_categories") @@ -49,27 +49,27 @@ public BaseClientHttpResponse> list(RequestOptions requestOpti try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse retrieve(String id) { + public PipedreamClientHttpResponse retrieve(String id) { return retrieve(id, null); } - public BaseClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + public PipedreamClientHttpResponse retrieve(String id, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect/app_categories") @@ -88,17 +88,17 @@ public BaseClientHttpResponse retrieve(String id, RequestOptions re try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), AppCategory.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } 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 bd53d7d..d844d04 100644 --- a/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java +++ b/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java @@ -3,11 +3,11 @@ */ package com.pipedream.api.resources.apps; -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.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -37,15 +37,15 @@ public AsyncRawAppsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture>> list() { + public CompletableFuture>> list() { return list(AppsListRequest.builder().build()); } - public CompletableFuture>> list(AppsListRequest request) { + public CompletableFuture>> list(AppsListRequest request) { return list(request, null); } - public CompletableFuture>> list( + public CompletableFuture>> list( AppsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -87,7 +87,7 @@ public CompletableFuture>> list( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -102,7 +102,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO .after(startingAfter) .build(); List result = parsedResponse.getData(); - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( new SyncPagingIterable(startingAfter.isPresent(), result, () -> { try { return list(nextRequest, requestOptions) @@ -116,30 +116,31 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> retrieve(String appId) { + public CompletableFuture> retrieve(String appId) { return retrieve(appId, null); } - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String appId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -156,32 +157,33 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetAppResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; 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 8b4a892..936baa1 100644 --- a/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java +++ b/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java @@ -3,11 +3,11 @@ */ package com.pipedream.api.resources.apps; -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.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -32,15 +32,15 @@ public RawAppsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse> list() { + public PipedreamClientHttpResponse> list() { return list(AppsListRequest.builder().build()); } - public BaseClientHttpResponse> list(AppsListRequest request) { + public PipedreamClientHttpResponse> list(AppsListRequest request) { return list(request, null); } - public BaseClientHttpResponse> list( + public PipedreamClientHttpResponse> list( AppsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -93,28 +93,28 @@ public BaseClientHttpResponse> list( .after(startingAfter) .build(); List result = parsedResponse.getData(); - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( new SyncPagingIterable( startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) .body()), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse retrieve(String appId) { + public PipedreamClientHttpResponse retrieve(String appId) { return retrieve(appId, null); } - public BaseClientHttpResponse retrieve(String appId, RequestOptions requestOptions) { + public PipedreamClientHttpResponse retrieve(String appId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect/apps") @@ -133,17 +133,17 @@ public BaseClientHttpResponse retrieve(String appId, RequestOpti try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetAppResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } 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 f0e05a6..5cfd7d0 100644 --- a/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java +++ b/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java @@ -3,12 +3,12 @@ */ package com.pipedream.api.resources.components; -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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -43,16 +43,16 @@ public AsyncRawComponentsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture>> list() { + public CompletableFuture>> list() { return list(ComponentsListRequest.builder().build()); } - public CompletableFuture>> list( + public CompletableFuture>> list( ComponentsListRequest request) { return list(request, null); } - public CompletableFuture>> list( + public CompletableFuture>> list( ComponentsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -87,7 +87,8 @@ public CompletableFuture>> if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = + new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -102,7 +103,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO .after(startingAfter) .build(); List result = parsedResponse.getData(); - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( new SyncPagingIterable(startingAfter.isPresent(), result, () -> { try { return list(nextRequest, requestOptions) @@ -116,30 +117,31 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> retrieve(String componentId) { + public CompletableFuture> retrieve(String componentId) { return retrieve(componentId, null); } - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String componentId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -158,7 +160,7 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -166,35 +168,36 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { GetComponentResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); - future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); + future.complete(new PipedreamClientHttpResponse<>(parsedResponse.getData(), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> configureProp( + public CompletableFuture> configureProp( ComponentsConfigurePropRequest request) { return configureProp(request, null); } - public CompletableFuture> configureProp( + public CompletableFuture> configureProp( ComponentsConfigurePropRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -223,43 +226,44 @@ public CompletableFuture> configur if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> reloadProps( + public CompletableFuture> reloadProps( ComponentsReloadPropsRequest request) { return reloadProps(request, null); } - public CompletableFuture> reloadProps( + public CompletableFuture> reloadProps( ComponentsReloadPropsRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -288,32 +292,33 @@ public CompletableFuture> reloadProp if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; 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 9cd5a6f..915b9e1 100644 --- a/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java +++ b/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java @@ -3,12 +3,12 @@ */ package com.pipedream.api.resources.components; -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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -38,15 +38,15 @@ public RawComponentsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse> list() { + public PipedreamClientHttpResponse> list() { return list(ComponentsListRequest.builder().build()); } - public BaseClientHttpResponse> list(ComponentsListRequest request) { + public PipedreamClientHttpResponse> list(ComponentsListRequest request) { return list(request, null); } - public BaseClientHttpResponse> list( + public PipedreamClientHttpResponse> list( ComponentsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -92,28 +92,28 @@ public BaseClientHttpResponse> list( .after(startingAfter) .build(); List result = parsedResponse.getData(); - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( new SyncPagingIterable( startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) .body()), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse retrieve(String componentId) { + public PipedreamClientHttpResponse retrieve(String componentId) { return retrieve(componentId, null); } - public BaseClientHttpResponse retrieve(String componentId, RequestOptions requestOptions) { + public PipedreamClientHttpResponse retrieve(String componentId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -136,24 +136,24 @@ public BaseClientHttpResponse retrieve(String componentId, RequestOpt if (response.isSuccessful()) { GetComponentResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); - return new BaseClientHttpResponse<>(parsedResponse.getData(), response); + return new PipedreamClientHttpResponse<>(parsedResponse.getData(), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse configureProp(ComponentsConfigurePropRequest request) { + public PipedreamClientHttpResponse configureProp(ComponentsConfigurePropRequest request) { return configureProp(request, null); } - public BaseClientHttpResponse configureProp( + public PipedreamClientHttpResponse configureProp( ComponentsConfigurePropRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -185,26 +185,26 @@ public BaseClientHttpResponse configureProp( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse reloadProps(ComponentsReloadPropsRequest request) { + public PipedreamClientHttpResponse reloadProps(ComponentsReloadPropsRequest request) { return reloadProps(request, null); } - public BaseClientHttpResponse reloadProps( + public PipedreamClientHttpResponse reloadProps( ComponentsReloadPropsRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -236,18 +236,18 @@ public BaseClientHttpResponse reloadProps( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("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 e91dca3..fcec7ce 100644 --- a/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java @@ -3,12 +3,12 @@ */ package com.pipedream.api.resources.deployedtriggers; -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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -53,12 +53,12 @@ public AsyncRawDeployedTriggersClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture>> list( + public CompletableFuture>> list( DeployedTriggersListRequest request) { return list(request, null); } - public CompletableFuture>> list( + public CompletableFuture>> list( DeployedTriggersListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -88,7 +88,7 @@ public CompletableFuture>> future = + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -104,7 +104,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO .after(startingAfter) .build(); List result = parsedResponse.getData(); - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( new SyncPagingIterable(startingAfter.isPresent(), result, () -> { try { return list(nextRequest, requestOptions) @@ -118,31 +118,32 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String triggerId, DeployedTriggersRetrieveRequest request) { return retrieve(triggerId, request, null); } - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -161,7 +162,7 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -169,35 +170,36 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { GetTriggerResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); - future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); + future.complete(new PipedreamClientHttpResponse<>(parsedResponse.getData(), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> update( + public CompletableFuture> update( String triggerId, UpdateTriggerOpts request) { return update(triggerId, request, null); } - public CompletableFuture> update( + public CompletableFuture> update( String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -234,7 +236,7 @@ public CompletableFuture> update( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -242,35 +244,36 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { GetTriggerResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); - future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); + future.complete(new PipedreamClientHttpResponse<>(parsedResponse.getData(), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> delete( + public CompletableFuture> delete( String triggerId, DeployedTriggersDeleteRequest request) { return delete(triggerId, request, null); } - public CompletableFuture> delete( + public CompletableFuture> delete( String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -292,41 +295,42 @@ public CompletableFuture> delete( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>(null, response)); + future.complete(new PipedreamClientHttpResponse<>(null, response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture>> listEvents( + public CompletableFuture>> listEvents( String triggerId, DeployedTriggersListEventsRequest request) { return listEvents(triggerId, request, null); } - public CompletableFuture>> listEvents( + public CompletableFuture>> listEvents( String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -349,7 +353,7 @@ public CompletableFuture>> listEvents( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -357,35 +361,36 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { GetTriggerEventsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), GetTriggerEventsResponse.class); - future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); + future.complete(new PipedreamClientHttpResponse<>(parsedResponse.getData(), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> listWorkflows( + public CompletableFuture> listWorkflows( String triggerId, DeployedTriggersListWorkflowsRequest request) { return listWorkflows(triggerId, request, null); } - public CompletableFuture> listWorkflows( + public CompletableFuture> listWorkflows( String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -405,44 +410,45 @@ public CompletableFuture> li if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), GetTriggerWorkflowsResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> updateWorkflows( + public CompletableFuture> updateWorkflows( String triggerId, UpdateTriggerWorkflowsOpts request) { return updateWorkflows(triggerId, request, null); } - public CompletableFuture> updateWorkflows( + public CompletableFuture> updateWorkflows( String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -472,44 +478,45 @@ public CompletableFuture> up if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), GetTriggerWorkflowsResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> listWebhooks( + public CompletableFuture> listWebhooks( String triggerId, DeployedTriggersListWebhooksRequest request) { return listWebhooks(triggerId, request, null); } - public CompletableFuture> listWebhooks( + public CompletableFuture> listWebhooks( String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -529,44 +536,45 @@ public CompletableFuture> lis if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), GetTriggerWebhooksResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> updateWebhooks( + public CompletableFuture> updateWebhooks( String triggerId, UpdateTriggerWebhooksOpts request) { return updateWebhooks(triggerId, request, null); } - public CompletableFuture> updateWebhooks( + public CompletableFuture> updateWebhooks( String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -596,33 +604,34 @@ public CompletableFuture> upd if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), GetTriggerWebhooksResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; 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 837d672..c14c963 100644 --- a/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java @@ -3,12 +3,12 @@ */ package com.pipedream.api.resources.deployedtriggers; -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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -48,11 +48,12 @@ public RawDeployedTriggersClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse> list(DeployedTriggersListRequest request) { + public PipedreamClientHttpResponse> list( + DeployedTriggersListRequest request) { return list(request, null); } - public BaseClientHttpResponse> list( + public PipedreamClientHttpResponse> list( DeployedTriggersListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -93,29 +94,29 @@ public BaseClientHttpResponse> list( .after(startingAfter) .build(); List result = parsedResponse.getData(); - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( new SyncPagingIterable( startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) .body()), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse retrieve( + public PipedreamClientHttpResponse retrieve( String triggerId, DeployedTriggersRetrieveRequest request) { return retrieve(triggerId, request, null); } - public BaseClientHttpResponse retrieve( + public PipedreamClientHttpResponse retrieve( String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -139,24 +140,24 @@ public BaseClientHttpResponse retrieve( if (response.isSuccessful()) { GetTriggerResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); - return new BaseClientHttpResponse<>(parsedResponse.getData(), response); + return new PipedreamClientHttpResponse<>(parsedResponse.getData(), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse update(String triggerId, UpdateTriggerOpts request) { + public PipedreamClientHttpResponse update(String triggerId, UpdateTriggerOpts request) { return update(triggerId, request, null); } - public BaseClientHttpResponse update( + public PipedreamClientHttpResponse update( String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -198,24 +199,24 @@ public BaseClientHttpResponse update( if (response.isSuccessful()) { GetTriggerResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); - return new BaseClientHttpResponse<>(parsedResponse.getData(), response); + return new PipedreamClientHttpResponse<>(parsedResponse.getData(), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse delete(String triggerId, DeployedTriggersDeleteRequest request) { + public PipedreamClientHttpResponse delete(String triggerId, DeployedTriggersDeleteRequest request) { return delete(triggerId, request, null); } - public BaseClientHttpResponse delete( + public PipedreamClientHttpResponse delete( String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -240,25 +241,25 @@ public BaseClientHttpResponse delete( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>(null, response); + return new PipedreamClientHttpResponse<>(null, response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse> listEvents( + public PipedreamClientHttpResponse> listEvents( String triggerId, DeployedTriggersListEventsRequest request) { return listEvents(triggerId, request, null); } - public BaseClientHttpResponse> listEvents( + public PipedreamClientHttpResponse> listEvents( String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -286,25 +287,25 @@ public BaseClientHttpResponse> listEvents( if (response.isSuccessful()) { GetTriggerEventsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerEventsResponse.class); - return new BaseClientHttpResponse<>(parsedResponse.getData(), response); + return new PipedreamClientHttpResponse<>(parsedResponse.getData(), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse listWorkflows( + public PipedreamClientHttpResponse listWorkflows( String triggerId, DeployedTriggersListWorkflowsRequest request) { return listWorkflows(triggerId, request, null); } - public BaseClientHttpResponse listWorkflows( + public PipedreamClientHttpResponse listWorkflows( String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -327,27 +328,27 @@ public BaseClientHttpResponse listWorkflows( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWorkflowsResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse updateWorkflows( + public PipedreamClientHttpResponse updateWorkflows( String triggerId, UpdateTriggerWorkflowsOpts request) { return updateWorkflows(triggerId, request, null); } - public BaseClientHttpResponse updateWorkflows( + public PipedreamClientHttpResponse updateWorkflows( String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -380,27 +381,27 @@ public BaseClientHttpResponse updateWorkflows( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWorkflowsResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse listWebhooks( + public PipedreamClientHttpResponse listWebhooks( String triggerId, DeployedTriggersListWebhooksRequest request) { return listWebhooks(triggerId, request, null); } - public BaseClientHttpResponse listWebhooks( + public PipedreamClientHttpResponse listWebhooks( String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -423,27 +424,27 @@ public BaseClientHttpResponse listWebhooks( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWebhooksResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse updateWebhooks( + public PipedreamClientHttpResponse updateWebhooks( String triggerId, UpdateTriggerWebhooksOpts request) { return updateWebhooks(triggerId, request, null); } - public BaseClientHttpResponse updateWebhooks( + public PipedreamClientHttpResponse updateWebhooks( String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -476,18 +477,18 @@ public BaseClientHttpResponse updateWebhooks( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWebhooksResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("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 1e0479b..0f9feec 100644 --- a/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java +++ b/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java @@ -4,12 +4,12 @@ package com.pipedream.api.resources.oauthtokens; 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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; import com.pipedream.api.types.CreateOAuthTokenResponse; @@ -33,11 +33,12 @@ public AsyncRawOauthTokensClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture> create(CreateOAuthTokenOpts request) { + public CompletableFuture> create( + CreateOAuthTokenOpts request) { return create(request, null); } - public CompletableFuture> create( + public CompletableFuture> create( CreateOAuthTokenOpts request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -48,7 +49,7 @@ public CompletableFuture> creat body = RequestBody.create( ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); } catch (JsonProcessingException e) { - throw new BaseClientException("Failed to serialize request", e); + throw new PipedreamClientException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() .url(httpUrl) @@ -61,33 +62,34 @@ public CompletableFuture> creat if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), CreateOAuthTokenResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; 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 6dd34fb..46f0f2c 100644 --- a/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java +++ b/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java @@ -4,12 +4,12 @@ package com.pipedream.api.resources.oauthtokens; 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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; import com.pipedream.api.types.CreateOAuthTokenResponse; @@ -29,11 +29,11 @@ public RawOauthTokensClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse create(CreateOAuthTokenOpts request) { + public PipedreamClientHttpResponse create(CreateOAuthTokenOpts request) { return create(request, null); } - public BaseClientHttpResponse create( + public PipedreamClientHttpResponse create( CreateOAuthTokenOpts request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -44,7 +44,7 @@ public BaseClientHttpResponse create( body = RequestBody.create( ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); } catch (JsonProcessingException e) { - throw new BaseClientException("Failed to serialize request", e); + throw new PipedreamClientException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() .url(httpUrl) @@ -60,18 +60,18 @@ public BaseClientHttpResponse create( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateOAuthTokenResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } 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 89c9ec3..1257726 100644 --- a/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java +++ b/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java @@ -3,11 +3,11 @@ */ package com.pipedream.api.resources.projects; -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.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.types.ProjectInfoResponse; import java.io.IOException; @@ -29,11 +29,12 @@ public AsyncRawProjectsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture> retrieveInfo() { + public CompletableFuture> retrieveInfo() { return retrieveInfo(null); } - public CompletableFuture> retrieveInfo(RequestOptions requestOptions) { + public CompletableFuture> retrieveInfo( + RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -50,32 +51,33 @@ public CompletableFuture> retrieveIn if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProjectInfoResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; 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 c927bf5..0812d7d 100644 --- a/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java +++ b/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java @@ -3,11 +3,11 @@ */ package com.pipedream.api.resources.projects; -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.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.types.ProjectInfoResponse; import java.io.IOException; @@ -25,11 +25,11 @@ public RawProjectsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse retrieveInfo() { + public PipedreamClientHttpResponse retrieveInfo() { return retrieveInfo(null); } - public BaseClientHttpResponse retrieveInfo(RequestOptions requestOptions) { + public PipedreamClientHttpResponse retrieveInfo(RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -49,18 +49,18 @@ public BaseClientHttpResponse retrieveInfo(RequestOptions r try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProjectInfoResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } diff --git a/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java b/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java index 30ca813..eed96c5 100644 --- a/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java +++ b/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java @@ -4,12 +4,12 @@ package com.pipedream.api.resources.proxy; import com.fasterxml.jackson.core.type.TypeReference; -import com.pipedream.api.core.BaseClientApiException; -import com.pipedream.api.core.BaseClientException; -import com.pipedream.api.core.BaseClientHttpResponse; import com.pipedream.api.core.ClientOptions; import com.pipedream.api.core.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; @@ -38,11 +38,12 @@ public AsyncRawProxyClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture>> get(String url64, ProxyGetRequest request) { + public CompletableFuture>> get( + String url64, ProxyGetRequest request) { return get(url64, request, null); } - public CompletableFuture>> get( + public CompletableFuture>> get( String url64, ProxyGetRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -62,43 +63,45 @@ public CompletableFuture>> get( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture>> post(String url64, ProxyPostRequest request) { + public CompletableFuture>> post( + String url64, ProxyPostRequest request) { return post(url64, request, null); } - public CompletableFuture>> post( + public CompletableFuture>> post( String url64, ProxyPostRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -126,43 +129,45 @@ public CompletableFuture>> post( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture>> put(String url64, ProxyPutRequest request) { + public CompletableFuture>> put( + String url64, ProxyPutRequest request) { return put(url64, request, null); } - public CompletableFuture>> put( + public CompletableFuture>> put( String url64, ProxyPutRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -190,44 +195,45 @@ public CompletableFuture>> put( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture>> delete( + public CompletableFuture>> delete( String url64, ProxyDeleteRequest request) { return delete(url64, request, null); } - public CompletableFuture>> delete( + public CompletableFuture>> delete( String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -247,44 +253,45 @@ public CompletableFuture>> delete( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture>> patch( + public CompletableFuture>> patch( String url64, ProxyPatchRequest request) { return patch(url64, request, null); } - public CompletableFuture>> patch( + public CompletableFuture>> patch( String url64, ProxyPatchRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -312,33 +319,34 @@ public CompletableFuture>> patch( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; diff --git a/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java b/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java index fb9c5bf..474415d 100644 --- a/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java +++ b/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java @@ -4,12 +4,12 @@ package com.pipedream.api.resources.proxy; import com.fasterxml.jackson.core.type.TypeReference; -import com.pipedream.api.core.BaseClientApiException; -import com.pipedream.api.core.BaseClientException; -import com.pipedream.api.core.BaseClientHttpResponse; import com.pipedream.api.core.ClientOptions; import com.pipedream.api.core.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; @@ -34,11 +34,11 @@ public RawProxyClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse> get(String url64, ProxyGetRequest request) { + public PipedreamClientHttpResponse> get(String url64, ProxyGetRequest request) { return get(url64, request, null); } - public BaseClientHttpResponse> get( + public PipedreamClientHttpResponse> get( String url64, ProxyGetRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -61,27 +61,27 @@ public BaseClientHttpResponse> get( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse> post(String url64, ProxyPostRequest request) { + public PipedreamClientHttpResponse> post(String url64, ProxyPostRequest request) { return post(url64, request, null); } - public BaseClientHttpResponse> post( + public PipedreamClientHttpResponse> post( String url64, ProxyPostRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -112,27 +112,27 @@ public BaseClientHttpResponse> post( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse> put(String url64, ProxyPutRequest request) { + public PipedreamClientHttpResponse> put(String url64, ProxyPutRequest request) { return put(url64, request, null); } - public BaseClientHttpResponse> put( + public PipedreamClientHttpResponse> put( String url64, ProxyPutRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -163,27 +163,27 @@ public BaseClientHttpResponse> put( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse> delete(String url64, ProxyDeleteRequest request) { + public PipedreamClientHttpResponse> delete(String url64, ProxyDeleteRequest request) { return delete(url64, request, null); } - public BaseClientHttpResponse> delete( + public PipedreamClientHttpResponse> delete( String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -206,27 +206,27 @@ public BaseClientHttpResponse> delete( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse> patch(String url64, ProxyPatchRequest request) { + public PipedreamClientHttpResponse> patch(String url64, ProxyPatchRequest request) { return patch(url64, request, null); } - public BaseClientHttpResponse> patch( + public PipedreamClientHttpResponse> patch( String url64, ProxyPatchRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -257,19 +257,19 @@ public BaseClientHttpResponse> patch( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBody.string(), new TypeReference>() {}), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } 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 84570a9..080ffc5 100644 --- a/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java +++ b/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java @@ -4,12 +4,12 @@ package com.pipedream.api.resources.tokens; 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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; @@ -36,11 +36,11 @@ public AsyncRawTokensClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture> create(CreateTokenRequest request) { + public CompletableFuture> create(CreateTokenRequest request) { return create(request, null); } - public CompletableFuture> create( + public CompletableFuture> create( CreateTokenRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -51,7 +51,7 @@ public CompletableFuture> create( body = RequestBody.create( ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); } catch (JsonProcessingException e) { - throw new BaseClientException("Failed to serialize request", e); + throw new PipedreamClientException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() .url(httpUrl) @@ -64,47 +64,48 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateTokenResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> validate(String ctok) { + public CompletableFuture> validate(String ctok) { return validate(ctok, TokensValidateRequest.builder().build()); } - public CompletableFuture> validate( + public CompletableFuture> validate( String ctok, TokensValidateRequest request) { return validate(ctok, request, null); } - public CompletableFuture> validate( + public CompletableFuture> validate( String ctok, TokensValidateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -125,32 +126,33 @@ public CompletableFuture> validate if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ValidateTokenResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; 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 b18022c..5b65962 100644 --- a/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java +++ b/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java @@ -4,12 +4,12 @@ package com.pipedream.api.resources.tokens; 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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; @@ -32,11 +32,11 @@ public RawTokensClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse create(CreateTokenRequest request) { + public PipedreamClientHttpResponse create(CreateTokenRequest request) { return create(request, null); } - public BaseClientHttpResponse create( + public PipedreamClientHttpResponse create( CreateTokenRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -47,7 +47,7 @@ public BaseClientHttpResponse create( body = RequestBody.create( ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); } catch (JsonProcessingException e) { - throw new BaseClientException("Failed to serialize request", e); + throw new PipedreamClientException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() .url(httpUrl) @@ -63,30 +63,30 @@ public BaseClientHttpResponse create( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateTokenResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse validate(String ctok) { + public PipedreamClientHttpResponse validate(String ctok) { return validate(ctok, TokensValidateRequest.builder().build()); } - public BaseClientHttpResponse validate(String ctok, TokensValidateRequest request) { + public PipedreamClientHttpResponse validate(String ctok, TokensValidateRequest request) { return validate(ctok, request, null); } - public BaseClientHttpResponse validate( + public PipedreamClientHttpResponse validate( String ctok, TokensValidateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -110,18 +110,18 @@ public BaseClientHttpResponse validate( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ValidateTokenResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } 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 ddc9aff..4b4a28d 100644 --- a/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java +++ b/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java @@ -4,12 +4,12 @@ package com.pipedream.api.resources.triggers; 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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -47,15 +47,16 @@ public AsyncRawTriggersClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture>> list() { + public CompletableFuture>> list() { return list(TriggersListRequest.builder().build()); } - public CompletableFuture>> list(TriggersListRequest request) { + public CompletableFuture>> list( + TriggersListRequest request) { return list(request, null); } - public CompletableFuture>> list( + public CompletableFuture>> list( TriggersListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -90,7 +91,8 @@ public CompletableFuture>> if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture>> future = new CompletableFuture<>(); + CompletableFuture>> future = + new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -105,7 +107,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO .after(startingAfter) .build(); List result = parsedResponse.getData(); - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( new SyncPagingIterable(startingAfter.isPresent(), result, () -> { try { return list(nextRequest, requestOptions) @@ -119,30 +121,31 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> retrieve(String componentId) { + public CompletableFuture> retrieve(String componentId) { return retrieve(componentId, null); } - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String componentId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -161,7 +164,7 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -169,35 +172,36 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { GetComponentResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); - future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); + future.complete(new PipedreamClientHttpResponse<>(parsedResponse.getData(), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> configureProp( + public CompletableFuture> configureProp( TriggersConfigurePropRequest request) { return configureProp(request, null); } - public CompletableFuture> configureProp( + public CompletableFuture> configureProp( TriggersConfigurePropRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -226,43 +230,44 @@ public CompletableFuture> configur if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> reloadProps( + public CompletableFuture> reloadProps( TriggersReloadPropsRequest request) { return reloadProps(request, null); } - public CompletableFuture> reloadProps( + public CompletableFuture> reloadProps( TriggersReloadPropsRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -291,42 +296,43 @@ public CompletableFuture> reloadProp if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>( + future.complete(new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; } - public CompletableFuture> deploy(DeployTriggerOpts request) { + public CompletableFuture> deploy(DeployTriggerOpts request) { return deploy(request, null); } - public CompletableFuture> deploy( + public CompletableFuture> deploy( DeployTriggerOpts request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -339,7 +345,7 @@ public CompletableFuture> deploy( body = RequestBody.create( ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); } catch (JsonProcessingException e) { - throw new BaseClientException("Failed to serialize request", e); + throw new PipedreamClientException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() .url(httpUrl) @@ -352,7 +358,7 @@ public CompletableFuture> deploy( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -360,24 +366,25 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { DeployTriggerResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeployTriggerResponse.class); - future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); + future.complete(new PipedreamClientHttpResponse<>(parsedResponse.getData(), response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; 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 192686d..b31c677 100644 --- a/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java +++ b/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java @@ -4,12 +4,12 @@ package com.pipedream.api.resources.triggers; 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.MediaTypes; import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.QueryStringMapper; import com.pipedream.api.core.RequestOptions; import com.pipedream.api.core.pagination.SyncPagingIterable; @@ -42,15 +42,15 @@ public RawTriggersClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse> list() { + public PipedreamClientHttpResponse> list() { return list(TriggersListRequest.builder().build()); } - public BaseClientHttpResponse> list(TriggersListRequest request) { + public PipedreamClientHttpResponse> list(TriggersListRequest request) { return list(request, null); } - public BaseClientHttpResponse> list( + public PipedreamClientHttpResponse> list( TriggersListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -96,28 +96,28 @@ public BaseClientHttpResponse> list( .after(startingAfter) .build(); List result = parsedResponse.getData(); - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( new SyncPagingIterable( startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) .body()), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse retrieve(String componentId) { + public PipedreamClientHttpResponse retrieve(String componentId) { return retrieve(componentId, null); } - public BaseClientHttpResponse retrieve(String componentId, RequestOptions requestOptions) { + public PipedreamClientHttpResponse retrieve(String componentId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -140,24 +140,24 @@ public BaseClientHttpResponse retrieve(String componentId, RequestOpt if (response.isSuccessful()) { GetComponentResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); - return new BaseClientHttpResponse<>(parsedResponse.getData(), response); + return new PipedreamClientHttpResponse<>(parsedResponse.getData(), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse configureProp(TriggersConfigurePropRequest request) { + public PipedreamClientHttpResponse configureProp(TriggersConfigurePropRequest request) { return configureProp(request, null); } - public BaseClientHttpResponse configureProp( + public PipedreamClientHttpResponse configureProp( TriggersConfigurePropRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -189,26 +189,26 @@ public BaseClientHttpResponse configureProp( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse reloadProps(TriggersReloadPropsRequest request) { + public PipedreamClientHttpResponse reloadProps(TriggersReloadPropsRequest request) { return reloadProps(request, null); } - public BaseClientHttpResponse reloadProps( + public PipedreamClientHttpResponse reloadProps( TriggersReloadPropsRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -240,26 +240,27 @@ public BaseClientHttpResponse reloadProps( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>( + return new PipedreamClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } - public BaseClientHttpResponse deploy(DeployTriggerOpts request) { + public PipedreamClientHttpResponse deploy(DeployTriggerOpts request) { return deploy(request, null); } - public BaseClientHttpResponse deploy(DeployTriggerOpts request, RequestOptions requestOptions) { + public PipedreamClientHttpResponse deploy( + DeployTriggerOpts request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -271,7 +272,7 @@ public BaseClientHttpResponse deploy(DeployTriggerOpts reques body = RequestBody.create( ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); } catch (JsonProcessingException e) { - throw new BaseClientException("Failed to serialize request", e); + throw new PipedreamClientException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() .url(httpUrl) @@ -289,16 +290,16 @@ public BaseClientHttpResponse deploy(DeployTriggerOpts reques if (response.isSuccessful()) { DeployTriggerResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeployTriggerResponse.class); - return new BaseClientHttpResponse<>(parsedResponse.getData(), response); + return new PipedreamClientHttpResponse<>(parsedResponse.getData(), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } } 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 53d886e..79210d1 100644 --- a/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java +++ b/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java @@ -3,11 +3,11 @@ */ package com.pipedream.api.resources.users; -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.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.RequestOptions; import java.io.IOException; import java.util.concurrent.CompletableFuture; @@ -28,11 +28,11 @@ public AsyncRawUsersClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture> deleteExternalUser(String externalUserId) { + public CompletableFuture> deleteExternalUser(String externalUserId) { return deleteExternalUser(externalUserId, null); } - public CompletableFuture> deleteExternalUser( + public CompletableFuture> deleteExternalUser( String externalUserId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -50,30 +50,31 @@ public CompletableFuture> deleteExternalUser( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { if (response.isSuccessful()) { - future.complete(new BaseClientHttpResponse<>(null, response)); + future.complete(new PipedreamClientHttpResponse<>(null, response)); return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - future.completeExceptionally(new BaseClientApiException( + future.completeExceptionally(new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } catch (IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally( + new PipedreamClientException("Network error executing HTTP request", e)); } } @Override public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); + future.completeExceptionally(new PipedreamClientException("Network error executing HTTP request", e)); } }); return future; 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 69011b7..d033ab1 100644 --- a/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java +++ b/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java @@ -3,11 +3,11 @@ */ package com.pipedream.api.resources.users; -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.PipedreamClientApiException; +import com.pipedream.api.core.PipedreamClientException; +import com.pipedream.api.core.PipedreamClientHttpResponse; import com.pipedream.api.core.RequestOptions; import java.io.IOException; import okhttp3.Headers; @@ -24,11 +24,11 @@ public RawUsersClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseClientHttpResponse deleteExternalUser(String externalUserId) { + public PipedreamClientHttpResponse deleteExternalUser(String externalUserId) { return deleteExternalUser(externalUserId, null); } - public BaseClientHttpResponse deleteExternalUser(String externalUserId, RequestOptions requestOptions) { + public PipedreamClientHttpResponse deleteExternalUser(String externalUserId, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("v1/connect") @@ -48,16 +48,16 @@ public BaseClientHttpResponse deleteExternalUser(String externalUserId, Re try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return new BaseClientHttpResponse<>(null, response); + return new PipedreamClientHttpResponse<>(null, response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - throw new BaseClientApiException( + throw new PipedreamClientApiException( "Error with status code " + response.code(), response.code(), ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } catch (IOException e) { - throw new BaseClientException("Network error executing HTTP request", e); + throw new PipedreamClientException("Network error executing HTTP request", e); } } }