diff --git a/.fern/metadata.json b/.fern/metadata.json new file mode 100644 index 0000000..6e0c231 --- /dev/null +++ b/.fern/metadata.json @@ -0,0 +1,12 @@ +{ + "cliVersion": "1.9.0", + "generatorName": "fernapi/fern-java-sdk", + "generatorVersion": "3.16.0", + "generatorConfig": { + "publish-to": "central", + "client-class-name": "BaseClient", + "custom-dependencies": [ + "api org.apache.commons:commons-text:1.13.1" + ] + } +} \ No newline at end of file diff --git a/README.md b/README.md index 06d55b9..63e12c9 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,22 @@ The Pipedream Java library provides convenient access to the Pipedream APIs from Java. +## Table of Contents + +- [Installation](#installation) +- [Usage](#usage) +- [Environments](#environments) +- [Base Url](#base-url) +- [Exception Handling](#exception-handling) +- [Advanced](#advanced) + - [Custom Client](#custom-client) + - [Retries](#retries) + - [Timeouts](#timeouts) + - [Custom Headers](#custom-headers) + - [Access Raw Response Data](#access-raw-response-data) +- [Contributing](#contributing) +- [Reference](#reference) + ## Installation ### Gradle @@ -25,7 +41,7 @@ Add the dependency in your `pom.xml` file: com.pipedream pipedream - 1.1.0 + 1.1.1 ``` @@ -104,7 +120,7 @@ try{ ### Custom Client -This SDK is built to work with any instance of `OkHttpClient`. By default, if no client is provided, the SDK will construct one. +This SDK is built to work with any instance of `OkHttpClient`. By default, if no client is provided, the SDK will construct one. However, you can pass your own client like so: ```java @@ -123,7 +139,9 @@ BaseClient client = BaseClient The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long as the request is deemed retryable and the number of retry attempts has not grown larger than the configured -retry limit (default: 2). +retry limit (default: 2). Before defaulting to exponential backoff, the SDK will first attempt to respect +the `Retry-After` header (as either in seconds or as an HTTP date), and then the `X-RateLimit-Reset` header +(as a Unix timestamp in epoch seconds); failing both of those, it will fall back to exponential backoff. A request is deemed retryable when any of the following HTTP status codes is returned: @@ -192,6 +210,19 @@ client.actions().run( ); ``` +### Access Raw Response Data + +The SDK provides access to raw response data, including headers, through the `withRawResponse()` method. +The `withRawResponse()` method returns a raw client that wraps all responses with `body()` and `headers()` methods. +(A normal client's `response` is identical to a raw client's `response.body()`.) + +```java +RunHttpResponse response = client.actions().withRawResponse().run(...); + +System.out.println(response.body()); +System.out.println(response.headers().get("X-My-Header")); +``` + ## Contributing While we value open-source contributions to this SDK, this library is generated programmatically. diff --git a/build.gradle b/build.gradle index 0db3646..8c962d4 100644 --- a/build.gradle +++ b/build.gradle @@ -14,15 +14,14 @@ repositories { } dependencies { - api 'com.squareup.okhttp3:okhttp:4.12.0' - api 'com.fasterxml.jackson.core:jackson-databind:2.17.2' - api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.2' - api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.2' + api 'com.squareup.okhttp3:okhttp:5.2.1' + api 'com.fasterxml.jackson.core:jackson-databind:2.18.2' + api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.2' + api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2' testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2' api 'org.apache.commons:commons-text:1.13.1' - testImplementation 'com.squareup.okhttp3:mockwebserver:4.12.0' } @@ -49,7 +48,7 @@ java { group = 'com.pipedream' -version = '1.1.0' +version = '1.1.1' jar { dependsOn(":generatePomFileForMavenPublication") @@ -80,7 +79,7 @@ publishing { maven(MavenPublication) { groupId = 'com.pipedream' artifactId = 'pipedream' - version = '1.1.0' + version = '1.1.1' from components.java pom { name = 'pipedream' diff --git a/src/main/java/com/pipedream/api/core/BaseClientApiException.java b/src/main/java/com/pipedream/api/core/BaseClientApiException.java index a2680b0..f0e59f6 100644 --- a/src/main/java/com/pipedream/api/core/BaseClientApiException.java +++ b/src/main/java/com/pipedream/api/core/BaseClientApiException.java @@ -65,9 +65,9 @@ public Map> headers() { return this.headers; } - @java.lang.Override + @Override public String toString() { return "BaseClientApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " - + body + "}"; + + ObjectMappers.stringify(body) + "}"; } } diff --git a/src/main/java/com/pipedream/api/core/ClientOptions.java b/src/main/java/com/pipedream/api/core/ClientOptions.java index 8132d65..7c9c07c 100644 --- a/src/main/java/com/pipedream/api/core/ClientOptions.java +++ b/src/main/java/com/pipedream/api/core/ClientOptions.java @@ -21,6 +21,8 @@ public final class ClientOptions { private final int timeout; + private final int maxRetries; + private String projectId; private ClientOptions( @@ -29,21 +31,23 @@ private ClientOptions( Map> headerSuppliers, OkHttpClient httpClient, int timeout, + int maxRetries, String projectId) { this.environment = environment; this.headers = new HashMap<>(); this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.pipedream:pipedream/1.1.0"); + put("User-Agent", "com.pipedream:pipedream/1.1.1"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.pipedream.fern:api-sdk"); - put("X-Fern-SDK-Version", "1.1.0"); + put("X-Fern-SDK-Version", "1.1.1"); } }); this.headerSuppliers = headerSuppliers; this.httpClient = httpClient; this.timeout = timeout; + this.maxRetries = maxRetries; this.projectId = projectId; } @@ -86,6 +90,10 @@ public OkHttpClient httpClientWithTimeout(RequestOptions requestOptions) { .build(); } + public int maxRetries() { + return this.maxRetries; + } + public String projectId() { return this.projectId; } @@ -181,7 +189,13 @@ public ClientOptions build() { this.timeout = Optional.of(httpClient.callTimeoutMillis() / 1000); return new ClientOptions( - environment, headers, headerSuppliers, httpClient, this.timeout.get(), this.projectId); + environment, + headers, + headerSuppliers, + httpClient, + this.timeout.get(), + this.maxRetries, + this.projectId); } /** diff --git a/src/main/java/com/pipedream/api/core/NullableNonemptyFilter.java b/src/main/java/com/pipedream/api/core/NullableNonemptyFilter.java index afad6eb..c268e6e 100644 --- a/src/main/java/com/pipedream/api/core/NullableNonemptyFilter.java +++ b/src/main/java/com/pipedream/api/core/NullableNonemptyFilter.java @@ -14,6 +14,9 @@ public boolean equals(Object o) { } private boolean isOptionalEmpty(Object o) { - return o instanceof Optional && !((Optional) o).isPresent(); + if (o instanceof Optional) { + return !((Optional) o).isPresent(); + } + return false; } } diff --git a/src/main/java/com/pipedream/api/core/ObjectMappers.java b/src/main/java/com/pipedream/api/core/ObjectMappers.java index 6dd6c3c..aa3ba10 100644 --- a/src/main/java/com/pipedream/api/core/ObjectMappers.java +++ b/src/main/java/com/pipedream/api/core/ObjectMappers.java @@ -4,6 +4,7 @@ package com.pipedream.api.core; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -33,4 +34,12 @@ public static String stringify(Object o) { return o.getClass().getName() + "@" + Integer.toHexString(o.hashCode()); } } + + public static Object parseErrorBody(String responseBodyString) { + try { + return JSON_MAPPER.readValue(responseBodyString, Object.class); + } catch (JsonProcessingException ignored) { + return responseBodyString; + } + } } diff --git a/src/main/java/com/pipedream/api/core/RetryInterceptor.java b/src/main/java/com/pipedream/api/core/RetryInterceptor.java index 66b6be4..da07beb 100644 --- a/src/main/java/com/pipedream/api/core/RetryInterceptor.java +++ b/src/main/java/com/pipedream/api/core/RetryInterceptor.java @@ -5,6 +5,9 @@ import java.io.IOException; import java.time.Duration; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; import java.util.Optional; import java.util.Random; import okhttp3.Interceptor; @@ -12,7 +15,10 @@ public class RetryInterceptor implements Interceptor { - private static final Duration ONE_SECOND = Duration.ofSeconds(1); + private static final Duration INITIAL_RETRY_DELAY = Duration.ofMillis(1000); + private static final Duration MAX_RETRY_DELAY = Duration.ofMillis(60000); + private static final double JITTER_FACTOR = 0.2; + private final ExponentialBackoff backoff; private final Random random = new Random(); @@ -32,7 +38,7 @@ public Response intercept(Chain chain) throws IOException { } private Response retryChain(Response response, Chain chain) throws IOException { - Optional nextBackoff = this.backoff.nextBackoff(); + Optional nextBackoff = this.backoff.nextBackoff(response); while (nextBackoff.isPresent()) { try { Thread.sleep(nextBackoff.get().toMillis()); @@ -42,7 +48,7 @@ private Response retryChain(Response response, Chain chain) throws IOException { response.close(); response = chain.proceed(chain.request()); if (shouldRetry(response.code())) { - nextBackoff = this.backoff.nextBackoff(); + nextBackoff = this.backoff.nextBackoff(response); } else { return response; } @@ -51,6 +57,102 @@ private Response retryChain(Response response, Chain chain) throws IOException { return response; } + /** + * Calculates the retry delay from response headers, with fallback to exponential backoff. + * Priority: Retry-After > X-RateLimit-Reset > Exponential Backoff + */ + private Duration getRetryDelayFromHeaders(Response response, int retryAttempt) { + // Check for Retry-After header first (RFC 7231), with no jitter + String retryAfter = response.header("Retry-After"); + if (retryAfter != null) { + // Parse as number of seconds... + Optional secondsDelay = tryParseLong(retryAfter) + .map(seconds -> seconds * 1000) + .filter(delayMs -> delayMs > 0) + .map(delayMs -> Math.min(delayMs, MAX_RETRY_DELAY.toMillis())) + .map(Duration::ofMillis); + if (secondsDelay.isPresent()) { + return secondsDelay.get(); + } + + // ...or as an HTTP date; both are valid + Optional dateDelay = tryParseHttpDate(retryAfter) + .map(resetTime -> resetTime.toInstant().toEpochMilli() - System.currentTimeMillis()) + .filter(delayMs -> delayMs > 0) + .map(delayMs -> Math.min(delayMs, MAX_RETRY_DELAY.toMillis())) + .map(Duration::ofMillis); + if (dateDelay.isPresent()) { + return dateDelay.get(); + } + } + + // Then check for industry-standard X-RateLimit-Reset header, with positive jitter + String rateLimitReset = response.header("X-RateLimit-Reset"); + if (rateLimitReset != null) { + // Assume Unix timestamp in epoch seconds + Optional rateLimitDelay = tryParseLong(rateLimitReset) + .map(resetTimeSeconds -> (resetTimeSeconds * 1000) - System.currentTimeMillis()) + .filter(delayMs -> delayMs > 0) + .map(delayMs -> Math.min(delayMs, MAX_RETRY_DELAY.toMillis())) + .map(this::addPositiveJitter) + .map(Duration::ofMillis); + if (rateLimitDelay.isPresent()) { + return rateLimitDelay.get(); + } + } + + // Fall back to exponential backoff, with symmetric jitter + long baseDelay = INITIAL_RETRY_DELAY.toMillis() * (1L << retryAttempt); // 2^retryAttempt + long cappedDelay = Math.min(baseDelay, MAX_RETRY_DELAY.toMillis()); + return Duration.ofMillis(addSymmetricJitter(cappedDelay)); + } + + /** + * Attempts to parse a string as a long, returning empty Optional on failure. + */ + private Optional tryParseLong(String value) { + if (value == null) { + return Optional.empty(); + } + try { + return Optional.of(Long.parseLong(value)); + } catch (NumberFormatException e) { + return Optional.empty(); + } + } + + /** + * Attempts to parse a string as an HTTP date (RFC 1123), returning empty Optional on failure. + */ + private Optional tryParseHttpDate(String value) { + if (value == null) { + return Optional.empty(); + } + try { + return Optional.of(ZonedDateTime.parse(value, DateTimeFormatter.RFC_1123_DATE_TIME)); + } catch (DateTimeParseException e) { + return Optional.empty(); + } + } + + /** + * Adds positive jitter (100-120% of original value) to prevent thundering herd. + * Used for X-RateLimit-Reset header delays. + */ + private long addPositiveJitter(long delayMs) { + double jitterMultiplier = 1.0 + (random.nextDouble() * JITTER_FACTOR); + return (long) (delayMs * jitterMultiplier); + } + + /** + * Adds symmetric jitter (90-110% of original value) to prevent thundering herd. + * Used for exponential backoff delays. + */ + private long addSymmetricJitter(long delayMs) { + double jitterMultiplier = 1.0 + ((random.nextDouble() - 0.5) * JITTER_FACTOR); + return (long) (delayMs * jitterMultiplier); + } + private static boolean shouldRetry(int statusCode) { return statusCode == 408 || statusCode == 429 || statusCode >= 500; } @@ -65,14 +167,14 @@ private final class ExponentialBackoff { this.maxNumRetries = maxNumRetries; } - public Optional nextBackoff() { - retryNumber += 1; - if (retryNumber > maxNumRetries) { + public Optional nextBackoff(Response response) { + if (retryNumber >= maxNumRetries) { return Optional.empty(); } - int upperBound = (int) Math.pow(2, retryNumber); - return Optional.of(ONE_SECOND.multipliedBy(random.nextInt(upperBound))); + Duration delay = getRetryDelayFromHeaders(response, retryNumber); + retryNumber += 1; + return Optional.of(delay); } } } 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 dd95b5f..2e1566a 100644 --- a/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java +++ b/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java @@ -111,9 +111,10 @@ public CompletableFuture>> li @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { ListAccountsResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAccountsResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAccountsResponse.class); Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); AccountsListRequest nextRequest = AccountsListRequest.builder() @@ -135,7 +136,6 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -145,11 +145,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -212,12 +210,12 @@ public CompletableFuture> create( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response)); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Account.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -227,11 +225,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -294,12 +290,12 @@ public CompletableFuture> retrieve( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response)); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Account.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -309,11 +305,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -375,11 +369,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -442,11 +434,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java b/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java index 777be36..c46f19e 100644 --- a/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java +++ b/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java @@ -103,9 +103,10 @@ public BaseClientHttpResponse> list( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { ListAccountsResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAccountsResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAccountsResponse.class); Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); AccountsListRequest nextRequest = AccountsListRequest.builder() .from(request) @@ -118,7 +119,6 @@ public BaseClientHttpResponse> list( .body()), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -127,11 +127,9 @@ public BaseClientHttpResponse> list( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -181,11 +179,11 @@ public BaseClientHttpResponse create(CreateAccountOpts request, Request } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Account.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -194,11 +192,9 @@ public BaseClientHttpResponse create(CreateAccountOpts request, Request } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -248,11 +244,11 @@ public BaseClientHttpResponse retrieve( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Account.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -261,11 +257,9 @@ public BaseClientHttpResponse retrieve( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -313,11 +307,9 @@ public BaseClientHttpResponse delete(String accountId, RequestOptions requ } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -366,11 +358,9 @@ public BaseClientHttpResponse deleteByApp(String appId, RequestOptions req } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java b/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java index 72dfcab..2adedc4 100644 --- a/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java +++ b/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java @@ -105,9 +105,10 @@ public CompletableFuture>> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { GetComponentsResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentsResponse.class); Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); ActionsListRequest nextRequest = ActionsListRequest.builder() @@ -129,7 +130,6 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -139,11 +139,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -203,13 +201,13 @@ public CompletableFuture> retrieve( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { GetComponentResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentResponse.class); future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -219,11 +217,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -254,7 +250,8 @@ public CompletableFuture> configur .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("actions/configure") + .addPathSegments("actions") + .addPathSegments("configure") .build(); RequestBody body; try { @@ -279,13 +276,13 @@ public CompletableFuture> configur @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ConfigurePropResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -295,11 +292,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -330,7 +325,8 @@ public CompletableFuture> reloadProp .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("actions/props") + .addPathSegments("actions") + .addPathSegments("props") .build(); RequestBody body; try { @@ -355,13 +351,13 @@ public CompletableFuture> reloadProp @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ReloadPropsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -371,11 +367,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -406,7 +400,8 @@ public CompletableFuture> run( .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("actions/run") + .addPathSegments("actions") + .addPathSegments("run") .build(); RequestBody body; try { @@ -431,13 +426,13 @@ public CompletableFuture> run( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), RunActionResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RunActionResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -447,11 +442,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java b/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java index 249368b..06cf202 100644 --- a/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java +++ b/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java @@ -97,9 +97,10 @@ public BaseClientHttpResponse> list( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { GetComponentsResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentsResponse.class); Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); ActionsListRequest nextRequest = ActionsListRequest.builder() .from(request) @@ -112,7 +113,6 @@ public BaseClientHttpResponse> list( .body()), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -121,11 +121,9 @@ public BaseClientHttpResponse> list( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -172,12 +170,12 @@ public BaseClientHttpResponse retrieve( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { GetComponentResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentResponse.class); return new BaseClientHttpResponse<>(parsedResponse.getData(), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -186,11 +184,9 @@ public BaseClientHttpResponse retrieve( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -212,7 +208,8 @@ public BaseClientHttpResponse configureProp( .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("actions/configure") + .addPathSegments("actions") + .addPathSegments("configure") .build(); RequestBody body; try { @@ -234,12 +231,11 @@ public BaseClientHttpResponse configureProp( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ConfigurePropResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -248,11 +244,9 @@ public BaseClientHttpResponse configureProp( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -274,7 +268,8 @@ public BaseClientHttpResponse reloadProps( .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("actions/props") + .addPathSegments("actions") + .addPathSegments("props") .build(); RequestBody body; try { @@ -296,12 +291,11 @@ public BaseClientHttpResponse reloadProps( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ReloadPropsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -310,11 +304,9 @@ public BaseClientHttpResponse reloadProps( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -335,7 +327,8 @@ public BaseClientHttpResponse run(RunActionOpts request, Requ .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("actions/run") + .addPathSegments("actions") + .addPathSegments("run") .build(); RequestBody body; try { @@ -357,11 +350,11 @@ public BaseClientHttpResponse run(RunActionOpts request, Requ } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), RunActionResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RunActionResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -370,11 +363,9 @@ public BaseClientHttpResponse run(RunActionOpts request, Requ } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java b/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java index ea828f1..a8e5d04 100644 --- a/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java +++ b/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java @@ -61,19 +61,17 @@ public CompletableFuture>> list(Request @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), new TypeReference>() {}), + responseBodyString, new TypeReference>() {}), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -119,18 +117,15 @@ public CompletableFuture> retrieve(String id @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), AppCategory.class), - response)); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AppCategory.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java b/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java index 401fd49..4a40980 100644 --- a/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java +++ b/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java @@ -54,18 +54,16 @@ public BaseClientHttpResponse> list(RequestOptions requestOpti } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), new TypeReference>() {}), + responseBodyString, new TypeReference>() {}), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -99,16 +97,14 @@ public BaseClientHttpResponse retrieve(String id, RequestOptions re } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), AppCategory.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AppCategory.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java b/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java index bfc2fde..44282c8 100644 --- a/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java +++ b/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java @@ -101,9 +101,10 @@ public CompletableFuture>> list( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { ListAppsResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAppsResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAppsResponse.class); Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); AppsListRequest nextRequest = AppsListRequest.builder() @@ -124,12 +125,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -176,18 +174,16 @@ public CompletableFuture> retrieve( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetAppResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetAppResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java b/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java index 1a8e637..76d91dc 100644 --- a/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java +++ b/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java @@ -93,9 +93,10 @@ public BaseClientHttpResponse> list( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { ListAppsResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAppsResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAppsResponse.class); Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); AppsListRequest nextRequest = AppsListRequest.builder() .from(request) @@ -108,12 +109,9 @@ public BaseClientHttpResponse> list( .body()), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -147,16 +145,14 @@ public BaseClientHttpResponse retrieve(String appId, RequestOpti } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetAppResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetAppResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java b/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java index 14f1c17..d7da1b0 100644 --- a/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java +++ b/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java @@ -108,9 +108,10 @@ public CompletableFuture>> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { GetComponentsResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentsResponse.class); Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); ComponentsListRequest nextRequest = ComponentsListRequest.builder() @@ -132,7 +133,6 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -142,11 +142,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -206,13 +204,13 @@ public CompletableFuture> retrieve( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { GetComponentResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentResponse.class); future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -222,11 +220,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -257,7 +253,8 @@ public CompletableFuture> configur .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("components/configure") + .addPathSegments("components") + .addPathSegments("configure") .build(); RequestBody body; try { @@ -282,13 +279,13 @@ public CompletableFuture> configur @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ConfigurePropResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -298,11 +295,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -333,7 +328,8 @@ public CompletableFuture> reloadProp .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("components/props") + .addPathSegments("components") + .addPathSegments("props") .build(); RequestBody body; try { @@ -358,13 +354,13 @@ public CompletableFuture> reloadProp @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ReloadPropsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -374,11 +370,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java b/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java index a98c026..2df1200 100644 --- a/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java +++ b/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java @@ -99,9 +99,10 @@ public BaseClientHttpResponse> list( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { GetComponentsResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentsResponse.class); Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); ComponentsListRequest nextRequest = ComponentsListRequest.builder() .from(request) @@ -114,7 +115,6 @@ public BaseClientHttpResponse> list( .body()), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -123,11 +123,9 @@ public BaseClientHttpResponse> list( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -174,12 +172,12 @@ public BaseClientHttpResponse retrieve( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { GetComponentResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentResponse.class); return new BaseClientHttpResponse<>(parsedResponse.getData(), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -188,11 +186,9 @@ public BaseClientHttpResponse retrieve( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -214,7 +210,8 @@ public BaseClientHttpResponse configureProp( .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("components/configure") + .addPathSegments("components") + .addPathSegments("configure") .build(); RequestBody body; try { @@ -236,12 +233,11 @@ public BaseClientHttpResponse configureProp( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ConfigurePropResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -250,11 +246,9 @@ public BaseClientHttpResponse configureProp( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -276,7 +270,8 @@ public BaseClientHttpResponse reloadProps( .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("components/props") + .addPathSegments("components") + .addPathSegments("props") .build(); RequestBody body; try { @@ -298,12 +293,11 @@ public BaseClientHttpResponse reloadProps( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ReloadPropsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -312,11 +306,9 @@ public BaseClientHttpResponse reloadProps( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java index 0542a9c..9f23ad1 100644 --- a/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java @@ -103,9 +103,10 @@ public CompletableFuture>> li @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { GetTriggersResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggersResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggersResponse.class); Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); DeployedTriggersListRequest nextRequest = DeployedTriggersListRequest.builder() @@ -127,7 +128,6 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -137,11 +137,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -191,13 +189,13 @@ public CompletableFuture> retrieve( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { GetTriggerResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerResponse.class); future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -207,11 +205,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -268,13 +264,13 @@ public CompletableFuture> update( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { GetTriggerResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerResponse.class); future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -284,11 +280,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -356,11 +350,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -414,13 +406,13 @@ public CompletableFuture>> listEvents( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - GetTriggerEventsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetTriggerEventsResponse.class); + GetTriggerEventsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerEventsResponse.class); future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -430,11 +422,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -485,14 +475,14 @@ public CompletableFuture> li @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetTriggerWorkflowsResponse.class), + responseBodyString, GetTriggerWorkflowsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -502,11 +492,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -565,14 +553,14 @@ public CompletableFuture> up @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetTriggerWorkflowsResponse.class), + responseBodyString, GetTriggerWorkflowsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -582,11 +570,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -637,14 +623,14 @@ public CompletableFuture> lis @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetTriggerWebhooksResponse.class), + responseBodyString, GetTriggerWebhooksResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -654,11 +640,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -717,14 +701,14 @@ public CompletableFuture> upd @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetTriggerWebhooksResponse.class), + responseBodyString, GetTriggerWebhooksResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -734,11 +718,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java index f5f5117..83bd803 100644 --- a/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java @@ -94,9 +94,10 @@ public BaseClientHttpResponse> list( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { GetTriggersResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggersResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggersResponse.class); Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); DeployedTriggersListRequest nextRequest = DeployedTriggersListRequest.builder() .from(request) @@ -109,7 +110,6 @@ public BaseClientHttpResponse> list( .body()), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -118,11 +118,9 @@ public BaseClientHttpResponse> list( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -159,12 +157,12 @@ public BaseClientHttpResponse retrieve( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { GetTriggerResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerResponse.class); return new BaseClientHttpResponse<>(parsedResponse.getData(), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -173,11 +171,9 @@ public BaseClientHttpResponse retrieve( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -222,12 +218,12 @@ public BaseClientHttpResponse update( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { GetTriggerResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerResponse.class); return new BaseClientHttpResponse<>(parsedResponse.getData(), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -236,11 +232,9 @@ public BaseClientHttpResponse update( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -293,11 +287,9 @@ public BaseClientHttpResponse delete( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -339,12 +331,12 @@ public BaseClientHttpResponse> listEvents( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { GetTriggerEventsResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerEventsResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerEventsResponse.class); return new BaseClientHttpResponse<>(parsedResponse.getData(), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -353,11 +345,9 @@ public BaseClientHttpResponse> listEvents( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -396,12 +386,12 @@ public BaseClientHttpResponse listWorkflows( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWorkflowsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerWorkflowsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -410,11 +400,9 @@ public BaseClientHttpResponse listWorkflows( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -461,12 +449,12 @@ public BaseClientHttpResponse updateWorkflows( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWorkflowsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerWorkflowsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -475,11 +463,9 @@ public BaseClientHttpResponse updateWorkflows( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -518,12 +504,12 @@ public BaseClientHttpResponse listWebhooks( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWebhooksResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerWebhooksResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -532,11 +518,9 @@ public BaseClientHttpResponse listWebhooks( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -583,12 +567,12 @@ public BaseClientHttpResponse updateWebhooks( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWebhooksResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetTriggerWebhooksResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -597,11 +581,9 @@ public BaseClientHttpResponse updateWebhooks( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerOpts.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerOpts.java index b7b613b..0bef6e9 100644 --- a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerOpts.java +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerOpts.java @@ -30,6 +30,8 @@ public final class UpdateTriggerOpts { private final Optional name; + private final Optional emitOnDeploy; + private final Map additionalProperties; private UpdateTriggerOpts( @@ -37,11 +39,13 @@ private UpdateTriggerOpts( Optional active, Optional> configuredProps, Optional name, + Optional emitOnDeploy, Map additionalProperties) { this.externalUserId = externalUserId; this.active = active; this.configuredProps = configuredProps; this.name = name; + this.emitOnDeploy = emitOnDeploy; this.additionalProperties = additionalProperties; } @@ -74,6 +78,14 @@ public Optional getName() { return name; } + /** + * @return Whether the trigger should emit events during deployment + */ + @JsonProperty("emit_on_deploy") + public Optional getEmitOnDeploy() { + return emitOnDeploy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -89,12 +101,13 @@ private boolean equalTo(UpdateTriggerOpts other) { return externalUserId.equals(other.externalUserId) && active.equals(other.active) && configuredProps.equals(other.configuredProps) - && name.equals(other.name); + && name.equals(other.name) + && emitOnDeploy.equals(other.emitOnDeploy); } @java.lang.Override public int hashCode() { - return Objects.hash(this.externalUserId, this.active, this.configuredProps, this.name); + return Objects.hash(this.externalUserId, this.active, this.configuredProps, this.name, this.emitOnDeploy); } @java.lang.Override @@ -135,12 +148,21 @@ public interface _FinalStage { _FinalStage name(Optional name); _FinalStage name(String name); + + /** + *

Whether the trigger should emit events during deployment

+ */ + _FinalStage emitOnDeploy(Optional emitOnDeploy); + + _FinalStage emitOnDeploy(Boolean emitOnDeploy); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements ExternalUserIdStage, _FinalStage { private String externalUserId; + private Optional emitOnDeploy = Optional.empty(); + private Optional name = Optional.empty(); private Optional> configuredProps = Optional.empty(); @@ -158,6 +180,7 @@ public Builder from(UpdateTriggerOpts other) { active(other.getActive()); configuredProps(other.getConfiguredProps()); name(other.getName()); + emitOnDeploy(other.getEmitOnDeploy()); return this; } @@ -173,6 +196,26 @@ public _FinalStage externalUserId(@NotNull String externalUserId) { return this; } + /** + *

Whether the trigger should emit events during deployment

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emitOnDeploy(Boolean emitOnDeploy) { + this.emitOnDeploy = Optional.ofNullable(emitOnDeploy); + return this; + } + + /** + *

Whether the trigger should emit events during deployment

+ */ + @java.lang.Override + @JsonSetter(value = "emit_on_deploy", nulls = Nulls.SKIP) + public _FinalStage emitOnDeploy(Optional emitOnDeploy) { + this.emitOnDeploy = emitOnDeploy; + return this; + } + /** *

The name of the trigger

* @return Reference to {@code this} so that method calls can be chained together. @@ -228,7 +271,8 @@ public _FinalStage active(Optional active) { @java.lang.Override public UpdateTriggerOpts build() { - return new UpdateTriggerOpts(externalUserId, active, configuredProps, name, additionalProperties); + return new UpdateTriggerOpts( + externalUserId, active, configuredProps, name, emitOnDeploy, additionalProperties); } } } diff --git a/src/main/java/com/pipedream/api/resources/filestash/AsyncRawFileStashClient.java b/src/main/java/com/pipedream/api/resources/filestash/AsyncRawFileStashClient.java index aa73f5d..af09992 100644 --- a/src/main/java/com/pipedream/api/resources/filestash/AsyncRawFileStashClient.java +++ b/src/main/java/com/pipedream/api/resources/filestash/AsyncRawFileStashClient.java @@ -50,7 +50,8 @@ public CompletableFuture> downloadFile( .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("file_stash/download"); + .addPathSegments("file_stash") + .addPathSegments("download"); QueryStringMapper.addQueryParameter(httpUrl, "s3_key", request.getS3Key(), false); Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) @@ -82,11 +83,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/pipedream/api/resources/filestash/RawFileStashClient.java b/src/main/java/com/pipedream/api/resources/filestash/RawFileStashClient.java index 2bd5052..e8dd8e7 100644 --- a/src/main/java/com/pipedream/api/resources/filestash/RawFileStashClient.java +++ b/src/main/java/com/pipedream/api/resources/filestash/RawFileStashClient.java @@ -46,7 +46,8 @@ public BaseClientHttpResponse downloadFile( .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("file_stash/download"); + .addPathSegments("file_stash") + .addPathSegments("download"); QueryStringMapper.addQueryParameter(httpUrl, "s3_key", request.getS3Key(), false); Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) @@ -73,11 +74,9 @@ public BaseClientHttpResponse downloadFile( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java b/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java index a922464..1632abd 100644 --- a/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java +++ b/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java @@ -72,19 +72,16 @@ public CompletableFuture> creat @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CreateOAuthTokenResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateOAuthTokenResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java b/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java index 23a1d85..9e8e254 100644 --- a/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java +++ b/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java @@ -65,17 +65,15 @@ public BaseClientHttpResponse create( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateOAuthTokenResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateOAuthTokenResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java b/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java index f3e1636..d9d5275 100644 --- a/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java +++ b/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java @@ -46,7 +46,8 @@ public CompletableFuture> retrieveIn .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("projects/info") + .addPathSegments("projects") + .addPathSegments("info") .build(); Request okhttpRequest = new Request.Builder() .url(httpUrl) @@ -63,13 +64,13 @@ public CompletableFuture> retrieveIn @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProjectInfoResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProjectInfoResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -79,11 +80,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java b/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java index d067eb7..8ed954f 100644 --- a/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java +++ b/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java @@ -42,7 +42,8 @@ public BaseClientHttpResponse retrieveInfo(RequestOptions r .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("projects/info") + .addPathSegments("projects") + .addPathSegments("info") .build(); Request okhttpRequest = new Request.Builder() .url(httpUrl) @@ -56,12 +57,11 @@ public BaseClientHttpResponse retrieveInfo(RequestOptions r } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProjectInfoResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProjectInfoResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -70,11 +70,9 @@ public BaseClientHttpResponse retrieveInfo(RequestOptions r } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java b/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java index 74bc677..f999876 100644 --- a/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java +++ b/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java @@ -73,12 +73,12 @@ public CompletableFuture> get( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Object.class), response)); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -88,11 +88,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -150,12 +148,12 @@ public CompletableFuture> post( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Object.class), response)); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -165,11 +163,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -227,12 +223,12 @@ public CompletableFuture> put( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Object.class), response)); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -242,11 +238,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -296,12 +290,12 @@ public CompletableFuture> delete( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Object.class), response)); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -311,11 +305,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -373,12 +365,12 @@ public CompletableFuture> patch( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Object.class), response)); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -388,11 +380,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java b/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java index 1388ed6..d924762 100644 --- a/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java +++ b/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java @@ -65,11 +65,11 @@ public BaseClientHttpResponse get(String url64, ProxyGetRequest request, } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Object.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -78,11 +78,9 @@ public BaseClientHttpResponse get(String url64, ProxyGetRequest request, } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -127,11 +125,11 @@ public BaseClientHttpResponse post(String url64, ProxyPostRequest reques } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Object.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -140,11 +138,9 @@ public BaseClientHttpResponse post(String url64, ProxyPostRequest reques } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -189,11 +185,11 @@ public BaseClientHttpResponse put(String url64, ProxyPutRequest request, } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Object.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -202,11 +198,9 @@ public BaseClientHttpResponse put(String url64, ProxyPutRequest request, } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -244,11 +238,11 @@ public BaseClientHttpResponse delete( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Object.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -257,11 +251,9 @@ public BaseClientHttpResponse delete( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -307,11 +299,11 @@ public BaseClientHttpResponse patch( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Object.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -320,11 +312,9 @@ public BaseClientHttpResponse patch( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java b/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java index 5ab836b..49f9aef 100644 --- a/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java +++ b/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java @@ -78,13 +78,13 @@ public CompletableFuture> create( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateTokenResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateTokenResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -94,11 +94,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -151,13 +149,13 @@ public CompletableFuture> validate @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ValidateTokenResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ValidateTokenResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -167,11 +165,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java b/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java index f9414f5..e5507d9 100644 --- a/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java +++ b/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java @@ -70,12 +70,11 @@ public BaseClientHttpResponse create(CreateTokenOpts reques } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateTokenResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateTokenResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -84,11 +83,9 @@ public BaseClientHttpResponse create(CreateTokenOpts reques } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -128,12 +125,11 @@ public BaseClientHttpResponse validate( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ValidateTokenResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ValidateTokenResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -142,11 +138,9 @@ public BaseClientHttpResponse validate( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java b/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java index ddcd859..f899699 100644 --- a/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java +++ b/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java @@ -106,9 +106,10 @@ public CompletableFuture>> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { GetComponentsResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentsResponse.class); Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); TriggersListRequest nextRequest = TriggersListRequest.builder() @@ -130,7 +131,6 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -140,11 +140,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -204,13 +202,13 @@ public CompletableFuture> retrieve( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { GetComponentResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentResponse.class); future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -220,11 +218,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -255,7 +251,8 @@ public CompletableFuture> configur .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("triggers/configure") + .addPathSegments("triggers") + .addPathSegments("configure") .build(); RequestBody body; try { @@ -280,13 +277,13 @@ public CompletableFuture> configur @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ConfigurePropResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -296,11 +293,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -331,7 +326,8 @@ public CompletableFuture> reloadProp .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("triggers/props") + .addPathSegments("triggers") + .addPathSegments("props") .build(); RequestBody body; try { @@ -356,13 +352,13 @@ public CompletableFuture> reloadProp @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ReloadPropsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -372,11 +368,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); @@ -407,7 +401,8 @@ public CompletableFuture> deploy( .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("triggers/deploy") + .addPathSegments("triggers") + .addPathSegments("deploy") .build(); RequestBody body; try { @@ -432,13 +427,13 @@ public CompletableFuture> deploy( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { DeployTriggerResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeployTriggerResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeployTriggerResponse.class); future.complete(new BaseClientHttpResponse<>(parsedResponse.getData(), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { future.completeExceptionally(new TooManyRequestsError( @@ -448,11 +443,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java b/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java index 052ddee..543c193 100644 --- a/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java +++ b/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java @@ -98,9 +98,10 @@ public BaseClientHttpResponse> list( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { GetComponentsResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentsResponse.class); Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); TriggersListRequest nextRequest = TriggersListRequest.builder() .from(request) @@ -113,7 +114,6 @@ public BaseClientHttpResponse> list( .body()), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -122,11 +122,9 @@ public BaseClientHttpResponse> list( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -173,12 +171,12 @@ public BaseClientHttpResponse retrieve( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { GetComponentResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentResponse.class); return new BaseClientHttpResponse<>(parsedResponse.getData(), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -187,11 +185,9 @@ public BaseClientHttpResponse retrieve( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -213,7 +209,8 @@ public BaseClientHttpResponse configureProp( .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("triggers/configure") + .addPathSegments("triggers") + .addPathSegments("configure") .build(); RequestBody body; try { @@ -235,12 +232,11 @@ public BaseClientHttpResponse configureProp( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ConfigurePropResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -249,11 +245,9 @@ public BaseClientHttpResponse configureProp( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -275,7 +269,8 @@ public BaseClientHttpResponse reloadProps( .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("triggers/props") + .addPathSegments("triggers") + .addPathSegments("props") .build(); RequestBody body; try { @@ -297,12 +292,11 @@ public BaseClientHttpResponse reloadProps( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ReloadPropsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -311,11 +305,9 @@ public BaseClientHttpResponse reloadProps( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } @@ -336,7 +328,8 @@ public BaseClientHttpResponse deploy(DeployTriggerOpts request, Request .newBuilder() .addPathSegments("v1/connect") .addPathSegment(clientOptions.projectId()) - .addPathSegments("triggers/deploy") + .addPathSegments("triggers") + .addPathSegments("deploy") .build(); RequestBody body; try { @@ -358,12 +351,12 @@ public BaseClientHttpResponse deploy(DeployTriggerOpts request, Request } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { DeployTriggerResponse parsedResponse = - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeployTriggerResponse.class); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeployTriggerResponse.class); return new BaseClientHttpResponse<>(parsedResponse.getData(), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { if (response.code() == 429) { throw new TooManyRequestsError( @@ -372,11 +365,9 @@ public BaseClientHttpResponse deploy(DeployTriggerOpts request, Request } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/pipedream/api/resources/triggers/requests/DeployTriggerOpts.java b/src/main/java/com/pipedream/api/resources/triggers/requests/DeployTriggerOpts.java index 96ffad8..9786097 100644 --- a/src/main/java/com/pipedream/api/resources/triggers/requests/DeployTriggerOpts.java +++ b/src/main/java/com/pipedream/api/resources/triggers/requests/DeployTriggerOpts.java @@ -36,6 +36,8 @@ public final class DeployTriggerOpts { private final Optional webhookUrl; + private final Optional emitOnDeploy; + private final Map additionalProperties; private DeployTriggerOpts( @@ -46,6 +48,7 @@ private DeployTriggerOpts( Optional dynamicPropsId, Optional workflowId, Optional webhookUrl, + Optional emitOnDeploy, Map additionalProperties) { this.id = id; this.version = version; @@ -54,6 +57,7 @@ private DeployTriggerOpts( this.dynamicPropsId = dynamicPropsId; this.workflowId = workflowId; this.webhookUrl = webhookUrl; + this.emitOnDeploy = emitOnDeploy; this.additionalProperties = additionalProperties; } @@ -110,6 +114,14 @@ public Optional getWebhookUrl() { return webhookUrl; } + /** + * @return Whether the trigger should emit events during the deploy hook execution. Defaults to true if not specified. + */ + @JsonProperty("emit_on_deploy") + public Optional getEmitOnDeploy() { + return emitOnDeploy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -128,7 +140,8 @@ private boolean equalTo(DeployTriggerOpts other) { && configuredProps.equals(other.configuredProps) && dynamicPropsId.equals(other.dynamicPropsId) && workflowId.equals(other.workflowId) - && webhookUrl.equals(other.webhookUrl); + && webhookUrl.equals(other.webhookUrl) + && emitOnDeploy.equals(other.emitOnDeploy); } @java.lang.Override @@ -140,7 +153,8 @@ public int hashCode() { this.configuredProps, this.dynamicPropsId, this.workflowId, - this.webhookUrl); + this.webhookUrl, + this.emitOnDeploy); } @java.lang.Override @@ -202,6 +216,13 @@ public interface _FinalStage { _FinalStage webhookUrl(Optional webhookUrl); _FinalStage webhookUrl(String webhookUrl); + + /** + *

Whether the trigger should emit events during the deploy hook execution. Defaults to true if not specified.

+ */ + _FinalStage emitOnDeploy(Optional emitOnDeploy); + + _FinalStage emitOnDeploy(Boolean emitOnDeploy); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -210,6 +231,8 @@ public static final class Builder implements IdStage, ExternalUserIdStage, _Fina private String externalUserId; + private Optional emitOnDeploy = Optional.empty(); + private Optional webhookUrl = Optional.empty(); private Optional workflowId = Optional.empty(); @@ -234,6 +257,7 @@ public Builder from(DeployTriggerOpts other) { dynamicPropsId(other.getDynamicPropsId()); workflowId(other.getWorkflowId()); webhookUrl(other.getWebhookUrl()); + emitOnDeploy(other.getEmitOnDeploy()); return this; } @@ -261,6 +285,26 @@ public _FinalStage externalUserId(@NotNull String externalUserId) { return this; } + /** + *

Whether the trigger should emit events during the deploy hook execution. Defaults to true if not specified.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emitOnDeploy(Boolean emitOnDeploy) { + this.emitOnDeploy = Optional.ofNullable(emitOnDeploy); + return this; + } + + /** + *

Whether the trigger should emit events during the deploy hook execution. Defaults to true if not specified.

+ */ + @java.lang.Override + @JsonSetter(value = "emit_on_deploy", nulls = Nulls.SKIP) + public _FinalStage emitOnDeploy(Optional emitOnDeploy) { + this.emitOnDeploy = emitOnDeploy; + return this; + } + /** *

Optional webhook URL to receive trigger events

* @return Reference to {@code this} so that method calls can be chained together. @@ -364,6 +408,7 @@ public DeployTriggerOpts build() { dynamicPropsId, workflowId, webhookUrl, + emitOnDeploy, additionalProperties); } } 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 c41f6f1..a1ad961 100644 --- a/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java +++ b/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java @@ -78,11 +78,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseClientException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java b/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java index 097eaaf..15600a5 100644 --- a/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java +++ b/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java @@ -68,11 +68,9 @@ public BaseClientHttpResponse deleteExternalUser(String externalUserId, Re } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseClientApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseClientException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/pipedream/api/types/ConfigurableProp.java b/src/main/java/com/pipedream/api/types/ConfigurableProp.java index 4c5213e..886d241 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurableProp.java +++ b/src/main/java/com/pipedream/api/types/ConfigurableProp.java @@ -3,549 +3,1230 @@ */ package com.pipedream.api.types; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.pipedream.api.core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; import java.util.Optional; -import org.jetbrains.annotations.NotNull; -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = ConfigurableProp.Builder.class) public final class ConfigurableProp { - private final String name; + private final Value value; - private final ConfigurablePropType type; + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ConfigurableProp(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ConfigurableProp alert(ConfigurablePropAlert value) { + return new ConfigurableProp(new AlertValue(value)); + } + + public static ConfigurableProp any(ConfigurablePropAny value) { + return new ConfigurableProp(new AnyValue(value)); + } + + public static ConfigurableProp app(ConfigurablePropApp value) { + return new ConfigurableProp(new AppValue(value)); + } + + public static ConfigurableProp boolean_(ConfigurablePropBoolean value) { + return new ConfigurableProp(new BooleanValue(value)); + } + + public static ConfigurableProp interfaceTimer(ConfigurablePropTimer value) { + return new ConfigurableProp(new InterfaceTimerValue(value)); + } + + public static ConfigurableProp interfaceApphook(ConfigurablePropApphook value) { + return new ConfigurableProp(new InterfaceApphookValue(value)); + } + + public static ConfigurableProp integer(ConfigurablePropIntegerArray value) { + return new ConfigurableProp(new IntegerValue(value)); + } + + public static ConfigurableProp interfaceHttp(ConfigurablePropHttp value) { + return new ConfigurableProp(new InterfaceHttpValue(value)); + } + + public static ConfigurableProp serviceDb(ConfigurablePropDb value) { + return new ConfigurableProp(new ServiceDbValue(value)); + } + + public static ConfigurableProp sql(ConfigurablePropSql value) { + return new ConfigurableProp(new SqlValue(value)); + } + + public static ConfigurableProp airtableBaseId(ConfigurablePropAirtableBaseId value) { + return new ConfigurableProp(new AirtableBaseIdValue(value)); + } + + public static ConfigurableProp airtableTableId(ConfigurablePropAirtableTableId value) { + return new ConfigurableProp(new AirtableTableIdValue(value)); + } - private final Optional label; + public static ConfigurableProp airtableViewId(ConfigurablePropAirtableViewId value) { + return new ConfigurableProp(new AirtableViewIdValue(value)); + } - private final Optional description; + public static ConfigurableProp airtableFieldId(ConfigurablePropAirtableFieldId value) { + return new ConfigurableProp(new AirtableFieldIdValue(value)); + } - private final Optional optional; + public static ConfigurableProp discordChannel(ConfigurablePropDiscordChannel value) { + return new ConfigurableProp(new DiscordChannelValue(value)); + } - private final Optional disabled; + public static ConfigurableProp discordChannel(ConfigurablePropDiscordChannelArray value) { + return new ConfigurableProp(new DiscordChannelValue(value)); + } - private final Optional hidden; + public static ConfigurableProp integer(ConfigurablePropInteger value) { + return new ConfigurableProp(new IntegerValue(value)); + } - private final Optional remoteOptions; + public static ConfigurableProp object(ConfigurablePropObject value) { + return new ConfigurableProp(new ObjectValue(value)); + } - private final Optional useQuery; + public static ConfigurableProp string(ConfigurablePropString value) { + return new ConfigurableProp(new StringValue(value)); + } - private final Optional reloadProps; + public static ConfigurableProp string(ConfigurablePropStringArray value) { + return new ConfigurableProp(new StringValue(value)); + } - private final Optional withLabel; + public boolean isAlert() { + return value instanceof AlertValue; + } - private final Map additionalProperties; + public boolean isAny() { + return value instanceof AnyValue; + } - private ConfigurableProp( - String name, - ConfigurablePropType type, - Optional label, - Optional description, - Optional optional, - Optional disabled, - Optional hidden, - Optional remoteOptions, - Optional useQuery, - Optional reloadProps, - Optional withLabel, - Map additionalProperties) { - this.name = name; - this.type = type; - this.label = label; - this.description = description; - this.optional = optional; - this.disabled = disabled; - this.hidden = hidden; - this.remoteOptions = remoteOptions; - this.useQuery = useQuery; - this.reloadProps = reloadProps; - this.withLabel = withLabel; - this.additionalProperties = additionalProperties; + public boolean isApp() { + return value instanceof AppValue; } - /** - * @return When building configuredProps, make sure to use this field as the key when setting the prop value - */ - @JsonProperty("name") - public String getName() { - return name; + public boolean isBoolean() { + return value instanceof BooleanValue; } - @JsonProperty("type") - public ConfigurablePropType getType() { - return type; + public boolean isInterfaceTimer() { + return value instanceof InterfaceTimerValue; } - /** - * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. - */ - @JsonProperty("label") - public Optional getLabel() { - return label; + public boolean isInterfaceApphook() { + return value instanceof InterfaceApphookValue; } - - /** - * @return A description of the prop, shown to the user when configuring the component. - */ - @JsonProperty("description") - public Optional getDescription() { - return description; + + public boolean isInteger() { + return value instanceof IntegerValue; } - - /** - * @return If true, this prop does not need to be specified. - */ - @JsonProperty("optional") - public Optional getOptional() { - return optional; + + public boolean isInterfaceHttp() { + return value instanceof InterfaceHttpValue; } - /** - * @return If true, this prop will be ignored. - */ - @JsonProperty("disabled") - public Optional getDisabled() { - return disabled; + public boolean isServiceDb() { + return value instanceof ServiceDbValue; } - /** - * @return If true, should not expose this prop to the user - */ - @JsonProperty("hidden") - public Optional getHidden() { - return hidden; + public boolean isSql() { + return value instanceof SqlValue; } - /** - * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options - */ - @JsonProperty("remoteOptions") - public Optional getRemoteOptions() { - return remoteOptions; + public boolean isAirtableBaseId() { + return value instanceof AirtableBaseIdValue; } - /** - * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options - */ - @JsonProperty("useQuery") - public Optional getUseQuery() { - return useQuery; - } - - /** - * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one - */ - @JsonProperty("reloadProps") - public Optional getReloadProps() { - return reloadProps; - } - - /** - * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label - */ - @JsonProperty("withLabel") - public Optional getWithLabel() { - return withLabel; + public boolean isAirtableTableId() { + return value instanceof AirtableTableIdValue; } - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ConfigurableProp && equalTo((ConfigurableProp) other); + public boolean isAirtableViewId() { + return value instanceof AirtableViewIdValue; } - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; + public boolean isAirtableFieldId() { + return value instanceof AirtableFieldIdValue; } - private boolean equalTo(ConfigurableProp other) { - return name.equals(other.name) - && type.equals(other.type) - && label.equals(other.label) - && description.equals(other.description) - && optional.equals(other.optional) - && disabled.equals(other.disabled) - && hidden.equals(other.hidden) - && remoteOptions.equals(other.remoteOptions) - && useQuery.equals(other.useQuery) - && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + public boolean isDiscordChannel() { + return value instanceof DiscordChannelValue; } - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.name, - this.type, - this.label, - this.description, - this.optional, - this.disabled, - this.hidden, - this.remoteOptions, - this.useQuery, - this.reloadProps, - this.withLabel); + public boolean isDiscordChannel() { + return value instanceof DiscordChannelValue; } - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); + public boolean isInteger() { + return value instanceof IntegerValue; } - public static NameStage builder() { - return new Builder(); + public boolean isObject() { + return value instanceof ObjectValue; } - public interface NameStage { - /** - *

When building configuredProps, make sure to use this field as the key when setting the prop value

- */ - TypeStage name(@NotNull String name); + public boolean isString() { + return value instanceof StringValue; + } - Builder from(ConfigurableProp other); + public boolean isString() { + return value instanceof StringValue; } - public interface TypeStage { - _FinalStage type(@NotNull ConfigurablePropType type); + public boolean _isUnknown() { + return value instanceof _UnknownValue; } - public interface _FinalStage { - ConfigurableProp build(); + public Optional getAlert() { + if (isAlert()) { + return Optional.of(((AlertValue) value).value); + } + return Optional.empty(); + } + + public Optional getAny() { + if (isAny()) { + return Optional.of(((AnyValue) value).value); + } + return Optional.empty(); + } + + public Optional getApp() { + if (isApp()) { + return Optional.of(((AppValue) value).value); + } + return Optional.empty(); + } + + public Optional getBoolean() { + if (isBoolean()) { + return Optional.of(((BooleanValue) value).value); + } + return Optional.empty(); + } + + public Optional getInterfaceTimer() { + if (isInterfaceTimer()) { + return Optional.of(((InterfaceTimerValue) value).value); + } + return Optional.empty(); + } + + public Optional getInterfaceApphook() { + if (isInterfaceApphook()) { + return Optional.of(((InterfaceApphookValue) value).value); + } + return Optional.empty(); + } + + public Optional getInteger() { + if (isInteger()) { + return Optional.of(((IntegerValue) value).value); + } + return Optional.empty(); + } + + public Optional getInterfaceHttp() { + if (isInterfaceHttp()) { + return Optional.of(((InterfaceHttpValue) value).value); + } + return Optional.empty(); + } + + public Optional getServiceDb() { + if (isServiceDb()) { + return Optional.of(((ServiceDbValue) value).value); + } + return Optional.empty(); + } + + public Optional getSql() { + if (isSql()) { + return Optional.of(((SqlValue) value).value); + } + return Optional.empty(); + } + + public Optional getAirtableBaseId() { + if (isAirtableBaseId()) { + return Optional.of(((AirtableBaseIdValue) value).value); + } + return Optional.empty(); + } + + public Optional getAirtableTableId() { + if (isAirtableTableId()) { + return Optional.of(((AirtableTableIdValue) value).value); + } + return Optional.empty(); + } + + public Optional getAirtableViewId() { + if (isAirtableViewId()) { + return Optional.of(((AirtableViewIdValue) value).value); + } + return Optional.empty(); + } + + public Optional getAirtableFieldId() { + if (isAirtableFieldId()) { + return Optional.of(((AirtableFieldIdValue) value).value); + } + return Optional.empty(); + } + + public Optional getDiscordChannel() { + if (isDiscordChannel()) { + return Optional.of(((DiscordChannelValue) value).value); + } + return Optional.empty(); + } + + public Optional getDiscordChannel() { + if (isDiscordChannel()) { + return Optional.of(((DiscordChannelValue) value).value); + } + return Optional.empty(); + } + + public Optional getInteger() { + if (isInteger()) { + return Optional.of(((IntegerValue) value).value); + } + return Optional.empty(); + } + + public Optional getObject() { + if (isObject()) { + return Optional.of(((ObjectValue) value).value); + } + return Optional.empty(); + } + + public Optional getString() { + if (isString()) { + return Optional.of(((StringValue) value).value); + } + return Optional.empty(); + } + + public Optional getString() { + if (isString()) { + return Optional.of(((StringValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitAlert(ConfigurablePropAlert alert); + + T visitAny(ConfigurablePropAny any); + + T visitApp(ConfigurablePropApp app); - /** - *

Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

- */ - _FinalStage label(Optional label); + T visitBoolean(ConfigurablePropBoolean boolean_); - _FinalStage label(String label); + T visitInterfaceTimer(ConfigurablePropTimer interfaceTimer); - /** - *

A description of the prop, shown to the user when configuring the component.

- */ - _FinalStage description(Optional description); + T visitInterfaceApphook(ConfigurablePropApphook interfaceApphook); - _FinalStage description(String description); + T visitInteger(ConfigurablePropIntegerArray integer); - /** - *

If true, this prop does not need to be specified.

- */ - _FinalStage optional(Optional optional); + T visitInterfaceHttp(ConfigurablePropHttp interfaceHttp); - _FinalStage optional(Boolean optional); + T visitServiceDb(ConfigurablePropDb serviceDb); - /** - *

If true, this prop will be ignored.

- */ - _FinalStage disabled(Optional disabled); + T visitSql(ConfigurablePropSql sql); - _FinalStage disabled(Boolean disabled); + T visitAirtableBaseId(ConfigurablePropAirtableBaseId airtableBaseId); - /** - *

If true, should not expose this prop to the user

- */ - _FinalStage hidden(Optional hidden); + T visitAirtableTableId(ConfigurablePropAirtableTableId airtableTableId); - _FinalStage hidden(Boolean hidden); + T visitAirtableViewId(ConfigurablePropAirtableViewId airtableViewId); - /** - *

If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

- */ - _FinalStage remoteOptions(Optional remoteOptions); + T visitAirtableFieldId(ConfigurablePropAirtableFieldId airtableFieldId); - _FinalStage remoteOptions(Boolean remoteOptions); + T visitDiscordChannel(ConfigurablePropDiscordChannel discordChannel); - /** - *

If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

- */ - _FinalStage useQuery(Optional useQuery); + T visitDiscordChannel(ConfigurablePropDiscordChannelArray discordChannel); - _FinalStage useQuery(Boolean useQuery); + T visitInteger(ConfigurablePropInteger integer); - /** - *

If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

- */ - _FinalStage reloadProps(Optional reloadProps); + T visitObject(ConfigurablePropObject object); - _FinalStage reloadProps(Boolean reloadProps); + T visitString(ConfigurablePropString string); - /** - *

If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

- */ - _FinalStage withLabel(Optional withLabel); + T visitString(ConfigurablePropStringArray string); - _FinalStage withLabel(Boolean withLabel); + T _visitUnknown(Object unknownType); } + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(AlertValue.class), + @JsonSubTypes.Type(AnyValue.class), + @JsonSubTypes.Type(AppValue.class), + @JsonSubTypes.Type(BooleanValue.class), + @JsonSubTypes.Type(InterfaceTimerValue.class), + @JsonSubTypes.Type(InterfaceApphookValue.class), + @JsonSubTypes.Type(IntegerValue.class), + @JsonSubTypes.Type(InterfaceHttpValue.class), + @JsonSubTypes.Type(ServiceDbValue.class), + @JsonSubTypes.Type(SqlValue.class), + @JsonSubTypes.Type(AirtableBaseIdValue.class), + @JsonSubTypes.Type(AirtableTableIdValue.class), + @JsonSubTypes.Type(AirtableViewIdValue.class), + @JsonSubTypes.Type(AirtableFieldIdValue.class), + @JsonSubTypes.Type(DiscordChannelValue.class), + @JsonSubTypes.Type(DiscordChannelValue.class), + @JsonSubTypes.Type(IntegerValue.class), + @JsonSubTypes.Type(ObjectValue.class), + @JsonSubTypes.Type(StringValue.class), + @JsonSubTypes.Type(StringValue.class) + }) @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, TypeStage, _FinalStage { - private String name; + private interface Value { + T visit(Visitor visitor); + } - private ConfigurablePropType type; + @JsonTypeName("alert") + @JsonIgnoreProperties("type") + private static final class AlertValue implements Value { + @JsonUnwrapped + private ConfigurablePropAlert value; - private Optional withLabel = Optional.empty(); + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AlertValue() {} - private Optional reloadProps = Optional.empty(); + private AlertValue(ConfigurablePropAlert value) { + this.value = value; + } - private Optional useQuery = Optional.empty(); + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAlert(value); + } - private Optional remoteOptions = Optional.empty(); + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AlertValue && equalTo((AlertValue) other); + } - private Optional hidden = Optional.empty(); + private boolean equalTo(AlertValue other) { + return value.equals(other.value); + } - private Optional disabled = Optional.empty(); + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } - private Optional optional = Optional.empty(); + @java.lang.Override + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } - private Optional description = Optional.empty(); + @JsonTypeName("any") + @JsonIgnoreProperties("type") + private static final class AnyValue implements Value { + @JsonUnwrapped + private ConfigurablePropAny value; - private Optional label = Optional.empty(); + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AnyValue() {} - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); + private AnyValue(ConfigurablePropAny value) { + this.value = value; + } - private Builder() {} + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAny(value); + } @java.lang.Override - public Builder from(ConfigurableProp other) { - name(other.getName()); - type(other.getType()); - label(other.getLabel()); - description(other.getDescription()); - optional(other.getOptional()); - disabled(other.getDisabled()); - hidden(other.getHidden()); - remoteOptions(other.getRemoteOptions()); - useQuery(other.getUseQuery()); - reloadProps(other.getReloadProps()); - withLabel(other.getWithLabel()); - return this; + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnyValue && equalTo((AnyValue) other); + } + + private boolean equalTo(AnyValue other) { + return value.equals(other.value); } - /** - *

When building configuredProps, make sure to use this field as the key when setting the prop value

- *

When building configuredProps, make sure to use this field as the key when setting the prop value

- * @return Reference to {@code this} so that method calls can be chained together. - */ @java.lang.Override - @JsonSetter("name") - public TypeStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; + public int hashCode() { + return Objects.hash(this.value); } @java.lang.Override - @JsonSetter("type") - public _FinalStage type(@NotNull ConfigurablePropType type) { - this.type = Objects.requireNonNull(type, "type must not be null"); - return this; + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } + + @JsonTypeName("app") + @JsonIgnoreProperties("type") + private static final class AppValue implements Value { + @JsonUnwrapped + private ConfigurablePropApp value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AppValue() {} + + private AppValue(ConfigurablePropApp value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitApp(value); } - /** - *

If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

- * @return Reference to {@code this} so that method calls can be chained together. - */ @java.lang.Override - public _FinalStage withLabel(Boolean withLabel) { - this.withLabel = Optional.ofNullable(withLabel); - return this; + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppValue && equalTo((AppValue) other); + } + + private boolean equalTo(AppValue other) { + return value.equals(other.value); } - /** - *

If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

- */ @java.lang.Override - @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) - public _FinalStage withLabel(Optional withLabel) { - this.withLabel = withLabel; - return this; + public int hashCode() { + return Objects.hash(this.value); } - /** - *

If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

- * @return Reference to {@code this} so that method calls can be chained together. - */ @java.lang.Override - public _FinalStage reloadProps(Boolean reloadProps) { - this.reloadProps = Optional.ofNullable(reloadProps); - return this; + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } + + @JsonTypeName("boolean") + @JsonIgnoreProperties("type") + private static final class BooleanValue implements Value { + @JsonUnwrapped + private ConfigurablePropBoolean value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BooleanValue() {} + + private BooleanValue(ConfigurablePropBoolean value) { + this.value = value; } - /** - *

If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

- */ @java.lang.Override - @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) - public _FinalStage reloadProps(Optional reloadProps) { - this.reloadProps = reloadProps; - return this; + public T visit(Visitor visitor) { + return visitor.visitBoolean(value); } - /** - *

If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

- * @return Reference to {@code this} so that method calls can be chained together. - */ @java.lang.Override - public _FinalStage useQuery(Boolean useQuery) { - this.useQuery = Optional.ofNullable(useQuery); - return this; + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BooleanValue && equalTo((BooleanValue) other); + } + + private boolean equalTo(BooleanValue other) { + return value.equals(other.value); } - /** - *

If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

- */ @java.lang.Override - @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) - public _FinalStage useQuery(Optional useQuery) { - this.useQuery = useQuery; - return this; + public int hashCode() { + return Objects.hash(this.value); } - /** - *

If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

- * @return Reference to {@code this} so that method calls can be chained together. - */ @java.lang.Override - public _FinalStage remoteOptions(Boolean remoteOptions) { - this.remoteOptions = Optional.ofNullable(remoteOptions); - return this; + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } + + @JsonTypeName("$.interface.timer") + @JsonIgnoreProperties("type") + private static final class InterfaceTimerValue implements Value { + @JsonUnwrapped + private ConfigurablePropTimer value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private InterfaceTimerValue() {} + + private InterfaceTimerValue(ConfigurablePropTimer value) { + this.value = value; } - /** - *

If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

- */ @java.lang.Override - @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) - public _FinalStage remoteOptions(Optional remoteOptions) { - this.remoteOptions = remoteOptions; - return this; + public T visit(Visitor visitor) { + return visitor.visitInterfaceTimer(value); } - /** - *

If true, should not expose this prop to the user

- * @return Reference to {@code this} so that method calls can be chained together. - */ @java.lang.Override - public _FinalStage hidden(Boolean hidden) { - this.hidden = Optional.ofNullable(hidden); - return this; + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InterfaceTimerValue && equalTo((InterfaceTimerValue) other); + } + + private boolean equalTo(InterfaceTimerValue other) { + return value.equals(other.value); } - /** - *

If true, should not expose this prop to the user

- */ @java.lang.Override - @JsonSetter(value = "hidden", nulls = Nulls.SKIP) - public _FinalStage hidden(Optional hidden) { - this.hidden = hidden; - return this; + public int hashCode() { + return Objects.hash(this.value); } - /** - *

If true, this prop will be ignored.

- * @return Reference to {@code this} so that method calls can be chained together. - */ @java.lang.Override - public _FinalStage disabled(Boolean disabled) { - this.disabled = Optional.ofNullable(disabled); - return this; + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } + + @JsonTypeName("$.interface.apphook") + @JsonIgnoreProperties("type") + private static final class InterfaceApphookValue implements Value { + @JsonUnwrapped + private ConfigurablePropApphook value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private InterfaceApphookValue() {} + + private InterfaceApphookValue(ConfigurablePropApphook value) { + this.value = value; } - /** - *

If true, this prop will be ignored.

- */ @java.lang.Override - @JsonSetter(value = "disabled", nulls = Nulls.SKIP) - public _FinalStage disabled(Optional disabled) { - this.disabled = disabled; - return this; + public T visit(Visitor visitor) { + return visitor.visitInterfaceApphook(value); } - /** - *

If true, this prop does not need to be specified.

- * @return Reference to {@code this} so that method calls can be chained together. - */ @java.lang.Override - public _FinalStage optional(Boolean optional) { - this.optional = Optional.ofNullable(optional); - return this; + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InterfaceApphookValue && equalTo((InterfaceApphookValue) other); + } + + private boolean equalTo(InterfaceApphookValue other) { + return value.equals(other.value); } - /** - *

If true, this prop does not need to be specified.

- */ @java.lang.Override - @JsonSetter(value = "optional", nulls = Nulls.SKIP) - public _FinalStage optional(Optional optional) { - this.optional = optional; - return this; + public int hashCode() { + return Objects.hash(this.value); } - /** - *

A description of the prop, shown to the user when configuring the component.

- * @return Reference to {@code this} so that method calls can be chained together. - */ @java.lang.Override - public _FinalStage description(String description) { - this.description = Optional.ofNullable(description); - return this; + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } + + @JsonTypeName("integer[]") + @JsonIgnoreProperties("type") + private static final class IntegerValue implements Value { + @JsonUnwrapped + private ConfigurablePropIntegerArray value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private IntegerValue() {} + + private IntegerValue(ConfigurablePropIntegerArray value) { + this.value = value; } - /** - *

A description of the prop, shown to the user when configuring the component.

- */ @java.lang.Override - @JsonSetter(value = "description", nulls = Nulls.SKIP) - public _FinalStage description(Optional description) { - this.description = description; - return this; + public T visit(Visitor visitor) { + return visitor.visitInteger(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IntegerValue && equalTo((IntegerValue) other); + } + + private boolean equalTo(IntegerValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } + + @JsonTypeName("$.interface.http") + @JsonIgnoreProperties("type") + private static final class InterfaceHttpValue implements Value { + @JsonUnwrapped + private ConfigurablePropHttp value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private InterfaceHttpValue() {} + + private InterfaceHttpValue(ConfigurablePropHttp value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitInterfaceHttp(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InterfaceHttpValue && equalTo((InterfaceHttpValue) other); + } + + private boolean equalTo(InterfaceHttpValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } + + @JsonTypeName("$.service.db") + @JsonIgnoreProperties("type") + private static final class ServiceDbValue implements Value { + @JsonUnwrapped + private ConfigurablePropDb value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ServiceDbValue() {} + + private ServiceDbValue(ConfigurablePropDb value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitServiceDb(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServiceDbValue && equalTo((ServiceDbValue) other); + } + + private boolean equalTo(ServiceDbValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sql") + @JsonIgnoreProperties("type") + private static final class SqlValue implements Value { + @JsonUnwrapped + private ConfigurablePropSql value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SqlValue() {} + + private SqlValue(ConfigurablePropSql value) { + this.value = value; } - /** - *

Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

- * @return Reference to {@code this} so that method calls can be chained together. - */ @java.lang.Override - public _FinalStage label(String label) { - this.label = Optional.ofNullable(label); - return this; + public T visit(Visitor visitor) { + return visitor.visitSql(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SqlValue && equalTo((SqlValue) other); + } + + private boolean equalTo(SqlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } + + @JsonTypeName("$.airtable.baseId") + @JsonIgnoreProperties("type") + private static final class AirtableBaseIdValue implements Value { + @JsonUnwrapped + private ConfigurablePropAirtableBaseId value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AirtableBaseIdValue() {} + + private AirtableBaseIdValue(ConfigurablePropAirtableBaseId value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAirtableBaseId(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AirtableBaseIdValue && equalTo((AirtableBaseIdValue) other); + } + + private boolean equalTo(AirtableBaseIdValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } + + @JsonTypeName("$.airtable.tableId") + @JsonIgnoreProperties("type") + private static final class AirtableTableIdValue implements Value { + @JsonUnwrapped + private ConfigurablePropAirtableTableId value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AirtableTableIdValue() {} + + private AirtableTableIdValue(ConfigurablePropAirtableTableId value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAirtableTableId(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AirtableTableIdValue && equalTo((AirtableTableIdValue) other); + } + + private boolean equalTo(AirtableTableIdValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } + + @JsonTypeName("$.airtable.viewId") + @JsonIgnoreProperties("type") + private static final class AirtableViewIdValue implements Value { + @JsonUnwrapped + private ConfigurablePropAirtableViewId value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AirtableViewIdValue() {} + + private AirtableViewIdValue(ConfigurablePropAirtableViewId value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAirtableViewId(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AirtableViewIdValue && equalTo((AirtableViewIdValue) other); + } + + private boolean equalTo(AirtableViewIdValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } + + @JsonTypeName("$.airtable.fieldId") + @JsonIgnoreProperties("type") + private static final class AirtableFieldIdValue implements Value { + @JsonUnwrapped + private ConfigurablePropAirtableFieldId value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AirtableFieldIdValue() {} + + private AirtableFieldIdValue(ConfigurablePropAirtableFieldId value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAirtableFieldId(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AirtableFieldIdValue && equalTo((AirtableFieldIdValue) other); + } + + private boolean equalTo(AirtableFieldIdValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } + + @JsonTypeName("$.discord.channel") + @JsonIgnoreProperties("type") + private static final class DiscordChannelValue implements Value { + @JsonUnwrapped + private ConfigurablePropDiscordChannel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DiscordChannelValue() {} + + private DiscordChannelValue(ConfigurablePropDiscordChannel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDiscordChannel(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DiscordChannelValue && equalTo((DiscordChannelValue) other); + } + + private boolean equalTo(DiscordChannelValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } + + @JsonTypeName("$.discord.channel[]") + @JsonIgnoreProperties("type") + private static final class DiscordChannelValue implements Value { + @JsonUnwrapped + private ConfigurablePropDiscordChannelArray value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DiscordChannelValue() {} + + private DiscordChannelValue(ConfigurablePropDiscordChannelArray value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDiscordChannel(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DiscordChannelValue && equalTo((DiscordChannelValue) other); + } + + private boolean equalTo(DiscordChannelValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } + + @JsonTypeName("integer") + @JsonIgnoreProperties("type") + private static final class IntegerValue implements Value { + @JsonUnwrapped + private ConfigurablePropInteger value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private IntegerValue() {} + + private IntegerValue(ConfigurablePropInteger value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitInteger(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IntegerValue && equalTo((IntegerValue) other); + } + + private boolean equalTo(IntegerValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } + + @JsonTypeName("object") + @JsonIgnoreProperties("type") + private static final class ObjectValue implements Value { + @JsonUnwrapped + private ConfigurablePropObject value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ObjectValue() {} + + private ObjectValue(ConfigurablePropObject value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitObject(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ObjectValue && equalTo((ObjectValue) other); + } + + private boolean equalTo(ObjectValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } + + @JsonTypeName("string") + @JsonIgnoreProperties("type") + private static final class StringValue implements Value { + @JsonUnwrapped + private ConfigurablePropString value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private StringValue() {} + + private StringValue(ConfigurablePropString value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitString(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StringValue && equalTo((StringValue) other); + } + + private boolean equalTo(StringValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } + + @JsonTypeName("string[]") + @JsonIgnoreProperties("type") + private static final class StringValue implements Value { + @JsonUnwrapped + private ConfigurablePropStringArray value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private StringValue() {} + + private StringValue(ConfigurablePropStringArray value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitString(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StringValue && equalTo((StringValue) other); + } + + private boolean equalTo(StringValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ConfigurableProp{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("type") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); } - /** - *

Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

- */ @java.lang.Override - @JsonSetter(value = "label", nulls = Nulls.SKIP) - public _FinalStage label(Optional label) { - this.label = label; - return this; + public int hashCode() { + return Objects.hash(this.type, this.value); } @java.lang.Override - public ConfigurableProp build() { - return new ConfigurableProp( - name, - type, - label, - description, - optional, - disabled, - hidden, - remoteOptions, - useQuery, - reloadProps, - withLabel, - additionalProperties); + public String toString() { + return "ConfigurableProp{" + "type: " + type + ", value: " + value + "}"; } } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropAirtableBaseId.java b/src/main/java/com/pipedream/api/types/ConfigurablePropAirtableBaseId.java index 4e70c27..c22bc7c 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropAirtableBaseId.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropAirtableBaseId.java @@ -20,9 +20,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropAirtableBaseId.Builder.class) -public final class ConfigurablePropAirtableBaseId { - private final String appProp; - +public final class ConfigurablePropAirtableBaseId implements IConfigurablePropBase { private final String name; private final Optional label; @@ -43,10 +41,11 @@ public final class ConfigurablePropAirtableBaseId { private final Optional withLabel; + private final String appProp; + private final Map additionalProperties; private ConfigurablePropAirtableBaseId( - String appProp, String name, Optional label, Optional description, @@ -57,8 +56,8 @@ private ConfigurablePropAirtableBaseId( Optional useQuery, Optional reloadProps, Optional withLabel, + String appProp, Map additionalProperties) { - this.appProp = appProp; this.name = name; this.label = label; this.description = description; @@ -69,26 +68,15 @@ private ConfigurablePropAirtableBaseId( this.useQuery = useQuery; this.reloadProps = reloadProps; this.withLabel = withLabel; + this.appProp = appProp; this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "$.airtable.baseId"; - } - - /** - * @return The name of the app prop that provides Airtable authentication - */ - @JsonProperty("appProp") - public String getAppProp() { - return appProp; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -97,6 +85,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -105,6 +94,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -113,6 +103,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -121,6 +112,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -129,6 +121,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -137,6 +130,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -145,6 +139,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -153,6 +148,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -161,10 +157,19 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + /** + * @return The name of the app prop that provides Airtable authentication + */ + @JsonProperty("appProp") + public String getAppProp() { + return appProp; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -177,8 +182,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConfigurablePropAirtableBaseId other) { - return appProp.equals(other.appProp) - && name.equals(other.name) + return name.equals(other.name) && label.equals(other.label) && description.equals(other.description) && optional.equals(other.optional) @@ -187,13 +191,13 @@ private boolean equalTo(ConfigurablePropAirtableBaseId other) { && remoteOptions.equals(other.remoteOptions) && useQuery.equals(other.useQuery) && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + && withLabel.equals(other.withLabel) + && appProp.equals(other.appProp); } @java.lang.Override public int hashCode() { return Objects.hash( - this.appProp, this.name, this.label, this.description, @@ -203,7 +207,8 @@ public int hashCode() { this.remoteOptions, this.useQuery, this.reloadProps, - this.withLabel); + this.withLabel, + this.appProp); } @java.lang.Override @@ -211,24 +216,24 @@ public String toString() { return ObjectMappers.stringify(this); } - public static AppPropStage builder() { + public static NameStage builder() { return new Builder(); } - public interface AppPropStage { + public interface NameStage { /** - *

The name of the app prop that provides Airtable authentication

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

*/ - NameStage appProp(@NotNull String appProp); + AppPropStage name(@NotNull String name); Builder from(ConfigurablePropAirtableBaseId other); } - public interface NameStage { + public interface AppPropStage { /** - *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

The name of the app prop that provides Airtable authentication

*/ - _FinalStage name(@NotNull String name); + _FinalStage appProp(@NotNull String appProp); } public interface _FinalStage { @@ -299,11 +304,11 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements AppPropStage, NameStage, _FinalStage { - private String appProp; - + public static final class Builder implements NameStage, AppPropStage, _FinalStage { private String name; + private String appProp; + private Optional withLabel = Optional.empty(); private Optional reloadProps = Optional.empty(); @@ -329,7 +334,6 @@ private Builder() {} @java.lang.Override public Builder from(ConfigurablePropAirtableBaseId other) { - appProp(other.getAppProp()); name(other.getName()); label(other.getLabel()); description(other.getDescription()); @@ -340,30 +344,31 @@ public Builder from(ConfigurablePropAirtableBaseId other) { useQuery(other.getUseQuery()); reloadProps(other.getReloadProps()); withLabel(other.getWithLabel()); + appProp(other.getAppProp()); return this; } /** - *

The name of the app prop that provides Airtable authentication

- *

The name of the app prop that provides Airtable authentication

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - @JsonSetter("appProp") - public NameStage appProp(@NotNull String appProp) { - this.appProp = Objects.requireNonNull(appProp, "appProp must not be null"); + @JsonSetter("name") + public AppPropStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); return this; } /** - *

When building configuredProps, make sure to use this field as the key when setting the prop value

- *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

The name of the app prop that provides Airtable authentication

+ *

The name of the app prop that provides Airtable authentication

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - @JsonSetter("name") - public _FinalStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); + @JsonSetter("appProp") + public _FinalStage appProp(@NotNull String appProp) { + this.appProp = Objects.requireNonNull(appProp, "appProp must not be null"); return this; } @@ -550,7 +555,6 @@ public _FinalStage label(Optional label) { @java.lang.Override public ConfigurablePropAirtableBaseId build() { return new ConfigurablePropAirtableBaseId( - appProp, name, label, description, @@ -561,6 +565,7 @@ public ConfigurablePropAirtableBaseId build() { useQuery, reloadProps, withLabel, + appProp, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropAirtableFieldId.java b/src/main/java/com/pipedream/api/types/ConfigurablePropAirtableFieldId.java index 04b67ca..85a2da9 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropAirtableFieldId.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropAirtableFieldId.java @@ -20,9 +20,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropAirtableFieldId.Builder.class) -public final class ConfigurablePropAirtableFieldId { - private final String tableIdProp; - +public final class ConfigurablePropAirtableFieldId implements IConfigurablePropBase { private final String name; private final Optional label; @@ -43,10 +41,11 @@ public final class ConfigurablePropAirtableFieldId { private final Optional withLabel; + private final String tableIdProp; + private final Map additionalProperties; private ConfigurablePropAirtableFieldId( - String tableIdProp, String name, Optional label, Optional description, @@ -57,8 +56,8 @@ private ConfigurablePropAirtableFieldId( Optional useQuery, Optional reloadProps, Optional withLabel, + String tableIdProp, Map additionalProperties) { - this.tableIdProp = tableIdProp; this.name = name; this.label = label; this.description = description; @@ -69,26 +68,15 @@ private ConfigurablePropAirtableFieldId( this.useQuery = useQuery; this.reloadProps = reloadProps; this.withLabel = withLabel; + this.tableIdProp = tableIdProp; this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "$.airtable.fieldId"; - } - - /** - * @return The name of the prop that provides the Airtable table ID - */ - @JsonProperty("tableIdProp") - public String getTableIdProp() { - return tableIdProp; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -97,6 +85,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -105,6 +94,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -113,6 +103,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -121,6 +112,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -129,6 +121,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -137,6 +130,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -145,6 +139,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -153,6 +148,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -161,10 +157,19 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + /** + * @return The name of the prop that provides the Airtable table ID + */ + @JsonProperty("tableIdProp") + public String getTableIdProp() { + return tableIdProp; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -177,8 +182,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConfigurablePropAirtableFieldId other) { - return tableIdProp.equals(other.tableIdProp) - && name.equals(other.name) + return name.equals(other.name) && label.equals(other.label) && description.equals(other.description) && optional.equals(other.optional) @@ -187,13 +191,13 @@ private boolean equalTo(ConfigurablePropAirtableFieldId other) { && remoteOptions.equals(other.remoteOptions) && useQuery.equals(other.useQuery) && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + && withLabel.equals(other.withLabel) + && tableIdProp.equals(other.tableIdProp); } @java.lang.Override public int hashCode() { return Objects.hash( - this.tableIdProp, this.name, this.label, this.description, @@ -203,7 +207,8 @@ public int hashCode() { this.remoteOptions, this.useQuery, this.reloadProps, - this.withLabel); + this.withLabel, + this.tableIdProp); } @java.lang.Override @@ -211,24 +216,24 @@ public String toString() { return ObjectMappers.stringify(this); } - public static TableIdPropStage builder() { + public static NameStage builder() { return new Builder(); } - public interface TableIdPropStage { + public interface NameStage { /** - *

The name of the prop that provides the Airtable table ID

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

*/ - NameStage tableIdProp(@NotNull String tableIdProp); + TableIdPropStage name(@NotNull String name); Builder from(ConfigurablePropAirtableFieldId other); } - public interface NameStage { + public interface TableIdPropStage { /** - *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

The name of the prop that provides the Airtable table ID

*/ - _FinalStage name(@NotNull String name); + _FinalStage tableIdProp(@NotNull String tableIdProp); } public interface _FinalStage { @@ -299,11 +304,11 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TableIdPropStage, NameStage, _FinalStage { - private String tableIdProp; - + public static final class Builder implements NameStage, TableIdPropStage, _FinalStage { private String name; + private String tableIdProp; + private Optional withLabel = Optional.empty(); private Optional reloadProps = Optional.empty(); @@ -329,7 +334,6 @@ private Builder() {} @java.lang.Override public Builder from(ConfigurablePropAirtableFieldId other) { - tableIdProp(other.getTableIdProp()); name(other.getName()); label(other.getLabel()); description(other.getDescription()); @@ -340,30 +344,31 @@ public Builder from(ConfigurablePropAirtableFieldId other) { useQuery(other.getUseQuery()); reloadProps(other.getReloadProps()); withLabel(other.getWithLabel()); + tableIdProp(other.getTableIdProp()); return this; } /** - *

The name of the prop that provides the Airtable table ID

- *

The name of the prop that provides the Airtable table ID

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - @JsonSetter("tableIdProp") - public NameStage tableIdProp(@NotNull String tableIdProp) { - this.tableIdProp = Objects.requireNonNull(tableIdProp, "tableIdProp must not be null"); + @JsonSetter("name") + public TableIdPropStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); return this; } /** - *

When building configuredProps, make sure to use this field as the key when setting the prop value

- *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

The name of the prop that provides the Airtable table ID

+ *

The name of the prop that provides the Airtable table ID

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - @JsonSetter("name") - public _FinalStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); + @JsonSetter("tableIdProp") + public _FinalStage tableIdProp(@NotNull String tableIdProp) { + this.tableIdProp = Objects.requireNonNull(tableIdProp, "tableIdProp must not be null"); return this; } @@ -550,7 +555,6 @@ public _FinalStage label(Optional label) { @java.lang.Override public ConfigurablePropAirtableFieldId build() { return new ConfigurablePropAirtableFieldId( - tableIdProp, name, label, description, @@ -561,6 +565,7 @@ public ConfigurablePropAirtableFieldId build() { useQuery, reloadProps, withLabel, + tableIdProp, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropAirtableTableId.java b/src/main/java/com/pipedream/api/types/ConfigurablePropAirtableTableId.java index 0ceeaee..8ca1904 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropAirtableTableId.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropAirtableTableId.java @@ -20,9 +20,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropAirtableTableId.Builder.class) -public final class ConfigurablePropAirtableTableId { - private final String baseIdProp; - +public final class ConfigurablePropAirtableTableId implements IConfigurablePropBase { private final String name; private final Optional label; @@ -43,10 +41,11 @@ public final class ConfigurablePropAirtableTableId { private final Optional withLabel; + private final String baseIdProp; + private final Map additionalProperties; private ConfigurablePropAirtableTableId( - String baseIdProp, String name, Optional label, Optional description, @@ -57,8 +56,8 @@ private ConfigurablePropAirtableTableId( Optional useQuery, Optional reloadProps, Optional withLabel, + String baseIdProp, Map additionalProperties) { - this.baseIdProp = baseIdProp; this.name = name; this.label = label; this.description = description; @@ -69,26 +68,15 @@ private ConfigurablePropAirtableTableId( this.useQuery = useQuery; this.reloadProps = reloadProps; this.withLabel = withLabel; + this.baseIdProp = baseIdProp; this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "$.airtable.tableId"; - } - - /** - * @return The name of the prop that provides the Airtable base ID - */ - @JsonProperty("baseIdProp") - public String getBaseIdProp() { - return baseIdProp; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -97,6 +85,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -105,6 +94,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -113,6 +103,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -121,6 +112,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -129,6 +121,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -137,6 +130,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -145,6 +139,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -153,6 +148,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -161,10 +157,19 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + /** + * @return The name of the prop that provides the Airtable base ID + */ + @JsonProperty("baseIdProp") + public String getBaseIdProp() { + return baseIdProp; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -177,8 +182,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConfigurablePropAirtableTableId other) { - return baseIdProp.equals(other.baseIdProp) - && name.equals(other.name) + return name.equals(other.name) && label.equals(other.label) && description.equals(other.description) && optional.equals(other.optional) @@ -187,13 +191,13 @@ private boolean equalTo(ConfigurablePropAirtableTableId other) { && remoteOptions.equals(other.remoteOptions) && useQuery.equals(other.useQuery) && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + && withLabel.equals(other.withLabel) + && baseIdProp.equals(other.baseIdProp); } @java.lang.Override public int hashCode() { return Objects.hash( - this.baseIdProp, this.name, this.label, this.description, @@ -203,7 +207,8 @@ public int hashCode() { this.remoteOptions, this.useQuery, this.reloadProps, - this.withLabel); + this.withLabel, + this.baseIdProp); } @java.lang.Override @@ -211,24 +216,24 @@ public String toString() { return ObjectMappers.stringify(this); } - public static BaseIdPropStage builder() { + public static NameStage builder() { return new Builder(); } - public interface BaseIdPropStage { + public interface NameStage { /** - *

The name of the prop that provides the Airtable base ID

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

*/ - NameStage baseIdProp(@NotNull String baseIdProp); + BaseIdPropStage name(@NotNull String name); Builder from(ConfigurablePropAirtableTableId other); } - public interface NameStage { + public interface BaseIdPropStage { /** - *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

The name of the prop that provides the Airtable base ID

*/ - _FinalStage name(@NotNull String name); + _FinalStage baseIdProp(@NotNull String baseIdProp); } public interface _FinalStage { @@ -299,11 +304,11 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements BaseIdPropStage, NameStage, _FinalStage { - private String baseIdProp; - + public static final class Builder implements NameStage, BaseIdPropStage, _FinalStage { private String name; + private String baseIdProp; + private Optional withLabel = Optional.empty(); private Optional reloadProps = Optional.empty(); @@ -329,7 +334,6 @@ private Builder() {} @java.lang.Override public Builder from(ConfigurablePropAirtableTableId other) { - baseIdProp(other.getBaseIdProp()); name(other.getName()); label(other.getLabel()); description(other.getDescription()); @@ -340,30 +344,31 @@ public Builder from(ConfigurablePropAirtableTableId other) { useQuery(other.getUseQuery()); reloadProps(other.getReloadProps()); withLabel(other.getWithLabel()); + baseIdProp(other.getBaseIdProp()); return this; } /** - *

The name of the prop that provides the Airtable base ID

- *

The name of the prop that provides the Airtable base ID

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - @JsonSetter("baseIdProp") - public NameStage baseIdProp(@NotNull String baseIdProp) { - this.baseIdProp = Objects.requireNonNull(baseIdProp, "baseIdProp must not be null"); + @JsonSetter("name") + public BaseIdPropStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); return this; } /** - *

When building configuredProps, make sure to use this field as the key when setting the prop value

- *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

The name of the prop that provides the Airtable base ID

+ *

The name of the prop that provides the Airtable base ID

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - @JsonSetter("name") - public _FinalStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); + @JsonSetter("baseIdProp") + public _FinalStage baseIdProp(@NotNull String baseIdProp) { + this.baseIdProp = Objects.requireNonNull(baseIdProp, "baseIdProp must not be null"); return this; } @@ -550,7 +555,6 @@ public _FinalStage label(Optional label) { @java.lang.Override public ConfigurablePropAirtableTableId build() { return new ConfigurablePropAirtableTableId( - baseIdProp, name, label, description, @@ -561,6 +565,7 @@ public ConfigurablePropAirtableTableId build() { useQuery, reloadProps, withLabel, + baseIdProp, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropAirtableViewId.java b/src/main/java/com/pipedream/api/types/ConfigurablePropAirtableViewId.java index 0104c20..73c59d6 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropAirtableViewId.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropAirtableViewId.java @@ -20,9 +20,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropAirtableViewId.Builder.class) -public final class ConfigurablePropAirtableViewId { - private final String tableIdProp; - +public final class ConfigurablePropAirtableViewId implements IConfigurablePropBase { private final String name; private final Optional label; @@ -43,10 +41,11 @@ public final class ConfigurablePropAirtableViewId { private final Optional withLabel; + private final String tableIdProp; + private final Map additionalProperties; private ConfigurablePropAirtableViewId( - String tableIdProp, String name, Optional label, Optional description, @@ -57,8 +56,8 @@ private ConfigurablePropAirtableViewId( Optional useQuery, Optional reloadProps, Optional withLabel, + String tableIdProp, Map additionalProperties) { - this.tableIdProp = tableIdProp; this.name = name; this.label = label; this.description = description; @@ -69,26 +68,15 @@ private ConfigurablePropAirtableViewId( this.useQuery = useQuery; this.reloadProps = reloadProps; this.withLabel = withLabel; + this.tableIdProp = tableIdProp; this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "$.airtable.viewId"; - } - - /** - * @return The name of the prop that provides the Airtable table ID - */ - @JsonProperty("tableIdProp") - public String getTableIdProp() { - return tableIdProp; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -97,6 +85,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -105,6 +94,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -113,6 +103,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -121,6 +112,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -129,6 +121,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -137,6 +130,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -145,6 +139,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -153,6 +148,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -161,10 +157,19 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + /** + * @return The name of the prop that provides the Airtable table ID + */ + @JsonProperty("tableIdProp") + public String getTableIdProp() { + return tableIdProp; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -177,8 +182,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConfigurablePropAirtableViewId other) { - return tableIdProp.equals(other.tableIdProp) - && name.equals(other.name) + return name.equals(other.name) && label.equals(other.label) && description.equals(other.description) && optional.equals(other.optional) @@ -187,13 +191,13 @@ private boolean equalTo(ConfigurablePropAirtableViewId other) { && remoteOptions.equals(other.remoteOptions) && useQuery.equals(other.useQuery) && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + && withLabel.equals(other.withLabel) + && tableIdProp.equals(other.tableIdProp); } @java.lang.Override public int hashCode() { return Objects.hash( - this.tableIdProp, this.name, this.label, this.description, @@ -203,7 +207,8 @@ public int hashCode() { this.remoteOptions, this.useQuery, this.reloadProps, - this.withLabel); + this.withLabel, + this.tableIdProp); } @java.lang.Override @@ -211,24 +216,24 @@ public String toString() { return ObjectMappers.stringify(this); } - public static TableIdPropStage builder() { + public static NameStage builder() { return new Builder(); } - public interface TableIdPropStage { + public interface NameStage { /** - *

The name of the prop that provides the Airtable table ID

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

*/ - NameStage tableIdProp(@NotNull String tableIdProp); + TableIdPropStage name(@NotNull String name); Builder from(ConfigurablePropAirtableViewId other); } - public interface NameStage { + public interface TableIdPropStage { /** - *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

The name of the prop that provides the Airtable table ID

*/ - _FinalStage name(@NotNull String name); + _FinalStage tableIdProp(@NotNull String tableIdProp); } public interface _FinalStage { @@ -299,11 +304,11 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TableIdPropStage, NameStage, _FinalStage { - private String tableIdProp; - + public static final class Builder implements NameStage, TableIdPropStage, _FinalStage { private String name; + private String tableIdProp; + private Optional withLabel = Optional.empty(); private Optional reloadProps = Optional.empty(); @@ -329,7 +334,6 @@ private Builder() {} @java.lang.Override public Builder from(ConfigurablePropAirtableViewId other) { - tableIdProp(other.getTableIdProp()); name(other.getName()); label(other.getLabel()); description(other.getDescription()); @@ -340,30 +344,31 @@ public Builder from(ConfigurablePropAirtableViewId other) { useQuery(other.getUseQuery()); reloadProps(other.getReloadProps()); withLabel(other.getWithLabel()); + tableIdProp(other.getTableIdProp()); return this; } /** - *

The name of the prop that provides the Airtable table ID

- *

The name of the prop that provides the Airtable table ID

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - @JsonSetter("tableIdProp") - public NameStage tableIdProp(@NotNull String tableIdProp) { - this.tableIdProp = Objects.requireNonNull(tableIdProp, "tableIdProp must not be null"); + @JsonSetter("name") + public TableIdPropStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); return this; } /** - *

When building configuredProps, make sure to use this field as the key when setting the prop value

- *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

The name of the prop that provides the Airtable table ID

+ *

The name of the prop that provides the Airtable table ID

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - @JsonSetter("name") - public _FinalStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); + @JsonSetter("tableIdProp") + public _FinalStage tableIdProp(@NotNull String tableIdProp) { + this.tableIdProp = Objects.requireNonNull(tableIdProp, "tableIdProp must not be null"); return this; } @@ -550,7 +555,6 @@ public _FinalStage label(Optional label) { @java.lang.Override public ConfigurablePropAirtableViewId build() { return new ConfigurablePropAirtableViewId( - tableIdProp, name, label, description, @@ -561,6 +565,7 @@ public ConfigurablePropAirtableViewId build() { useQuery, reloadProps, withLabel, + tableIdProp, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropAlert.java b/src/main/java/com/pipedream/api/types/ConfigurablePropAlert.java index 188ce32..2d42a09 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropAlert.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropAlert.java @@ -20,11 +20,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropAlert.Builder.class) -public final class ConfigurablePropAlert { - private final Optional alertType; - - private final String content; - +public final class ConfigurablePropAlert implements IConfigurablePropBase { private final String name; private final Optional label; @@ -45,11 +41,13 @@ public final class ConfigurablePropAlert { private final Optional withLabel; + private final Optional alertType; + + private final String content; + private final Map additionalProperties; private ConfigurablePropAlert( - Optional alertType, - String content, String name, Optional label, Optional description, @@ -60,9 +58,9 @@ private ConfigurablePropAlert( Optional useQuery, Optional reloadProps, Optional withLabel, + Optional alertType, + String content, Map additionalProperties) { - this.alertType = alertType; - this.content = content; this.name = name; this.label = label; this.description = description; @@ -73,31 +71,16 @@ private ConfigurablePropAlert( this.useQuery = useQuery; this.reloadProps = reloadProps; this.withLabel = withLabel; + this.alertType = alertType; + this.content = content; this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "alert"; - } - - @JsonProperty("alertType") - public Optional getAlertType() { - return alertType; - } - - /** - * @return The content of the alert, which can include HTML or plain text. - */ - @JsonProperty("content") - public String getContent() { - return content; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -106,6 +89,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -114,6 +98,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -122,6 +107,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -130,6 +116,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -138,6 +125,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -146,6 +134,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -154,6 +143,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -162,6 +152,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -170,10 +161,24 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + @JsonProperty("alertType") + public Optional getAlertType() { + return alertType; + } + + /** + * @return The content of the alert, which can include HTML or plain text. + */ + @JsonProperty("content") + public String getContent() { + return content; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -186,9 +191,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConfigurablePropAlert other) { - return alertType.equals(other.alertType) - && content.equals(other.content) - && name.equals(other.name) + return name.equals(other.name) && label.equals(other.label) && description.equals(other.description) && optional.equals(other.optional) @@ -197,14 +200,14 @@ private boolean equalTo(ConfigurablePropAlert other) { && remoteOptions.equals(other.remoteOptions) && useQuery.equals(other.useQuery) && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + && withLabel.equals(other.withLabel) + && alertType.equals(other.alertType) + && content.equals(other.content); } @java.lang.Override public int hashCode() { return Objects.hash( - this.alertType, - this.content, this.name, this.label, this.description, @@ -214,7 +217,9 @@ public int hashCode() { this.remoteOptions, this.useQuery, this.reloadProps, - this.withLabel); + this.withLabel, + this.alertType, + this.content); } @java.lang.Override @@ -222,33 +227,29 @@ public String toString() { return ObjectMappers.stringify(this); } - public static ContentStage builder() { + public static NameStage builder() { return new Builder(); } - public interface ContentStage { + public interface NameStage { /** - *

The content of the alert, which can include HTML or plain text.

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

*/ - NameStage content(@NotNull String content); + ContentStage name(@NotNull String name); Builder from(ConfigurablePropAlert other); } - public interface NameStage { + public interface ContentStage { /** - *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

The content of the alert, which can include HTML or plain text.

*/ - _FinalStage name(@NotNull String name); + _FinalStage content(@NotNull String content); } public interface _FinalStage { ConfigurablePropAlert build(); - _FinalStage alertType(Optional alertType); - - _FinalStage alertType(ConfigurablePropAlertType alertType); - /** *

Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

*/ @@ -311,13 +312,19 @@ public interface _FinalStage { _FinalStage withLabel(Optional withLabel); _FinalStage withLabel(Boolean withLabel); + + _FinalStage alertType(Optional alertType); + + _FinalStage alertType(ConfigurablePropAlertType alertType); } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ContentStage, NameStage, _FinalStage { + public static final class Builder implements NameStage, ContentStage, _FinalStage { + private String name; + private String content; - private String name; + private Optional alertType = Optional.empty(); private Optional withLabel = Optional.empty(); @@ -337,8 +344,6 @@ public static final class Builder implements ContentStage, NameStage, _FinalStag private Optional label = Optional.empty(); - private Optional alertType = Optional.empty(); - @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -346,8 +351,6 @@ private Builder() {} @java.lang.Override public Builder from(ConfigurablePropAlert other) { - alertType(other.getAlertType()); - content(other.getContent()); name(other.getName()); label(other.getLabel()); description(other.getDescription()); @@ -358,6 +361,20 @@ public Builder from(ConfigurablePropAlert other) { useQuery(other.getUseQuery()); reloadProps(other.getReloadProps()); withLabel(other.getWithLabel()); + alertType(other.getAlertType()); + content(other.getContent()); + return this; + } + + /** + *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public ContentStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); return this; } @@ -368,20 +385,21 @@ public Builder from(ConfigurablePropAlert other) { */ @java.lang.Override @JsonSetter("content") - public NameStage content(@NotNull String content) { + public _FinalStage content(@NotNull String content) { this.content = Objects.requireNonNull(content, "content must not be null"); return this; } - /** - *

When building configuredProps, make sure to use this field as the key when setting the prop value

- *

When building configuredProps, make sure to use this field as the key when setting the prop value

- * @return Reference to {@code this} so that method calls can be chained together. - */ @java.lang.Override - @JsonSetter("name") - public _FinalStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); + public _FinalStage alertType(ConfigurablePropAlertType alertType) { + this.alertType = Optional.ofNullable(alertType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "alertType", nulls = Nulls.SKIP) + public _FinalStage alertType(Optional alertType) { + this.alertType = alertType; return this; } @@ -565,24 +583,9 @@ public _FinalStage label(Optional label) { return this; } - @java.lang.Override - public _FinalStage alertType(ConfigurablePropAlertType alertType) { - this.alertType = Optional.ofNullable(alertType); - return this; - } - - @java.lang.Override - @JsonSetter(value = "alertType", nulls = Nulls.SKIP) - public _FinalStage alertType(Optional alertType) { - this.alertType = alertType; - return this; - } - @java.lang.Override public ConfigurablePropAlert build() { return new ConfigurablePropAlert( - alertType, - content, name, label, description, @@ -593,6 +596,8 @@ public ConfigurablePropAlert build() { useQuery, reloadProps, withLabel, + alertType, + content, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropAny.java b/src/main/java/com/pipedream/api/types/ConfigurablePropAny.java index f94d595..f7b1250 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropAny.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropAny.java @@ -21,11 +21,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropAny.Builder.class) -public final class ConfigurablePropAny { - private final Optional default_; - - private final Optional> options; - +public final class ConfigurablePropAny implements IConfigurablePropBase { private final String name; private final Optional label; @@ -46,11 +42,13 @@ public final class ConfigurablePropAny { private final Optional withLabel; + private final Optional default_; + + private final Optional> options; + private final Map additionalProperties; private ConfigurablePropAny( - Optional default_, - Optional> options, String name, Optional label, Optional description, @@ -61,9 +59,9 @@ private ConfigurablePropAny( Optional useQuery, Optional reloadProps, Optional withLabel, + Optional default_, + Optional> options, Map additionalProperties) { - this.default_ = default_; - this.options = options; this.name = name; this.label = label; this.description = description; @@ -74,28 +72,16 @@ private ConfigurablePropAny( this.useQuery = useQuery; this.reloadProps = reloadProps; this.withLabel = withLabel; + this.default_ = default_; + this.options = options; this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "any"; - } - - @JsonProperty("default") - public Optional getDefault() { - return default_; - } - - @JsonProperty("options") - public Optional> getOptions() { - return options; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -104,6 +90,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -112,6 +99,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -120,6 +108,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -128,6 +117,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -136,6 +126,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -144,6 +135,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -152,6 +144,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -160,6 +153,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -168,10 +162,21 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + @JsonProperty("default") + public Optional getDefault() { + return default_; + } + + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -184,9 +189,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConfigurablePropAny other) { - return default_.equals(other.default_) - && options.equals(other.options) - && name.equals(other.name) + return name.equals(other.name) && label.equals(other.label) && description.equals(other.description) && optional.equals(other.optional) @@ -195,14 +198,14 @@ private boolean equalTo(ConfigurablePropAny other) { && remoteOptions.equals(other.remoteOptions) && useQuery.equals(other.useQuery) && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + && withLabel.equals(other.withLabel) + && default_.equals(other.default_) + && options.equals(other.options); } @java.lang.Override public int hashCode() { return Objects.hash( - this.default_, - this.options, this.name, this.label, this.description, @@ -212,7 +215,9 @@ public int hashCode() { this.remoteOptions, this.useQuery, this.reloadProps, - this.withLabel); + this.withLabel, + this.default_, + this.options); } @java.lang.Override @@ -236,14 +241,6 @@ public interface NameStage { public interface _FinalStage { ConfigurablePropAny build(); - _FinalStage default_(Optional default_); - - _FinalStage default_(Object default_); - - _FinalStage options(Optional> options); - - _FinalStage options(List options); - /** *

Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

*/ @@ -306,12 +303,24 @@ public interface _FinalStage { _FinalStage withLabel(Optional withLabel); _FinalStage withLabel(Boolean withLabel); + + _FinalStage default_(Optional default_); + + _FinalStage default_(Object default_); + + _FinalStage options(Optional> options); + + _FinalStage options(List options); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements NameStage, _FinalStage { private String name; + private Optional> options = Optional.empty(); + + private Optional default_ = Optional.empty(); + private Optional withLabel = Optional.empty(); private Optional reloadProps = Optional.empty(); @@ -330,10 +339,6 @@ public static final class Builder implements NameStage, _FinalStage { private Optional label = Optional.empty(); - private Optional> options = Optional.empty(); - - private Optional default_ = Optional.empty(); - @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -341,8 +346,6 @@ private Builder() {} @java.lang.Override public Builder from(ConfigurablePropAny other) { - default_(other.getDefault()); - options(other.getOptions()); name(other.getName()); label(other.getLabel()); description(other.getDescription()); @@ -353,6 +356,8 @@ public Builder from(ConfigurablePropAny other) { useQuery(other.getUseQuery()); reloadProps(other.getReloadProps()); withLabel(other.getWithLabel()); + default_(other.getDefault()); + options(other.getOptions()); return this; } @@ -368,6 +373,32 @@ public _FinalStage name(@NotNull String name) { return this; } + @java.lang.Override + public _FinalStage options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + @java.lang.Override + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public _FinalStage options(Optional> options) { + this.options = options; + return this; + } + + @java.lang.Override + public _FinalStage default_(Object default_) { + this.default_ = Optional.ofNullable(default_); + return this; + } + + @java.lang.Override + @JsonSetter(value = "default", nulls = Nulls.SKIP) + public _FinalStage default_(Optional default_) { + this.default_ = default_; + return this; + } + /** *

If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

* @return Reference to {@code this} so that method calls can be chained together. @@ -548,37 +579,9 @@ public _FinalStage label(Optional label) { return this; } - @java.lang.Override - public _FinalStage options(List options) { - this.options = Optional.ofNullable(options); - return this; - } - - @java.lang.Override - @JsonSetter(value = "options", nulls = Nulls.SKIP) - public _FinalStage options(Optional> options) { - this.options = options; - return this; - } - - @java.lang.Override - public _FinalStage default_(Object default_) { - this.default_ = Optional.ofNullable(default_); - return this; - } - - @java.lang.Override - @JsonSetter(value = "default", nulls = Nulls.SKIP) - public _FinalStage default_(Optional default_) { - this.default_ = default_; - return this; - } - @java.lang.Override public ConfigurablePropAny build() { return new ConfigurablePropAny( - default_, - options, name, label, description, @@ -589,6 +592,8 @@ public ConfigurablePropAny build() { useQuery, reloadProps, withLabel, + default_, + options, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropApp.java b/src/main/java/com/pipedream/api/types/ConfigurablePropApp.java index 3b71506..db33c23 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropApp.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropApp.java @@ -20,9 +20,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropApp.Builder.class) -public final class ConfigurablePropApp { - private final String app; - +public final class ConfigurablePropApp implements IConfigurablePropBase { private final String name; private final Optional label; @@ -43,10 +41,11 @@ public final class ConfigurablePropApp { private final Optional withLabel; + private final String app; + private final Map additionalProperties; private ConfigurablePropApp( - String app, String name, Optional label, Optional description, @@ -57,8 +56,8 @@ private ConfigurablePropApp( Optional useQuery, Optional reloadProps, Optional withLabel, + String app, Map additionalProperties) { - this.app = app; this.name = name; this.label = label; this.description = description; @@ -69,26 +68,15 @@ private ConfigurablePropApp( this.useQuery = useQuery; this.reloadProps = reloadProps; this.withLabel = withLabel; + this.app = app; this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "app"; - } - - /** - * @return The name slug of the app, e.g. 'github', 'slack', etc. This is used to identify the app for which the account is being configured. - */ - @JsonProperty("app") - public String getApp() { - return app; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -97,6 +85,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -105,6 +94,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -113,6 +103,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -121,6 +112,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -129,6 +121,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -137,6 +130,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -145,6 +139,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -153,6 +148,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -161,10 +157,19 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + /** + * @return The name slug of the app, e.g. 'github', 'slack', etc. This is used to identify the app for which the account is being configured. + */ + @JsonProperty("app") + public String getApp() { + return app; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -177,8 +182,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConfigurablePropApp other) { - return app.equals(other.app) - && name.equals(other.name) + return name.equals(other.name) && label.equals(other.label) && description.equals(other.description) && optional.equals(other.optional) @@ -187,13 +191,13 @@ private boolean equalTo(ConfigurablePropApp other) { && remoteOptions.equals(other.remoteOptions) && useQuery.equals(other.useQuery) && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + && withLabel.equals(other.withLabel) + && app.equals(other.app); } @java.lang.Override public int hashCode() { return Objects.hash( - this.app, this.name, this.label, this.description, @@ -203,7 +207,8 @@ public int hashCode() { this.remoteOptions, this.useQuery, this.reloadProps, - this.withLabel); + this.withLabel, + this.app); } @java.lang.Override @@ -211,24 +216,24 @@ public String toString() { return ObjectMappers.stringify(this); } - public static AppStage builder() { + public static NameStage builder() { return new Builder(); } - public interface AppStage { + public interface NameStage { /** - *

The name slug of the app, e.g. 'github', 'slack', etc. This is used to identify the app for which the account is being configured.

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

*/ - NameStage app(@NotNull String app); + AppStage name(@NotNull String name); Builder from(ConfigurablePropApp other); } - public interface NameStage { + public interface AppStage { /** - *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

The name slug of the app, e.g. 'github', 'slack', etc. This is used to identify the app for which the account is being configured.

*/ - _FinalStage name(@NotNull String name); + _FinalStage app(@NotNull String app); } public interface _FinalStage { @@ -299,11 +304,11 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements AppStage, NameStage, _FinalStage { - private String app; - + public static final class Builder implements NameStage, AppStage, _FinalStage { private String name; + private String app; + private Optional withLabel = Optional.empty(); private Optional reloadProps = Optional.empty(); @@ -329,7 +334,6 @@ private Builder() {} @java.lang.Override public Builder from(ConfigurablePropApp other) { - app(other.getApp()); name(other.getName()); label(other.getLabel()); description(other.getDescription()); @@ -340,30 +344,31 @@ public Builder from(ConfigurablePropApp other) { useQuery(other.getUseQuery()); reloadProps(other.getReloadProps()); withLabel(other.getWithLabel()); + app(other.getApp()); return this; } /** - *

The name slug of the app, e.g. 'github', 'slack', etc. This is used to identify the app for which the account is being configured.

- *

The name slug of the app, e.g. 'github', 'slack', etc. This is used to identify the app for which the account is being configured.

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - @JsonSetter("app") - public NameStage app(@NotNull String app) { - this.app = Objects.requireNonNull(app, "app must not be null"); + @JsonSetter("name") + public AppStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); return this; } /** - *

When building configuredProps, make sure to use this field as the key when setting the prop value

- *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

The name slug of the app, e.g. 'github', 'slack', etc. This is used to identify the app for which the account is being configured.

+ *

The name slug of the app, e.g. 'github', 'slack', etc. This is used to identify the app for which the account is being configured.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - @JsonSetter("name") - public _FinalStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); + @JsonSetter("app") + public _FinalStage app(@NotNull String app) { + this.app = Objects.requireNonNull(app, "app must not be null"); return this; } @@ -550,7 +555,6 @@ public _FinalStage label(Optional label) { @java.lang.Override public ConfigurablePropApp build() { return new ConfigurablePropApp( - app, name, label, description, @@ -561,6 +565,7 @@ public ConfigurablePropApp build() { useQuery, reloadProps, withLabel, + app, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropApphook.java b/src/main/java/com/pipedream/api/types/ConfigurablePropApphook.java index fbfd3f7..1483e43 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropApphook.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropApphook.java @@ -21,15 +21,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropApphook.Builder.class) -public final class ConfigurablePropApphook { - private final String appProp; - - private final Optional> eventNames; - - private final Optional remote; - - private final Optional> static_; - +public final class ConfigurablePropApphook implements IConfigurablePropBase { private final String name; private final Optional label; @@ -50,13 +42,17 @@ public final class ConfigurablePropApphook { private final Optional withLabel; + private final String appProp; + + private final Optional> eventNames; + + private final Optional remote; + + private final Optional> static_; + private final Map additionalProperties; private ConfigurablePropApphook( - String appProp, - Optional> eventNames, - Optional remote, - Optional> static_, String name, Optional label, Optional description, @@ -67,11 +63,11 @@ private ConfigurablePropApphook( Optional useQuery, Optional reloadProps, Optional withLabel, + String appProp, + Optional> eventNames, + Optional remote, + Optional> static_, Map additionalProperties) { - this.appProp = appProp; - this.eventNames = eventNames; - this.remote = remote; - this.static_ = static_; this.name = name; this.label = label; this.description = description; @@ -82,50 +78,18 @@ private ConfigurablePropApphook( this.useQuery = useQuery; this.reloadProps = reloadProps; this.withLabel = withLabel; + this.appProp = appProp; + this.eventNames = eventNames; + this.remote = remote; + this.static_ = static_; this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "$.interface.apphook"; - } - - /** - * @return The name of the app prop that this apphook depends on - */ - @JsonProperty("appProp") - public String getAppProp() { - return appProp; - } - - /** - * @return List of event names to listen for - */ - @JsonProperty("eventNames") - public Optional> getEventNames() { - return eventNames; - } - - /** - * @return Whether this apphook is remote - */ - @JsonProperty("remote") - public Optional getRemote() { - return remote; - } - - /** - * @return Static configuration for the apphook - */ - @JsonProperty("static") - public Optional> getStatic() { - return static_; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -134,6 +98,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -142,6 +107,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -150,6 +116,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -158,6 +125,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -166,6 +134,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -174,6 +143,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -182,6 +152,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -190,6 +161,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -198,10 +170,43 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + /** + * @return The name of the app prop that this apphook depends on + */ + @JsonProperty("appProp") + public String getAppProp() { + return appProp; + } + + /** + * @return List of event names to listen for + */ + @JsonProperty("eventNames") + public Optional> getEventNames() { + return eventNames; + } + + /** + * @return Whether this apphook is remote + */ + @JsonProperty("remote") + public Optional getRemote() { + return remote; + } + + /** + * @return Static configuration for the apphook + */ + @JsonProperty("static") + public Optional> getStatic() { + return static_; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -214,11 +219,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConfigurablePropApphook other) { - return appProp.equals(other.appProp) - && eventNames.equals(other.eventNames) - && remote.equals(other.remote) - && static_.equals(other.static_) - && name.equals(other.name) + return name.equals(other.name) && label.equals(other.label) && description.equals(other.description) && optional.equals(other.optional) @@ -227,16 +228,16 @@ private boolean equalTo(ConfigurablePropApphook other) { && remoteOptions.equals(other.remoteOptions) && useQuery.equals(other.useQuery) && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + && withLabel.equals(other.withLabel) + && appProp.equals(other.appProp) + && eventNames.equals(other.eventNames) + && remote.equals(other.remote) + && static_.equals(other.static_); } @java.lang.Override public int hashCode() { return Objects.hash( - this.appProp, - this.eventNames, - this.remote, - this.static_, this.name, this.label, this.description, @@ -246,7 +247,11 @@ public int hashCode() { this.remoteOptions, this.useQuery, this.reloadProps, - this.withLabel); + this.withLabel, + this.appProp, + this.eventNames, + this.remote, + this.static_); } @java.lang.Override @@ -254,50 +259,29 @@ public String toString() { return ObjectMappers.stringify(this); } - public static AppPropStage builder() { + public static NameStage builder() { return new Builder(); } - public interface AppPropStage { + public interface NameStage { /** - *

The name of the app prop that this apphook depends on

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

*/ - NameStage appProp(@NotNull String appProp); + AppPropStage name(@NotNull String name); Builder from(ConfigurablePropApphook other); } - public interface NameStage { + public interface AppPropStage { /** - *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

The name of the app prop that this apphook depends on

*/ - _FinalStage name(@NotNull String name); + _FinalStage appProp(@NotNull String appProp); } public interface _FinalStage { ConfigurablePropApphook build(); - /** - *

List of event names to listen for

- */ - _FinalStage eventNames(Optional> eventNames); - - _FinalStage eventNames(List eventNames); - - /** - *

Whether this apphook is remote

- */ - _FinalStage remote(Optional remote); - - _FinalStage remote(Boolean remote); - - /** - *

Static configuration for the apphook

- */ - _FinalStage static_(Optional> static_); - - _FinalStage static_(List static_); - /** *

Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

*/ @@ -360,13 +344,40 @@ public interface _FinalStage { _FinalStage withLabel(Optional withLabel); _FinalStage withLabel(Boolean withLabel); + + /** + *

List of event names to listen for

+ */ + _FinalStage eventNames(Optional> eventNames); + + _FinalStage eventNames(List eventNames); + + /** + *

Whether this apphook is remote

+ */ + _FinalStage remote(Optional remote); + + _FinalStage remote(Boolean remote); + + /** + *

Static configuration for the apphook

+ */ + _FinalStage static_(Optional> static_); + + _FinalStage static_(List static_); } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements AppPropStage, NameStage, _FinalStage { + public static final class Builder implements NameStage, AppPropStage, _FinalStage { + private String name; + private String appProp; - private String name; + private Optional> static_ = Optional.empty(); + + private Optional remote = Optional.empty(); + + private Optional> eventNames = Optional.empty(); private Optional withLabel = Optional.empty(); @@ -386,12 +397,6 @@ public static final class Builder implements AppPropStage, NameStage, _FinalStag private Optional label = Optional.empty(); - private Optional> static_ = Optional.empty(); - - private Optional remote = Optional.empty(); - - private Optional> eventNames = Optional.empty(); - @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -399,10 +404,6 @@ private Builder() {} @java.lang.Override public Builder from(ConfigurablePropApphook other) { - appProp(other.getAppProp()); - eventNames(other.getEventNames()); - remote(other.getRemote()); - static_(other.getStatic()); name(other.getName()); label(other.getLabel()); description(other.getDescription()); @@ -413,6 +414,22 @@ public Builder from(ConfigurablePropApphook other) { useQuery(other.getUseQuery()); reloadProps(other.getReloadProps()); withLabel(other.getWithLabel()); + appProp(other.getAppProp()); + eventNames(other.getEventNames()); + remote(other.getRemote()); + static_(other.getStatic()); + return this; + } + + /** + *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public AppPropStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); return this; } @@ -423,20 +440,68 @@ public Builder from(ConfigurablePropApphook other) { */ @java.lang.Override @JsonSetter("appProp") - public NameStage appProp(@NotNull String appProp) { + public _FinalStage appProp(@NotNull String appProp) { this.appProp = Objects.requireNonNull(appProp, "appProp must not be null"); return this; } /** - *

When building configuredProps, make sure to use this field as the key when setting the prop value

- *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

Static configuration for the apphook

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - @JsonSetter("name") - public _FinalStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); + public _FinalStage static_(List static_) { + this.static_ = Optional.ofNullable(static_); + return this; + } + + /** + *

Static configuration for the apphook

+ */ + @java.lang.Override + @JsonSetter(value = "static", nulls = Nulls.SKIP) + public _FinalStage static_(Optional> static_) { + this.static_ = static_; + return this; + } + + /** + *

Whether this apphook is remote

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage remote(Boolean remote) { + this.remote = Optional.ofNullable(remote); + return this; + } + + /** + *

Whether this apphook is remote

+ */ + @java.lang.Override + @JsonSetter(value = "remote", nulls = Nulls.SKIP) + public _FinalStage remote(Optional remote) { + this.remote = remote; + return this; + } + + /** + *

List of event names to listen for

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage eventNames(List eventNames) { + this.eventNames = Optional.ofNullable(eventNames); + return this; + } + + /** + *

List of event names to listen for

+ */ + @java.lang.Override + @JsonSetter(value = "eventNames", nulls = Nulls.SKIP) + public _FinalStage eventNames(Optional> eventNames) { + this.eventNames = eventNames; return this; } @@ -620,73 +685,9 @@ public _FinalStage label(Optional label) { return this; } - /** - *

Static configuration for the apphook

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage static_(List static_) { - this.static_ = Optional.ofNullable(static_); - return this; - } - - /** - *

Static configuration for the apphook

- */ - @java.lang.Override - @JsonSetter(value = "static", nulls = Nulls.SKIP) - public _FinalStage static_(Optional> static_) { - this.static_ = static_; - return this; - } - - /** - *

Whether this apphook is remote

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage remote(Boolean remote) { - this.remote = Optional.ofNullable(remote); - return this; - } - - /** - *

Whether this apphook is remote

- */ - @java.lang.Override - @JsonSetter(value = "remote", nulls = Nulls.SKIP) - public _FinalStage remote(Optional remote) { - this.remote = remote; - return this; - } - - /** - *

List of event names to listen for

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage eventNames(List eventNames) { - this.eventNames = Optional.ofNullable(eventNames); - return this; - } - - /** - *

List of event names to listen for

- */ - @java.lang.Override - @JsonSetter(value = "eventNames", nulls = Nulls.SKIP) - public _FinalStage eventNames(Optional> eventNames) { - this.eventNames = eventNames; - return this; - } - @java.lang.Override public ConfigurablePropApphook build() { return new ConfigurablePropApphook( - appProp, - eventNames, - remote, - static_, name, label, description, @@ -697,6 +698,10 @@ public ConfigurablePropApphook build() { useQuery, reloadProps, withLabel, + appProp, + eventNames, + remote, + static_, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropBase.java b/src/main/java/com/pipedream/api/types/ConfigurablePropBase.java new file mode 100644 index 0000000..db0b589 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropBase.java @@ -0,0 +1,535 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropBase.Builder.class) +public final class ConfigurablePropBase implements IConfigurablePropBase { + private final String name; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurablePropBase( + String name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.name = name; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + @java.lang.Override + public String getName() { + return name; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + @java.lang.Override + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + @java.lang.Override + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + @java.lang.Override + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + @java.lang.Override + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + @java.lang.Override + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + @java.lang.Override + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + @java.lang.Override + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + @java.lang.Override + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + @java.lang.Override + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropBase && equalTo((ConfigurablePropBase) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropBase other) { + return name.equals(other.name) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.name, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ */ + _FinalStage name(@NotNull String name); + + Builder from(ConfigurablePropBase other); + } + + public interface _FinalStage { + ConfigurablePropBase build(); + + /** + *

Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

+ */ + _FinalStage label(Optional label); + + _FinalStage label(String label); + + /** + *

A description of the prop, shown to the user when configuring the component.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + /** + *

If true, this prop does not need to be specified.

+ */ + _FinalStage optional(Optional optional); + + _FinalStage optional(Boolean optional); + + /** + *

If true, this prop will be ignored.

+ */ + _FinalStage disabled(Optional disabled); + + _FinalStage disabled(Boolean disabled); + + /** + *

If true, should not expose this prop to the user

+ */ + _FinalStage hidden(Optional hidden); + + _FinalStage hidden(Boolean hidden); + + /** + *

If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

+ */ + _FinalStage remoteOptions(Optional remoteOptions); + + _FinalStage remoteOptions(Boolean remoteOptions); + + /** + *

If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

+ */ + _FinalStage useQuery(Optional useQuery); + + _FinalStage useQuery(Boolean useQuery); + + /** + *

If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

+ */ + _FinalStage reloadProps(Optional reloadProps); + + _FinalStage reloadProps(Boolean reloadProps); + + /** + *

If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

+ */ + _FinalStage withLabel(Optional withLabel); + + _FinalStage withLabel(Boolean withLabel); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, _FinalStage { + private String name; + + private Optional withLabel = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional label = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ConfigurablePropBase other) { + name(other.getName()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + /** + *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + /** + *

If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

+ */ + @java.lang.Override + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public _FinalStage withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + /** + *

If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

+ */ + @java.lang.Override + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public _FinalStage reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + /** + *

If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

+ */ + @java.lang.Override + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public _FinalStage useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + /** + *

If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

+ */ + @java.lang.Override + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public _FinalStage remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + /** + *

If true, should not expose this prop to the user

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @java.lang.Override + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public _FinalStage hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + /** + *

If true, this prop will be ignored.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @java.lang.Override + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public _FinalStage disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + /** + *

If true, this prop does not need to be specified.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop does not need to be specified.

+ */ + @java.lang.Override + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public _FinalStage optional(Optional optional) { + this.optional = optional; + return this; + } + + /** + *

A description of the prop, shown to the user when configuring the component.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

A description of the prop, shown to the user when configuring the component.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

+ */ + @java.lang.Override + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public _FinalStage label(Optional label) { + this.label = label; + return this; + } + + @java.lang.Override + public ConfigurablePropBase build() { + return new ConfigurablePropBase( + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropBoolean.java b/src/main/java/com/pipedream/api/types/ConfigurablePropBoolean.java index 8d20484..c40a0d6 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropBoolean.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropBoolean.java @@ -21,11 +21,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropBoolean.Builder.class) -public final class ConfigurablePropBoolean { - private final Optional default_; - - private final Optional> options; - +public final class ConfigurablePropBoolean implements IConfigurablePropBase { private final String name; private final Optional label; @@ -46,11 +42,13 @@ public final class ConfigurablePropBoolean { private final Optional withLabel; + private final Optional default_; + + private final Optional> options; + private final Map additionalProperties; private ConfigurablePropBoolean( - Optional default_, - Optional> options, String name, Optional label, Optional description, @@ -61,9 +59,9 @@ private ConfigurablePropBoolean( Optional useQuery, Optional reloadProps, Optional withLabel, + Optional default_, + Optional> options, Map additionalProperties) { - this.default_ = default_; - this.options = options; this.name = name; this.label = label; this.description = description; @@ -74,28 +72,16 @@ private ConfigurablePropBoolean( this.useQuery = useQuery; this.reloadProps = reloadProps; this.withLabel = withLabel; + this.default_ = default_; + this.options = options; this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "boolean"; - } - - @JsonProperty("default") - public Optional getDefault() { - return default_; - } - - @JsonProperty("options") - public Optional> getOptions() { - return options; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -104,6 +90,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -112,6 +99,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -120,6 +108,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -128,6 +117,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -136,6 +126,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -144,6 +135,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -152,6 +144,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -160,6 +153,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -168,10 +162,21 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + @JsonProperty("default") + public Optional getDefault() { + return default_; + } + + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -184,9 +189,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConfigurablePropBoolean other) { - return default_.equals(other.default_) - && options.equals(other.options) - && name.equals(other.name) + return name.equals(other.name) && label.equals(other.label) && description.equals(other.description) && optional.equals(other.optional) @@ -195,14 +198,14 @@ private boolean equalTo(ConfigurablePropBoolean other) { && remoteOptions.equals(other.remoteOptions) && useQuery.equals(other.useQuery) && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + && withLabel.equals(other.withLabel) + && default_.equals(other.default_) + && options.equals(other.options); } @java.lang.Override public int hashCode() { return Objects.hash( - this.default_, - this.options, this.name, this.label, this.description, @@ -212,7 +215,9 @@ public int hashCode() { this.remoteOptions, this.useQuery, this.reloadProps, - this.withLabel); + this.withLabel, + this.default_, + this.options); } @java.lang.Override @@ -236,14 +241,6 @@ public interface NameStage { public interface _FinalStage { ConfigurablePropBoolean build(); - _FinalStage default_(Optional default_); - - _FinalStage default_(Boolean default_); - - _FinalStage options(Optional> options); - - _FinalStage options(List options); - /** *

Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

*/ @@ -306,12 +303,24 @@ public interface _FinalStage { _FinalStage withLabel(Optional withLabel); _FinalStage withLabel(Boolean withLabel); + + _FinalStage default_(Optional default_); + + _FinalStage default_(Boolean default_); + + _FinalStage options(Optional> options); + + _FinalStage options(List options); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements NameStage, _FinalStage { private String name; + private Optional> options = Optional.empty(); + + private Optional default_ = Optional.empty(); + private Optional withLabel = Optional.empty(); private Optional reloadProps = Optional.empty(); @@ -330,10 +339,6 @@ public static final class Builder implements NameStage, _FinalStage { private Optional label = Optional.empty(); - private Optional> options = Optional.empty(); - - private Optional default_ = Optional.empty(); - @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -341,8 +346,6 @@ private Builder() {} @java.lang.Override public Builder from(ConfigurablePropBoolean other) { - default_(other.getDefault()); - options(other.getOptions()); name(other.getName()); label(other.getLabel()); description(other.getDescription()); @@ -353,6 +356,8 @@ public Builder from(ConfigurablePropBoolean other) { useQuery(other.getUseQuery()); reloadProps(other.getReloadProps()); withLabel(other.getWithLabel()); + default_(other.getDefault()); + options(other.getOptions()); return this; } @@ -368,6 +373,32 @@ public _FinalStage name(@NotNull String name) { return this; } + @java.lang.Override + public _FinalStage options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + @java.lang.Override + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public _FinalStage options(Optional> options) { + this.options = options; + return this; + } + + @java.lang.Override + public _FinalStage default_(Boolean default_) { + this.default_ = Optional.ofNullable(default_); + return this; + } + + @java.lang.Override + @JsonSetter(value = "default", nulls = Nulls.SKIP) + public _FinalStage default_(Optional default_) { + this.default_ = default_; + return this; + } + /** *

If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

* @return Reference to {@code this} so that method calls can be chained together. @@ -548,37 +579,9 @@ public _FinalStage label(Optional label) { return this; } - @java.lang.Override - public _FinalStage options(List options) { - this.options = Optional.ofNullable(options); - return this; - } - - @java.lang.Override - @JsonSetter(value = "options", nulls = Nulls.SKIP) - public _FinalStage options(Optional> options) { - this.options = options; - return this; - } - - @java.lang.Override - public _FinalStage default_(Boolean default_) { - this.default_ = Optional.ofNullable(default_); - return this; - } - - @java.lang.Override - @JsonSetter(value = "default", nulls = Nulls.SKIP) - public _FinalStage default_(Optional default_) { - this.default_ = default_; - return this; - } - @java.lang.Override public ConfigurablePropBoolean build() { return new ConfigurablePropBoolean( - default_, - options, name, label, description, @@ -589,6 +592,8 @@ public ConfigurablePropBoolean build() { useQuery, reloadProps, withLabel, + default_, + options, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropDb.java b/src/main/java/com/pipedream/api/types/ConfigurablePropDb.java index e66e9bf..1625bfb 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropDb.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropDb.java @@ -20,7 +20,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropDb.Builder.class) -public final class ConfigurablePropDb { +public final class ConfigurablePropDb implements IConfigurablePropBase { private final String name; private final Optional label; @@ -68,15 +68,11 @@ private ConfigurablePropDb( this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "$.service.db"; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -85,6 +81,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -93,6 +90,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -101,6 +99,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -109,6 +108,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -117,6 +117,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -125,6 +126,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -133,6 +135,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -141,6 +144,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -149,6 +153,7 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropDiscord.java b/src/main/java/com/pipedream/api/types/ConfigurablePropDiscord.java index 456b93e..705e354 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropDiscord.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropDiscord.java @@ -20,7 +20,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropDiscord.Builder.class) -public final class ConfigurablePropDiscord { +public final class ConfigurablePropDiscord implements IConfigurablePropBase { private final String name; private final Optional label; @@ -68,15 +68,11 @@ private ConfigurablePropDiscord( this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "$.discord.channel"; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -85,6 +81,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -93,6 +90,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -101,6 +99,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -109,6 +108,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -117,6 +117,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -125,6 +126,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -133,6 +135,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -141,6 +144,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -149,10 +153,16 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + @JsonProperty("type") + public String getType() { + return "$.discord.channel"; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropDiscordChannel.java b/src/main/java/com/pipedream/api/types/ConfigurablePropDiscordChannel.java index daae542..a765ce5 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropDiscordChannel.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropDiscordChannel.java @@ -20,9 +20,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropDiscordChannel.Builder.class) -public final class ConfigurablePropDiscordChannel { - private final String appProp; - +public final class ConfigurablePropDiscordChannel implements IConfigurablePropBase { private final String name; private final Optional label; @@ -43,10 +41,11 @@ public final class ConfigurablePropDiscordChannel { private final Optional withLabel; + private final String appProp; + private final Map additionalProperties; private ConfigurablePropDiscordChannel( - String appProp, String name, Optional label, Optional description, @@ -57,8 +56,8 @@ private ConfigurablePropDiscordChannel( Optional useQuery, Optional reloadProps, Optional withLabel, + String appProp, Map additionalProperties) { - this.appProp = appProp; this.name = name; this.label = label; this.description = description; @@ -69,26 +68,15 @@ private ConfigurablePropDiscordChannel( this.useQuery = useQuery; this.reloadProps = reloadProps; this.withLabel = withLabel; + this.appProp = appProp; this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "$.discord.channel"; - } - - /** - * @return The name of the app prop that provides Discord authentication - */ - @JsonProperty("appProp") - public String getAppProp() { - return appProp; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -97,6 +85,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -105,6 +94,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -113,6 +103,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -121,6 +112,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -129,6 +121,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -137,6 +130,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -145,6 +139,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -153,6 +148,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -161,10 +157,19 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + /** + * @return The name of the app prop that provides Discord authentication + */ + @JsonProperty("appProp") + public String getAppProp() { + return appProp; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -177,8 +182,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConfigurablePropDiscordChannel other) { - return appProp.equals(other.appProp) - && name.equals(other.name) + return name.equals(other.name) && label.equals(other.label) && description.equals(other.description) && optional.equals(other.optional) @@ -187,13 +191,13 @@ private boolean equalTo(ConfigurablePropDiscordChannel other) { && remoteOptions.equals(other.remoteOptions) && useQuery.equals(other.useQuery) && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + && withLabel.equals(other.withLabel) + && appProp.equals(other.appProp); } @java.lang.Override public int hashCode() { return Objects.hash( - this.appProp, this.name, this.label, this.description, @@ -203,7 +207,8 @@ public int hashCode() { this.remoteOptions, this.useQuery, this.reloadProps, - this.withLabel); + this.withLabel, + this.appProp); } @java.lang.Override @@ -211,24 +216,24 @@ public String toString() { return ObjectMappers.stringify(this); } - public static AppPropStage builder() { + public static NameStage builder() { return new Builder(); } - public interface AppPropStage { + public interface NameStage { /** - *

The name of the app prop that provides Discord authentication

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

*/ - NameStage appProp(@NotNull String appProp); + AppPropStage name(@NotNull String name); Builder from(ConfigurablePropDiscordChannel other); } - public interface NameStage { + public interface AppPropStage { /** - *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

The name of the app prop that provides Discord authentication

*/ - _FinalStage name(@NotNull String name); + _FinalStage appProp(@NotNull String appProp); } public interface _FinalStage { @@ -299,11 +304,11 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements AppPropStage, NameStage, _FinalStage { - private String appProp; - + public static final class Builder implements NameStage, AppPropStage, _FinalStage { private String name; + private String appProp; + private Optional withLabel = Optional.empty(); private Optional reloadProps = Optional.empty(); @@ -329,7 +334,6 @@ private Builder() {} @java.lang.Override public Builder from(ConfigurablePropDiscordChannel other) { - appProp(other.getAppProp()); name(other.getName()); label(other.getLabel()); description(other.getDescription()); @@ -340,30 +344,31 @@ public Builder from(ConfigurablePropDiscordChannel other) { useQuery(other.getUseQuery()); reloadProps(other.getReloadProps()); withLabel(other.getWithLabel()); + appProp(other.getAppProp()); return this; } /** - *

The name of the app prop that provides Discord authentication

- *

The name of the app prop that provides Discord authentication

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

When building configuredProps, make sure to use this field as the key when setting the prop value

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - @JsonSetter("appProp") - public NameStage appProp(@NotNull String appProp) { - this.appProp = Objects.requireNonNull(appProp, "appProp must not be null"); + @JsonSetter("name") + public AppPropStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); return this; } /** - *

When building configuredProps, make sure to use this field as the key when setting the prop value

- *

When building configuredProps, make sure to use this field as the key when setting the prop value

+ *

The name of the app prop that provides Discord authentication

+ *

The name of the app prop that provides Discord authentication

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - @JsonSetter("name") - public _FinalStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); + @JsonSetter("appProp") + public _FinalStage appProp(@NotNull String appProp) { + this.appProp = Objects.requireNonNull(appProp, "appProp must not be null"); return this; } @@ -550,7 +555,6 @@ public _FinalStage label(Optional label) { @java.lang.Override public ConfigurablePropDiscordChannel build() { return new ConfigurablePropDiscordChannel( - appProp, name, label, description, @@ -561,6 +565,7 @@ public ConfigurablePropDiscordChannel build() { useQuery, reloadProps, withLabel, + appProp, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropDiscordChannelArray.java b/src/main/java/com/pipedream/api/types/ConfigurablePropDiscordChannelArray.java index 240c7bd..08e40ab 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropDiscordChannelArray.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropDiscordChannelArray.java @@ -20,9 +20,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropDiscordChannelArray.Builder.class) -public final class ConfigurablePropDiscordChannelArray { - private final Optional appProp; - +public final class ConfigurablePropDiscordChannelArray implements IConfigurablePropBase { private final String name; private final Optional label; @@ -43,10 +41,11 @@ public final class ConfigurablePropDiscordChannelArray { private final Optional withLabel; + private final Optional appProp; + private final Map additionalProperties; private ConfigurablePropDiscordChannelArray( - Optional appProp, String name, Optional label, Optional description, @@ -57,8 +56,8 @@ private ConfigurablePropDiscordChannelArray( Optional useQuery, Optional reloadProps, Optional withLabel, + Optional appProp, Map additionalProperties) { - this.appProp = appProp; this.name = name; this.label = label; this.description = description; @@ -69,26 +68,15 @@ private ConfigurablePropDiscordChannelArray( this.useQuery = useQuery; this.reloadProps = reloadProps; this.withLabel = withLabel; + this.appProp = appProp; this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "$.discord.channel[]"; - } - - /** - * @return The name of the app prop that provides Discord authentication - */ - @JsonProperty("appProp") - public Optional getAppProp() { - return appProp; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -97,6 +85,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -105,6 +94,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -113,6 +103,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -121,6 +112,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -129,6 +121,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -137,6 +130,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -145,6 +139,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -153,6 +148,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -161,10 +157,19 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + /** + * @return The name of the app prop that provides Discord authentication + */ + @JsonProperty("appProp") + public Optional getAppProp() { + return appProp; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -178,8 +183,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConfigurablePropDiscordChannelArray other) { - return appProp.equals(other.appProp) - && name.equals(other.name) + return name.equals(other.name) && label.equals(other.label) && description.equals(other.description) && optional.equals(other.optional) @@ -188,13 +192,13 @@ private boolean equalTo(ConfigurablePropDiscordChannelArray other) { && remoteOptions.equals(other.remoteOptions) && useQuery.equals(other.useQuery) && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + && withLabel.equals(other.withLabel) + && appProp.equals(other.appProp); } @java.lang.Override public int hashCode() { return Objects.hash( - this.appProp, this.name, this.label, this.description, @@ -204,7 +208,8 @@ public int hashCode() { this.remoteOptions, this.useQuery, this.reloadProps, - this.withLabel); + this.withLabel, + this.appProp); } @java.lang.Override @@ -228,13 +233,6 @@ public interface NameStage { public interface _FinalStage { ConfigurablePropDiscordChannelArray build(); - /** - *

The name of the app prop that provides Discord authentication

- */ - _FinalStage appProp(Optional appProp); - - _FinalStage appProp(String appProp); - /** *

Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

*/ @@ -297,12 +295,21 @@ public interface _FinalStage { _FinalStage withLabel(Optional withLabel); _FinalStage withLabel(Boolean withLabel); + + /** + *

The name of the app prop that provides Discord authentication

+ */ + _FinalStage appProp(Optional appProp); + + _FinalStage appProp(String appProp); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements NameStage, _FinalStage { private String name; + private Optional appProp = Optional.empty(); + private Optional withLabel = Optional.empty(); private Optional reloadProps = Optional.empty(); @@ -321,8 +328,6 @@ public static final class Builder implements NameStage, _FinalStage { private Optional label = Optional.empty(); - private Optional appProp = Optional.empty(); - @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -330,7 +335,6 @@ private Builder() {} @java.lang.Override public Builder from(ConfigurablePropDiscordChannelArray other) { - appProp(other.getAppProp()); name(other.getName()); label(other.getLabel()); description(other.getDescription()); @@ -341,6 +345,7 @@ public Builder from(ConfigurablePropDiscordChannelArray other) { useQuery(other.getUseQuery()); reloadProps(other.getReloadProps()); withLabel(other.getWithLabel()); + appProp(other.getAppProp()); return this; } @@ -356,6 +361,26 @@ public _FinalStage name(@NotNull String name) { return this; } + /** + *

The name of the app prop that provides Discord authentication

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appProp(String appProp) { + this.appProp = Optional.ofNullable(appProp); + return this; + } + + /** + *

The name of the app prop that provides Discord authentication

+ */ + @java.lang.Override + @JsonSetter(value = "appProp", nulls = Nulls.SKIP) + public _FinalStage appProp(Optional appProp) { + this.appProp = appProp; + return this; + } + /** *

If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

* @return Reference to {@code this} so that method calls can be chained together. @@ -536,30 +561,9 @@ public _FinalStage label(Optional label) { return this; } - /** - *

The name of the app prop that provides Discord authentication

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage appProp(String appProp) { - this.appProp = Optional.ofNullable(appProp); - return this; - } - - /** - *

The name of the app prop that provides Discord authentication

- */ - @java.lang.Override - @JsonSetter(value = "appProp", nulls = Nulls.SKIP) - public _FinalStage appProp(Optional appProp) { - this.appProp = appProp; - return this; - } - @java.lang.Override public ConfigurablePropDiscordChannelArray build() { return new ConfigurablePropDiscordChannelArray( - appProp, name, label, description, @@ -570,6 +574,7 @@ public ConfigurablePropDiscordChannelArray build() { useQuery, reloadProps, withLabel, + appProp, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropHttp.java b/src/main/java/com/pipedream/api/types/ConfigurablePropHttp.java index 18c009b..489b992 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropHttp.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropHttp.java @@ -20,9 +20,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropHttp.Builder.class) -public final class ConfigurablePropHttp { - private final Optional customResponse; - +public final class ConfigurablePropHttp implements IConfigurablePropBase { private final String name; private final Optional label; @@ -43,10 +41,11 @@ public final class ConfigurablePropHttp { private final Optional withLabel; + private final Optional customResponse; + private final Map additionalProperties; private ConfigurablePropHttp( - Optional customResponse, String name, Optional label, Optional description, @@ -57,8 +56,8 @@ private ConfigurablePropHttp( Optional useQuery, Optional reloadProps, Optional withLabel, + Optional customResponse, Map additionalProperties) { - this.customResponse = customResponse; this.name = name; this.label = label; this.description = description; @@ -69,26 +68,15 @@ private ConfigurablePropHttp( this.useQuery = useQuery; this.reloadProps = reloadProps; this.withLabel = withLabel; + this.customResponse = customResponse; this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "$.interface.http"; - } - - /** - * @return Whether this HTTP interface allows custom responses - */ - @JsonProperty("customResponse") - public Optional getCustomResponse() { - return customResponse; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -97,6 +85,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -105,6 +94,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -113,6 +103,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -121,6 +112,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -129,6 +121,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -137,6 +130,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -145,6 +139,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -153,6 +148,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -161,10 +157,19 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + /** + * @return Whether this HTTP interface allows custom responses + */ + @JsonProperty("customResponse") + public Optional getCustomResponse() { + return customResponse; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -177,8 +182,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConfigurablePropHttp other) { - return customResponse.equals(other.customResponse) - && name.equals(other.name) + return name.equals(other.name) && label.equals(other.label) && description.equals(other.description) && optional.equals(other.optional) @@ -187,13 +191,13 @@ private boolean equalTo(ConfigurablePropHttp other) { && remoteOptions.equals(other.remoteOptions) && useQuery.equals(other.useQuery) && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + && withLabel.equals(other.withLabel) + && customResponse.equals(other.customResponse); } @java.lang.Override public int hashCode() { return Objects.hash( - this.customResponse, this.name, this.label, this.description, @@ -203,7 +207,8 @@ public int hashCode() { this.remoteOptions, this.useQuery, this.reloadProps, - this.withLabel); + this.withLabel, + this.customResponse); } @java.lang.Override @@ -227,13 +232,6 @@ public interface NameStage { public interface _FinalStage { ConfigurablePropHttp build(); - /** - *

Whether this HTTP interface allows custom responses

- */ - _FinalStage customResponse(Optional customResponse); - - _FinalStage customResponse(Boolean customResponse); - /** *

Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

*/ @@ -296,12 +294,21 @@ public interface _FinalStage { _FinalStage withLabel(Optional withLabel); _FinalStage withLabel(Boolean withLabel); + + /** + *

Whether this HTTP interface allows custom responses

+ */ + _FinalStage customResponse(Optional customResponse); + + _FinalStage customResponse(Boolean customResponse); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements NameStage, _FinalStage { private String name; + private Optional customResponse = Optional.empty(); + private Optional withLabel = Optional.empty(); private Optional reloadProps = Optional.empty(); @@ -320,8 +327,6 @@ public static final class Builder implements NameStage, _FinalStage { private Optional label = Optional.empty(); - private Optional customResponse = Optional.empty(); - @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -329,7 +334,6 @@ private Builder() {} @java.lang.Override public Builder from(ConfigurablePropHttp other) { - customResponse(other.getCustomResponse()); name(other.getName()); label(other.getLabel()); description(other.getDescription()); @@ -340,6 +344,7 @@ public Builder from(ConfigurablePropHttp other) { useQuery(other.getUseQuery()); reloadProps(other.getReloadProps()); withLabel(other.getWithLabel()); + customResponse(other.getCustomResponse()); return this; } @@ -355,6 +360,26 @@ public _FinalStage name(@NotNull String name) { return this; } + /** + *

Whether this HTTP interface allows custom responses

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customResponse(Boolean customResponse) { + this.customResponse = Optional.ofNullable(customResponse); + return this; + } + + /** + *

Whether this HTTP interface allows custom responses

+ */ + @java.lang.Override + @JsonSetter(value = "customResponse", nulls = Nulls.SKIP) + public _FinalStage customResponse(Optional customResponse) { + this.customResponse = customResponse; + return this; + } + /** *

If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

* @return Reference to {@code this} so that method calls can be chained together. @@ -535,30 +560,9 @@ public _FinalStage label(Optional label) { return this; } - /** - *

Whether this HTTP interface allows custom responses

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage customResponse(Boolean customResponse) { - this.customResponse = Optional.ofNullable(customResponse); - return this; - } - - /** - *

Whether this HTTP interface allows custom responses

- */ - @java.lang.Override - @JsonSetter(value = "customResponse", nulls = Nulls.SKIP) - public _FinalStage customResponse(Optional customResponse) { - this.customResponse = customResponse; - return this; - } - @java.lang.Override public ConfigurablePropHttp build() { return new ConfigurablePropHttp( - customResponse, name, label, description, @@ -569,6 +573,7 @@ public ConfigurablePropHttp build() { useQuery, reloadProps, withLabel, + customResponse, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropInteger.java b/src/main/java/com/pipedream/api/types/ConfigurablePropInteger.java index 5559198..b890aaf 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropInteger.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropInteger.java @@ -21,15 +21,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropInteger.Builder.class) -public final class ConfigurablePropInteger { - private final Optional min; - - private final Optional max; - - private final Optional default_; - - private final Optional> options; - +public final class ConfigurablePropInteger implements IConfigurablePropBase { private final String name; private final Optional label; @@ -50,13 +42,17 @@ public final class ConfigurablePropInteger { private final Optional withLabel; + private final Optional min; + + private final Optional max; + + private final Optional default_; + + private final Optional> options; + private final Map additionalProperties; private ConfigurablePropInteger( - Optional min, - Optional max, - Optional default_, - Optional> options, String name, Optional label, Optional description, @@ -67,11 +63,11 @@ private ConfigurablePropInteger( Optional useQuery, Optional reloadProps, Optional withLabel, + Optional min, + Optional max, + Optional default_, + Optional> options, Map additionalProperties) { - this.min = min; - this.max = max; - this.default_ = default_; - this.options = options; this.name = name; this.label = label; this.description = description; @@ -82,47 +78,18 @@ private ConfigurablePropInteger( this.useQuery = useQuery; this.reloadProps = reloadProps; this.withLabel = withLabel; + this.min = min; + this.max = max; + this.default_ = default_; + this.options = options; this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "integer"; - } - - /** - * @return The minimum value for this integer prop. - */ - @JsonProperty("min") - public Optional getMin() { - return min; - } - - /** - * @return The maximum value for this integer prop. - */ - @JsonProperty("max") - public Optional getMax() { - return max; - } - - @JsonProperty("default") - public Optional getDefault() { - return default_; - } - - /** - * @return Available integer options - */ - @JsonProperty("options") - public Optional> getOptions() { - return options; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -131,6 +98,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -139,6 +107,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -147,6 +116,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -155,6 +125,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -163,6 +134,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -171,6 +143,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -179,6 +152,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -187,6 +161,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -195,10 +170,40 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + /** + * @return The minimum value for this integer prop. + */ + @JsonProperty("min") + public Optional getMin() { + return min; + } + + /** + * @return The maximum value for this integer prop. + */ + @JsonProperty("max") + public Optional getMax() { + return max; + } + + @JsonProperty("default") + public Optional getDefault() { + return default_; + } + + /** + * @return Available integer options + */ + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -211,11 +216,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConfigurablePropInteger other) { - return min.equals(other.min) - && max.equals(other.max) - && default_.equals(other.default_) - && options.equals(other.options) - && name.equals(other.name) + return name.equals(other.name) && label.equals(other.label) && description.equals(other.description) && optional.equals(other.optional) @@ -224,16 +225,16 @@ private boolean equalTo(ConfigurablePropInteger other) { && remoteOptions.equals(other.remoteOptions) && useQuery.equals(other.useQuery) && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + && withLabel.equals(other.withLabel) + && min.equals(other.min) + && max.equals(other.max) + && default_.equals(other.default_) + && options.equals(other.options); } @java.lang.Override public int hashCode() { return Objects.hash( - this.min, - this.max, - this.default_, - this.options, this.name, this.label, this.description, @@ -243,7 +244,11 @@ public int hashCode() { this.remoteOptions, this.useQuery, this.reloadProps, - this.withLabel); + this.withLabel, + this.min, + this.max, + this.default_, + this.options); } @java.lang.Override @@ -267,31 +272,6 @@ public interface NameStage { public interface _FinalStage { ConfigurablePropInteger build(); - /** - *

The minimum value for this integer prop.

- */ - _FinalStage min(Optional min); - - _FinalStage min(Integer min); - - /** - *

The maximum value for this integer prop.

- */ - _FinalStage max(Optional max); - - _FinalStage max(Integer max); - - _FinalStage default_(Optional default_); - - _FinalStage default_(Double default_); - - /** - *

Available integer options

- */ - _FinalStage options(Optional> options); - - _FinalStage options(List options); - /** *

Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

*/ @@ -354,12 +334,45 @@ public interface _FinalStage { _FinalStage withLabel(Optional withLabel); _FinalStage withLabel(Boolean withLabel); + + /** + *

The minimum value for this integer prop.

+ */ + _FinalStage min(Optional min); + + _FinalStage min(Integer min); + + /** + *

The maximum value for this integer prop.

+ */ + _FinalStage max(Optional max); + + _FinalStage max(Integer max); + + _FinalStage default_(Optional default_); + + _FinalStage default_(Double default_); + + /** + *

Available integer options

+ */ + _FinalStage options(Optional> options); + + _FinalStage options(List options); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements NameStage, _FinalStage { private String name; + private Optional> options = Optional.empty(); + + private Optional default_ = Optional.empty(); + + private Optional max = Optional.empty(); + + private Optional min = Optional.empty(); + private Optional withLabel = Optional.empty(); private Optional reloadProps = Optional.empty(); @@ -378,14 +391,6 @@ public static final class Builder implements NameStage, _FinalStage { private Optional label = Optional.empty(); - private Optional> options = Optional.empty(); - - private Optional default_ = Optional.empty(); - - private Optional max = Optional.empty(); - - private Optional min = Optional.empty(); - @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -393,10 +398,6 @@ private Builder() {} @java.lang.Override public Builder from(ConfigurablePropInteger other) { - min(other.getMin()); - max(other.getMax()); - default_(other.getDefault()); - options(other.getOptions()); name(other.getName()); label(other.getLabel()); description(other.getDescription()); @@ -407,6 +408,10 @@ public Builder from(ConfigurablePropInteger other) { useQuery(other.getUseQuery()); reloadProps(other.getReloadProps()); withLabel(other.getWithLabel()); + min(other.getMin()); + max(other.getMax()); + default_(other.getDefault()); + options(other.getOptions()); return this; } @@ -422,6 +427,79 @@ public _FinalStage name(@NotNull String name) { return this; } + /** + *

Available integer options

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + /** + *

Available integer options

+ */ + @java.lang.Override + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public _FinalStage options(Optional> options) { + this.options = options; + return this; + } + + @java.lang.Override + public _FinalStage default_(Double default_) { + this.default_ = Optional.ofNullable(default_); + return this; + } + + @java.lang.Override + @JsonSetter(value = "default", nulls = Nulls.SKIP) + public _FinalStage default_(Optional default_) { + this.default_ = default_; + return this; + } + + /** + *

The maximum value for this integer prop.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage max(Integer max) { + this.max = Optional.ofNullable(max); + return this; + } + + /** + *

The maximum value for this integer prop.

+ */ + @java.lang.Override + @JsonSetter(value = "max", nulls = Nulls.SKIP) + public _FinalStage max(Optional max) { + this.max = max; + return this; + } + + /** + *

The minimum value for this integer prop.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage min(Integer min) { + this.min = Optional.ofNullable(min); + return this; + } + + /** + *

The minimum value for this integer prop.

+ */ + @java.lang.Override + @JsonSetter(value = "min", nulls = Nulls.SKIP) + public _FinalStage min(Optional min) { + this.min = min; + return this; + } + /** *

If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

* @return Reference to {@code this} so that method calls can be chained together. @@ -602,86 +680,9 @@ public _FinalStage label(Optional label) { return this; } - /** - *

Available integer options

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage options(List options) { - this.options = Optional.ofNullable(options); - return this; - } - - /** - *

Available integer options

- */ - @java.lang.Override - @JsonSetter(value = "options", nulls = Nulls.SKIP) - public _FinalStage options(Optional> options) { - this.options = options; - return this; - } - - @java.lang.Override - public _FinalStage default_(Double default_) { - this.default_ = Optional.ofNullable(default_); - return this; - } - - @java.lang.Override - @JsonSetter(value = "default", nulls = Nulls.SKIP) - public _FinalStage default_(Optional default_) { - this.default_ = default_; - return this; - } - - /** - *

The maximum value for this integer prop.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage max(Integer max) { - this.max = Optional.ofNullable(max); - return this; - } - - /** - *

The maximum value for this integer prop.

- */ - @java.lang.Override - @JsonSetter(value = "max", nulls = Nulls.SKIP) - public _FinalStage max(Optional max) { - this.max = max; - return this; - } - - /** - *

The minimum value for this integer prop.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage min(Integer min) { - this.min = Optional.ofNullable(min); - return this; - } - - /** - *

The minimum value for this integer prop.

- */ - @java.lang.Override - @JsonSetter(value = "min", nulls = Nulls.SKIP) - public _FinalStage min(Optional min) { - this.min = min; - return this; - } - @java.lang.Override public ConfigurablePropInteger build() { return new ConfigurablePropInteger( - min, - max, - default_, - options, name, label, description, @@ -692,6 +693,10 @@ public ConfigurablePropInteger build() { useQuery, reloadProps, withLabel, + min, + max, + default_, + options, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropIntegerArray.java b/src/main/java/com/pipedream/api/types/ConfigurablePropIntegerArray.java index dc2000d..970e522 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropIntegerArray.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropIntegerArray.java @@ -21,15 +21,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropIntegerArray.Builder.class) -public final class ConfigurablePropIntegerArray { - private final Optional min; - - private final Optional max; - - private final Optional> default_; - - private final Optional> options; - +public final class ConfigurablePropIntegerArray implements IConfigurablePropBase { private final String name; private final Optional label; @@ -50,13 +42,17 @@ public final class ConfigurablePropIntegerArray { private final Optional withLabel; + private final Optional min; + + private final Optional max; + + private final Optional> default_; + + private final Optional> options; + private final Map additionalProperties; private ConfigurablePropIntegerArray( - Optional min, - Optional max, - Optional> default_, - Optional> options, String name, Optional label, Optional description, @@ -67,11 +63,11 @@ private ConfigurablePropIntegerArray( Optional useQuery, Optional reloadProps, Optional withLabel, + Optional min, + Optional max, + Optional> default_, + Optional> options, Map additionalProperties) { - this.min = min; - this.max = max; - this.default_ = default_; - this.options = options; this.name = name; this.label = label; this.description = description; @@ -82,50 +78,18 @@ private ConfigurablePropIntegerArray( this.useQuery = useQuery; this.reloadProps = reloadProps; this.withLabel = withLabel; + this.min = min; + this.max = max; + this.default_ = default_; + this.options = options; this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "integer[]"; - } - - /** - * @return The minimum value for integers in this array - */ - @JsonProperty("min") - public Optional getMin() { - return min; - } - - /** - * @return The maximum value for integers in this array - */ - @JsonProperty("max") - public Optional getMax() { - return max; - } - - /** - * @return Default array of integers - */ - @JsonProperty("default") - public Optional> getDefault() { - return default_; - } - - /** - * @return Available options for the integer array - */ - @JsonProperty("options") - public Optional> getOptions() { - return options; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -134,6 +98,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -142,6 +107,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -150,6 +116,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -158,6 +125,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -166,6 +134,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -174,6 +143,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -182,6 +152,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -190,6 +161,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -198,10 +170,43 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + /** + * @return The minimum value for integers in this array + */ + @JsonProperty("min") + public Optional getMin() { + return min; + } + + /** + * @return The maximum value for integers in this array + */ + @JsonProperty("max") + public Optional getMax() { + return max; + } + + /** + * @return Default array of integers + */ + @JsonProperty("default") + public Optional> getDefault() { + return default_; + } + + /** + * @return Available options for the integer array + */ + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -214,11 +219,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConfigurablePropIntegerArray other) { - return min.equals(other.min) - && max.equals(other.max) - && default_.equals(other.default_) - && options.equals(other.options) - && name.equals(other.name) + return name.equals(other.name) && label.equals(other.label) && description.equals(other.description) && optional.equals(other.optional) @@ -227,16 +228,16 @@ private boolean equalTo(ConfigurablePropIntegerArray other) { && remoteOptions.equals(other.remoteOptions) && useQuery.equals(other.useQuery) && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + && withLabel.equals(other.withLabel) + && min.equals(other.min) + && max.equals(other.max) + && default_.equals(other.default_) + && options.equals(other.options); } @java.lang.Override public int hashCode() { return Objects.hash( - this.min, - this.max, - this.default_, - this.options, this.name, this.label, this.description, @@ -246,7 +247,11 @@ public int hashCode() { this.remoteOptions, this.useQuery, this.reloadProps, - this.withLabel); + this.withLabel, + this.min, + this.max, + this.default_, + this.options); } @java.lang.Override @@ -270,34 +275,6 @@ public interface NameStage { public interface _FinalStage { ConfigurablePropIntegerArray build(); - /** - *

The minimum value for integers in this array

- */ - _FinalStage min(Optional min); - - _FinalStage min(Integer min); - - /** - *

The maximum value for integers in this array

- */ - _FinalStage max(Optional max); - - _FinalStage max(Integer max); - - /** - *

Default array of integers

- */ - _FinalStage default_(Optional> default_); - - _FinalStage default_(List default_); - - /** - *

Available options for the integer array

- */ - _FinalStage options(Optional> options); - - _FinalStage options(List options); - /** *

Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

*/ @@ -360,12 +337,48 @@ public interface _FinalStage { _FinalStage withLabel(Optional withLabel); _FinalStage withLabel(Boolean withLabel); + + /** + *

The minimum value for integers in this array

+ */ + _FinalStage min(Optional min); + + _FinalStage min(Integer min); + + /** + *

The maximum value for integers in this array

+ */ + _FinalStage max(Optional max); + + _FinalStage max(Integer max); + + /** + *

Default array of integers

+ */ + _FinalStage default_(Optional> default_); + + _FinalStage default_(List default_); + + /** + *

Available options for the integer array

+ */ + _FinalStage options(Optional> options); + + _FinalStage options(List options); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements NameStage, _FinalStage { private String name; + private Optional> options = Optional.empty(); + + private Optional> default_ = Optional.empty(); + + private Optional max = Optional.empty(); + + private Optional min = Optional.empty(); + private Optional withLabel = Optional.empty(); private Optional reloadProps = Optional.empty(); @@ -384,14 +397,6 @@ public static final class Builder implements NameStage, _FinalStage { private Optional label = Optional.empty(); - private Optional> options = Optional.empty(); - - private Optional> default_ = Optional.empty(); - - private Optional max = Optional.empty(); - - private Optional min = Optional.empty(); - @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -399,10 +404,6 @@ private Builder() {} @java.lang.Override public Builder from(ConfigurablePropIntegerArray other) { - min(other.getMin()); - max(other.getMax()); - default_(other.getDefault()); - options(other.getOptions()); name(other.getName()); label(other.getLabel()); description(other.getDescription()); @@ -413,6 +414,10 @@ public Builder from(ConfigurablePropIntegerArray other) { useQuery(other.getUseQuery()); reloadProps(other.getReloadProps()); withLabel(other.getWithLabel()); + min(other.getMin()); + max(other.getMax()); + default_(other.getDefault()); + options(other.getOptions()); return this; } @@ -428,6 +433,86 @@ public _FinalStage name(@NotNull String name) { return this; } + /** + *

Available options for the integer array

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + /** + *

Available options for the integer array

+ */ + @java.lang.Override + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public _FinalStage options(Optional> options) { + this.options = options; + return this; + } + + /** + *

Default array of integers

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage default_(List default_) { + this.default_ = Optional.ofNullable(default_); + return this; + } + + /** + *

Default array of integers

+ */ + @java.lang.Override + @JsonSetter(value = "default", nulls = Nulls.SKIP) + public _FinalStage default_(Optional> default_) { + this.default_ = default_; + return this; + } + + /** + *

The maximum value for integers in this array

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage max(Integer max) { + this.max = Optional.ofNullable(max); + return this; + } + + /** + *

The maximum value for integers in this array

+ */ + @java.lang.Override + @JsonSetter(value = "max", nulls = Nulls.SKIP) + public _FinalStage max(Optional max) { + this.max = max; + return this; + } + + /** + *

The minimum value for integers in this array

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage min(Integer min) { + this.min = Optional.ofNullable(min); + return this; + } + + /** + *

The minimum value for integers in this array

+ */ + @java.lang.Override + @JsonSetter(value = "min", nulls = Nulls.SKIP) + public _FinalStage min(Optional min) { + this.min = min; + return this; + } + /** *

If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

* @return Reference to {@code this} so that method calls can be chained together. @@ -608,93 +693,9 @@ public _FinalStage label(Optional label) { return this; } - /** - *

Available options for the integer array

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage options(List options) { - this.options = Optional.ofNullable(options); - return this; - } - - /** - *

Available options for the integer array

- */ - @java.lang.Override - @JsonSetter(value = "options", nulls = Nulls.SKIP) - public _FinalStage options(Optional> options) { - this.options = options; - return this; - } - - /** - *

Default array of integers

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage default_(List default_) { - this.default_ = Optional.ofNullable(default_); - return this; - } - - /** - *

Default array of integers

- */ - @java.lang.Override - @JsonSetter(value = "default", nulls = Nulls.SKIP) - public _FinalStage default_(Optional> default_) { - this.default_ = default_; - return this; - } - - /** - *

The maximum value for integers in this array

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage max(Integer max) { - this.max = Optional.ofNullable(max); - return this; - } - - /** - *

The maximum value for integers in this array

- */ - @java.lang.Override - @JsonSetter(value = "max", nulls = Nulls.SKIP) - public _FinalStage max(Optional max) { - this.max = max; - return this; - } - - /** - *

The minimum value for integers in this array

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage min(Integer min) { - this.min = Optional.ofNullable(min); - return this; - } - - /** - *

The minimum value for integers in this array

- */ - @java.lang.Override - @JsonSetter(value = "min", nulls = Nulls.SKIP) - public _FinalStage min(Optional min) { - this.min = min; - return this; - } - @java.lang.Override public ConfigurablePropIntegerArray build() { return new ConfigurablePropIntegerArray( - min, - max, - default_, - options, name, label, description, @@ -705,6 +706,10 @@ public ConfigurablePropIntegerArray build() { useQuery, reloadProps, withLabel, + min, + max, + default_, + options, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropObject.java b/src/main/java/com/pipedream/api/types/ConfigurablePropObject.java index 6174398..a0773df 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropObject.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropObject.java @@ -21,11 +21,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropObject.Builder.class) -public final class ConfigurablePropObject { - private final Optional> default_; - - private final Optional> options; - +public final class ConfigurablePropObject implements IConfigurablePropBase { private final String name; private final Optional label; @@ -46,11 +42,13 @@ public final class ConfigurablePropObject { private final Optional withLabel; + private final Optional> default_; + + private final Optional> options; + private final Map additionalProperties; private ConfigurablePropObject( - Optional> default_, - Optional> options, String name, Optional label, Optional description, @@ -61,9 +59,9 @@ private ConfigurablePropObject( Optional useQuery, Optional reloadProps, Optional withLabel, + Optional> default_, + Optional> options, Map additionalProperties) { - this.default_ = default_; - this.options = options; this.name = name; this.label = label; this.description = description; @@ -74,28 +72,16 @@ private ConfigurablePropObject( this.useQuery = useQuery; this.reloadProps = reloadProps; this.withLabel = withLabel; + this.default_ = default_; + this.options = options; this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "object"; - } - - @JsonProperty("default") - public Optional> getDefault() { - return default_; - } - - @JsonProperty("options") - public Optional> getOptions() { - return options; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -104,6 +90,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -112,6 +99,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -120,6 +108,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -128,6 +117,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -136,6 +126,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -144,6 +135,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -152,6 +144,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -160,6 +153,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -168,10 +162,21 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + @JsonProperty("default") + public Optional> getDefault() { + return default_; + } + + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -184,9 +189,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConfigurablePropObject other) { - return default_.equals(other.default_) - && options.equals(other.options) - && name.equals(other.name) + return name.equals(other.name) && label.equals(other.label) && description.equals(other.description) && optional.equals(other.optional) @@ -195,14 +198,14 @@ private boolean equalTo(ConfigurablePropObject other) { && remoteOptions.equals(other.remoteOptions) && useQuery.equals(other.useQuery) && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + && withLabel.equals(other.withLabel) + && default_.equals(other.default_) + && options.equals(other.options); } @java.lang.Override public int hashCode() { return Objects.hash( - this.default_, - this.options, this.name, this.label, this.description, @@ -212,7 +215,9 @@ public int hashCode() { this.remoteOptions, this.useQuery, this.reloadProps, - this.withLabel); + this.withLabel, + this.default_, + this.options); } @java.lang.Override @@ -236,14 +241,6 @@ public interface NameStage { public interface _FinalStage { ConfigurablePropObject build(); - _FinalStage default_(Optional> default_); - - _FinalStage default_(Map default_); - - _FinalStage options(Optional> options); - - _FinalStage options(List options); - /** *

Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

*/ @@ -306,12 +303,24 @@ public interface _FinalStage { _FinalStage withLabel(Optional withLabel); _FinalStage withLabel(Boolean withLabel); + + _FinalStage default_(Optional> default_); + + _FinalStage default_(Map default_); + + _FinalStage options(Optional> options); + + _FinalStage options(List options); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements NameStage, _FinalStage { private String name; + private Optional> options = Optional.empty(); + + private Optional> default_ = Optional.empty(); + private Optional withLabel = Optional.empty(); private Optional reloadProps = Optional.empty(); @@ -330,10 +339,6 @@ public static final class Builder implements NameStage, _FinalStage { private Optional label = Optional.empty(); - private Optional> options = Optional.empty(); - - private Optional> default_ = Optional.empty(); - @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -341,8 +346,6 @@ private Builder() {} @java.lang.Override public Builder from(ConfigurablePropObject other) { - default_(other.getDefault()); - options(other.getOptions()); name(other.getName()); label(other.getLabel()); description(other.getDescription()); @@ -353,6 +356,8 @@ public Builder from(ConfigurablePropObject other) { useQuery(other.getUseQuery()); reloadProps(other.getReloadProps()); withLabel(other.getWithLabel()); + default_(other.getDefault()); + options(other.getOptions()); return this; } @@ -368,6 +373,32 @@ public _FinalStage name(@NotNull String name) { return this; } + @java.lang.Override + public _FinalStage options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + @java.lang.Override + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public _FinalStage options(Optional> options) { + this.options = options; + return this; + } + + @java.lang.Override + public _FinalStage default_(Map default_) { + this.default_ = Optional.ofNullable(default_); + return this; + } + + @java.lang.Override + @JsonSetter(value = "default", nulls = Nulls.SKIP) + public _FinalStage default_(Optional> default_) { + this.default_ = default_; + return this; + } + /** *

If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

* @return Reference to {@code this} so that method calls can be chained together. @@ -548,37 +579,9 @@ public _FinalStage label(Optional label) { return this; } - @java.lang.Override - public _FinalStage options(List options) { - this.options = Optional.ofNullable(options); - return this; - } - - @java.lang.Override - @JsonSetter(value = "options", nulls = Nulls.SKIP) - public _FinalStage options(Optional> options) { - this.options = options; - return this; - } - - @java.lang.Override - public _FinalStage default_(Map default_) { - this.default_ = Optional.ofNullable(default_); - return this; - } - - @java.lang.Override - @JsonSetter(value = "default", nulls = Nulls.SKIP) - public _FinalStage default_(Optional> default_) { - this.default_ = default_; - return this; - } - @java.lang.Override public ConfigurablePropObject build() { return new ConfigurablePropObject( - default_, - options, name, label, description, @@ -589,6 +592,8 @@ public ConfigurablePropObject build() { useQuery, reloadProps, withLabel, + default_, + options, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropSql.java b/src/main/java/com/pipedream/api/types/ConfigurablePropSql.java index 7a570e1..ec5950e 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropSql.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropSql.java @@ -21,13 +21,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropSql.Builder.class) -public final class ConfigurablePropSql { - private final Optional auth; - - private final Optional default_; - - private final Optional> options; - +public final class ConfigurablePropSql implements IConfigurablePropBase { private final String name; private final Optional label; @@ -48,12 +42,15 @@ public final class ConfigurablePropSql { private final Optional withLabel; + private final Optional auth; + + private final Optional default_; + + private final Optional> options; + private final Map additionalProperties; private ConfigurablePropSql( - Optional auth, - Optional default_, - Optional> options, String name, Optional label, Optional description, @@ -64,10 +61,10 @@ private ConfigurablePropSql( Optional useQuery, Optional reloadProps, Optional withLabel, + Optional auth, + Optional default_, + Optional> options, Map additionalProperties) { - this.auth = auth; - this.default_ = default_; - this.options = options; this.name = name; this.label = label; this.description = description; @@ -78,33 +75,17 @@ private ConfigurablePropSql( this.useQuery = useQuery; this.reloadProps = reloadProps; this.withLabel = withLabel; + this.auth = auth; + this.default_ = default_; + this.options = options; this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "sql"; - } - - @JsonProperty("auth") - public Optional getAuth() { - return auth; - } - - @JsonProperty("default") - public Optional getDefault() { - return default_; - } - - @JsonProperty("options") - public Optional> getOptions() { - return options; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -113,6 +94,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -121,6 +103,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -129,6 +112,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -137,6 +121,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -145,6 +130,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -153,6 +139,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -161,6 +148,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -169,6 +157,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -177,10 +166,26 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + @JsonProperty("auth") + public Optional getAuth() { + return auth; + } + + @JsonProperty("default") + public Optional getDefault() { + return default_; + } + + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -193,10 +198,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConfigurablePropSql other) { - return auth.equals(other.auth) - && default_.equals(other.default_) - && options.equals(other.options) - && name.equals(other.name) + return name.equals(other.name) && label.equals(other.label) && description.equals(other.description) && optional.equals(other.optional) @@ -205,15 +207,15 @@ private boolean equalTo(ConfigurablePropSql other) { && remoteOptions.equals(other.remoteOptions) && useQuery.equals(other.useQuery) && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + && withLabel.equals(other.withLabel) + && auth.equals(other.auth) + && default_.equals(other.default_) + && options.equals(other.options); } @java.lang.Override public int hashCode() { return Objects.hash( - this.auth, - this.default_, - this.options, this.name, this.label, this.description, @@ -223,7 +225,10 @@ public int hashCode() { this.remoteOptions, this.useQuery, this.reloadProps, - this.withLabel); + this.withLabel, + this.auth, + this.default_, + this.options); } @java.lang.Override @@ -247,18 +252,6 @@ public interface NameStage { public interface _FinalStage { ConfigurablePropSql build(); - _FinalStage auth(Optional auth); - - _FinalStage auth(ConfigurablePropSqlAuth auth); - - _FinalStage default_(Optional default_); - - _FinalStage default_(ConfiguredPropValueSql default_); - - _FinalStage options(Optional> options); - - _FinalStage options(List options); - /** *

Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

*/ @@ -321,12 +314,30 @@ public interface _FinalStage { _FinalStage withLabel(Optional withLabel); _FinalStage withLabel(Boolean withLabel); + + _FinalStage auth(Optional auth); + + _FinalStage auth(ConfigurablePropSqlAuth auth); + + _FinalStage default_(Optional default_); + + _FinalStage default_(ConfiguredPropValueSql default_); + + _FinalStage options(Optional> options); + + _FinalStage options(List options); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements NameStage, _FinalStage { private String name; + private Optional> options = Optional.empty(); + + private Optional default_ = Optional.empty(); + + private Optional auth = Optional.empty(); + private Optional withLabel = Optional.empty(); private Optional reloadProps = Optional.empty(); @@ -345,12 +356,6 @@ public static final class Builder implements NameStage, _FinalStage { private Optional label = Optional.empty(); - private Optional> options = Optional.empty(); - - private Optional default_ = Optional.empty(); - - private Optional auth = Optional.empty(); - @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -358,9 +363,6 @@ private Builder() {} @java.lang.Override public Builder from(ConfigurablePropSql other) { - auth(other.getAuth()); - default_(other.getDefault()); - options(other.getOptions()); name(other.getName()); label(other.getLabel()); description(other.getDescription()); @@ -371,6 +373,9 @@ public Builder from(ConfigurablePropSql other) { useQuery(other.getUseQuery()); reloadProps(other.getReloadProps()); withLabel(other.getWithLabel()); + auth(other.getAuth()); + default_(other.getDefault()); + options(other.getOptions()); return this; } @@ -386,6 +391,45 @@ public _FinalStage name(@NotNull String name) { return this; } + @java.lang.Override + public _FinalStage options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + @java.lang.Override + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public _FinalStage options(Optional> options) { + this.options = options; + return this; + } + + @java.lang.Override + public _FinalStage default_(ConfiguredPropValueSql default_) { + this.default_ = Optional.ofNullable(default_); + return this; + } + + @java.lang.Override + @JsonSetter(value = "default", nulls = Nulls.SKIP) + public _FinalStage default_(Optional default_) { + this.default_ = default_; + return this; + } + + @java.lang.Override + public _FinalStage auth(ConfigurablePropSqlAuth auth) { + this.auth = Optional.ofNullable(auth); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auth", nulls = Nulls.SKIP) + public _FinalStage auth(Optional auth) { + this.auth = auth; + return this; + } + /** *

If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

* @return Reference to {@code this} so that method calls can be chained together. @@ -566,51 +610,9 @@ public _FinalStage label(Optional label) { return this; } - @java.lang.Override - public _FinalStage options(List options) { - this.options = Optional.ofNullable(options); - return this; - } - - @java.lang.Override - @JsonSetter(value = "options", nulls = Nulls.SKIP) - public _FinalStage options(Optional> options) { - this.options = options; - return this; - } - - @java.lang.Override - public _FinalStage default_(ConfiguredPropValueSql default_) { - this.default_ = Optional.ofNullable(default_); - return this; - } - - @java.lang.Override - @JsonSetter(value = "default", nulls = Nulls.SKIP) - public _FinalStage default_(Optional default_) { - this.default_ = default_; - return this; - } - - @java.lang.Override - public _FinalStage auth(ConfigurablePropSqlAuth auth) { - this.auth = Optional.ofNullable(auth); - return this; - } - - @java.lang.Override - @JsonSetter(value = "auth", nulls = Nulls.SKIP) - public _FinalStage auth(Optional auth) { - this.auth = auth; - return this; - } - @java.lang.Override public ConfigurablePropSql build() { return new ConfigurablePropSql( - auth, - default_, - options, name, label, description, @@ -621,6 +623,9 @@ public ConfigurablePropSql build() { useQuery, reloadProps, withLabel, + auth, + default_, + options, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropString.java b/src/main/java/com/pipedream/api/types/ConfigurablePropString.java index d1ce2e7..9aeb4f1 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropString.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropString.java @@ -21,13 +21,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropString.Builder.class) -public final class ConfigurablePropString { - private final Optional secret; - - private final Optional default_; - - private final Optional> options; - +public final class ConfigurablePropString implements IConfigurablePropBase { private final String name; private final Optional label; @@ -48,12 +42,15 @@ public final class ConfigurablePropString { private final Optional withLabel; + private final Optional secret; + + private final Optional default_; + + private final Optional> options; + private final Map additionalProperties; private ConfigurablePropString( - Optional secret, - Optional default_, - Optional> options, String name, Optional label, Optional description, @@ -64,10 +61,10 @@ private ConfigurablePropString( Optional useQuery, Optional reloadProps, Optional withLabel, + Optional secret, + Optional default_, + Optional> options, Map additionalProperties) { - this.secret = secret; - this.default_ = default_; - this.options = options; this.name = name; this.label = label; this.description = description; @@ -78,36 +75,17 @@ private ConfigurablePropString( this.useQuery = useQuery; this.reloadProps = reloadProps; this.withLabel = withLabel; + this.secret = secret; + this.default_ = default_; + this.options = options; this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "string"; - } - - /** - * @return If true, this prop is a secret and should not be displayed in plain text. - */ - @JsonProperty("secret") - public Optional getSecret() { - return secret; - } - - @JsonProperty("default") - public Optional getDefault() { - return default_; - } - - @JsonProperty("options") - public Optional> getOptions() { - return options; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -116,6 +94,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -124,6 +103,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -132,6 +112,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -140,6 +121,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -148,6 +130,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -156,6 +139,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -164,6 +148,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -172,6 +157,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -180,10 +166,29 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + /** + * @return If true, this prop is a secret and should not be displayed in plain text. + */ + @JsonProperty("secret") + public Optional getSecret() { + return secret; + } + + @JsonProperty("default") + public Optional getDefault() { + return default_; + } + + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -196,10 +201,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConfigurablePropString other) { - return secret.equals(other.secret) - && default_.equals(other.default_) - && options.equals(other.options) - && name.equals(other.name) + return name.equals(other.name) && label.equals(other.label) && description.equals(other.description) && optional.equals(other.optional) @@ -208,15 +210,15 @@ private boolean equalTo(ConfigurablePropString other) { && remoteOptions.equals(other.remoteOptions) && useQuery.equals(other.useQuery) && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + && withLabel.equals(other.withLabel) + && secret.equals(other.secret) + && default_.equals(other.default_) + && options.equals(other.options); } @java.lang.Override public int hashCode() { return Objects.hash( - this.secret, - this.default_, - this.options, this.name, this.label, this.description, @@ -226,7 +228,10 @@ public int hashCode() { this.remoteOptions, this.useQuery, this.reloadProps, - this.withLabel); + this.withLabel, + this.secret, + this.default_, + this.options); } @java.lang.Override @@ -250,21 +255,6 @@ public interface NameStage { public interface _FinalStage { ConfigurablePropString build(); - /** - *

If true, this prop is a secret and should not be displayed in plain text.

- */ - _FinalStage secret(Optional secret); - - _FinalStage secret(Boolean secret); - - _FinalStage default_(Optional default_); - - _FinalStage default_(String default_); - - _FinalStage options(Optional> options); - - _FinalStage options(List options); - /** *

Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

*/ @@ -327,12 +317,33 @@ public interface _FinalStage { _FinalStage withLabel(Optional withLabel); _FinalStage withLabel(Boolean withLabel); + + /** + *

If true, this prop is a secret and should not be displayed in plain text.

+ */ + _FinalStage secret(Optional secret); + + _FinalStage secret(Boolean secret); + + _FinalStage default_(Optional default_); + + _FinalStage default_(String default_); + + _FinalStage options(Optional> options); + + _FinalStage options(List options); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements NameStage, _FinalStage { private String name; + private Optional> options = Optional.empty(); + + private Optional default_ = Optional.empty(); + + private Optional secret = Optional.empty(); + private Optional withLabel = Optional.empty(); private Optional reloadProps = Optional.empty(); @@ -351,12 +362,6 @@ public static final class Builder implements NameStage, _FinalStage { private Optional label = Optional.empty(); - private Optional> options = Optional.empty(); - - private Optional default_ = Optional.empty(); - - private Optional secret = Optional.empty(); - @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -364,9 +369,6 @@ private Builder() {} @java.lang.Override public Builder from(ConfigurablePropString other) { - secret(other.getSecret()); - default_(other.getDefault()); - options(other.getOptions()); name(other.getName()); label(other.getLabel()); description(other.getDescription()); @@ -377,6 +379,9 @@ public Builder from(ConfigurablePropString other) { useQuery(other.getUseQuery()); reloadProps(other.getReloadProps()); withLabel(other.getWithLabel()); + secret(other.getSecret()); + default_(other.getDefault()); + options(other.getOptions()); return this; } @@ -392,6 +397,52 @@ public _FinalStage name(@NotNull String name) { return this; } + @java.lang.Override + public _FinalStage options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + @java.lang.Override + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public _FinalStage options(Optional> options) { + this.options = options; + return this; + } + + @java.lang.Override + public _FinalStage default_(String default_) { + this.default_ = Optional.ofNullable(default_); + return this; + } + + @java.lang.Override + @JsonSetter(value = "default", nulls = Nulls.SKIP) + public _FinalStage default_(Optional default_) { + this.default_ = default_; + return this; + } + + /** + *

If true, this prop is a secret and should not be displayed in plain text.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secret(Boolean secret) { + this.secret = Optional.ofNullable(secret); + return this; + } + + /** + *

If true, this prop is a secret and should not be displayed in plain text.

+ */ + @java.lang.Override + @JsonSetter(value = "secret", nulls = Nulls.SKIP) + public _FinalStage secret(Optional secret) { + this.secret = secret; + return this; + } + /** *

If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

* @return Reference to {@code this} so that method calls can be chained together. @@ -572,58 +623,9 @@ public _FinalStage label(Optional label) { return this; } - @java.lang.Override - public _FinalStage options(List options) { - this.options = Optional.ofNullable(options); - return this; - } - - @java.lang.Override - @JsonSetter(value = "options", nulls = Nulls.SKIP) - public _FinalStage options(Optional> options) { - this.options = options; - return this; - } - - @java.lang.Override - public _FinalStage default_(String default_) { - this.default_ = Optional.ofNullable(default_); - return this; - } - - @java.lang.Override - @JsonSetter(value = "default", nulls = Nulls.SKIP) - public _FinalStage default_(Optional default_) { - this.default_ = default_; - return this; - } - - /** - *

If true, this prop is a secret and should not be displayed in plain text.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage secret(Boolean secret) { - this.secret = Optional.ofNullable(secret); - return this; - } - - /** - *

If true, this prop is a secret and should not be displayed in plain text.

- */ - @java.lang.Override - @JsonSetter(value = "secret", nulls = Nulls.SKIP) - public _FinalStage secret(Optional secret) { - this.secret = secret; - return this; - } - @java.lang.Override public ConfigurablePropString build() { return new ConfigurablePropString( - secret, - default_, - options, name, label, description, @@ -634,6 +636,9 @@ public ConfigurablePropString build() { useQuery, reloadProps, withLabel, + secret, + default_, + options, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropStringArray.java b/src/main/java/com/pipedream/api/types/ConfigurablePropStringArray.java index af508a0..18622e1 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropStringArray.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropStringArray.java @@ -21,13 +21,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropStringArray.Builder.class) -public final class ConfigurablePropStringArray { - private final Optional secret; - - private final Optional> default_; - - private final Optional> options; - +public final class ConfigurablePropStringArray implements IConfigurablePropBase { private final String name; private final Optional label; @@ -48,12 +42,15 @@ public final class ConfigurablePropStringArray { private final Optional withLabel; + private final Optional secret; + + private final Optional> default_; + + private final Optional> options; + private final Map additionalProperties; private ConfigurablePropStringArray( - Optional secret, - Optional> default_, - Optional> options, String name, Optional label, Optional description, @@ -64,10 +61,10 @@ private ConfigurablePropStringArray( Optional useQuery, Optional reloadProps, Optional withLabel, + Optional secret, + Optional> default_, + Optional> options, Map additionalProperties) { - this.secret = secret; - this.default_ = default_; - this.options = options; this.name = name; this.label = label; this.description = description; @@ -78,39 +75,17 @@ private ConfigurablePropStringArray( this.useQuery = useQuery; this.reloadProps = reloadProps; this.withLabel = withLabel; + this.secret = secret; + this.default_ = default_; + this.options = options; this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "string[]"; - } - - /** - * @return If true, this prop is a secret and should not be displayed in plain text. - */ - @JsonProperty("secret") - public Optional getSecret() { - return secret; - } - - /** - * @return The default value for this prop - */ - @JsonProperty("default") - public Optional> getDefault() { - return default_; - } - - @JsonProperty("options") - public Optional> getOptions() { - return options; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -119,6 +94,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -127,6 +103,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -135,6 +112,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -143,6 +121,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -151,6 +130,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -159,6 +139,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -167,6 +148,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -175,6 +157,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -183,10 +166,32 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + /** + * @return If true, this prop is a secret and should not be displayed in plain text. + */ + @JsonProperty("secret") + public Optional getSecret() { + return secret; + } + + /** + * @return The default value for this prop + */ + @JsonProperty("default") + public Optional> getDefault() { + return default_; + } + + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -199,10 +204,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConfigurablePropStringArray other) { - return secret.equals(other.secret) - && default_.equals(other.default_) - && options.equals(other.options) - && name.equals(other.name) + return name.equals(other.name) && label.equals(other.label) && description.equals(other.description) && optional.equals(other.optional) @@ -211,15 +213,15 @@ private boolean equalTo(ConfigurablePropStringArray other) { && remoteOptions.equals(other.remoteOptions) && useQuery.equals(other.useQuery) && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + && withLabel.equals(other.withLabel) + && secret.equals(other.secret) + && default_.equals(other.default_) + && options.equals(other.options); } @java.lang.Override public int hashCode() { return Objects.hash( - this.secret, - this.default_, - this.options, this.name, this.label, this.description, @@ -229,7 +231,10 @@ public int hashCode() { this.remoteOptions, this.useQuery, this.reloadProps, - this.withLabel); + this.withLabel, + this.secret, + this.default_, + this.options); } @java.lang.Override @@ -253,24 +258,6 @@ public interface NameStage { public interface _FinalStage { ConfigurablePropStringArray build(); - /** - *

If true, this prop is a secret and should not be displayed in plain text.

- */ - _FinalStage secret(Optional secret); - - _FinalStage secret(Boolean secret); - - /** - *

The default value for this prop

- */ - _FinalStage default_(Optional> default_); - - _FinalStage default_(List default_); - - _FinalStage options(Optional> options); - - _FinalStage options(List options); - /** *

Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

*/ @@ -333,12 +320,36 @@ public interface _FinalStage { _FinalStage withLabel(Optional withLabel); _FinalStage withLabel(Boolean withLabel); + + /** + *

If true, this prop is a secret and should not be displayed in plain text.

+ */ + _FinalStage secret(Optional secret); + + _FinalStage secret(Boolean secret); + + /** + *

The default value for this prop

+ */ + _FinalStage default_(Optional> default_); + + _FinalStage default_(List default_); + + _FinalStage options(Optional> options); + + _FinalStage options(List options); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements NameStage, _FinalStage { private String name; + private Optional> options = Optional.empty(); + + private Optional> default_ = Optional.empty(); + + private Optional secret = Optional.empty(); + private Optional withLabel = Optional.empty(); private Optional reloadProps = Optional.empty(); @@ -357,12 +368,6 @@ public static final class Builder implements NameStage, _FinalStage { private Optional label = Optional.empty(); - private Optional> options = Optional.empty(); - - private Optional> default_ = Optional.empty(); - - private Optional secret = Optional.empty(); - @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -370,9 +375,6 @@ private Builder() {} @java.lang.Override public Builder from(ConfigurablePropStringArray other) { - secret(other.getSecret()); - default_(other.getDefault()); - options(other.getOptions()); name(other.getName()); label(other.getLabel()); description(other.getDescription()); @@ -383,6 +385,9 @@ public Builder from(ConfigurablePropStringArray other) { useQuery(other.getUseQuery()); reloadProps(other.getReloadProps()); withLabel(other.getWithLabel()); + secret(other.getSecret()); + default_(other.getDefault()); + options(other.getOptions()); return this; } @@ -398,6 +403,59 @@ public _FinalStage name(@NotNull String name) { return this; } + @java.lang.Override + public _FinalStage options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + @java.lang.Override + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public _FinalStage options(Optional> options) { + this.options = options; + return this; + } + + /** + *

The default value for this prop

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage default_(List default_) { + this.default_ = Optional.ofNullable(default_); + return this; + } + + /** + *

The default value for this prop

+ */ + @java.lang.Override + @JsonSetter(value = "default", nulls = Nulls.SKIP) + public _FinalStage default_(Optional> default_) { + this.default_ = default_; + return this; + } + + /** + *

If true, this prop is a secret and should not be displayed in plain text.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secret(Boolean secret) { + this.secret = Optional.ofNullable(secret); + return this; + } + + /** + *

If true, this prop is a secret and should not be displayed in plain text.

+ */ + @java.lang.Override + @JsonSetter(value = "secret", nulls = Nulls.SKIP) + public _FinalStage secret(Optional secret) { + this.secret = secret; + return this; + } + /** *

If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

* @return Reference to {@code this} so that method calls can be chained together. @@ -578,65 +636,9 @@ public _FinalStage label(Optional label) { return this; } - @java.lang.Override - public _FinalStage options(List options) { - this.options = Optional.ofNullable(options); - return this; - } - - @java.lang.Override - @JsonSetter(value = "options", nulls = Nulls.SKIP) - public _FinalStage options(Optional> options) { - this.options = options; - return this; - } - - /** - *

The default value for this prop

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage default_(List default_) { - this.default_ = Optional.ofNullable(default_); - return this; - } - - /** - *

The default value for this prop

- */ - @java.lang.Override - @JsonSetter(value = "default", nulls = Nulls.SKIP) - public _FinalStage default_(Optional> default_) { - this.default_ = default_; - return this; - } - - /** - *

If true, this prop is a secret and should not be displayed in plain text.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage secret(Boolean secret) { - this.secret = Optional.ofNullable(secret); - return this; - } - - /** - *

If true, this prop is a secret and should not be displayed in plain text.

- */ - @java.lang.Override - @JsonSetter(value = "secret", nulls = Nulls.SKIP) - public _FinalStage secret(Optional secret) { - this.secret = secret; - return this; - } - @java.lang.Override public ConfigurablePropStringArray build() { return new ConfigurablePropStringArray( - secret, - default_, - options, name, label, description, @@ -647,6 +649,9 @@ public ConfigurablePropStringArray build() { useQuery, reloadProps, withLabel, + secret, + default_, + options, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropTimer.java b/src/main/java/com/pipedream/api/types/ConfigurablePropTimer.java index 91e02c9..6be9844 100644 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropTimer.java +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropTimer.java @@ -21,13 +21,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConfigurablePropTimer.Builder.class) -public final class ConfigurablePropTimer { - private final Optional static_; - - private final Optional default_; - - private final Optional>> options; - +public final class ConfigurablePropTimer implements IConfigurablePropBase { private final String name; private final Optional label; @@ -48,12 +42,15 @@ public final class ConfigurablePropTimer { private final Optional withLabel; + private final Optional static_; + + private final Optional default_; + + private final Optional>> options; + private final Map additionalProperties; private ConfigurablePropTimer( - Optional static_, - Optional default_, - Optional>> options, String name, Optional label, Optional description, @@ -64,10 +61,10 @@ private ConfigurablePropTimer( Optional useQuery, Optional reloadProps, Optional withLabel, + Optional static_, + Optional default_, + Optional>> options, Map additionalProperties) { - this.static_ = static_; - this.default_ = default_; - this.options = options; this.name = name; this.label = label; this.description = description; @@ -78,36 +75,17 @@ private ConfigurablePropTimer( this.useQuery = useQuery; this.reloadProps = reloadProps; this.withLabel = withLabel; + this.static_ = static_; + this.default_ = default_; + this.options = options; this.additionalProperties = additionalProperties; } - @JsonProperty("type") - public String getType() { - return "$.interface.timer"; - } - - @JsonProperty("static") - public Optional getStatic() { - return static_; - } - - @JsonProperty("default") - public Optional getDefault() { - return default_; - } - - /** - * @return Available timer configuration options - */ - @JsonProperty("options") - public Optional>> getOptions() { - return options; - } - /** * @return When building configuredProps, make sure to use this field as the key when setting the prop value */ @JsonProperty("name") + @java.lang.Override public String getName() { return name; } @@ -116,6 +94,7 @@ public String getName() { * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. */ @JsonProperty("label") + @java.lang.Override public Optional getLabel() { return label; } @@ -124,6 +103,7 @@ public Optional getLabel() { * @return A description of the prop, shown to the user when configuring the component. */ @JsonProperty("description") + @java.lang.Override public Optional getDescription() { return description; } @@ -132,6 +112,7 @@ public Optional getDescription() { * @return If true, this prop does not need to be specified. */ @JsonProperty("optional") + @java.lang.Override public Optional getOptional() { return optional; } @@ -140,6 +121,7 @@ public Optional getOptional() { * @return If true, this prop will be ignored. */ @JsonProperty("disabled") + @java.lang.Override public Optional getDisabled() { return disabled; } @@ -148,6 +130,7 @@ public Optional getDisabled() { * @return If true, should not expose this prop to the user */ @JsonProperty("hidden") + @java.lang.Override public Optional getHidden() { return hidden; } @@ -156,6 +139,7 @@ public Optional getHidden() { * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options */ @JsonProperty("remoteOptions") + @java.lang.Override public Optional getRemoteOptions() { return remoteOptions; } @@ -164,6 +148,7 @@ public Optional getRemoteOptions() { * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options */ @JsonProperty("useQuery") + @java.lang.Override public Optional getUseQuery() { return useQuery; } @@ -172,6 +157,7 @@ public Optional getUseQuery() { * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one */ @JsonProperty("reloadProps") + @java.lang.Override public Optional getReloadProps() { return reloadProps; } @@ -180,10 +166,29 @@ public Optional getReloadProps() { * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label */ @JsonProperty("withLabel") + @java.lang.Override public Optional getWithLabel() { return withLabel; } + @JsonProperty("static") + public Optional getStatic() { + return static_; + } + + @JsonProperty("default") + public Optional getDefault() { + return default_; + } + + /** + * @return Available timer configuration options + */ + @JsonProperty("options") + public Optional>> getOptions() { + return options; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -196,10 +201,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConfigurablePropTimer other) { - return static_.equals(other.static_) - && default_.equals(other.default_) - && options.equals(other.options) - && name.equals(other.name) + return name.equals(other.name) && label.equals(other.label) && description.equals(other.description) && optional.equals(other.optional) @@ -208,15 +210,15 @@ private boolean equalTo(ConfigurablePropTimer other) { && remoteOptions.equals(other.remoteOptions) && useQuery.equals(other.useQuery) && reloadProps.equals(other.reloadProps) - && withLabel.equals(other.withLabel); + && withLabel.equals(other.withLabel) + && static_.equals(other.static_) + && default_.equals(other.default_) + && options.equals(other.options); } @java.lang.Override public int hashCode() { return Objects.hash( - this.static_, - this.default_, - this.options, this.name, this.label, this.description, @@ -226,7 +228,10 @@ public int hashCode() { this.remoteOptions, this.useQuery, this.reloadProps, - this.withLabel); + this.withLabel, + this.static_, + this.default_, + this.options); } @java.lang.Override @@ -250,21 +255,6 @@ public interface NameStage { public interface _FinalStage { ConfigurablePropTimer build(); - _FinalStage static_(Optional static_); - - _FinalStage static_(ConfigurablePropTimerStatic static_); - - _FinalStage default_(Optional default_); - - _FinalStage default_(ConfigurablePropTimerDefault default_); - - /** - *

Available timer configuration options

- */ - _FinalStage options(Optional>> options); - - _FinalStage options(List> options); - /** *

Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

*/ @@ -327,12 +317,33 @@ public interface _FinalStage { _FinalStage withLabel(Optional withLabel); _FinalStage withLabel(Boolean withLabel); + + _FinalStage static_(Optional static_); + + _FinalStage static_(ConfigurablePropTimerStatic static_); + + _FinalStage default_(Optional default_); + + _FinalStage default_(ConfigurablePropTimerDefault default_); + + /** + *

Available timer configuration options

+ */ + _FinalStage options(Optional>> options); + + _FinalStage options(List> options); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements NameStage, _FinalStage { private String name; + private Optional>> options = Optional.empty(); + + private Optional default_ = Optional.empty(); + + private Optional static_ = Optional.empty(); + private Optional withLabel = Optional.empty(); private Optional reloadProps = Optional.empty(); @@ -351,12 +362,6 @@ public static final class Builder implements NameStage, _FinalStage { private Optional label = Optional.empty(); - private Optional>> options = Optional.empty(); - - private Optional default_ = Optional.empty(); - - private Optional static_ = Optional.empty(); - @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -364,9 +369,6 @@ private Builder() {} @java.lang.Override public Builder from(ConfigurablePropTimer other) { - static_(other.getStatic()); - default_(other.getDefault()); - options(other.getOptions()); name(other.getName()); label(other.getLabel()); description(other.getDescription()); @@ -377,6 +379,9 @@ public Builder from(ConfigurablePropTimer other) { useQuery(other.getUseQuery()); reloadProps(other.getReloadProps()); withLabel(other.getWithLabel()); + static_(other.getStatic()); + default_(other.getDefault()); + options(other.getOptions()); return this; } @@ -392,6 +397,52 @@ public _FinalStage name(@NotNull String name) { return this; } + /** + *

Available timer configuration options

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage options(List> options) { + this.options = Optional.ofNullable(options); + return this; + } + + /** + *

Available timer configuration options

+ */ + @java.lang.Override + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public _FinalStage options(Optional>> options) { + this.options = options; + return this; + } + + @java.lang.Override + public _FinalStage default_(ConfigurablePropTimerDefault default_) { + this.default_ = Optional.ofNullable(default_); + return this; + } + + @java.lang.Override + @JsonSetter(value = "default", nulls = Nulls.SKIP) + public _FinalStage default_(Optional default_) { + this.default_ = default_; + return this; + } + + @java.lang.Override + public _FinalStage static_(ConfigurablePropTimerStatic static_) { + this.static_ = Optional.ofNullable(static_); + return this; + } + + @java.lang.Override + @JsonSetter(value = "static", nulls = Nulls.SKIP) + public _FinalStage static_(Optional static_) { + this.static_ = static_; + return this; + } + /** *

If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

* @return Reference to {@code this} so that method calls can be chained together. @@ -572,58 +623,9 @@ public _FinalStage label(Optional label) { return this; } - /** - *

Available timer configuration options

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage options(List> options) { - this.options = Optional.ofNullable(options); - return this; - } - - /** - *

Available timer configuration options

- */ - @java.lang.Override - @JsonSetter(value = "options", nulls = Nulls.SKIP) - public _FinalStage options(Optional>> options) { - this.options = options; - return this; - } - - @java.lang.Override - public _FinalStage default_(ConfigurablePropTimerDefault default_) { - this.default_ = Optional.ofNullable(default_); - return this; - } - - @java.lang.Override - @JsonSetter(value = "default", nulls = Nulls.SKIP) - public _FinalStage default_(Optional default_) { - this.default_ = default_; - return this; - } - - @java.lang.Override - public _FinalStage static_(ConfigurablePropTimerStatic static_) { - this.static_ = Optional.ofNullable(static_); - return this; - } - - @java.lang.Override - @JsonSetter(value = "static", nulls = Nulls.SKIP) - public _FinalStage static_(Optional static_) { - this.static_ = static_; - return this; - } - @java.lang.Override public ConfigurablePropTimer build() { return new ConfigurablePropTimer( - static_, - default_, - options, name, label, description, @@ -634,6 +636,9 @@ public ConfigurablePropTimer build() { useQuery, reloadProps, withLabel, + static_, + default_, + options, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropType.java b/src/main/java/com/pipedream/api/types/ConfigurablePropType.java deleted file mode 100644 index ae5fd13..0000000 --- a/src/main/java/com/pipedream/api/types/ConfigurablePropType.java +++ /dev/null @@ -1,303 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.pipedream.api.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ConfigurablePropType { - public static final ConfigurablePropType AIRTABLE_VIEW_ID = - new ConfigurablePropType(Value.AIRTABLE_VIEW_ID, "$.airtable.viewId"); - - public static final ConfigurablePropType APP = new ConfigurablePropType(Value.APP, "app"); - - public static final ConfigurablePropType AIRTABLE_BASE_ID = - new ConfigurablePropType(Value.AIRTABLE_BASE_ID, "$.airtable.baseId"); - - public static final ConfigurablePropType AIRTABLE_TABLE_ID = - new ConfigurablePropType(Value.AIRTABLE_TABLE_ID, "$.airtable.tableId"); - - public static final ConfigurablePropType BOOLEAN = new ConfigurablePropType(Value.BOOLEAN, "boolean"); - - public static final ConfigurablePropType INTERFACE_TIMER = - new ConfigurablePropType(Value.INTERFACE_TIMER, "$.interface.timer"); - - public static final ConfigurablePropType ANY = new ConfigurablePropType(Value.ANY, "any"); - - public static final ConfigurablePropType SERVICE_DB = new ConfigurablePropType(Value.SERVICE_DB, "$.service.db"); - - public static final ConfigurablePropType SQL = new ConfigurablePropType(Value.SQL, "sql"); - - public static final ConfigurablePropType AIRTABLE_FIELD_ID = - new ConfigurablePropType(Value.AIRTABLE_FIELD_ID, "$.airtable.fieldId"); - - public static final ConfigurablePropType STRING_ARRAY = new ConfigurablePropType(Value.STRING_ARRAY, "string[]"); - - public static final ConfigurablePropType DISCORD_CHANNEL_ARRAY = - new ConfigurablePropType(Value.DISCORD_CHANNEL_ARRAY, "$.discord.channel[]"); - - public static final ConfigurablePropType OBJECT = new ConfigurablePropType(Value.OBJECT, "object"); - - public static final ConfigurablePropType INTERFACE_APPHOOK = - new ConfigurablePropType(Value.INTERFACE_APPHOOK, "$.interface.apphook"); - - public static final ConfigurablePropType ALERT = new ConfigurablePropType(Value.ALERT, "alert"); - - public static final ConfigurablePropType STRING = new ConfigurablePropType(Value.STRING, "string"); - - public static final ConfigurablePropType INTEGER = new ConfigurablePropType(Value.INTEGER, "integer"); - - public static final ConfigurablePropType DISCORD_CHANNEL = - new ConfigurablePropType(Value.DISCORD_CHANNEL, "$.discord.channel"); - - public static final ConfigurablePropType INTEGER_ARRAY = new ConfigurablePropType(Value.INTEGER_ARRAY, "integer[]"); - - public static final ConfigurablePropType DATA_STORE = new ConfigurablePropType(Value.DATA_STORE, "data_store"); - - public static final ConfigurablePropType HTTP_REQUEST = - new ConfigurablePropType(Value.HTTP_REQUEST, "http_request"); - - public static final ConfigurablePropType DIR = new ConfigurablePropType(Value.DIR, "dir"); - - public static final ConfigurablePropType INTERFACE_HTTP = - new ConfigurablePropType(Value.INTERFACE_HTTP, "$.interface.http"); - - private final Value value; - - private final String string; - - ConfigurablePropType(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ConfigurablePropType && this.string.equals(((ConfigurablePropType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case AIRTABLE_VIEW_ID: - return visitor.visitAirtableViewId(); - case APP: - return visitor.visitApp(); - case AIRTABLE_BASE_ID: - return visitor.visitAirtableBaseId(); - case AIRTABLE_TABLE_ID: - return visitor.visitAirtableTableId(); - case BOOLEAN: - return visitor.visitBoolean(); - case INTERFACE_TIMER: - return visitor.visitInterfaceTimer(); - case ANY: - return visitor.visitAny(); - case SERVICE_DB: - return visitor.visitServiceDb(); - case SQL: - return visitor.visitSql(); - case AIRTABLE_FIELD_ID: - return visitor.visitAirtableFieldId(); - case STRING_ARRAY: - return visitor.visitStringArray(); - case DISCORD_CHANNEL_ARRAY: - return visitor.visitDiscordChannelArray(); - case OBJECT: - return visitor.visitObject(); - case INTERFACE_APPHOOK: - return visitor.visitInterfaceApphook(); - case ALERT: - return visitor.visitAlert(); - case STRING: - return visitor.visitString(); - case INTEGER: - return visitor.visitInteger(); - case DISCORD_CHANNEL: - return visitor.visitDiscordChannel(); - case INTEGER_ARRAY: - return visitor.visitIntegerArray(); - case DATA_STORE: - return visitor.visitDataStore(); - case HTTP_REQUEST: - return visitor.visitHttpRequest(); - case DIR: - return visitor.visitDir(); - case INTERFACE_HTTP: - return visitor.visitInterfaceHttp(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ConfigurablePropType valueOf(String value) { - switch (value) { - case "$.airtable.viewId": - return AIRTABLE_VIEW_ID; - case "app": - return APP; - case "$.airtable.baseId": - return AIRTABLE_BASE_ID; - case "$.airtable.tableId": - return AIRTABLE_TABLE_ID; - case "boolean": - return BOOLEAN; - case "$.interface.timer": - return INTERFACE_TIMER; - case "any": - return ANY; - case "$.service.db": - return SERVICE_DB; - case "sql": - return SQL; - case "$.airtable.fieldId": - return AIRTABLE_FIELD_ID; - case "string[]": - return STRING_ARRAY; - case "$.discord.channel[]": - return DISCORD_CHANNEL_ARRAY; - case "object": - return OBJECT; - case "$.interface.apphook": - return INTERFACE_APPHOOK; - case "alert": - return ALERT; - case "string": - return STRING; - case "integer": - return INTEGER; - case "$.discord.channel": - return DISCORD_CHANNEL; - case "integer[]": - return INTEGER_ARRAY; - case "data_store": - return DATA_STORE; - case "http_request": - return HTTP_REQUEST; - case "dir": - return DIR; - case "$.interface.http": - return INTERFACE_HTTP; - default: - return new ConfigurablePropType(Value.UNKNOWN, value); - } - } - - public enum Value { - AIRTABLE_BASE_ID, - - AIRTABLE_FIELD_ID, - - AIRTABLE_TABLE_ID, - - AIRTABLE_VIEW_ID, - - DISCORD_CHANNEL, - - DISCORD_CHANNEL_ARRAY, - - INTERFACE_APPHOOK, - - INTERFACE_HTTP, - - INTERFACE_TIMER, - - SERVICE_DB, - - ALERT, - - ANY, - - APP, - - BOOLEAN, - - DATA_STORE, - - DIR, - - HTTP_REQUEST, - - INTEGER, - - INTEGER_ARRAY, - - OBJECT, - - SQL, - - STRING, - - STRING_ARRAY, - - UNKNOWN - } - - public interface Visitor { - T visitAirtableBaseId(); - - T visitAirtableFieldId(); - - T visitAirtableTableId(); - - T visitAirtableViewId(); - - T visitDiscordChannel(); - - T visitDiscordChannelArray(); - - T visitInterfaceApphook(); - - T visitInterfaceHttp(); - - T visitInterfaceTimer(); - - T visitServiceDb(); - - T visitAlert(); - - T visitAny(); - - T visitApp(); - - T visitBoolean(); - - T visitDataStore(); - - T visitDir(); - - T visitHttpRequest(); - - T visitInteger(); - - T visitIntegerArray(); - - T visitObject(); - - T visitSql(); - - T visitString(); - - T visitStringArray(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/pipedream/api/types/DeployedComponent.java b/src/main/java/com/pipedream/api/types/DeployedComponent.java index f019798..b079a0c 100644 --- a/src/main/java/com/pipedream/api/types/DeployedComponent.java +++ b/src/main/java/com/pipedream/api/types/DeployedComponent.java @@ -48,6 +48,8 @@ public final class DeployedComponent { private final Optional callbackObservations; + private final Optional emitOnDeploy; + private final Map additionalProperties; private DeployedComponent( @@ -63,6 +65,7 @@ private DeployedComponent( String name, String nameSlug, Optional callbackObservations, + Optional emitOnDeploy, Map additionalProperties) { this.id = id; this.ownerId = ownerId; @@ -76,6 +79,7 @@ private DeployedComponent( this.name = name; this.nameSlug = nameSlug; this.callbackObservations = callbackObservations; + this.emitOnDeploy = emitOnDeploy; this.additionalProperties = additionalProperties; } @@ -172,6 +176,14 @@ public Optional getCallbackObservations() { return callbackObservations; } + /** + * @return Whether the trigger emits events during the deploy hook execution. When false, the $emit function is disabled during deploy hook execution. Defaults to true. + */ + @JsonProperty("emit_on_deploy") + public Optional getEmitOnDeploy() { + return emitOnDeploy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -195,7 +207,8 @@ private boolean equalTo(DeployedComponent other) { && updatedAt == other.updatedAt && name.equals(other.name) && nameSlug.equals(other.nameSlug) - && callbackObservations.equals(other.callbackObservations); + && callbackObservations.equals(other.callbackObservations) + && emitOnDeploy.equals(other.emitOnDeploy); } @java.lang.Override @@ -212,7 +225,8 @@ public int hashCode() { this.updatedAt, this.name, this.nameSlug, - this.callbackObservations); + this.callbackObservations, + this.emitOnDeploy); } @java.lang.Override @@ -313,6 +327,13 @@ public interface _FinalStage { _FinalStage callbackObservations(Optional callbackObservations); _FinalStage callbackObservations(Object callbackObservations); + + /** + *

Whether the trigger emits events during the deploy hook execution. When false, the $emit function is disabled during deploy hook execution. Defaults to true.

+ */ + _FinalStage emitOnDeploy(Optional emitOnDeploy); + + _FinalStage emitOnDeploy(Boolean emitOnDeploy); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -342,6 +363,8 @@ public static final class Builder private String nameSlug; + private Optional emitOnDeploy = Optional.empty(); + private Optional callbackObservations = Optional.empty(); private Map configuredProps = new LinkedHashMap<>(); @@ -369,6 +392,7 @@ public Builder from(DeployedComponent other) { name(other.getName()); nameSlug(other.getNameSlug()); callbackObservations(other.getCallbackObservations()); + emitOnDeploy(other.getEmitOnDeploy()); return this; } @@ -468,6 +492,26 @@ public _FinalStage nameSlug(@NotNull String nameSlug) { return this; } + /** + *

Whether the trigger emits events during the deploy hook execution. When false, the $emit function is disabled during deploy hook execution. Defaults to true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emitOnDeploy(Boolean emitOnDeploy) { + this.emitOnDeploy = Optional.ofNullable(emitOnDeploy); + return this; + } + + /** + *

Whether the trigger emits events during the deploy hook execution. When false, the $emit function is disabled during deploy hook execution. Defaults to true.

+ */ + @java.lang.Override + @JsonSetter(value = "emit_on_deploy", nulls = Nulls.SKIP) + public _FinalStage emitOnDeploy(Optional emitOnDeploy) { + this.emitOnDeploy = emitOnDeploy; + return this; + } + /** *

Callback observations for the deployed component

* @return Reference to {@code this} so that method calls can be chained together. @@ -582,6 +626,7 @@ public DeployedComponent build() { name, nameSlug, callbackObservations, + emitOnDeploy, additionalProperties); } } diff --git a/src/main/java/com/pipedream/api/types/IConfigurablePropBase.java b/src/main/java/com/pipedream/api/types/IConfigurablePropBase.java new file mode 100644 index 0000000..39f1f9e --- /dev/null +++ b/src/main/java/com/pipedream/api/types/IConfigurablePropBase.java @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import java.util.Optional; + +public interface IConfigurablePropBase { + String getName(); + + Optional getLabel(); + + Optional getDescription(); + + Optional getOptional(); + + Optional getDisabled(); + + Optional getHidden(); + + Optional getRemoteOptions(); + + Optional getUseQuery(); + + Optional getReloadProps(); + + Optional getWithLabel(); +} diff --git a/src/test/java/com/pipedream/api/OauthTokensWireTest.java b/src/test/java/com/pipedream/api/OauthTokensWireTest.java deleted file mode 100644 index 0979f9c..0000000 --- a/src/test/java/com/pipedream/api/OauthTokensWireTest.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.pipedream.api; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.pipedream.api.core.ObjectMappers; -import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; -import com.pipedream.api.types.CreateOAuthTokenResponse; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; -import okhttp3.mockwebserver.RecordedRequest; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -public class OauthTokensWireTest { - private MockWebServer server; - private BaseClient client; - private ObjectMapper objectMapper = ObjectMappers.JSON_MAPPER; - - @BeforeEach - public void setup() throws Exception { - server = new MockWebServer(); - server.start(); - client = BaseClient.builder().url(server.url("/").toString()).build(); - } - - @AfterEach - public void teardown() throws Exception { - server.shutdown(); - } - - @Test - public void testCreate() throws Exception { - server.enqueue(new MockResponse() - .setResponseCode(200) - .setBody("{\"access_token\":\"access_token\",\"token_type\":\"token_type\",\"expires_in\":1}")); - CreateOAuthTokenResponse response = client.oauthTokens() - .create(CreateOAuthTokenOpts.builder() - .clientId("client_id") - .clientSecret("client_secret") - .build()); - RecordedRequest request = server.takeRequest(); - Assertions.assertNotNull(request); - Assertions.assertEquals("POST", request.getMethod()); - // Validate request body - String actualRequestBody = request.getBody().readUtf8(); - String expectedRequestBody = "" - + "{\n" - + " \"grant_type\": \"client_credentials\",\n" - + " \"client_id\": \"client_id\",\n" - + " \"client_secret\": \"client_secret\"\n" - + "}"; - JsonNode actualJson = objectMapper.readTree(actualRequestBody); - JsonNode expectedJson = objectMapper.readTree(expectedRequestBody); - Assertions.assertEquals(expectedJson, actualJson, "Request body structure does not match expected"); - if (actualJson.has("type") || actualJson.has("_type") || actualJson.has("kind")) { - String discriminator = null; - if (actualJson.has("type")) discriminator = actualJson.get("type").asText(); - else if (actualJson.has("_type")) - discriminator = actualJson.get("_type").asText(); - else if (actualJson.has("kind")) - discriminator = actualJson.get("kind").asText(); - Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); - Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); - } - - if (!actualJson.isNull()) { - Assertions.assertTrue( - actualJson.isObject() || actualJson.isArray() || actualJson.isValueNode(), - "request should be a valid JSON value"); - } - - if (actualJson.isArray()) { - Assertions.assertTrue(actualJson.size() >= 0, "Array should have valid size"); - } - if (actualJson.isObject()) { - Assertions.assertTrue(actualJson.size() >= 0, "Object should have valid field count"); - } - - // Validate response body - Assertions.assertNotNull(response, "Response should not be null"); - String actualResponseJson = objectMapper.writeValueAsString(response); - String expectedResponseBody = "" - + "{\n" - + " \"access_token\": \"access_token\",\n" - + " \"token_type\": \"token_type\",\n" - + " \"expires_in\": 1\n" - + "}"; - JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson); - JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody); - Assertions.assertEquals( - expectedResponseNode, actualResponseNode, "Response body structure does not match expected"); - if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) { - String discriminator = null; - if (actualResponseNode.has("type")) - discriminator = actualResponseNode.get("type").asText(); - else if (actualResponseNode.has("_type")) - discriminator = actualResponseNode.get("_type").asText(); - else if (actualResponseNode.has("kind")) - discriminator = actualResponseNode.get("kind").asText(); - Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); - Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); - } - - if (!actualResponseNode.isNull()) { - Assertions.assertTrue( - actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(), - "response should be a valid JSON value"); - } - - if (actualResponseNode.isArray()) { - Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size"); - } - if (actualResponseNode.isObject()) { - Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count"); - } - } -} diff --git a/src/test/java/com/pipedream/api/TokensWireTest.java b/src/test/java/com/pipedream/api/TokensWireTest.java deleted file mode 100644 index 0762707..0000000 --- a/src/test/java/com/pipedream/api/TokensWireTest.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.pipedream.api; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.pipedream.api.core.ObjectMappers; -import com.pipedream.api.resources.tokens.requests.TokensValidateRequest; -import com.pipedream.api.types.ValidateTokenResponse; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; -import okhttp3.mockwebserver.RecordedRequest; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -public class TokensWireTest { - private MockWebServer server; - private BaseClient client; - private ObjectMapper objectMapper = ObjectMappers.JSON_MAPPER; - - @BeforeEach - public void setup() throws Exception { - server = new MockWebServer(); - server.start(); - client = BaseClient.builder().url(server.url("/").toString()).build(); - } - - @AfterEach - public void teardown() throws Exception { - server.shutdown(); - } - - @Test - public void testValidate() throws Exception { - server.enqueue( - new MockResponse() - .setResponseCode(200) - .setBody( - "{\"app\":{\"id\":\"id\",\"name_slug\":\"name_slug\",\"name\":\"name\",\"auth_type\":\"keys\",\"description\":\"description\",\"img_src\":\"img_src\",\"custom_fields_json\":\"custom_fields_json\",\"categories\":[\"categories\"],\"featured_weight\":1.1},\"error\":\"error\",\"error_redirect_uri\":\"error_redirect_uri\",\"oauth_app_id\":\"oauth_app_id\",\"project_app_name\":\"project_app_name\",\"project_environment\":\"project_environment\",\"project_id\":\"project_id\",\"project_support_email\":\"project_support_email\",\"success\":true,\"success_redirect_uri\":\"success_redirect_uri\"}")); - ValidateTokenResponse response = client.tokens() - .validate( - "ctok", - TokensValidateRequest.builder() - .appId("app_id") - .oauthAppId("oauth_app_id") - .build()); - RecordedRequest request = server.takeRequest(); - Assertions.assertNotNull(request); - Assertions.assertEquals("GET", request.getMethod()); - - // Validate response body - Assertions.assertNotNull(response, "Response should not be null"); - String actualResponseJson = objectMapper.writeValueAsString(response); - String expectedResponseBody = "" - + "{\n" - + " \"app\": {\n" - + " \"id\": \"id\",\n" - + " \"name_slug\": \"name_slug\",\n" - + " \"name\": \"name\",\n" - + " \"auth_type\": \"keys\",\n" - + " \"description\": \"description\",\n" - + " \"img_src\": \"img_src\",\n" - + " \"custom_fields_json\": \"custom_fields_json\",\n" - + " \"categories\": [\n" - + " \"categories\"\n" - + " ],\n" - + " \"featured_weight\": 1.1\n" - + " },\n" - + " \"error\": \"error\",\n" - + " \"error_redirect_uri\": \"error_redirect_uri\",\n" - + " \"oauth_app_id\": \"oauth_app_id\",\n" - + " \"project_app_name\": \"project_app_name\",\n" - + " \"project_environment\": \"project_environment\",\n" - + " \"project_id\": \"project_id\",\n" - + " \"project_support_email\": \"project_support_email\",\n" - + " \"success\": true,\n" - + " \"success_redirect_uri\": \"success_redirect_uri\"\n" - + "}"; - JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson); - JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody); - Assertions.assertEquals( - expectedResponseNode, actualResponseNode, "Response body structure does not match expected"); - if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) { - String discriminator = null; - if (actualResponseNode.has("type")) - discriminator = actualResponseNode.get("type").asText(); - else if (actualResponseNode.has("_type")) - discriminator = actualResponseNode.get("_type").asText(); - else if (actualResponseNode.has("kind")) - discriminator = actualResponseNode.get("kind").asText(); - Assertions.assertNotNull(discriminator, "Union type should have a discriminator field"); - Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty"); - } - - if (!actualResponseNode.isNull()) { - Assertions.assertTrue( - actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(), - "response should be a valid JSON value"); - } - - if (actualResponseNode.isArray()) { - Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size"); - } - if (actualResponseNode.isObject()) { - Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count"); - } - } -}