diff --git a/.gradle/8.14.3/checksums/checksums.lock b/.gradle/8.14.3/checksums/checksums.lock new file mode 100644 index 0000000..f2ac8c4 Binary files /dev/null and b/.gradle/8.14.3/checksums/checksums.lock differ diff --git a/.gradle/8.14.3/checksums/md5-checksums.bin b/.gradle/8.14.3/checksums/md5-checksums.bin new file mode 100644 index 0000000..8b208bf Binary files /dev/null and b/.gradle/8.14.3/checksums/md5-checksums.bin differ diff --git a/.gradle/8.14.3/checksums/sha1-checksums.bin b/.gradle/8.14.3/checksums/sha1-checksums.bin new file mode 100644 index 0000000..ce3459b Binary files /dev/null and b/.gradle/8.14.3/checksums/sha1-checksums.bin differ diff --git a/.gradle/8.14.3/executionHistory/executionHistory.bin b/.gradle/8.14.3/executionHistory/executionHistory.bin new file mode 100644 index 0000000..da9dccc Binary files /dev/null and b/.gradle/8.14.3/executionHistory/executionHistory.bin differ diff --git a/.gradle/8.14.3/executionHistory/executionHistory.lock b/.gradle/8.14.3/executionHistory/executionHistory.lock new file mode 100644 index 0000000..7d371c6 Binary files /dev/null and b/.gradle/8.14.3/executionHistory/executionHistory.lock differ diff --git a/.gradle/8.14.3/fileChanges/last-build.bin b/.gradle/8.14.3/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/.gradle/8.14.3/fileChanges/last-build.bin differ diff --git a/.gradle/8.14.3/fileHashes/fileHashes.bin b/.gradle/8.14.3/fileHashes/fileHashes.bin new file mode 100644 index 0000000..3257e7c Binary files /dev/null and b/.gradle/8.14.3/fileHashes/fileHashes.bin differ diff --git a/.gradle/8.14.3/fileHashes/fileHashes.lock b/.gradle/8.14.3/fileHashes/fileHashes.lock new file mode 100644 index 0000000..3794de0 Binary files /dev/null and b/.gradle/8.14.3/fileHashes/fileHashes.lock differ diff --git a/.gradle/8.14.3/gc.properties b/.gradle/8.14.3/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..5fcec81 Binary files /dev/null and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..bfdb235 --- /dev/null +++ b/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Thu Jul 17 20:22:15 UTC 2025 +gradle.version=8.14.3 diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000..d8ba933 Binary files /dev/null and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/.gradle/vcs-1/gc.properties b/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.publish/prepare.sh b/.publish/prepare.sh new file mode 100755 index 0000000..df3948e --- /dev/null +++ b/.publish/prepare.sh @@ -0,0 +1,8 @@ +# Write key ring file +echo "$MAVEN_SIGNATURE_SECRET_KEY" > armored_key.asc +gpg -o publish_key.gpg --dearmor armored_key.asc + +# Generate gradle.properties file +echo "signing.keyId=$MAVEN_SIGNATURE_KID" > gradle.properties +echo "signing.secretKeyRingFile=publish_key.gpg" >> gradle.properties +echo "signing.password=$MAVEN_SIGNATURE_PASSWORD" >> gradle.properties diff --git a/README.md b/README.md new file mode 100644 index 0000000..2fc833f --- /dev/null +++ b/README.md @@ -0,0 +1,178 @@ +# Pipedream Java Library + +[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FPipedreamHQ%2Fpipedream-sdk-java) +[![Maven Central](https://img.shields.io/maven-central/v/com.pipedream/pipedream)](https://central.sonatype.com/artifact/com.pipedream/pipedream) + +The Pipedream Java library provides convenient access to the Pipedream API from Java. + +## Installation + +### Gradle + +Add the dependency in your `build.gradle` file: + +```groovy +dependencies { + implementation 'com.pipedream:pipedream' +} +``` + +### Maven + +Add the dependency in your `pom.xml` file: + +```xml + + com.pipedream + pipedream + 0.0.190 + +``` + +## Usage + +Instantiate and use the client with the following: + +```java +package com.example.usage; + +import com.pipedream.api.PipedreamApiClient; +import com.pipedream.api.resources.accounts.requests.CreateAccountRequest; + +public class Example { + public static void main(String[] args) { + PipedreamApiClient client = PipedreamApiClient + .builder() + .clientId("") + .clientSecret("") + .build(); + + client.accounts().create( + "project_id", + CreateAccountRequest + .builder() + .appSlug("app_slug") + .cfmapJson("cfmap_json") + .connectToken("connect_token") + .build() + ); + } +} +``` + +## Environments + +This SDK allows you to configure different environments for API requests. + +```java +import com.pipedream.api.PipedreamApiClient; +import com.pipedream.api.core.Environment; + +PipedreamApiClient client = PipedreamApiClient + .builder() + .environment(Environment.Prod) + .build(); +``` + +## Base Url + +You can set a custom base URL when constructing the client. + +```java +import com.pipedream.api.PipedreamApiClient; + +PipedreamApiClient client = PipedreamApiClient + .builder() + .url("https://example.com") + .build(); +``` + +## Exception Handling + +When the API returns a non-success status code (4xx or 5xx response), an API exception will be thrown. + +```java +import com.pipedream.api.core.PipedreamApiApiException; + +try { + client.accounts().create(...); +} catch (PipedreamApiApiException e) { + // Do something with the API exception... +} +``` + +## Advanced + +### 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. +However, you can pass your own client like so: + +```java +import com.pipedream.api.PipedreamApiClient; +import okhttp3.OkHttpClient; + +OkHttpClient customClient = ...; + +PipedreamApiClient client = PipedreamApiClient + .builder() + .httpClient(customClient) + .build(); +``` + +### Retries + +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). + +A request is deemed retryable when any of the following HTTP status codes is returned: + +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) + +Use the `maxRetries` client option to configure this behavior. + +```java +import com.pipedream.api.PipedreamApiClient; + +PipedreamApiClient client = PipedreamApiClient + .builder() + .maxRetries(1) + .build(); +``` + +### Timeouts + +The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level. + +```java +import com.pipedream.api.PipedreamApiClient; +import com.pipedream.api.core.RequestOptions; + +// Client level +PipedreamApiClient client = PipedreamApiClient + .builder() + .timeout(10) + .build(); + +// Request level +client.accounts().create( + ..., + RequestOptions + .builder() + .timeout(10) + .build() +); +``` + +## Contributing + +While we value open-source contributions to this SDK, this library is generated programmatically. +Additions made directly to this library would have to be moved over to our generation code, +otherwise they would be overwritten upon the next generated release. Feel free to open a PR as +a proof of concept, but know that we will not be able to merge it as-is. We suggest opening +an issue first to discuss with us! + +On the other hand, contributions to the README are always very welcome! \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..f74d5fa --- /dev/null +++ b/build.gradle @@ -0,0 +1,130 @@ +plugins { + id 'java-library' + id 'maven-publish' + id 'com.diffplug.spotless' version '6.11.0' + id 'signing' + id 'cl.franciscosolis.sonatype-central-upload' version '1.0.3' +} + +repositories { + mavenCentral() + maven { + url 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' + } +} + +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' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' + testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2' +} + + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + +tasks.withType(Javadoc) { + failOnError false + options.addStringOption('Xdoclint:none', '-quiet') +} + +spotless { + java { + palantirJavaFormat() + } +} + + +java { + withSourcesJar() + withJavadocJar() +} + + +group = 'com.pipedream' + +version = '0.0.190' + +jar { + dependsOn(":generatePomFileForMavenPublication") + archiveBaseName = "pipedream" +} + +sourcesJar { + archiveBaseName = "pipedream" +} + +javadocJar { + archiveBaseName = "pipedream" +} + +signing { + sign(publishing.publications) +} + +test { + useJUnitPlatform() + testLogging { + showStandardStreams = true + } +} + +publishing { + publications { + maven(MavenPublication) { + groupId = 'com.pipedream' + artifactId = 'pipedream' + version = '0.0.190' + from components.java + pom { + name = 'pipedream' + description = 'The official SDK of pipedream' + url = 'https://buildwithfern.com' + licenses { + license { + name = 'The MIT License (MIT)' + url = 'https://mit-license.org/' + } + } + developers { + developer { + name = 'pipedream' + email = 'developers@pipedream.com' + } + } + scm { + connection = 'scm:git:git://github.com/PipedreamHQ/pipedream-sdk-java.git' + developerConnection = 'scm:git:git://github.com/PipedreamHQ/pipedream-sdk-java.git' + url = 'https://github.com/PipedreamHQ/pipedream-sdk-java' + } + } + } + } +} + +sonatypeCentralUpload { + username = "$System.env.MAVEN_USERNAME" + password = "$System.env.MAVEN_PASSWORD" + + archives = files( + "$buildDir/libs/pipedream-" + version + ".jar", + "$buildDir/libs/pipedream-" + version + "-sources.jar", + "$buildDir/libs/pipedream-" + version + "-javadoc.jar" + ) + + pom = file("$buildDir/publications/maven/pom-default.xml") + signingKey = "$System.env.MAVEN_SIGNATURE_SECRET_KEY" + signingKeyPassphrase = "$System.env.MAVEN_SIGNATURE_PASSWORD" +} + +signing { + def signingKeyId = "$System.env.MAVEN_SIGNATURE_SECRET_KEY" + def signingPassword = "$System.env.MAVEN_SIGNATURE_PASSWORD" + useInMemoryPgpKeys(signingKeyId, signingPassword) + sign publishing.publications.maven +} + +sonatypeCentralUpload.dependsOn build diff --git a/build/reports/problems/problems-report.html b/build/reports/problems/problems-report.html new file mode 100644 index 0000000..bea792b --- /dev/null +++ b/build/reports/problems/problems-report.html @@ -0,0 +1,663 @@ + + + + + + + + + + + + + Gradle Configuration Cache + + + +
+ +
+ Loading... +
+ + + + + + diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamApiClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamApiClient.java new file mode 100644 index 0000000..ee61fa8 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamApiClient.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.Suppliers; +import com.pipedream.api.resources.accounts.AsyncAccountsClient; +import com.pipedream.api.resources.actions.AsyncActionsClient; +import com.pipedream.api.resources.appcategories.AsyncAppCategoriesClient; +import com.pipedream.api.resources.apps.AsyncAppsClient; +import com.pipedream.api.resources.components.AsyncComponentsClient; +import com.pipedream.api.resources.deployedtriggers.AsyncDeployedTriggersClient; +import com.pipedream.api.resources.oauthtokens.AsyncOauthTokensClient; +import com.pipedream.api.resources.projects.AsyncProjectsClient; +import com.pipedream.api.resources.proxy.AsyncProxyClient; +import com.pipedream.api.resources.tokens.AsyncTokensClient; +import com.pipedream.api.resources.triggers.AsyncTriggersClient; +import com.pipedream.api.resources.users.AsyncUsersClient; +import java.util.function.Supplier; + +public class AsyncPipedreamApiClient { + protected final ClientOptions clientOptions; + + protected final Supplier appCategoriesClient; + + protected final Supplier appsClient; + + protected final Supplier accountsClient; + + protected final Supplier usersClient; + + protected final Supplier componentsClient; + + protected final Supplier actionsClient; + + protected final Supplier triggersClient; + + protected final Supplier deployedTriggersClient; + + protected final Supplier projectsClient; + + protected final Supplier proxyClient; + + protected final Supplier tokensClient; + + protected final Supplier oauthTokensClient; + + public AsyncPipedreamApiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.appCategoriesClient = Suppliers.memoize(() -> new AsyncAppCategoriesClient(clientOptions)); + this.appsClient = Suppliers.memoize(() -> new AsyncAppsClient(clientOptions)); + this.accountsClient = Suppliers.memoize(() -> new AsyncAccountsClient(clientOptions)); + this.usersClient = Suppliers.memoize(() -> new AsyncUsersClient(clientOptions)); + this.componentsClient = Suppliers.memoize(() -> new AsyncComponentsClient(clientOptions)); + this.actionsClient = Suppliers.memoize(() -> new AsyncActionsClient(clientOptions)); + this.triggersClient = Suppliers.memoize(() -> new AsyncTriggersClient(clientOptions)); + this.deployedTriggersClient = Suppliers.memoize(() -> new AsyncDeployedTriggersClient(clientOptions)); + this.projectsClient = Suppliers.memoize(() -> new AsyncProjectsClient(clientOptions)); + this.proxyClient = Suppliers.memoize(() -> new AsyncProxyClient(clientOptions)); + this.tokensClient = Suppliers.memoize(() -> new AsyncTokensClient(clientOptions)); + this.oauthTokensClient = Suppliers.memoize(() -> new AsyncOauthTokensClient(clientOptions)); + } + + public AsyncAppCategoriesClient appCategories() { + return this.appCategoriesClient.get(); + } + + public AsyncAppsClient apps() { + return this.appsClient.get(); + } + + public AsyncAccountsClient accounts() { + return this.accountsClient.get(); + } + + public AsyncUsersClient users() { + return this.usersClient.get(); + } + + public AsyncComponentsClient components() { + return this.componentsClient.get(); + } + + public AsyncActionsClient actions() { + return this.actionsClient.get(); + } + + public AsyncTriggersClient triggers() { + return this.triggersClient.get(); + } + + public AsyncDeployedTriggersClient deployedTriggers() { + return this.deployedTriggersClient.get(); + } + + public AsyncProjectsClient projects() { + return this.projectsClient.get(); + } + + public AsyncProxyClient proxy() { + return this.proxyClient.get(); + } + + public AsyncTokensClient tokens() { + return this.tokensClient.get(); + } + + public AsyncOauthTokensClient oauthTokens() { + return this.oauthTokensClient.get(); + } + + public static AsyncPipedreamApiClientBuilder builder() { + return new AsyncPipedreamApiClientBuilder(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamApiClientBuilder.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamApiClientBuilder.java new file mode 100644 index 0000000..0ebee7b --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamApiClientBuilder.java @@ -0,0 +1,99 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.Environment; +import com.pipedream.api.core.OAuthTokenSupplier; +import com.pipedream.api.resources.oauthtokens.OauthTokensClient; +import okhttp3.OkHttpClient; + +public final class AsyncPipedreamApiClientBuilder { + private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); + + private String clientId = System.getenv("PIPEDREAM_CLIENT_ID"); + + private String clientSecret = System.getenv("PIPEDREAM_CLIENT_SECRET"); + + private String projectEnvironment = null; + + private Environment environment = Environment.PROD; + + /** + * Sets clientId. + * Defaults to the PIPEDREAM_CLIENT_ID environment variable. + */ + public AsyncPipedreamApiClientBuilder clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Sets clientSecret. + * Defaults to the PIPEDREAM_CLIENT_SECRET environment variable. + */ + public AsyncPipedreamApiClientBuilder clientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Sets projectEnvironment + */ + public AsyncPipedreamApiClientBuilder projectEnvironment(String projectEnvironment) { + this.projectEnvironment = projectEnvironment; + return this; + } + + public AsyncPipedreamApiClientBuilder environment(Environment environment) { + this.environment = environment; + return this; + } + + public AsyncPipedreamApiClientBuilder url(String url) { + this.environment = Environment.custom(url); + return this; + } + + /** + * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. + */ + public AsyncPipedreamApiClientBuilder timeout(int timeout) { + this.clientOptionsBuilder.timeout(timeout); + return this; + } + + /** + * Sets the maximum number of retries for the client. Defaults to 2 retries. + */ + public AsyncPipedreamApiClientBuilder maxRetries(int maxRetries) { + this.clientOptionsBuilder.maxRetries(maxRetries); + return this; + } + + /** + * Sets the underlying OkHttp client + */ + public AsyncPipedreamApiClientBuilder httpClient(OkHttpClient httpClient) { + this.clientOptionsBuilder.httpClient(httpClient); + return this; + } + + public AsyncPipedreamApiClientBuilder projectId(String projectId) { + clientOptionsBuilder.projectId(projectId); + return this; + } + + public AsyncPipedreamApiClient build() { + OauthTokensClient authClient = new OauthTokensClient( + ClientOptions.builder().environment(this.environment).build()); + OAuthTokenSupplier oAuthTokenSupplier = new OAuthTokenSupplier(clientId, clientSecret, authClient); + this.clientOptionsBuilder.addHeader("Authorization", oAuthTokenSupplier); + if (projectEnvironment != null) { + this.clientOptionsBuilder.addHeader("x-pd-environment", this.projectEnvironment); + } + clientOptionsBuilder.environment(this.environment); + return new AsyncPipedreamApiClient(clientOptionsBuilder.build()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamApiClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamApiClient.java new file mode 100644 index 0000000..fbe892b --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamApiClient.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.Suppliers; +import com.pipedream.api.resources.accounts.AccountsClient; +import com.pipedream.api.resources.actions.ActionsClient; +import com.pipedream.api.resources.appcategories.AppCategoriesClient; +import com.pipedream.api.resources.apps.AppsClient; +import com.pipedream.api.resources.components.ComponentsClient; +import com.pipedream.api.resources.deployedtriggers.DeployedTriggersClient; +import com.pipedream.api.resources.oauthtokens.OauthTokensClient; +import com.pipedream.api.resources.projects.ProjectsClient; +import com.pipedream.api.resources.proxy.ProxyClient; +import com.pipedream.api.resources.tokens.TokensClient; +import com.pipedream.api.resources.triggers.TriggersClient; +import com.pipedream.api.resources.users.UsersClient; +import java.util.function.Supplier; + +public class PipedreamApiClient { + protected final ClientOptions clientOptions; + + protected final Supplier appCategoriesClient; + + protected final Supplier appsClient; + + protected final Supplier accountsClient; + + protected final Supplier usersClient; + + protected final Supplier componentsClient; + + protected final Supplier actionsClient; + + protected final Supplier triggersClient; + + protected final Supplier deployedTriggersClient; + + protected final Supplier projectsClient; + + protected final Supplier proxyClient; + + protected final Supplier tokensClient; + + protected final Supplier oauthTokensClient; + + public PipedreamApiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.appCategoriesClient = Suppliers.memoize(() -> new AppCategoriesClient(clientOptions)); + this.appsClient = Suppliers.memoize(() -> new AppsClient(clientOptions)); + this.accountsClient = Suppliers.memoize(() -> new AccountsClient(clientOptions)); + this.usersClient = Suppliers.memoize(() -> new UsersClient(clientOptions)); + this.componentsClient = Suppliers.memoize(() -> new ComponentsClient(clientOptions)); + this.actionsClient = Suppliers.memoize(() -> new ActionsClient(clientOptions)); + this.triggersClient = Suppliers.memoize(() -> new TriggersClient(clientOptions)); + this.deployedTriggersClient = Suppliers.memoize(() -> new DeployedTriggersClient(clientOptions)); + this.projectsClient = Suppliers.memoize(() -> new ProjectsClient(clientOptions)); + this.proxyClient = Suppliers.memoize(() -> new ProxyClient(clientOptions)); + this.tokensClient = Suppliers.memoize(() -> new TokensClient(clientOptions)); + this.oauthTokensClient = Suppliers.memoize(() -> new OauthTokensClient(clientOptions)); + } + + public AppCategoriesClient appCategories() { + return this.appCategoriesClient.get(); + } + + public AppsClient apps() { + return this.appsClient.get(); + } + + public AccountsClient accounts() { + return this.accountsClient.get(); + } + + public UsersClient users() { + return this.usersClient.get(); + } + + public ComponentsClient components() { + return this.componentsClient.get(); + } + + public ActionsClient actions() { + return this.actionsClient.get(); + } + + public TriggersClient triggers() { + return this.triggersClient.get(); + } + + public DeployedTriggersClient deployedTriggers() { + return this.deployedTriggersClient.get(); + } + + public ProjectsClient projects() { + return this.projectsClient.get(); + } + + public ProxyClient proxy() { + return this.proxyClient.get(); + } + + public TokensClient tokens() { + return this.tokensClient.get(); + } + + public OauthTokensClient oauthTokens() { + return this.oauthTokensClient.get(); + } + + public static PipedreamApiClientBuilder builder() { + return new PipedreamApiClientBuilder(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamApiClientBuilder.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamApiClientBuilder.java new file mode 100644 index 0000000..9983f98 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamApiClientBuilder.java @@ -0,0 +1,99 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.Environment; +import com.pipedream.api.core.OAuthTokenSupplier; +import com.pipedream.api.resources.oauthtokens.OauthTokensClient; +import okhttp3.OkHttpClient; + +public final class PipedreamApiClientBuilder { + private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); + + private String clientId = System.getenv("PIPEDREAM_CLIENT_ID"); + + private String clientSecret = System.getenv("PIPEDREAM_CLIENT_SECRET"); + + private String projectEnvironment = null; + + private Environment environment = Environment.PROD; + + /** + * Sets clientId. + * Defaults to the PIPEDREAM_CLIENT_ID environment variable. + */ + public PipedreamApiClientBuilder clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Sets clientSecret. + * Defaults to the PIPEDREAM_CLIENT_SECRET environment variable. + */ + public PipedreamApiClientBuilder clientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Sets projectEnvironment + */ + public PipedreamApiClientBuilder projectEnvironment(String projectEnvironment) { + this.projectEnvironment = projectEnvironment; + return this; + } + + public PipedreamApiClientBuilder environment(Environment environment) { + this.environment = environment; + return this; + } + + public PipedreamApiClientBuilder url(String url) { + this.environment = Environment.custom(url); + return this; + } + + /** + * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. + */ + public PipedreamApiClientBuilder timeout(int timeout) { + this.clientOptionsBuilder.timeout(timeout); + return this; + } + + /** + * Sets the maximum number of retries for the client. Defaults to 2 retries. + */ + public PipedreamApiClientBuilder maxRetries(int maxRetries) { + this.clientOptionsBuilder.maxRetries(maxRetries); + return this; + } + + /** + * Sets the underlying OkHttp client + */ + public PipedreamApiClientBuilder httpClient(OkHttpClient httpClient) { + this.clientOptionsBuilder.httpClient(httpClient); + return this; + } + + public PipedreamApiClientBuilder projectId(String projectId) { + clientOptionsBuilder.projectId(projectId); + return this; + } + + public PipedreamApiClient build() { + OauthTokensClient authClient = new OauthTokensClient( + ClientOptions.builder().environment(this.environment).build()); + OAuthTokenSupplier oAuthTokenSupplier = new OAuthTokenSupplier(clientId, clientSecret, authClient); + this.clientOptionsBuilder.addHeader("Authorization", oAuthTokenSupplier); + if (projectEnvironment != null) { + this.clientOptionsBuilder.addHeader("x-pd-environment", this.projectEnvironment); + } + clientOptionsBuilder.environment(this.environment); + return new PipedreamApiClient(clientOptionsBuilder.build()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ClientOptions.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ClientOptions.java new file mode 100644 index 0000000..71e9632 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ClientOptions.java @@ -0,0 +1,186 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +import okhttp3.OkHttpClient; + +public final class ClientOptions { + private final Environment environment; + + private final Map headers; + + private final Map> headerSuppliers; + + private final OkHttpClient httpClient; + + private final int timeout; + + private String projectId; + + private ClientOptions( + Environment environment, + Map headers, + Map> headerSuppliers, + OkHttpClient httpClient, + int timeout, + String projectId) { + this.environment = environment; + this.headers = new HashMap<>(); + this.headers.putAll(headers); + this.headers.putAll(new HashMap() { + { + put("X-Fern-Language", "JAVA"); + put("X-Fern-SDK-Name", "com.pipedream.fern:api-sdk"); + put("X-Fern-SDK-Version", "0.0.190"); + } + }); + this.headerSuppliers = headerSuppliers; + this.httpClient = httpClient; + this.timeout = timeout; + this.projectId = projectId; + } + + public Environment environment() { + return this.environment; + } + + public Map headers(RequestOptions requestOptions) { + Map values = new HashMap<>(this.headers); + headerSuppliers.forEach((key, supplier) -> { + values.put(key, supplier.get()); + }); + if (requestOptions != null) { + values.putAll(requestOptions.getHeaders()); + } + return values; + } + + public int timeout(RequestOptions requestOptions) { + if (requestOptions == null) { + return this.timeout; + } + return requestOptions.getTimeout().orElse(this.timeout); + } + + public OkHttpClient httpClient() { + return this.httpClient; + } + + public OkHttpClient httpClientWithTimeout(RequestOptions requestOptions) { + if (requestOptions == null) { + return this.httpClient; + } + return this.httpClient + .newBuilder() + .callTimeout(requestOptions.getTimeout().get(), requestOptions.getTimeoutTimeUnit()) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS) + .build(); + } + + public String projectId() { + return this.projectId; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private Environment environment; + + private final Map headers = new HashMap<>(); + + private final Map> headerSuppliers = new HashMap<>(); + + private int maxRetries = 2; + + private Optional timeout = Optional.empty(); + + private OkHttpClient httpClient = null; + + private String projectId; + + public Builder environment(Environment environment) { + this.environment = environment; + return this; + } + + public Builder addHeader(String key, String value) { + this.headers.put(key, value); + return this; + } + + public Builder addHeader(String key, Supplier value) { + this.headerSuppliers.put(key, value); + return this; + } + + /** + * Override the timeout in seconds. Defaults to 60 seconds. + */ + public Builder timeout(int timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + /** + * Override the timeout in seconds. Defaults to 60 seconds. + */ + public Builder timeout(Optional timeout) { + this.timeout = timeout; + return this; + } + + /** + * Override the maximum number of retries. Defaults to 2 retries. + */ + public Builder maxRetries(int maxRetries) { + this.maxRetries = maxRetries; + return this; + } + + public Builder httpClient(OkHttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + + public ClientOptions build() { + OkHttpClient.Builder httpClientBuilder = + this.httpClient != null ? this.httpClient.newBuilder() : new OkHttpClient.Builder(); + + if (this.httpClient != null) { + timeout.ifPresent(timeout -> httpClientBuilder + .callTimeout(timeout, TimeUnit.SECONDS) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS)); + } else { + httpClientBuilder + .callTimeout(this.timeout.orElse(60), TimeUnit.SECONDS) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS) + .addInterceptor(new RetryInterceptor(this.maxRetries)); + } + + this.httpClient = httpClientBuilder.build(); + this.timeout = Optional.of(httpClient.callTimeoutMillis() / 1000); + + return new ClientOptions( + environment, headers, headerSuppliers, httpClient, this.timeout.get(), this.projectId); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/DateTimeDeserializer.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/DateTimeDeserializer.java new file mode 100644 index 0000000..e9083a3 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/DateTimeDeserializer.java @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.module.SimpleModule; +import java.io.IOException; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAccessor; +import java.time.temporal.TemporalQueries; + +/** + * Custom deserializer that handles converting ISO8601 dates into {@link OffsetDateTime} objects. + */ +class DateTimeDeserializer extends JsonDeserializer { + private static final SimpleModule MODULE; + + static { + MODULE = new SimpleModule().addDeserializer(OffsetDateTime.class, new DateTimeDeserializer()); + } + + /** + * Gets a module wrapping this deserializer as an adapter for the Jackson ObjectMapper. + * + * @return A {@link SimpleModule} to be plugged onto Jackson ObjectMapper. + */ + public static SimpleModule getModule() { + return MODULE; + } + + @Override + public OffsetDateTime deserialize(JsonParser parser, DeserializationContext context) throws IOException { + JsonToken token = parser.currentToken(); + if (token == JsonToken.VALUE_NUMBER_INT) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(parser.getValueAsLong()), ZoneOffset.UTC); + } else { + TemporalAccessor temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest( + parser.getValueAsString(), OffsetDateTime::from, LocalDateTime::from); + + if (temporal.query(TemporalQueries.offset()) == null) { + return LocalDateTime.from(temporal).atOffset(ZoneOffset.UTC); + } else { + return OffsetDateTime.from(temporal); + } + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Environment.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Environment.java new file mode 100644 index 0000000..def399b --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Environment.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +public final class Environment { + public static final Environment CANARY = new Environment("https://api2.pipedream.com"); + + public static final Environment DEV = new Environment("https://api.${DEV_NAMESPACE}.gkes.pipedream.net"); + + public static final Environment PROD = new Environment("https://api.pipedream.com"); + + private final String url; + + private Environment(String url) { + this.url = url; + } + + public String getUrl() { + return this.url; + } + + public static Environment custom(String url) { + return new Environment(url); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/FileStream.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/FileStream.java new file mode 100644 index 0000000..d5500e2 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/FileStream.java @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.InputStream; +import java.util.Objects; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import org.jetbrains.annotations.Nullable; + +/** + * Represents a file stream with associated metadata for file uploads. + */ +public class FileStream { + private final InputStream inputStream; + private final String fileName; + private final MediaType contentType; + + /** + * Constructs a FileStream with the given input stream and optional metadata. + * + * @param inputStream The input stream of the file content. Must not be null. + * @param fileName The name of the file, or null if unknown. + * @param contentType The MIME type of the file content, or null if unknown. + * @throws NullPointerException if inputStream is null + */ + public FileStream(InputStream inputStream, @Nullable String fileName, @Nullable MediaType contentType) { + this.inputStream = Objects.requireNonNull(inputStream, "Input stream cannot be null"); + this.fileName = fileName; + this.contentType = contentType; + } + + public FileStream(InputStream inputStream) { + this(inputStream, null, null); + } + + public InputStream getInputStream() { + return inputStream; + } + + @Nullable + public String getFileName() { + return fileName; + } + + @Nullable + public MediaType getContentType() { + return contentType; + } + + /** + * Creates a RequestBody suitable for use with OkHttp client. + * + * @return A RequestBody instance representing this file stream. + */ + public RequestBody toRequestBody() { + return new InputStreamRequestBody(contentType, inputStream); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/InputStreamRequestBody.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/InputStreamRequestBody.java new file mode 100644 index 0000000..a91bea5 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/InputStreamRequestBody.java @@ -0,0 +1,79 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Objects; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import okhttp3.internal.Util; +import okio.BufferedSink; +import okio.Okio; +import okio.Source; +import org.jetbrains.annotations.Nullable; + +/** + * A custom implementation of OkHttp's RequestBody that wraps an InputStream. + * This class allows streaming of data from an InputStream directly to an HTTP request body, + * which is useful for file uploads or sending large amounts of data without loading it all into memory. + */ +public class InputStreamRequestBody extends RequestBody { + private final InputStream inputStream; + private final MediaType contentType; + + /** + * Constructs an InputStreamRequestBody with the specified content type and input stream. + * + * @param contentType the MediaType of the content, or null if not known + * @param inputStream the InputStream containing the data to be sent + * @throws NullPointerException if inputStream is null + */ + public InputStreamRequestBody(@Nullable MediaType contentType, InputStream inputStream) { + this.contentType = contentType; + this.inputStream = Objects.requireNonNull(inputStream, "inputStream == null"); + } + + /** + * Returns the content type of this request body. + * + * @return the MediaType of the content, or null if not specified + */ + @Nullable + @Override + public MediaType contentType() { + return contentType; + } + + /** + * Returns the content length of this request body, if known. + * This method attempts to determine the length using the InputStream's available() method, + * which may not always accurately reflect the total length of the stream. + * + * @return the content length, or -1 if the length is unknown + * @throws IOException if an I/O error occurs + */ + @Override + public long contentLength() throws IOException { + return inputStream.available() == 0 ? -1 : inputStream.available(); + } + + /** + * Writes the content of the InputStream to the given BufferedSink. + * This method is responsible for transferring the data from the InputStream to the network request. + * + * @param sink the BufferedSink to write the content to + * @throws IOException if an I/O error occurs during writing + */ + @Override + public void writeTo(BufferedSink sink) throws IOException { + Source source = null; + try { + source = Okio.source(inputStream); + sink.writeAll(source); + } finally { + Util.closeQuietly(Objects.requireNonNull(source)); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/MediaTypes.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/MediaTypes.java new file mode 100644 index 0000000..6b6288f --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/MediaTypes.java @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import okhttp3.MediaType; + +public final class MediaTypes { + + public static final MediaType APPLICATION_JSON = MediaType.parse("application/json"); + + private MediaTypes() {} +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Nullable.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Nullable.java new file mode 100644 index 0000000..2b6af74 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Nullable.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.Optional; +import java.util.function.Function; + +public final class Nullable { + + private final Either, Null> value; + + private Nullable() { + this.value = Either.left(Optional.empty()); + } + + private Nullable(T value) { + if (value == null) { + this.value = Either.right(Null.INSTANCE); + } else { + this.value = Either.left(Optional.of(value)); + } + } + + public static Nullable ofNull() { + return new Nullable<>(null); + } + + public static Nullable of(T value) { + return new Nullable<>(value); + } + + public static Nullable empty() { + return new Nullable<>(); + } + + public static Nullable ofOptional(Optional value) { + if (value.isPresent()) { + return of(value.get()); + } else { + return empty(); + } + } + + public boolean isNull() { + return this.value.isRight(); + } + + public boolean isEmpty() { + return this.value.isLeft() && !this.value.getLeft().isPresent(); + } + + public T get() { + if (this.isNull()) { + return null; + } + + return this.value.getLeft().get(); + } + + public Nullable map(Function mapper) { + if (this.isNull()) { + return Nullable.ofNull(); + } + + return Nullable.ofOptional(this.value.getLeft().map(mapper)); + } + + @Override + public boolean equals(Object other) { + if (!(other instanceof Nullable)) { + return false; + } + + if (((Nullable) other).isNull() && this.isNull()) { + return true; + } + + return this.value.getLeft().equals(((Nullable) other).value.getLeft()); + } + + private static final class Either { + private L left = null; + private R right = null; + + private Either(L left, R right) { + if (left != null && right != null) { + throw new IllegalArgumentException("Left and right argument cannot both be non-null."); + } + + if (left == null && right == null) { + throw new IllegalArgumentException("Left and right argument cannot both be null."); + } + + if (left != null) { + this.left = left; + } + + if (right != null) { + this.right = right; + } + } + + public static Either left(L left) { + return new Either<>(left, null); + } + + public static Either right(R right) { + return new Either<>(null, right); + } + + public boolean isLeft() { + return this.left != null; + } + + public boolean isRight() { + return this.right != null; + } + + public L getLeft() { + if (!this.isLeft()) { + throw new IllegalArgumentException("Cannot get left from right Either."); + } + return this.left; + } + + public R getRight() { + if (!this.isRight()) { + throw new IllegalArgumentException("Cannot get right from left Either."); + } + return this.right; + } + } + + private static final class Null { + private static final Null INSTANCE = new Null(); + + private Null() {} + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/NullableNonemptyFilter.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/NullableNonemptyFilter.java new file mode 100644 index 0000000..afad6eb --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/NullableNonemptyFilter.java @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.Optional; + +public final class NullableNonemptyFilter { + @Override + public boolean equals(Object o) { + boolean isOptionalEmpty = isOptionalEmpty(o); + + return isOptionalEmpty; + } + + private boolean isOptionalEmpty(Object o) { + return o instanceof Optional && !((Optional) o).isPresent(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/OAuthTokenSupplier.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/OAuthTokenSupplier.java new file mode 100644 index 0000000..ddbde79 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/OAuthTokenSupplier.java @@ -0,0 +1,54 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import com.pipedream.api.resources.oauthtokens.OauthTokensClient; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.function.Supplier; + +public final class OAuthTokenSupplier implements Supplier { + private static final long BUFFER_IN_MINUTES = 2; + + private final String clientId; + + private final String clientSecret; + + private final OauthTokensClient authClient; + + private String accessToken; + + private Instant expiresAt; + + public OAuthTokenSupplier(String clientId, String clientSecret, OauthTokensClient authClient) { + this.clientId = clientId; + this.clientSecret = clientSecret; + this.authClient = authClient; + this.expiresAt = Instant.now(); + } + + public CreateOAuthTokenResponse fetchToken() { + CreateOAuthTokenOpts getTokenRequest = CreateOAuthTokenOpts.builder() + .clientId(clientId) + .clientSecret(clientSecret) + .build(); + return authClient.create(getTokenRequest); + } + + @java.lang.Override + public String get() { + if (accessToken == null || expiresAt.isBefore(Instant.now())) { + CreateOAuthTokenResponse authResponse = fetchToken(); + this.accessToken = authResponse.getAccessToken(); + this.expiresAt = getExpiresAt(authResponse.getExpiresIn()); + } + return "Bearer " + accessToken; + } + + private Instant getExpiresAt(long expiresInSeconds) { + return Instant.now().plus(expiresInSeconds, ChronoUnit.SECONDS).minus(BUFFER_IN_MINUTES, ChronoUnit.MINUTES); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ObjectMappers.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ObjectMappers.java new file mode 100644 index 0000000..6dd6c3c --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ObjectMappers.java @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import java.io.IOException; + +public final class ObjectMappers { + public static final ObjectMapper JSON_MAPPER = JsonMapper.builder() + .addModule(new Jdk8Module()) + .addModule(new JavaTimeModule()) + .addModule(DateTimeDeserializer.getModule()) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .build(); + + private ObjectMappers() {} + + public static String stringify(Object o) { + try { + return JSON_MAPPER + .setSerializationInclusion(JsonInclude.Include.ALWAYS) + .writerWithDefaultPrettyPrinter() + .writeValueAsString(o); + } catch (IOException e) { + return o.getClass().getName() + "@" + Integer.toHexString(o.hashCode()); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiApiException.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiApiException.java new file mode 100644 index 0000000..d4d2e56 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiApiException.java @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.Response; + +/** + * This exception type will be thrown for any non-2XX API responses. + */ +public class PipedreamApiApiException extends PipedreamApiException { + /** + * The error code of the response that triggered the exception. + */ + private final int statusCode; + + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + private final Map> headers; + + public PipedreamApiApiException(String message, int statusCode, Object body) { + super(message); + this.statusCode = statusCode; + this.body = body; + this.headers = new HashMap<>(); + } + + public PipedreamApiApiException(String message, int statusCode, Object body, Response rawResponse) { + super(message); + this.statusCode = statusCode; + this.body = body; + this.headers = new HashMap<>(); + rawResponse.headers().forEach(header -> { + String key = header.component1(); + String value = header.component2(); + this.headers.computeIfAbsent(key, _str -> new ArrayList<>()).add(value); + }); + } + + /** + * @return the statusCode + */ + public int statusCode() { + return this.statusCode; + } + + /** + * @return the body + */ + public Object body() { + return this.body; + } + + /** + * @return the headers + */ + public Map> headers() { + return this.headers; + } + + @java.lang.Override + public String toString() { + return "PipedreamApiApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " + + body + "}"; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiException.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiException.java new file mode 100644 index 0000000..866b47e --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiException.java @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +/** + * This class serves as the base exception for all errors in the SDK. + */ +public class PipedreamApiException extends RuntimeException { + public PipedreamApiException(String message) { + super(message); + } + + public PipedreamApiException(String message, Exception e) { + super(message, e); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiHttpResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiHttpResponse.java new file mode 100644 index 0000000..59f2804 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiHttpResponse.java @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.Response; + +public final class PipedreamApiHttpResponse { + + private final T body; + + private final Map> headers; + + public PipedreamApiHttpResponse(T body, Response rawResponse) { + this.body = body; + + Map> headers = new HashMap<>(); + rawResponse.headers().forEach(header -> { + String key = header.component1(); + String value = header.component2(); + headers.computeIfAbsent(key, _str -> new ArrayList<>()).add(value); + }); + this.headers = headers; + } + + public T body() { + return this.body; + } + + public Map> headers() { + return headers; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/QueryStringMapper.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/QueryStringMapper.java new file mode 100644 index 0000000..70723d0 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/QueryStringMapper.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import okhttp3.HttpUrl; +import okhttp3.MultipartBody; + +public class QueryStringMapper { + + private static final ObjectMapper MAPPER = ObjectMappers.JSON_MAPPER; + + public static void addQueryParameter(HttpUrl.Builder httpUrl, String key, Object value, boolean arraysAsRepeats) { + JsonNode valueNode = MAPPER.valueToTree(value); + + List> flat; + if (valueNode.isObject()) { + flat = flattenObject((ObjectNode) valueNode, arraysAsRepeats); + } else if (valueNode.isArray()) { + flat = flattenArray((ArrayNode) valueNode, "", arraysAsRepeats); + } else { + if (valueNode.isTextual()) { + httpUrl.addQueryParameter(key, valueNode.textValue()); + } else { + httpUrl.addQueryParameter(key, valueNode.toString()); + } + return; + } + + for (Map.Entry field : flat) { + if (field.getValue().isTextual()) { + httpUrl.addQueryParameter(key + field.getKey(), field.getValue().textValue()); + } else { + httpUrl.addQueryParameter(key + field.getKey(), field.getValue().toString()); + } + } + } + + public static void addFormDataPart( + MultipartBody.Builder multipartBody, String key, Object value, boolean arraysAsRepeats) { + JsonNode valueNode = MAPPER.valueToTree(value); + + List> flat; + if (valueNode.isObject()) { + flat = flattenObject((ObjectNode) valueNode, arraysAsRepeats); + } else if (valueNode.isArray()) { + flat = flattenArray((ArrayNode) valueNode, "", arraysAsRepeats); + } else { + if (valueNode.isTextual()) { + multipartBody.addFormDataPart(key, valueNode.textValue()); + } else { + multipartBody.addFormDataPart(key, valueNode.toString()); + } + return; + } + + for (Map.Entry field : flat) { + if (field.getValue().isTextual()) { + multipartBody.addFormDataPart( + key + field.getKey(), field.getValue().textValue()); + } else { + multipartBody.addFormDataPart( + key + field.getKey(), field.getValue().toString()); + } + } + } + + public static List> flattenObject(ObjectNode object, boolean arraysAsRepeats) { + List> flat = new ArrayList<>(); + + Iterator> fields = object.fields(); + while (fields.hasNext()) { + Map.Entry field = fields.next(); + + String key = "[" + field.getKey() + "]"; + + if (field.getValue().isObject()) { + List> flatField = + flattenObject((ObjectNode) field.getValue(), arraysAsRepeats); + addAll(flat, flatField, key); + } else if (field.getValue().isArray()) { + List> flatField = + flattenArray((ArrayNode) field.getValue(), key, arraysAsRepeats); + addAll(flat, flatField, ""); + } else { + flat.add(new AbstractMap.SimpleEntry<>(key, field.getValue())); + } + } + + return flat; + } + + private static List> flattenArray( + ArrayNode array, String key, boolean arraysAsRepeats) { + List> flat = new ArrayList<>(); + + Iterator elements = array.elements(); + + int index = 0; + while (elements.hasNext()) { + JsonNode element = elements.next(); + + String indexKey = key + "[" + index + "]"; + + if (arraysAsRepeats) { + indexKey = key; + } + + if (element.isObject()) { + List> flatField = flattenObject((ObjectNode) element, arraysAsRepeats); + addAll(flat, flatField, indexKey); + } else if (element.isArray()) { + List> flatField = flattenArray((ArrayNode) element, "", arraysAsRepeats); + addAll(flat, flatField, indexKey); + } else { + flat.add(new AbstractMap.SimpleEntry<>(indexKey, element)); + } + + index++; + } + + return flat; + } + + private static void addAll( + List> target, List> source, String prefix) { + for (Map.Entry entry : source) { + Map.Entry entryToAdd = + new AbstractMap.SimpleEntry<>(prefix + entry.getKey(), entry.getValue()); + target.add(entryToAdd); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/RequestOptions.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/RequestOptions.java new file mode 100644 index 0000000..559f48d --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/RequestOptions.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; + +public final class RequestOptions { + private final String projectEnvironment; + + private final Optional timeout; + + private final TimeUnit timeoutTimeUnit; + + private final Map headers; + + private final Map> headerSuppliers; + + private RequestOptions( + String projectEnvironment, + Optional timeout, + TimeUnit timeoutTimeUnit, + Map headers, + Map> headerSuppliers) { + this.projectEnvironment = projectEnvironment; + this.timeout = timeout; + this.timeoutTimeUnit = timeoutTimeUnit; + this.headers = headers; + this.headerSuppliers = headerSuppliers; + } + + public Optional getTimeout() { + return timeout; + } + + public TimeUnit getTimeoutTimeUnit() { + return timeoutTimeUnit; + } + + public Map getHeaders() { + Map headers = new HashMap<>(); + if (this.projectEnvironment != null) { + headers.put("x-pd-environment", this.projectEnvironment); + } + headers.putAll(this.headers); + this.headerSuppliers.forEach((key, supplier) -> { + headers.put(key, supplier.get()); + }); + return headers; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private String projectEnvironment = null; + + private Optional timeout = Optional.empty(); + + private TimeUnit timeoutTimeUnit = TimeUnit.SECONDS; + + private final Map headers = new HashMap<>(); + + private final Map> headerSuppliers = new HashMap<>(); + + public Builder projectEnvironment(String projectEnvironment) { + this.projectEnvironment = projectEnvironment; + return this; + } + + public Builder timeout(Integer timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + public Builder timeout(Integer timeout, TimeUnit timeoutTimeUnit) { + this.timeout = Optional.of(timeout); + this.timeoutTimeUnit = timeoutTimeUnit; + return this; + } + + public Builder addHeader(String key, String value) { + this.headers.put(key, value); + return this; + } + + public Builder addHeader(String key, Supplier value) { + this.headerSuppliers.put(key, value); + return this; + } + + public RequestOptions build() { + return new RequestOptions(projectEnvironment, timeout, timeoutTimeUnit, headers, headerSuppliers); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ResponseBodyInputStream.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ResponseBodyInputStream.java new file mode 100644 index 0000000..56b0fb5 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ResponseBodyInputStream.java @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.FilterInputStream; +import java.io.IOException; +import okhttp3.Response; + +/** + * A custom InputStream that wraps the InputStream from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the stream is closed. + * + * This class extends FilterInputStream and takes an OkHttp Response object as a parameter. + * It retrieves the InputStream from the Response and overrides the close method to close + * both the InputStream and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyInputStream extends FilterInputStream { + private final Response response; + + /** + * Constructs a ResponseBodyInputStream that wraps the InputStream from the given OkHttp + * Response object. + * + * @param response the OkHttp Response object from which the InputStream is retrieved + * @throws IOException if an I/O error occurs while retrieving the InputStream + */ + public ResponseBodyInputStream(Response response) throws IOException { + super(response.body().byteStream()); + this.response = response; + } + + /** + * Closes the InputStream and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the stream is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the stream is closed + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ResponseBodyReader.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ResponseBodyReader.java new file mode 100644 index 0000000..54dff9f --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ResponseBodyReader.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.FilterReader; +import java.io.IOException; +import okhttp3.Response; + +/** + * A custom Reader that wraps the Reader from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the reader is closed. + * + * This class extends FilterReader and takes an OkHttp Response object as a parameter. + * It retrieves the Reader from the Response and overrides the close method to close + * both the Reader and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyReader extends FilterReader { + private final Response response; + + /** + * Constructs a ResponseBodyReader that wraps the Reader from the given OkHttp Response object. + * + * @param response the OkHttp Response object from which the Reader is retrieved + * @throws IOException if an I/O error occurs while retrieving the Reader + */ + public ResponseBodyReader(Response response) throws IOException { + super(response.body().charStream()); + this.response = response; + } + + /** + * Closes the Reader and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the reader is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the reader is closed + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/RetryInterceptor.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/RetryInterceptor.java new file mode 100644 index 0000000..66b6be4 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/RetryInterceptor.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.IOException; +import java.time.Duration; +import java.util.Optional; +import java.util.Random; +import okhttp3.Interceptor; +import okhttp3.Response; + +public class RetryInterceptor implements Interceptor { + + private static final Duration ONE_SECOND = Duration.ofSeconds(1); + private final ExponentialBackoff backoff; + private final Random random = new Random(); + + public RetryInterceptor(int maxRetries) { + this.backoff = new ExponentialBackoff(maxRetries); + } + + @Override + public Response intercept(Chain chain) throws IOException { + Response response = chain.proceed(chain.request()); + + if (shouldRetry(response.code())) { + return retryChain(response, chain); + } + + return response; + } + + private Response retryChain(Response response, Chain chain) throws IOException { + Optional nextBackoff = this.backoff.nextBackoff(); + while (nextBackoff.isPresent()) { + try { + Thread.sleep(nextBackoff.get().toMillis()); + } catch (InterruptedException e) { + throw new IOException("Interrupted while trying request", e); + } + response.close(); + response = chain.proceed(chain.request()); + if (shouldRetry(response.code())) { + nextBackoff = this.backoff.nextBackoff(); + } else { + return response; + } + } + + return response; + } + + private static boolean shouldRetry(int statusCode) { + return statusCode == 408 || statusCode == 429 || statusCode >= 500; + } + + private final class ExponentialBackoff { + + private final int maxNumRetries; + + private int retryNumber = 0; + + ExponentialBackoff(int maxNumRetries) { + this.maxNumRetries = maxNumRetries; + } + + public Optional nextBackoff() { + retryNumber += 1; + if (retryNumber > maxNumRetries) { + return Optional.empty(); + } + + int upperBound = (int) Math.pow(2, retryNumber); + return Optional.of(ONE_SECOND.multipliedBy(random.nextInt(upperBound))); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Stream.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Stream.java new file mode 100644 index 0000000..3781dcc --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Stream.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.Closeable; +import java.io.IOException; +import java.io.Reader; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.Scanner; + +/** + * The {@code Stream} class implements {@link Iterable} to provide a simple mechanism for reading and parsing + * objects of a given type from data streamed via a {@link Reader} using a specified delimiter. + *

+ * {@code Stream} assumes that data is being pushed to the provided {@link Reader} asynchronously and utilizes a + * {@code Scanner} to block during iteration if the next object is not available. + * Iterable stream for parsing JSON and Server-Sent Events (SSE) data. + * Supports both newline-delimited JSON and SSE with optional stream termination. + * + * @param The type of objects in the stream. + */ +public final class Stream implements Iterable, Closeable { + + private static final String NEWLINE = "\n"; + private static final String DATA_PREFIX = "data:"; + + public enum StreamType { + JSON, + SSE + } + + private final Class valueType; + private final Scanner scanner; + private final StreamType streamType; + private final String messageTerminator; + private final String streamTerminator; + private final Reader sseReader; + private boolean isClosed = false; + + /** + * Constructs a new {@code Stream} with the specified value type, reader, and delimiter. + * + * @param valueType The class of the objects in the stream. + * @param reader The reader that provides the streamed data. + * @param delimiter The delimiter used to separate elements in the stream. + */ + public Stream(Class valueType, Reader reader, String delimiter) { + this.valueType = valueType; + this.scanner = new Scanner(reader).useDelimiter(delimiter); + this.streamType = StreamType.JSON; + this.messageTerminator = delimiter; + this.streamTerminator = null; + this.sseReader = null; + } + + private Stream(Class valueType, StreamType type, Reader reader, String terminator) { + this.valueType = valueType; + this.streamType = type; + if (type == StreamType.JSON) { + this.scanner = new Scanner(reader).useDelimiter(terminator); + this.messageTerminator = terminator; + this.streamTerminator = null; + this.sseReader = null; + } else { + this.scanner = null; + this.messageTerminator = NEWLINE; + this.streamTerminator = terminator; + this.sseReader = reader; + } + } + + public static Stream fromJson(Class valueType, Reader reader, String delimiter) { + return new Stream<>(valueType, reader, delimiter); + } + + public static Stream fromJson(Class valueType, Reader reader) { + return new Stream<>(valueType, reader, NEWLINE); + } + + public static Stream fromSse(Class valueType, Reader sseReader) { + return new Stream<>(valueType, StreamType.SSE, sseReader, null); + } + + public static Stream fromSse(Class valueType, Reader sseReader, String streamTerminator) { + return new Stream<>(valueType, StreamType.SSE, sseReader, streamTerminator); + } + + @Override + public void close() throws IOException { + if (!isClosed) { + isClosed = true; + if (scanner != null) { + scanner.close(); + } + if (sseReader != null) { + sseReader.close(); + } + } + } + + private boolean isStreamClosed() { + return isClosed; + } + + /** + * Returns an iterator over the elements in this stream that blocks during iteration when the next object is + * not yet available. + * + * @return An iterator that can be used to traverse the elements in the stream. + */ + @Override + public Iterator iterator() { + if (streamType == StreamType.SSE) { + return new SSEIterator(); + } else { + return new JsonIterator(); + } + } + + private final class JsonIterator implements Iterator { + + /** + * Returns {@code true} if there are more elements in the stream. + *

+ * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return {@code true} if there are more elements, {@code false} otherwise. + */ + @Override + public boolean hasNext() { + if (isStreamClosed()) { + return false; + } + return scanner.hasNext(); + } + + /** + * Returns the next element in the stream. + *

+ * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return The next element in the stream. + * @throws NoSuchElementException If there are no more elements in the stream. + */ + @Override + public T next() { + if (isStreamClosed()) { + throw new NoSuchElementException("Stream is closed"); + } + + if (!scanner.hasNext()) { + throw new NoSuchElementException(); + } else { + try { + T parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(scanner.next().trim(), valueType); + return parsedResponse; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + } + + private final class SSEIterator implements Iterator { + private Scanner sseScanner; + private T nextItem; + private boolean hasNextItem = false; + private boolean endOfStream = false; + private StringBuilder buffer = new StringBuilder(); + private boolean prefixSeen = false; + + private SSEIterator() { + if (sseReader != null && !isStreamClosed()) { + this.sseScanner = new Scanner(sseReader); + } else { + this.endOfStream = true; + } + } + + @Override + public boolean hasNext() { + if (isStreamClosed() || endOfStream) { + return false; + } + + if (hasNextItem) { + return true; + } + + return readNextMessage(); + } + + @Override + public T next() { + if (!hasNext()) { + throw new NoSuchElementException("No more elements in stream"); + } + + T result = nextItem; + nextItem = null; + hasNextItem = false; + return result; + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + + private boolean readNextMessage() { + if (sseScanner == null || isStreamClosed()) { + endOfStream = true; + return false; + } + + try { + while (sseScanner.hasNextLine()) { + String chunk = sseScanner.nextLine(); + buffer.append(chunk).append(NEWLINE); + + int terminatorIndex; + while ((terminatorIndex = buffer.indexOf(messageTerminator)) >= 0) { + String line = buffer.substring(0, terminatorIndex + messageTerminator.length()); + buffer.delete(0, terminatorIndex + messageTerminator.length()); + + line = line.trim(); + if (line.isEmpty()) { + continue; + } + + if (!prefixSeen && line.startsWith(DATA_PREFIX)) { + prefixSeen = true; + line = line.substring(DATA_PREFIX.length()).trim(); + } else if (!prefixSeen) { + continue; + } + + if (streamTerminator != null && line.contains(streamTerminator)) { + endOfStream = true; + return false; + } + + try { + nextItem = ObjectMappers.JSON_MAPPER.readValue(line, valueType); + hasNextItem = true; + prefixSeen = false; + return true; + } catch (Exception parseEx) { + continue; + } + } + } + + endOfStream = true; + return false; + + } catch (Exception e) { + System.err.println("Failed to parse SSE stream: " + e.getMessage()); + endOfStream = true; + return false; + } + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Suppliers.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Suppliers.java new file mode 100644 index 0000000..b907552 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Suppliers.java @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +public final class Suppliers { + private Suppliers() {} + + public static Supplier memoize(Supplier delegate) { + AtomicReference value = new AtomicReference<>(); + return () -> { + T val = value.get(); + if (val == null) { + val = value.updateAndGet(cur -> cur == null ? Objects.requireNonNull(delegate.get()) : cur); + } + return val; + }; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/BasePage.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/BasePage.java new file mode 100644 index 0000000..ca83fe4 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/BasePage.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core.pagination; + +import java.util.List; + +public abstract class BasePage { + private final boolean hasNext; + private final List items; + + public BasePage(boolean hasNext, List items) { + this.hasNext = hasNext; + this.items = items; + } + + public boolean hasNext() { + return !items.isEmpty() && hasNext; + } + + public List getItems() { + return items; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/SyncPage.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/SyncPage.java new file mode 100644 index 0000000..86fc5b7 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/SyncPage.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core.pagination; + +import java.util.List; +import java.util.NoSuchElementException; +import java.util.function.Supplier; + +public class SyncPage extends BasePage { + protected final Supplier> nextSupplier; + + public SyncPage(boolean hasNext, List items, Supplier> nextSupplier) { + super(hasNext, items); + this.nextSupplier = nextSupplier; + } + + public SyncPage nextPage() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + return nextSupplier.get(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/SyncPagingIterable.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/SyncPagingIterable.java new file mode 100644 index 0000000..fd5fca3 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/SyncPagingIterable.java @@ -0,0 +1,61 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core.pagination; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.Optional; +import java.util.function.Supplier; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + +public class SyncPagingIterable extends SyncPage implements Iterable { + + public SyncPagingIterable(boolean hasNext, List items, Supplier> getNext) { + super(hasNext, items, getNext); + } + + public SyncPagingIterable(boolean hasNext, Optional> items, Supplier> getNext) { + super(hasNext, items.orElse(new ArrayList<>()), getNext); + } + + public Stream streamItems() { + return StreamSupport.stream(this.spliterator(), false); + } + + @Override + public Iterator iterator() { + return new Iterator() { + private Iterator itemsIterator = getItems().iterator(); + private SyncPage currentPage = SyncPagingIterable.this; + + @Override + public boolean hasNext() { + if (itemsIterator.hasNext()) { + return true; + } + if (currentPage.hasNext()) { + advancePage(); + return itemsIterator.hasNext(); + } + return false; + } + + @Override + public T next() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + return itemsIterator.next(); + } + + private void advancePage() { + currentPage = currentPage.nextPage(); + itemsIterator = currentPage.getItems().iterator(); + } + }; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AccountsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AccountsClient.java new file mode 100644 index 0000000..81f9441 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AccountsClient.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.accounts.requests.AccountsListRequest; +import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest; +import com.pipedream.api.resources.accounts.requests.CreateAccountRequest; +import com.pipedream.api.types.Account; + +public class AccountsClient { + protected final ClientOptions clientOptions; + + private final RawAccountsClient rawClient; + + public AccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAccountsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAccountsClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(AccountsListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(AccountsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public Account create(CreateAccountRequest request) { + return this.rawClient.create(request).body(); + } + + public Account create(CreateAccountRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + public Account retrieve(String accountId) { + return this.rawClient.retrieve(accountId).body(); + } + + public Account retrieve(String accountId, AccountsRetrieveRequest request) { + return this.rawClient.retrieve(accountId, request).body(); + } + + public Account retrieve(String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(accountId, request, requestOptions).body(); + } + + public void delete(String accountId) { + this.rawClient.delete(accountId).body(); + } + + public void delete(String accountId, RequestOptions requestOptions) { + this.rawClient.delete(accountId, requestOptions).body(); + } + + public void deleteByApp(String appId) { + this.rawClient.deleteByApp(appId).body(); + } + + public void deleteByApp(String appId, RequestOptions requestOptions) { + this.rawClient.deleteByApp(appId, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AsyncAccountsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AsyncAccountsClient.java new file mode 100644 index 0000000..761a206 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AsyncAccountsClient.java @@ -0,0 +1,81 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.accounts.requests.AccountsListRequest; +import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest; +import com.pipedream.api.resources.accounts.requests.CreateAccountRequest; +import com.pipedream.api.types.Account; +import java.util.concurrent.CompletableFuture; + +public class AsyncAccountsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAccountsClient rawClient; + + public AsyncAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAccountsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAccountsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(AccountsListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + AccountsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture create(CreateAccountRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + public CompletableFuture create(CreateAccountRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String accountId) { + return this.rawClient.retrieve(accountId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String accountId, AccountsRetrieveRequest request) { + return this.rawClient.retrieve(accountId, request).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve( + String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(accountId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture delete(String accountId) { + return this.rawClient.delete(accountId).thenApply(response -> response.body()); + } + + public CompletableFuture delete(String accountId, RequestOptions requestOptions) { + return this.rawClient.delete(accountId, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture deleteByApp(String appId) { + return this.rawClient.deleteByApp(appId).thenApply(response -> response.body()); + } + + public CompletableFuture deleteByApp(String appId, RequestOptions requestOptions) { + return this.rawClient.deleteByApp(appId, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java new file mode 100644 index 0000000..1c4a9bb --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java @@ -0,0 +1,391 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.accounts.requests.AccountsListRequest; +import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest; +import com.pipedream.api.resources.accounts.requests.CreateAccountRequest; +import com.pipedream.api.types.Account; +import com.pipedream.api.types.ListAccountsResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAccountsClient { + protected final ClientOptions clientOptions; + + public AsyncRawAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(AccountsListRequest.builder().build()); + } + + public CompletableFuture>> list(AccountsListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + AccountsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts"); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getExternalUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "external_user_id", request.getExternalUserId().get(), false); + } + if (request.getOauthAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "oauth_app_id", request.getOauthAppId().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getIncludeCredentials().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_credentials", + request.getIncludeCredentials().get(), + false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + ListAccountsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAccountsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + AccountsListRequest nextRequest = AccountsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> create(CreateAccountRequest request) { + return create(request, null); + } + + public CompletableFuture> create( + CreateAccountRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts"); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getExternalUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "external_user_id", request.getExternalUserId().get(), false); + } + if (request.getOauthAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "oauth_app_id", request.getOauthAppId().get(), false); + } + Map properties = new HashMap<>(); + properties.put("app_slug", request.getAppSlug()); + properties.put("cfmap_json", request.getCfmapJson()); + properties.put("connect_token", request.getConnectToken()); + if (request.getName().isPresent()) { + properties.put("name", request.getName()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String accountId) { + return retrieve(accountId, AccountsRetrieveRequest.builder().build()); + } + + public CompletableFuture> retrieve( + String accountId, AccountsRetrieveRequest request) { + return retrieve(accountId, request, null); + } + + public CompletableFuture> retrieve( + String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts") + .addPathSegment(accountId); + if (request.getIncludeCredentials().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_credentials", + request.getIncludeCredentials().get(), + false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> delete(String accountId) { + return delete(accountId, null); + } + + public CompletableFuture> delete(String accountId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts") + .addPathSegment(accountId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> deleteByApp(String appId) { + return deleteByApp(appId, null); + } + + public CompletableFuture> deleteByApp(String appId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("apps") + .addPathSegment(appId) + .addPathSegments("accounts") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java new file mode 100644 index 0000000..114533c --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java @@ -0,0 +1,312 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.accounts.requests.AccountsListRequest; +import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest; +import com.pipedream.api.resources.accounts.requests.CreateAccountRequest; +import com.pipedream.api.types.Account; +import com.pipedream.api.types.ListAccountsResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAccountsClient { + protected final ClientOptions clientOptions; + + public RawAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(AccountsListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(AccountsListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + AccountsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts"); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getExternalUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "external_user_id", request.getExternalUserId().get(), false); + } + if (request.getOauthAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "oauth_app_id", request.getOauthAppId().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getIncludeCredentials().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_credentials", + request.getIncludeCredentials().get(), + false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + ListAccountsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAccountsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + AccountsListRequest nextRequest = AccountsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse create(CreateAccountRequest request) { + return create(request, null); + } + + public PipedreamApiHttpResponse create(CreateAccountRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts"); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getExternalUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "external_user_id", request.getExternalUserId().get(), false); + } + if (request.getOauthAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "oauth_app_id", request.getOauthAppId().get(), false); + } + Map properties = new HashMap<>(); + properties.put("app_slug", request.getAppSlug()); + properties.put("cfmap_json", request.getCfmapJson()); + properties.put("connect_token", request.getConnectToken()); + if (request.getName().isPresent()) { + properties.put("name", request.getName()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String accountId) { + return retrieve(accountId, AccountsRetrieveRequest.builder().build()); + } + + public PipedreamApiHttpResponse retrieve(String accountId, AccountsRetrieveRequest request) { + return retrieve(accountId, request, null); + } + + public PipedreamApiHttpResponse retrieve( + String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts") + .addPathSegment(accountId); + if (request.getIncludeCredentials().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_credentials", + request.getIncludeCredentials().get(), + false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse delete(String accountId) { + return delete(accountId, null); + } + + public PipedreamApiHttpResponse delete(String accountId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts") + .addPathSegment(accountId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse deleteByApp(String appId) { + return deleteByApp(appId, null); + } + + public PipedreamApiHttpResponse deleteByApp(String appId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("apps") + .addPathSegment(appId) + .addPathSegments("accounts") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsListRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsListRequest.java new file mode 100644 index 0000000..2d67f6d --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsListRequest.java @@ -0,0 +1,285 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountsListRequest.Builder.class) +public final class AccountsListRequest { + private final Optional appId; + + private final Optional externalUserId; + + private final Optional oauthAppId; + + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional includeCredentials; + + private final Map additionalProperties; + + private AccountsListRequest( + Optional appId, + Optional externalUserId, + Optional oauthAppId, + Optional after, + Optional before, + Optional limit, + Optional includeCredentials, + Map additionalProperties) { + this.appId = appId; + this.externalUserId = externalUserId; + this.oauthAppId = oauthAppId; + this.after = after; + this.before = before; + this.limit = limit; + this.includeCredentials = includeCredentials; + this.additionalProperties = additionalProperties; + } + + /** + * @return The app slug or ID to filter accounts by. + */ + @JsonProperty("app_id") + public Optional getAppId() { + return appId; + } + + @JsonProperty("external_user_id") + public Optional getExternalUserId() { + return externalUserId; + } + + /** + * @return The OAuth app ID to filter by, if applicable + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Whether to retrieve the account's credentials or not + */ + @JsonProperty("include_credentials") + public Optional getIncludeCredentials() { + return includeCredentials; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountsListRequest && equalTo((AccountsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountsListRequest other) { + return appId.equals(other.appId) + && externalUserId.equals(other.externalUserId) + && oauthAppId.equals(other.oauthAppId) + && after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && includeCredentials.equals(other.includeCredentials); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.appId, + this.externalUserId, + this.oauthAppId, + this.after, + this.before, + this.limit, + this.includeCredentials); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional appId = Optional.empty(); + + private Optional externalUserId = Optional.empty(); + + private Optional oauthAppId = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional includeCredentials = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AccountsListRequest other) { + appId(other.getAppId()); + externalUserId(other.getExternalUserId()); + oauthAppId(other.getOauthAppId()); + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + includeCredentials(other.getIncludeCredentials()); + return this; + } + + /** + *

The app slug or ID to filter accounts by.

+ */ + @JsonSetter(value = "app_id", nulls = Nulls.SKIP) + public Builder appId(Optional appId) { + this.appId = appId; + return this; + } + + public Builder appId(String appId) { + this.appId = Optional.ofNullable(appId); + return this; + } + + @JsonSetter(value = "external_user_id", nulls = Nulls.SKIP) + public Builder externalUserId(Optional externalUserId) { + this.externalUserId = externalUserId; + return this; + } + + public Builder externalUserId(String externalUserId) { + this.externalUserId = Optional.ofNullable(externalUserId); + return this; + } + + /** + *

The OAuth app ID to filter by, if applicable

+ */ + @JsonSetter(value = "oauth_app_id", nulls = Nulls.SKIP) + public Builder oauthAppId(Optional oauthAppId) { + this.oauthAppId = oauthAppId; + return this; + } + + public Builder oauthAppId(String oauthAppId) { + this.oauthAppId = Optional.ofNullable(oauthAppId); + return this; + } + + /** + *

The cursor to start from for pagination

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The cursor to end before for pagination

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The maximum number of results to return

+ */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

Whether to retrieve the account's credentials or not

+ */ + @JsonSetter(value = "include_credentials", nulls = Nulls.SKIP) + public Builder includeCredentials(Optional includeCredentials) { + this.includeCredentials = includeCredentials; + return this; + } + + public Builder includeCredentials(Boolean includeCredentials) { + this.includeCredentials = Optional.ofNullable(includeCredentials); + return this; + } + + public AccountsListRequest build() { + return new AccountsListRequest( + appId, externalUserId, oauthAppId, after, before, limit, includeCredentials, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsRetrieveRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsRetrieveRequest.java new file mode 100644 index 0000000..3844f9d --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsRetrieveRequest.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountsRetrieveRequest.Builder.class) +public final class AccountsRetrieveRequest { + private final Optional includeCredentials; + + private final Map additionalProperties; + + private AccountsRetrieveRequest(Optional includeCredentials, Map additionalProperties) { + this.includeCredentials = includeCredentials; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether to retrieve the account's credentials or not + */ + @JsonProperty("include_credentials") + public Optional getIncludeCredentials() { + return includeCredentials; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountsRetrieveRequest && equalTo((AccountsRetrieveRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountsRetrieveRequest other) { + return includeCredentials.equals(other.includeCredentials); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.includeCredentials); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional includeCredentials = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AccountsRetrieveRequest other) { + includeCredentials(other.getIncludeCredentials()); + return this; + } + + /** + *

Whether to retrieve the account's credentials or not

+ */ + @JsonSetter(value = "include_credentials", nulls = Nulls.SKIP) + public Builder includeCredentials(Optional includeCredentials) { + this.includeCredentials = includeCredentials; + return this; + } + + public Builder includeCredentials(Boolean includeCredentials) { + this.includeCredentials = Optional.ofNullable(includeCredentials); + return this; + } + + public AccountsRetrieveRequest build() { + return new AccountsRetrieveRequest(includeCredentials, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountRequest.java new file mode 100644 index 0000000..aeec52a --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountRequest.java @@ -0,0 +1,354 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts.requests; + +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 = CreateAccountRequest.Builder.class) +public final class CreateAccountRequest { + private final Optional appId; + + private final Optional externalUserId; + + private final Optional oauthAppId; + + private final String appSlug; + + private final String cfmapJson; + + private final String connectToken; + + private final Optional name; + + private final Map additionalProperties; + + private CreateAccountRequest( + Optional appId, + Optional externalUserId, + Optional oauthAppId, + String appSlug, + String cfmapJson, + String connectToken, + Optional name, + Map additionalProperties) { + this.appId = appId; + this.externalUserId = externalUserId; + this.oauthAppId = oauthAppId; + this.appSlug = appSlug; + this.cfmapJson = cfmapJson; + this.connectToken = connectToken; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The app slug or ID to filter accounts by. + */ + @JsonProperty("app_id") + public Optional getAppId() { + return appId; + } + + @JsonProperty("external_user_id") + public Optional getExternalUserId() { + return externalUserId; + } + + /** + * @return The OAuth app ID to filter by, if applicable + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + + /** + * @return The app slug for the account + */ + @JsonProperty("app_slug") + public String getAppSlug() { + return appSlug; + } + + /** + * @return JSON string containing the custom fields mapping + */ + @JsonProperty("cfmap_json") + public String getCfmapJson() { + return cfmapJson; + } + + /** + * @return The connect token for authentication + */ + @JsonProperty("connect_token") + public String getConnectToken() { + return connectToken; + } + + /** + * @return Optional name for the account + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAccountRequest && equalTo((CreateAccountRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAccountRequest other) { + return appId.equals(other.appId) + && externalUserId.equals(other.externalUserId) + && oauthAppId.equals(other.oauthAppId) + && appSlug.equals(other.appSlug) + && cfmapJson.equals(other.cfmapJson) + && connectToken.equals(other.connectToken) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.appId, + this.externalUserId, + this.oauthAppId, + this.appSlug, + this.cfmapJson, + this.connectToken, + this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AppSlugStage builder() { + return new Builder(); + } + + public interface AppSlugStage { + /** + *

The app slug for the account

+ */ + CfmapJsonStage appSlug(@NotNull String appSlug); + + Builder from(CreateAccountRequest other); + } + + public interface CfmapJsonStage { + /** + *

JSON string containing the custom fields mapping

+ */ + ConnectTokenStage cfmapJson(@NotNull String cfmapJson); + } + + public interface ConnectTokenStage { + /** + *

The connect token for authentication

+ */ + _FinalStage connectToken(@NotNull String connectToken); + } + + public interface _FinalStage { + CreateAccountRequest build(); + + /** + *

The app slug or ID to filter accounts by.

+ */ + _FinalStage appId(Optional appId); + + _FinalStage appId(String appId); + + _FinalStage externalUserId(Optional externalUserId); + + _FinalStage externalUserId(String externalUserId); + + /** + *

The OAuth app ID to filter by, if applicable

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

Optional name for the account

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AppSlugStage, CfmapJsonStage, ConnectTokenStage, _FinalStage { + private String appSlug; + + private String cfmapJson; + + private String connectToken; + + private Optional name = Optional.empty(); + + private Optional oauthAppId = Optional.empty(); + + private Optional externalUserId = Optional.empty(); + + private Optional appId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateAccountRequest other) { + appId(other.getAppId()); + externalUserId(other.getExternalUserId()); + oauthAppId(other.getOauthAppId()); + appSlug(other.getAppSlug()); + cfmapJson(other.getCfmapJson()); + connectToken(other.getConnectToken()); + name(other.getName()); + return this; + } + + /** + *

The app slug for the account

+ *

The app slug for the account

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

JSON string containing the custom fields mapping

+ *

JSON string containing the custom fields mapping

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

The connect token for authentication

+ *

The connect token for authentication

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

Optional name for the account

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

Optional name for the account

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

The OAuth app ID to filter by, if applicable

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

The OAuth app ID to filter by, if applicable

+ */ + @java.lang.Override + @JsonSetter(value = "oauth_app_id", nulls = Nulls.SKIP) + public _FinalStage oauthAppId(Optional oauthAppId) { + this.oauthAppId = oauthAppId; + return this; + } + + @java.lang.Override + public _FinalStage externalUserId(String externalUserId) { + this.externalUserId = Optional.ofNullable(externalUserId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "external_user_id", nulls = Nulls.SKIP) + public _FinalStage externalUserId(Optional externalUserId) { + this.externalUserId = externalUserId; + return this; + } + + /** + *

The app slug or ID to filter accounts by.

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

The app slug or ID to filter accounts by.

+ */ + @java.lang.Override + @JsonSetter(value = "app_id", nulls = Nulls.SKIP) + public _FinalStage appId(Optional appId) { + this.appId = appId; + return this; + } + + @java.lang.Override + public CreateAccountRequest build() { + return new CreateAccountRequest( + appId, externalUserId, oauthAppId, appSlug, cfmapJson, connectToken, name, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java new file mode 100644 index 0000000..52efedb --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.actions.requests.ActionsConfigurePropRequest; +import com.pipedream.api.resources.actions.requests.ActionsListRequest; +import com.pipedream.api.resources.actions.requests.ActionsReloadPropsRequest; +import com.pipedream.api.resources.actions.requests.RunActionOpts; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import com.pipedream.api.types.RunActionResponse; + +public class ActionsClient { + protected final ClientOptions clientOptions; + + private final RawActionsClient rawClient; + + public ActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawActionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawActionsClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(ActionsListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(ActionsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public Component retrieve(String componentId) { + return this.rawClient.retrieve(componentId).body(); + } + + public Component retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).body(); + } + + public ConfigurePropResponse configureProp(ActionsConfigurePropRequest request) { + return this.rawClient.configureProp(request).body(); + } + + public ConfigurePropResponse configureProp(ActionsConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).body(); + } + + public ReloadPropsResponse reloadProps(ActionsReloadPropsRequest request) { + return this.rawClient.reloadProps(request).body(); + } + + public ReloadPropsResponse reloadProps(ActionsReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).body(); + } + + public RunActionResponse run(RunActionOpts request) { + return this.rawClient.run(request).body(); + } + + public RunActionResponse run(RunActionOpts request, RequestOptions requestOptions) { + return this.rawClient.run(request, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java new file mode 100644 index 0000000..19ff8e7 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.actions.requests.ActionsConfigurePropRequest; +import com.pipedream.api.resources.actions.requests.ActionsListRequest; +import com.pipedream.api.resources.actions.requests.ActionsReloadPropsRequest; +import com.pipedream.api.resources.actions.requests.RunActionOpts; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import com.pipedream.api.types.RunActionResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncActionsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawActionsClient rawClient; + + public AsyncActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawActionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawActionsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(ActionsListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + ActionsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId) { + return this.rawClient.retrieve(componentId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp(ActionsConfigurePropRequest request) { + return this.rawClient.configureProp(request).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp( + ActionsConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps(ActionsReloadPropsRequest request) { + return this.rawClient.reloadProps(request).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps( + ActionsReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture run(RunActionOpts request) { + return this.rawClient.run(request).thenApply(response -> response.body()); + } + + public CompletableFuture run(RunActionOpts request, RequestOptions requestOptions) { + return this.rawClient.run(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java new file mode 100644 index 0000000..9686990 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java @@ -0,0 +1,397 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.actions.requests.ActionsConfigurePropRequest; +import com.pipedream.api.resources.actions.requests.ActionsListRequest; +import com.pipedream.api.resources.actions.requests.ActionsReloadPropsRequest; +import com.pipedream.api.resources.actions.requests.RunActionOpts; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import com.pipedream.api.types.RunActionResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawActionsClient { + protected final ClientOptions clientOptions; + + public AsyncRawActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(ActionsListRequest.builder().build()); + } + + public CompletableFuture>> list(ActionsListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + ActionsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ActionsListRequest nextRequest = ActionsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String componentId) { + return retrieve(componentId, null); + } + + public CompletableFuture> retrieve( + String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> configureProp( + ActionsConfigurePropRequest request) { + return configureProp(request, null); + } + + public CompletableFuture> configureProp( + ActionsConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> reloadProps( + ActionsReloadPropsRequest request) { + return reloadProps(request, null); + } + + public CompletableFuture> reloadProps( + ActionsReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> run(RunActionOpts request) { + return run(request, null); + } + + public CompletableFuture> run( + RunActionOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/run") + .build(); + Map properties = new HashMap<>(); + properties.put("id", request.getId()); + properties.put("external_user_id", request.getExternalUserId()); + if (request.getConfiguredProps().isPresent()) { + properties.put("configured_props", request.getConfiguredProps()); + } + if (request.getDynamicPropsId().isPresent()) { + properties.put("dynamic_props_id", request.getDynamicPropsId()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), RunActionResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java new file mode 100644 index 0000000..eee1aa6 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.actions.requests.ActionsConfigurePropRequest; +import com.pipedream.api.resources.actions.requests.ActionsListRequest; +import com.pipedream.api.resources.actions.requests.ActionsReloadPropsRequest; +import com.pipedream.api.resources.actions.requests.RunActionOpts; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import com.pipedream.api.types.RunActionResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawActionsClient { + protected final ClientOptions clientOptions; + + public RawActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(ActionsListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(ActionsListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + ActionsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ActionsListRequest nextRequest = ActionsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String componentId) { + return retrieve(componentId, null); + } + + public PipedreamApiHttpResponse retrieve(String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse configureProp(ActionsConfigurePropRequest request) { + return configureProp(request, null); + } + + public PipedreamApiHttpResponse configureProp( + ActionsConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse reloadProps(ActionsReloadPropsRequest request) { + return reloadProps(request, null); + } + + public PipedreamApiHttpResponse reloadProps( + ActionsReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse run(RunActionOpts request) { + return run(request, null); + } + + public PipedreamApiHttpResponse run(RunActionOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/run") + .build(); + Map properties = new HashMap<>(); + properties.put("id", request.getId()); + properties.put("external_user_id", request.getExternalUserId()); + if (request.getConfiguredProps().isPresent()) { + properties.put("configured_props", request.getConfiguredProps()); + } + if (request.getDynamicPropsId().isPresent()) { + properties.put("dynamic_props_id", request.getDynamicPropsId()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), RunActionResponse.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsConfigurePropRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsConfigurePropRequest.java new file mode 100644 index 0000000..5da951b --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsConfigurePropRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions.requests; + +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 com.pipedream.api.types.ConfigurePropOpts; +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 = ActionsConfigurePropRequest.Builder.class) +public final class ActionsConfigurePropRequest { + private final Optional asyncHandle; + + private final ConfigurePropOpts body; + + private final Map additionalProperties; + + private ActionsConfigurePropRequest( + Optional asyncHandle, ConfigurePropOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ConfigurePropOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ActionsConfigurePropRequest && equalTo((ActionsConfigurePropRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ActionsConfigurePropRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ConfigurePropOpts body); + + Builder from(ActionsConfigurePropRequest other); + } + + public interface _FinalStage { + ActionsConfigurePropRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ConfigurePropOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ActionsConfigurePropRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ConfigurePropOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public ActionsConfigurePropRequest build() { + return new ActionsConfigurePropRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsListRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsListRequest.java new file mode 100644 index 0000000..60f1e37 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsListRequest.java @@ -0,0 +1,223 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ActionsListRequest.Builder.class) +public final class ActionsListRequest { + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional q; + + private final Optional app; + + private final Map additionalProperties; + + private ActionsListRequest( + Optional after, + Optional before, + Optional limit, + Optional q, + Optional app, + Map additionalProperties) { + this.after = after; + this.before = before; + this.limit = limit; + this.q = q; + this.app = app; + this.additionalProperties = additionalProperties; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return A search query to filter the actions + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return The ID or name slug of the app to filter the actions + */ + @JsonProperty("app") + public Optional getApp() { + return app; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ActionsListRequest && equalTo((ActionsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ActionsListRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && q.equals(other.q) + && app.equals(other.app); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.limit, this.q, this.app); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional app = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ActionsListRequest other) { + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + q(other.getQ()); + app(other.getApp()); + return this; + } + + /** + *

The cursor to start from for pagination

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The cursor to end before for pagination

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The maximum number of results to return

+ */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

A search query to filter the actions

+ */ + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + /** + *

The ID or name slug of the app to filter the actions

+ */ + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(String app) { + this.app = Optional.ofNullable(app); + return this; + } + + public ActionsListRequest build() { + return new ActionsListRequest(after, before, limit, q, app, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsReloadPropsRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsReloadPropsRequest.java new file mode 100644 index 0000000..afefa8a --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsReloadPropsRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions.requests; + +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 com.pipedream.api.types.ReloadPropsOpts; +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 = ActionsReloadPropsRequest.Builder.class) +public final class ActionsReloadPropsRequest { + private final Optional asyncHandle; + + private final ReloadPropsOpts body; + + private final Map additionalProperties; + + private ActionsReloadPropsRequest( + Optional asyncHandle, ReloadPropsOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ReloadPropsOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ActionsReloadPropsRequest && equalTo((ActionsReloadPropsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ActionsReloadPropsRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ReloadPropsOpts body); + + Builder from(ActionsReloadPropsRequest other); + } + + public interface _FinalStage { + ActionsReloadPropsRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ReloadPropsOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ActionsReloadPropsRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ReloadPropsOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public ActionsReloadPropsRequest build() { + return new ActionsReloadPropsRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/RunActionOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/RunActionOpts.java new file mode 100644 index 0000000..6a16af8 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/RunActionOpts.java @@ -0,0 +1,269 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions.requests; + +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 = RunActionOpts.Builder.class) +public final class RunActionOpts { + private final Optional asyncHandle; + + private final String id; + + private final String externalUserId; + + private final Optional> configuredProps; + + private final Optional dynamicPropsId; + + private final Map additionalProperties; + + private RunActionOpts( + Optional asyncHandle, + String id, + String externalUserId, + Optional> configuredProps, + Optional dynamicPropsId, + Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.id = id; + this.externalUserId = externalUserId; + this.configuredProps = configuredProps; + this.dynamicPropsId = dynamicPropsId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + /** + * @return The action component ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The external user ID + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The configured properties for the action + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The ID for dynamic props + */ + @JsonProperty("dynamic_props_id") + public Optional getDynamicPropsId() { + return dynamicPropsId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RunActionOpts && equalTo((RunActionOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RunActionOpts other) { + return asyncHandle.equals(other.asyncHandle) + && id.equals(other.id) + && externalUserId.equals(other.externalUserId) + && configuredProps.equals(other.configuredProps) + && dynamicPropsId.equals(other.dynamicPropsId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.id, this.externalUserId, this.configuredProps, this.dynamicPropsId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The action component ID

+ */ + ExternalUserIdStage id(@NotNull String id); + + Builder from(RunActionOpts other); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID

+ */ + _FinalStage externalUserId(@NotNull String externalUserId); + } + + public interface _FinalStage { + RunActionOpts build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + + /** + *

The configured properties for the action

+ */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

The ID for dynamic props

+ */ + _FinalStage dynamicPropsId(Optional dynamicPropsId); + + _FinalStage dynamicPropsId(String dynamicPropsId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ExternalUserIdStage, _FinalStage { + private String id; + + private String externalUserId; + + private Optional dynamicPropsId = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RunActionOpts other) { + asyncHandle(other.getAsyncHandle()); + id(other.getId()); + externalUserId(other.getExternalUserId()); + configuredProps(other.getConfiguredProps()); + dynamicPropsId(other.getDynamicPropsId()); + return this; + } + + /** + *

The action component ID

+ *

The action component ID

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

The external user ID

+ *

The external user ID

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

The ID for dynamic props

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

The ID for dynamic props

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

The configured properties for the action

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

The configured properties for the action

+ */ + @java.lang.Override + @JsonSetter(value = "configured_props", nulls = Nulls.SKIP) + public _FinalStage configuredProps(Optional> configuredProps) { + this.configuredProps = configuredProps; + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public RunActionOpts build() { + return new RunActionOpts( + asyncHandle, id, externalUserId, configuredProps, dynamicPropsId, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AppCategoriesClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AppCategoriesClient.java new file mode 100644 index 0000000..357d245 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AppCategoriesClient.java @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appcategories; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.AppCategory; +import java.util.List; + +public class AppCategoriesClient { + protected final ClientOptions clientOptions; + + private final RawAppCategoriesClient rawClient; + + public AppCategoriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAppCategoriesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAppCategoriesClient withRawResponse() { + return this.rawClient; + } + + public List list() { + return this.rawClient.list().body(); + } + + public List list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + public AppCategory retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + public AppCategory retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AsyncAppCategoriesClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AsyncAppCategoriesClient.java new file mode 100644 index 0000000..d374614 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AsyncAppCategoriesClient.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appcategories; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.AppCategory; +import java.util.List; +import java.util.concurrent.CompletableFuture; + +public class AsyncAppCategoriesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAppCategoriesClient rawClient; + + public AsyncAppCategoriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAppCategoriesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAppCategoriesClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java new file mode 100644 index 0000000..c7a7bf5 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appcategories; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.AppCategory; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAppCategoriesClient { + protected final ClientOptions clientOptions; + + public AsyncRawAppCategoriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(null); + } + + public CompletableFuture>> list(RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/app_categories") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String id) { + return retrieve(id, null); + } + + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/app_categories") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), AppCategory.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java new file mode 100644 index 0000000..497bd77 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appcategories; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.AppCategory; +import java.io.IOException; +import java.util.List; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAppCategoriesClient { + protected final ClientOptions clientOptions; + + public RawAppCategoriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(null); + } + + public PipedreamApiHttpResponse> list(RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/app_categories") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String id) { + return retrieve(id, null); + } + + public PipedreamApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/app_categories") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), AppCategory.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AppsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AppsClient.java new file mode 100644 index 0000000..39bcb35 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AppsClient.java @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.apps.requests.AppsListRequest; +import com.pipedream.api.types.App; +import com.pipedream.api.types.GetAppResponse; + +public class AppsClient { + protected final ClientOptions clientOptions; + + private final RawAppsClient rawClient; + + public AppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAppsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAppsClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(AppsListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(AppsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public GetAppResponse retrieve(String appId) { + return this.rawClient.retrieve(appId).body(); + } + + public GetAppResponse retrieve(String appId, RequestOptions requestOptions) { + return this.rawClient.retrieve(appId, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AsyncAppsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AsyncAppsClient.java new file mode 100644 index 0000000..fbe87f5 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AsyncAppsClient.java @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.apps.requests.AppsListRequest; +import com.pipedream.api.types.App; +import com.pipedream.api.types.GetAppResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncAppsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAppsClient rawClient; + + public AsyncAppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAppsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAppsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(AppsListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list(AppsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String appId) { + return this.rawClient.retrieve(appId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String appId, RequestOptions requestOptions) { + return this.rawClient.retrieve(appId, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java new file mode 100644 index 0000000..42967c0 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java @@ -0,0 +1,189 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.apps.requests.AppsListRequest; +import com.pipedream.api.types.App; +import com.pipedream.api.types.GetAppResponse; +import com.pipedream.api.types.ListAppsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAppsClient { + protected final ClientOptions clientOptions; + + public AsyncRawAppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(AppsListRequest.builder().build()); + } + + public CompletableFuture>> list(AppsListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + AppsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/apps"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getSortKey().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_key", request.getSortKey().get(), false); + } + if (request.getSortDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_direction", request.getSortDirection().get(), false); + } + if (request.getCategoryIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "category_ids", request.getCategoryIds().get(), true); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + ListAppsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAppsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + AppsListRequest nextRequest = AppsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String appId) { + return retrieve(appId, null); + } + + public CompletableFuture> retrieve( + String appId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/apps") + .addPathSegment(appId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetAppResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java new file mode 100644 index 0000000..37619d9 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java @@ -0,0 +1,149 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.apps.requests.AppsListRequest; +import com.pipedream.api.types.App; +import com.pipedream.api.types.GetAppResponse; +import com.pipedream.api.types.ListAppsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAppsClient { + protected final ClientOptions clientOptions; + + public RawAppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(AppsListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(AppsListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + AppsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/apps"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getSortKey().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_key", request.getSortKey().get(), false); + } + if (request.getSortDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_direction", request.getSortDirection().get(), false); + } + if (request.getCategoryIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "category_ids", request.getCategoryIds().get(), true); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + ListAppsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAppsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + AppsListRequest nextRequest = AppsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String appId) { + return retrieve(appId, null); + } + + public PipedreamApiHttpResponse retrieve(String appId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/apps") + .addPathSegment(appId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetAppResponse.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/requests/AppsListRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/requests/AppsListRequest.java new file mode 100644 index 0000000..5e13f36 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/requests/AppsListRequest.java @@ -0,0 +1,294 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps.requests; + +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 com.pipedream.api.resources.apps.types.AppsListRequestSortDirection; +import com.pipedream.api.resources.apps.types.AppsListRequestSortKey; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppsListRequest.Builder.class) +public final class AppsListRequest { + private final Optional> categoryIds; + + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional q; + + private final Optional sortKey; + + private final Optional sortDirection; + + private final Map additionalProperties; + + private AppsListRequest( + Optional> categoryIds, + Optional after, + Optional before, + Optional limit, + Optional q, + Optional sortKey, + Optional sortDirection, + Map additionalProperties) { + this.categoryIds = categoryIds; + this.after = after; + this.before = before; + this.limit = limit; + this.q = q; + this.sortKey = sortKey; + this.sortDirection = sortDirection; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only return apps in these categories + */ + @JsonProperty("category_ids") + public Optional> getCategoryIds() { + return categoryIds; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return A search query to filter the apps + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return The key to sort the apps by + */ + @JsonProperty("sort_key") + public Optional getSortKey() { + return sortKey; + } + + /** + * @return The direction to sort the apps + */ + @JsonProperty("sort_direction") + public Optional getSortDirection() { + return sortDirection; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppsListRequest && equalTo((AppsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppsListRequest other) { + return categoryIds.equals(other.categoryIds) + && after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && q.equals(other.q) + && sortKey.equals(other.sortKey) + && sortDirection.equals(other.sortDirection); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.categoryIds, this.after, this.before, this.limit, this.q, this.sortKey, this.sortDirection); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> categoryIds = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional sortKey = Optional.empty(); + + private Optional sortDirection = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AppsListRequest other) { + categoryIds(other.getCategoryIds()); + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + q(other.getQ()); + sortKey(other.getSortKey()); + sortDirection(other.getSortDirection()); + return this; + } + + /** + *

Only return apps in these categories

+ */ + @JsonSetter(value = "category_ids", nulls = Nulls.SKIP) + public Builder categoryIds(Optional> categoryIds) { + this.categoryIds = categoryIds; + return this; + } + + public Builder categoryIds(List categoryIds) { + this.categoryIds = Optional.ofNullable(categoryIds); + return this; + } + + public Builder categoryIds(String categoryIds) { + this.categoryIds = Optional.of(Collections.singletonList(categoryIds)); + return this; + } + + /** + *

The cursor to start from for pagination

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The cursor to end before for pagination

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The maximum number of results to return

+ */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

A search query to filter the apps

+ */ + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + /** + *

The key to sort the apps by

+ */ + @JsonSetter(value = "sort_key", nulls = Nulls.SKIP) + public Builder sortKey(Optional sortKey) { + this.sortKey = sortKey; + return this; + } + + public Builder sortKey(AppsListRequestSortKey sortKey) { + this.sortKey = Optional.ofNullable(sortKey); + return this; + } + + /** + *

The direction to sort the apps

+ */ + @JsonSetter(value = "sort_direction", nulls = Nulls.SKIP) + public Builder sortDirection(Optional sortDirection) { + this.sortDirection = sortDirection; + return this; + } + + public Builder sortDirection(AppsListRequestSortDirection sortDirection) { + this.sortDirection = Optional.ofNullable(sortDirection); + return this; + } + + public AppsListRequest build() { + return new AppsListRequest( + categoryIds, after, before, limit, q, sortKey, sortDirection, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortDirection.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortDirection.java new file mode 100644 index 0000000..18cc793 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortDirection.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AppsListRequestSortDirection { + ASC("asc"), + + DESC("desc"); + + private final String value; + + AppsListRequestSortDirection(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortKey.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortKey.java new file mode 100644 index 0000000..7260231 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortKey.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AppsListRequestSortKey { + NAME("name"), + + NAME_SLUG("name_slug"), + + FEATURED_WEIGHT("featured_weight"); + + private final String value; + + AppsListRequestSortKey(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/AsyncComponentsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/AsyncComponentsClient.java new file mode 100644 index 0000000..c5934f3 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/AsyncComponentsClient.java @@ -0,0 +1,72 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.components.requests.ComponentsConfigurePropRequest; +import com.pipedream.api.resources.components.requests.ComponentsListRequest; +import com.pipedream.api.resources.components.requests.ComponentsReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncComponentsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawComponentsClient rawClient; + + public AsyncComponentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawComponentsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawComponentsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(ComponentsListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + ComponentsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId) { + return this.rawClient.retrieve(componentId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp(ComponentsConfigurePropRequest request) { + return this.rawClient.configureProp(request).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp( + ComponentsConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps(ComponentsReloadPropsRequest request) { + return this.rawClient.reloadProps(request).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps( + ComponentsReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java new file mode 100644 index 0000000..43e8178 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java @@ -0,0 +1,321 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.components.requests.ComponentsConfigurePropRequest; +import com.pipedream.api.resources.components.requests.ComponentsListRequest; +import com.pipedream.api.resources.components.requests.ComponentsReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawComponentsClient { + protected final ClientOptions clientOptions; + + public AsyncRawComponentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(ComponentsListRequest.builder().build()); + } + + public CompletableFuture>> list( + ComponentsListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + ComponentsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ComponentsListRequest nextRequest = ComponentsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String componentId) { + return retrieve(componentId, null); + } + + public CompletableFuture> retrieve( + String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> configureProp( + ComponentsConfigurePropRequest request) { + return configureProp(request, null); + } + + public CompletableFuture> configureProp( + ComponentsConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> reloadProps( + ComponentsReloadPropsRequest request) { + return reloadProps(request, null); + } + + public CompletableFuture> reloadProps( + ComponentsReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/ComponentsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/ComponentsClient.java new file mode 100644 index 0000000..f273dcb --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/ComponentsClient.java @@ -0,0 +1,68 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.components.requests.ComponentsConfigurePropRequest; +import com.pipedream.api.resources.components.requests.ComponentsListRequest; +import com.pipedream.api.resources.components.requests.ComponentsReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.ReloadPropsResponse; + +public class ComponentsClient { + protected final ClientOptions clientOptions; + + private final RawComponentsClient rawClient; + + public ComponentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawComponentsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawComponentsClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(ComponentsListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(ComponentsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public Component retrieve(String componentId) { + return this.rawClient.retrieve(componentId).body(); + } + + public Component retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).body(); + } + + public ConfigurePropResponse configureProp(ComponentsConfigurePropRequest request) { + return this.rawClient.configureProp(request).body(); + } + + public ConfigurePropResponse configureProp(ComponentsConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).body(); + } + + public ReloadPropsResponse reloadProps(ComponentsReloadPropsRequest request) { + return this.rawClient.reloadProps(request).body(); + } + + public ReloadPropsResponse reloadProps(ComponentsReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java new file mode 100644 index 0000000..cd8521d --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java @@ -0,0 +1,253 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.components.requests.ComponentsConfigurePropRequest; +import com.pipedream.api.resources.components.requests.ComponentsListRequest; +import com.pipedream.api.resources.components.requests.ComponentsReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawComponentsClient { + protected final ClientOptions clientOptions; + + public RawComponentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(ComponentsListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(ComponentsListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + ComponentsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ComponentsListRequest nextRequest = ComponentsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String componentId) { + return retrieve(componentId, null); + } + + public PipedreamApiHttpResponse retrieve(String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse configureProp(ComponentsConfigurePropRequest request) { + return configureProp(request, null); + } + + public PipedreamApiHttpResponse configureProp( + ComponentsConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse reloadProps(ComponentsReloadPropsRequest request) { + return reloadProps(request, null); + } + + public PipedreamApiHttpResponse reloadProps( + ComponentsReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsConfigurePropRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsConfigurePropRequest.java new file mode 100644 index 0000000..541a93e --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsConfigurePropRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components.requests; + +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 com.pipedream.api.types.ConfigurePropOpts; +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 = ComponentsConfigurePropRequest.Builder.class) +public final class ComponentsConfigurePropRequest { + private final Optional asyncHandle; + + private final ConfigurePropOpts body; + + private final Map additionalProperties; + + private ComponentsConfigurePropRequest( + Optional asyncHandle, ConfigurePropOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ConfigurePropOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ComponentsConfigurePropRequest && equalTo((ComponentsConfigurePropRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ComponentsConfigurePropRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ConfigurePropOpts body); + + Builder from(ComponentsConfigurePropRequest other); + } + + public interface _FinalStage { + ComponentsConfigurePropRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ConfigurePropOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ComponentsConfigurePropRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ConfigurePropOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public ComponentsConfigurePropRequest build() { + return new ComponentsConfigurePropRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsListRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsListRequest.java new file mode 100644 index 0000000..8d5b23b --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsListRequest.java @@ -0,0 +1,223 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ComponentsListRequest.Builder.class) +public final class ComponentsListRequest { + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional q; + + private final Optional app; + + private final Map additionalProperties; + + private ComponentsListRequest( + Optional after, + Optional before, + Optional limit, + Optional q, + Optional app, + Map additionalProperties) { + this.after = after; + this.before = before; + this.limit = limit; + this.q = q; + this.app = app; + this.additionalProperties = additionalProperties; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return A search query to filter the components + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return The ID or name slug of the app to filter the components + */ + @JsonProperty("app") + public Optional getApp() { + return app; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ComponentsListRequest && equalTo((ComponentsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ComponentsListRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && q.equals(other.q) + && app.equals(other.app); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.limit, this.q, this.app); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional app = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ComponentsListRequest other) { + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + q(other.getQ()); + app(other.getApp()); + return this; + } + + /** + *

The cursor to start from for pagination

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The cursor to end before for pagination

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The maximum number of results to return

+ */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

A search query to filter the components

+ */ + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + /** + *

The ID or name slug of the app to filter the components

+ */ + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(String app) { + this.app = Optional.ofNullable(app); + return this; + } + + public ComponentsListRequest build() { + return new ComponentsListRequest(after, before, limit, q, app, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsReloadPropsRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsReloadPropsRequest.java new file mode 100644 index 0000000..960dc66 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsReloadPropsRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components.requests; + +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 com.pipedream.api.types.ReloadPropsOpts; +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 = ComponentsReloadPropsRequest.Builder.class) +public final class ComponentsReloadPropsRequest { + private final Optional asyncHandle; + + private final ReloadPropsOpts body; + + private final Map additionalProperties; + + private ComponentsReloadPropsRequest( + Optional asyncHandle, ReloadPropsOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ReloadPropsOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ComponentsReloadPropsRequest && equalTo((ComponentsReloadPropsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ComponentsReloadPropsRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ReloadPropsOpts body); + + Builder from(ComponentsReloadPropsRequest other); + } + + public interface _FinalStage { + ComponentsReloadPropsRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ReloadPropsOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ComponentsReloadPropsRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ReloadPropsOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public ComponentsReloadPropsRequest build() { + return new ComponentsReloadPropsRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java new file mode 100644 index 0000000..bc6b458 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersDeleteRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListEventsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWebhooksOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.EmittedEvent; +import com.pipedream.api.types.GetTriggerWebhooksResponse; +import com.pipedream.api.types.GetTriggerWorkflowsResponse; +import java.util.List; +import java.util.concurrent.CompletableFuture; + +public class AsyncDeployedTriggersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawDeployedTriggersClient rawClient; + + public AsyncDeployedTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawDeployedTriggersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawDeployedTriggersClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list(DeployedTriggersListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + DeployedTriggersListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String triggerId, DeployedTriggersRetrieveRequest request) { + return this.rawClient.retrieve(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve( + String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture update(String triggerId, UpdateTriggerOpts request) { + return this.rawClient.update(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture update( + String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { + return this.rawClient.update(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture delete(String triggerId, DeployedTriggersDeleteRequest request) { + return this.rawClient.delete(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture delete( + String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> listEvents( + String triggerId, DeployedTriggersListEventsRequest request) { + return this.rawClient.listEvents(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture> listEvents( + String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { + return this.rawClient.listEvents(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request) { + return this.rawClient.listWorkflows(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { + return this.rawClient.listWorkflows(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request) { + return this.rawClient.updateWorkflows(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { + return this.rawClient + .updateWorkflows(triggerId, request, requestOptions) + .thenApply(response -> response.body()); + } + + public CompletableFuture listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request) { + return this.rawClient.listWebhooks(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.listWebhooks(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request) { + return this.rawClient.updateWebhooks(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { + return this.rawClient.updateWebhooks(triggerId, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java new file mode 100644 index 0000000..cbee597 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java @@ -0,0 +1,630 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersDeleteRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListEventsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWebhooksOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.EmittedEvent; +import com.pipedream.api.types.GetTriggerEventsResponse; +import com.pipedream.api.types.GetTriggerResponse; +import com.pipedream.api.types.GetTriggerWebhooksResponse; +import com.pipedream.api.types.GetTriggerWorkflowsResponse; +import com.pipedream.api.types.GetTriggersResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawDeployedTriggersClient { + protected final ClientOptions clientOptions; + + public AsyncRawDeployedTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list( + DeployedTriggersListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + DeployedTriggersListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetTriggersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggersResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + DeployedTriggersListRequest nextRequest = DeployedTriggersListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve( + String triggerId, DeployedTriggersRetrieveRequest request) { + return retrieve(triggerId, request, null); + } + + public CompletableFuture> retrieve( + String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> update( + String triggerId, UpdateTriggerOpts request) { + return update(triggerId, request, null); + } + + public CompletableFuture> update( + String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + if (request.getActive().isPresent()) { + properties.put("active", request.getActive()); + } + if (request.getConfiguredProps().isPresent()) { + properties.put("configured_props", request.getConfiguredProps()); + } + if (request.getName().isPresent()) { + properties.put("name", request.getName()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> delete( + String triggerId, DeployedTriggersDeleteRequest request) { + return delete(triggerId, request, null); + } + + public CompletableFuture> delete( + String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + if (request.getIgnoreHookErrors().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ignore_hook_errors", request.getIgnoreHookErrors().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> listEvents( + String triggerId, DeployedTriggersListEventsRequest request) { + return listEvents(triggerId, request, null); + } + + public CompletableFuture>> listEvents( + String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("events"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + if (request.getN().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "n", request.getN().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetTriggerEventsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerEventsResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request) { + return listWorkflows(triggerId, request, null); + } + + public CompletableFuture> listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("pipelines"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerWorkflowsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request) { + return updateWorkflows(triggerId, request, null); + } + + public CompletableFuture> updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("pipelines"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + properties.put("workflow_ids", request.getWorkflowIds()); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerWorkflowsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request) { + return listWebhooks(triggerId, request, null); + } + + public CompletableFuture> listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("webhooks"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerWebhooksResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request) { + return updateWebhooks(triggerId, request, null); + } + + public CompletableFuture> updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("webhooks"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + properties.put("webhook_urls", request.getWebhookUrls()); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerWebhooksResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java new file mode 100644 index 0000000..891ce12 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java @@ -0,0 +1,121 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersDeleteRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListEventsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWebhooksOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.EmittedEvent; +import com.pipedream.api.types.GetTriggerWebhooksResponse; +import com.pipedream.api.types.GetTriggerWorkflowsResponse; +import java.util.List; + +public class DeployedTriggersClient { + protected final ClientOptions clientOptions; + + private final RawDeployedTriggersClient rawClient; + + public DeployedTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawDeployedTriggersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawDeployedTriggersClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list(DeployedTriggersListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list( + DeployedTriggersListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public DeployedComponent retrieve(String triggerId, DeployedTriggersRetrieveRequest request) { + return this.rawClient.retrieve(triggerId, request).body(); + } + + public DeployedComponent retrieve( + String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(triggerId, request, requestOptions).body(); + } + + public DeployedComponent update(String triggerId, UpdateTriggerOpts request) { + return this.rawClient.update(triggerId, request).body(); + } + + public DeployedComponent update(String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { + return this.rawClient.update(triggerId, request, requestOptions).body(); + } + + public void delete(String triggerId, DeployedTriggersDeleteRequest request) { + this.rawClient.delete(triggerId, request).body(); + } + + public void delete(String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { + this.rawClient.delete(triggerId, request, requestOptions).body(); + } + + public List listEvents(String triggerId, DeployedTriggersListEventsRequest request) { + return this.rawClient.listEvents(triggerId, request).body(); + } + + public List listEvents( + String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { + return this.rawClient.listEvents(triggerId, request, requestOptions).body(); + } + + public GetTriggerWorkflowsResponse listWorkflows(String triggerId, DeployedTriggersListWorkflowsRequest request) { + return this.rawClient.listWorkflows(triggerId, request).body(); + } + + public GetTriggerWorkflowsResponse listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { + return this.rawClient.listWorkflows(triggerId, request, requestOptions).body(); + } + + public GetTriggerWorkflowsResponse updateWorkflows(String triggerId, UpdateTriggerWorkflowsOpts request) { + return this.rawClient.updateWorkflows(triggerId, request).body(); + } + + public GetTriggerWorkflowsResponse updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { + return this.rawClient + .updateWorkflows(triggerId, request, requestOptions) + .body(); + } + + public GetTriggerWebhooksResponse listWebhooks(String triggerId, DeployedTriggersListWebhooksRequest request) { + return this.rawClient.listWebhooks(triggerId, request).body(); + } + + public GetTriggerWebhooksResponse listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.listWebhooks(triggerId, request, requestOptions).body(); + } + + public GetTriggerWebhooksResponse updateWebhooks(String triggerId, UpdateTriggerWebhooksOpts request) { + return this.rawClient.updateWebhooks(triggerId, request).body(); + } + + public GetTriggerWebhooksResponse updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { + return this.rawClient.updateWebhooks(triggerId, request, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java new file mode 100644 index 0000000..0e1e09f --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java @@ -0,0 +1,493 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersDeleteRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListEventsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWebhooksOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.EmittedEvent; +import com.pipedream.api.types.GetTriggerEventsResponse; +import com.pipedream.api.types.GetTriggerResponse; +import com.pipedream.api.types.GetTriggerWebhooksResponse; +import com.pipedream.api.types.GetTriggerWorkflowsResponse; +import com.pipedream.api.types.GetTriggersResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawDeployedTriggersClient { + protected final ClientOptions clientOptions; + + public RawDeployedTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list(DeployedTriggersListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + DeployedTriggersListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetTriggersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggersResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + DeployedTriggersListRequest nextRequest = DeployedTriggersListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve( + String triggerId, DeployedTriggersRetrieveRequest request) { + return retrieve(triggerId, request, null); + } + + public PipedreamApiHttpResponse retrieve( + String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse update(String triggerId, UpdateTriggerOpts request) { + return update(triggerId, request, null); + } + + public PipedreamApiHttpResponse update( + String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + if (request.getActive().isPresent()) { + properties.put("active", request.getActive()); + } + if (request.getConfiguredProps().isPresent()) { + properties.put("configured_props", request.getConfiguredProps()); + } + if (request.getName().isPresent()) { + properties.put("name", request.getName()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse delete(String triggerId, DeployedTriggersDeleteRequest request) { + return delete(triggerId, request, null); + } + + public PipedreamApiHttpResponse delete( + String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + if (request.getIgnoreHookErrors().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ignore_hook_errors", request.getIgnoreHookErrors().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> listEvents( + String triggerId, DeployedTriggersListEventsRequest request) { + return listEvents(triggerId, request, null); + } + + public PipedreamApiHttpResponse> listEvents( + String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("events"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + if (request.getN().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "n", request.getN().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetTriggerEventsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerEventsResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request) { + return listWorkflows(triggerId, request, null); + } + + public PipedreamApiHttpResponse listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("pipelines"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWorkflowsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request) { + return updateWorkflows(triggerId, request, null); + } + + public PipedreamApiHttpResponse updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("pipelines"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + properties.put("workflow_ids", request.getWorkflowIds()); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWorkflowsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request) { + return listWebhooks(triggerId, request, null); + } + + public PipedreamApiHttpResponse listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("webhooks"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWebhooksResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request) { + return updateWebhooks(triggerId, request, null); + } + + public PipedreamApiHttpResponse updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("webhooks"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + properties.put("webhook_urls", request.getWebhookUrls()); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWebhooksResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersDeleteRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersDeleteRequest.java new file mode 100644 index 0000000..3989d6e --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersDeleteRequest.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +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 = DeployedTriggersDeleteRequest.Builder.class) +public final class DeployedTriggersDeleteRequest { + private final String externalUserId; + + private final Optional ignoreHookErrors; + + private final Map additionalProperties; + + private DeployedTriggersDeleteRequest( + String externalUserId, Optional ignoreHookErrors, Map additionalProperties) { + this.externalUserId = externalUserId; + this.ignoreHookErrors = ignoreHookErrors; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Whether to ignore errors during deactivation hook + */ + @JsonProperty("ignore_hook_errors") + public Optional getIgnoreHookErrors() { + return ignoreHookErrors; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersDeleteRequest && equalTo((DeployedTriggersDeleteRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersDeleteRequest other) { + return externalUserId.equals(other.externalUserId) && ignoreHookErrors.equals(other.ignoreHookErrors); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.ignoreHookErrors); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID who owns the trigger

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

Whether to ignore errors during deactivation hook

+ */ + _FinalStage ignoreHookErrors(Optional ignoreHookErrors); + + _FinalStage ignoreHookErrors(Boolean ignoreHookErrors); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private Optional ignoreHookErrors = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersDeleteRequest other) { + externalUserId(other.getExternalUserId()); + ignoreHookErrors(other.getIgnoreHookErrors()); + return this; + } + + /** + *

The external user ID who owns the trigger

+ *

The external user ID who owns the trigger

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

Whether to ignore errors during deactivation hook

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

Whether to ignore errors during deactivation hook

+ */ + @java.lang.Override + @JsonSetter(value = "ignore_hook_errors", nulls = Nulls.SKIP) + public _FinalStage ignoreHookErrors(Optional ignoreHookErrors) { + this.ignoreHookErrors = ignoreHookErrors; + return this; + } + + @java.lang.Override + public DeployedTriggersDeleteRequest build() { + return new DeployedTriggersDeleteRequest(externalUserId, ignoreHookErrors, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListEventsRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListEventsRequest.java new file mode 100644 index 0000000..e3015b2 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListEventsRequest.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +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 = DeployedTriggersListEventsRequest.Builder.class) +public final class DeployedTriggersListEventsRequest { + private final String externalUserId; + + private final Optional n; + + private final Map additionalProperties; + + private DeployedTriggersListEventsRequest( + String externalUserId, Optional n, Map additionalProperties) { + this.externalUserId = externalUserId; + this.n = n; + this.additionalProperties = additionalProperties; + } + + /** + * @return Your end user ID, for whom you deployed the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The number of events to retrieve (defaults to 20 if not provided) + */ + @JsonProperty("n") + public Optional getN() { + return n; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersListEventsRequest && equalTo((DeployedTriggersListEventsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersListEventsRequest other) { + return externalUserId.equals(other.externalUserId) && n.equals(other.n); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.n); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

Your end user ID, for whom you deployed the trigger

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

The number of events to retrieve (defaults to 20 if not provided)

+ */ + _FinalStage n(Optional n); + + _FinalStage n(Integer n); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private Optional n = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersListEventsRequest other) { + externalUserId(other.getExternalUserId()); + n(other.getN()); + return this; + } + + /** + *

Your end user ID, for whom you deployed the trigger

+ *

Your end user ID, for whom you deployed the trigger

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

The number of events to retrieve (defaults to 20 if not provided)

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

The number of events to retrieve (defaults to 20 if not provided)

+ */ + @java.lang.Override + @JsonSetter(value = "n", nulls = Nulls.SKIP) + public _FinalStage n(Optional n) { + this.n = n; + return this; + } + + @java.lang.Override + public DeployedTriggersListEventsRequest build() { + return new DeployedTriggersListEventsRequest(externalUserId, n, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListRequest.java new file mode 100644 index 0000000..556c4f0 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListRequest.java @@ -0,0 +1,246 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +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 = DeployedTriggersListRequest.Builder.class) +public final class DeployedTriggersListRequest { + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final String externalUserId; + + private final Map additionalProperties; + + private DeployedTriggersListRequest( + Optional after, + Optional before, + Optional limit, + String externalUserId, + Map additionalProperties) { + this.after = after; + this.before = before; + this.limit = limit; + this.externalUserId = externalUserId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Your end user ID, for whom you deployed the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersListRequest && equalTo((DeployedTriggersListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersListRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && externalUserId.equals(other.externalUserId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.limit, this.externalUserId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

Your end user ID, for whom you deployed the trigger

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

The cursor to start from for pagination

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

The cursor to end before for pagination

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

The maximum number of results to return

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(Integer limit); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private Optional limit = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersListRequest other) { + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + externalUserId(other.getExternalUserId()); + return this; + } + + /** + *

Your end user ID, for whom you deployed the trigger

+ *

Your end user ID, for whom you deployed the trigger

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

The maximum number of results to return

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

The maximum number of results to return

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

The cursor to end before for pagination

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

The cursor to end before for pagination

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

The cursor to start from for pagination

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

The cursor to start from for pagination

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public DeployedTriggersListRequest build() { + return new DeployedTriggersListRequest(after, before, limit, externalUserId, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWebhooksRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWebhooksRequest.java new file mode 100644 index 0000000..62cf4dd --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWebhooksRequest.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedTriggersListWebhooksRequest.Builder.class) +public final class DeployedTriggersListWebhooksRequest { + private final String externalUserId; + + private final Map additionalProperties; + + private DeployedTriggersListWebhooksRequest(String externalUserId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersListWebhooksRequest + && equalTo((DeployedTriggersListWebhooksRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersListWebhooksRequest other) { + return externalUserId.equals(other.externalUserId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID who owns the trigger

+ */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(DeployedTriggersListWebhooksRequest other); + } + + public interface _FinalStage { + DeployedTriggersListWebhooksRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersListWebhooksRequest other) { + externalUserId(other.getExternalUserId()); + return this; + } + + /** + *

The external user ID who owns the trigger

+ *

The external user ID who owns the trigger

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + @java.lang.Override + public DeployedTriggersListWebhooksRequest build() { + return new DeployedTriggersListWebhooksRequest(externalUserId, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWorkflowsRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWorkflowsRequest.java new file mode 100644 index 0000000..95979ed --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWorkflowsRequest.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedTriggersListWorkflowsRequest.Builder.class) +public final class DeployedTriggersListWorkflowsRequest { + private final String externalUserId; + + private final Map additionalProperties; + + private DeployedTriggersListWorkflowsRequest(String externalUserId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersListWorkflowsRequest + && equalTo((DeployedTriggersListWorkflowsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersListWorkflowsRequest other) { + return externalUserId.equals(other.externalUserId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID who owns the trigger

+ */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(DeployedTriggersListWorkflowsRequest other); + } + + public interface _FinalStage { + DeployedTriggersListWorkflowsRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersListWorkflowsRequest other) { + externalUserId(other.getExternalUserId()); + return this; + } + + /** + *

The external user ID who owns the trigger

+ *

The external user ID who owns the trigger

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + @java.lang.Override + public DeployedTriggersListWorkflowsRequest build() { + return new DeployedTriggersListWorkflowsRequest(externalUserId, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersRetrieveRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersRetrieveRequest.java new file mode 100644 index 0000000..4aab165 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersRetrieveRequest.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedTriggersRetrieveRequest.Builder.class) +public final class DeployedTriggersRetrieveRequest { + private final String externalUserId; + + private final Map additionalProperties; + + private DeployedTriggersRetrieveRequest(String externalUserId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Your end user ID, for whom you deployed the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersRetrieveRequest && equalTo((DeployedTriggersRetrieveRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersRetrieveRequest other) { + return externalUserId.equals(other.externalUserId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

Your end user ID, for whom you deployed the trigger

+ */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(DeployedTriggersRetrieveRequest other); + } + + public interface _FinalStage { + DeployedTriggersRetrieveRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersRetrieveRequest other) { + externalUserId(other.getExternalUserId()); + return this; + } + + /** + *

Your end user ID, for whom you deployed the trigger

+ *

Your end user ID, for whom you deployed the trigger

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + @java.lang.Override + public DeployedTriggersRetrieveRequest build() { + return new DeployedTriggersRetrieveRequest(externalUserId, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerOpts.java new file mode 100644 index 0000000..735cf4a --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerOpts.java @@ -0,0 +1,246 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +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 = UpdateTriggerOpts.Builder.class) +public final class UpdateTriggerOpts { + private final String externalUserId; + + private final Optional active; + + private final Optional> configuredProps; + + private final Optional name; + + private final Map additionalProperties; + + private UpdateTriggerOpts( + String externalUserId, + Optional active, + Optional> configuredProps, + Optional name, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.active = active; + this.configuredProps = configuredProps; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Whether the trigger should be active + */ + @JsonProperty("active") + public Optional getActive() { + return active; + } + + /** + * @return The configured properties for the trigger + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The name of the trigger + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateTriggerOpts && equalTo((UpdateTriggerOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateTriggerOpts other) { + return externalUserId.equals(other.externalUserId) + && active.equals(other.active) + && configuredProps.equals(other.configuredProps) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.active, this.configuredProps, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID who owns the trigger

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

Whether the trigger should be active

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

The configured properties for the trigger

+ */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

The name of the trigger

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private Optional name = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + private Optional active = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateTriggerOpts other) { + externalUserId(other.getExternalUserId()); + active(other.getActive()); + configuredProps(other.getConfiguredProps()); + name(other.getName()); + return this; + } + + /** + *

The external user ID who owns the trigger

+ *

The external user ID who owns the trigger

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

The name of the trigger

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

The name of the trigger

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

The configured properties for the trigger

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

The configured properties for the trigger

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

Whether the trigger should be active

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

Whether the trigger should be active

+ */ + @java.lang.Override + @JsonSetter(value = "active", nulls = Nulls.SKIP) + public _FinalStage active(Optional active) { + this.active = active; + return this; + } + + @java.lang.Override + public UpdateTriggerOpts build() { + return new UpdateTriggerOpts(externalUserId, active, configuredProps, name, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWebhooksOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWebhooksOpts.java new file mode 100644 index 0000000..d00d5fb --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWebhooksOpts.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateTriggerWebhooksOpts.Builder.class) +public final class UpdateTriggerWebhooksOpts { + private final String externalUserId; + + private final List webhookUrls; + + private final Map additionalProperties; + + private UpdateTriggerWebhooksOpts( + String externalUserId, List webhookUrls, Map additionalProperties) { + this.externalUserId = externalUserId; + this.webhookUrls = webhookUrls; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Array of webhook URLs to set + */ + @JsonProperty("webhook_urls") + public List getWebhookUrls() { + return webhookUrls; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateTriggerWebhooksOpts && equalTo((UpdateTriggerWebhooksOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateTriggerWebhooksOpts other) { + return externalUserId.equals(other.externalUserId) && webhookUrls.equals(other.webhookUrls); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.webhookUrls); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID who owns the trigger

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

Array of webhook URLs to set

+ */ + _FinalStage webhookUrls(List webhookUrls); + + _FinalStage addWebhookUrls(String webhookUrls); + + _FinalStage addAllWebhookUrls(List webhookUrls); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private List webhookUrls = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateTriggerWebhooksOpts other) { + externalUserId(other.getExternalUserId()); + webhookUrls(other.getWebhookUrls()); + return this; + } + + /** + *

The external user ID who owns the trigger

+ *

The external user ID who owns the trigger

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

Array of webhook URLs to set

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

Array of webhook URLs to set

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

Array of webhook URLs to set

+ */ + @java.lang.Override + @JsonSetter(value = "webhook_urls", nulls = Nulls.SKIP) + public _FinalStage webhookUrls(List webhookUrls) { + this.webhookUrls.clear(); + this.webhookUrls.addAll(webhookUrls); + return this; + } + + @java.lang.Override + public UpdateTriggerWebhooksOpts build() { + return new UpdateTriggerWebhooksOpts(externalUserId, webhookUrls, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWorkflowsOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWorkflowsOpts.java new file mode 100644 index 0000000..7022dd6 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWorkflowsOpts.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateTriggerWorkflowsOpts.Builder.class) +public final class UpdateTriggerWorkflowsOpts { + private final String externalUserId; + + private final List workflowIds; + + private final Map additionalProperties; + + private UpdateTriggerWorkflowsOpts( + String externalUserId, List workflowIds, Map additionalProperties) { + this.externalUserId = externalUserId; + this.workflowIds = workflowIds; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Array of workflow IDs to set + */ + @JsonProperty("workflow_ids") + public List getWorkflowIds() { + return workflowIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateTriggerWorkflowsOpts && equalTo((UpdateTriggerWorkflowsOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateTriggerWorkflowsOpts other) { + return externalUserId.equals(other.externalUserId) && workflowIds.equals(other.workflowIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.workflowIds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID who owns the trigger

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

Array of workflow IDs to set

+ */ + _FinalStage workflowIds(List workflowIds); + + _FinalStage addWorkflowIds(String workflowIds); + + _FinalStage addAllWorkflowIds(List workflowIds); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private List workflowIds = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateTriggerWorkflowsOpts other) { + externalUserId(other.getExternalUserId()); + workflowIds(other.getWorkflowIds()); + return this; + } + + /** + *

The external user ID who owns the trigger

+ *

The external user ID who owns the trigger

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

Array of workflow IDs to set

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

Array of workflow IDs to set

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

Array of workflow IDs to set

+ */ + @java.lang.Override + @JsonSetter(value = "workflow_ids", nulls = Nulls.SKIP) + public _FinalStage workflowIds(List workflowIds) { + this.workflowIds.clear(); + this.workflowIds.addAll(workflowIds); + return this; + } + + @java.lang.Override + public UpdateTriggerWorkflowsOpts build() { + return new UpdateTriggerWorkflowsOpts(externalUserId, workflowIds, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncOauthTokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncOauthTokensClient.java new file mode 100644 index 0000000..87556e3 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncOauthTokensClient.java @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncOauthTokensClient { + protected final ClientOptions clientOptions; + + private final AsyncRawOauthTokensClient rawClient; + + public AsyncOauthTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawOauthTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawOauthTokensClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture create(CreateOAuthTokenOpts request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + public CompletableFuture create( + CreateOAuthTokenOpts request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java new file mode 100644 index 0000000..cc29bb8 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawOauthTokensClient { + protected final ClientOptions clientOptions; + + public AsyncRawOauthTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> create(CreateOAuthTokenOpts request) { + return create(request, null); + } + + public CompletableFuture> create( + CreateOAuthTokenOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/oauth/token") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), CreateOAuthTokenResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/OauthTokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/OauthTokensClient.java new file mode 100644 index 0000000..1ae2bf1 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/OauthTokensClient.java @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; + +public class OauthTokensClient { + protected final ClientOptions clientOptions; + + private final RawOauthTokensClient rawClient; + + public OauthTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawOauthTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawOauthTokensClient withRawResponse() { + return this.rawClient; + } + + public CreateOAuthTokenResponse create(CreateOAuthTokenOpts request) { + return this.rawClient.create(request).body(); + } + + public CreateOAuthTokenResponse create(CreateOAuthTokenOpts request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java new file mode 100644 index 0000000..c7096b4 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java @@ -0,0 +1,77 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawOauthTokensClient { + protected final ClientOptions clientOptions; + + public RawOauthTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse create(CreateOAuthTokenOpts request) { + return create(request, null); + } + + public PipedreamApiHttpResponse create( + CreateOAuthTokenOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/oauth/token") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateOAuthTokenResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/requests/CreateOAuthTokenOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/requests/CreateOAuthTokenOpts.java new file mode 100644 index 0000000..50ab4b2 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/requests/CreateOAuthTokenOpts.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens.requests; + +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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateOAuthTokenOpts.Builder.class) +public final class CreateOAuthTokenOpts { + private final String clientId; + + private final String clientSecret; + + private final Map additionalProperties; + + private CreateOAuthTokenOpts(String clientId, String clientSecret, Map additionalProperties) { + this.clientId = clientId; + this.clientSecret = clientSecret; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("grant_type") + public String getGrantType() { + return "client_credentials"; + } + + @JsonProperty("client_id") + public String getClientId() { + return clientId; + } + + @JsonProperty("client_secret") + public String getClientSecret() { + return clientSecret; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOAuthTokenOpts && equalTo((CreateOAuthTokenOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateOAuthTokenOpts other) { + return clientId.equals(other.clientId) && clientSecret.equals(other.clientSecret); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.clientId, this.clientSecret); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ClientIdStage builder() { + return new Builder(); + } + + public interface ClientIdStage { + ClientSecretStage clientId(@NotNull String clientId); + + Builder from(CreateOAuthTokenOpts other); + } + + public interface ClientSecretStage { + _FinalStage clientSecret(@NotNull String clientSecret); + } + + public interface _FinalStage { + CreateOAuthTokenOpts build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ClientIdStage, ClientSecretStage, _FinalStage { + private String clientId; + + private String clientSecret; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateOAuthTokenOpts other) { + clientId(other.getClientId()); + clientSecret(other.getClientSecret()); + return this; + } + + @java.lang.Override + @JsonSetter("client_id") + public ClientSecretStage clientId(@NotNull String clientId) { + this.clientId = Objects.requireNonNull(clientId, "clientId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("client_secret") + public _FinalStage clientSecret(@NotNull String clientSecret) { + this.clientSecret = Objects.requireNonNull(clientSecret, "clientSecret must not be null"); + return this; + } + + @java.lang.Override + public CreateOAuthTokenOpts build() { + return new CreateOAuthTokenOpts(clientId, clientSecret, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/AsyncProjectsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/AsyncProjectsClient.java new file mode 100644 index 0000000..1d75dd6 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/AsyncProjectsClient.java @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.projects; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.ProjectInfoResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncProjectsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawProjectsClient rawClient; + + public AsyncProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawProjectsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawProjectsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture retrieveInfo() { + return this.rawClient.retrieveInfo().thenApply(response -> response.body()); + } + + public CompletableFuture retrieveInfo(RequestOptions requestOptions) { + return this.rawClient.retrieveInfo(requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java new file mode 100644 index 0000000..df37ce8 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.projects; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.ProjectInfoResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawProjectsClient { + protected final ClientOptions clientOptions; + + public AsyncRawProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> retrieveInfo() { + return retrieveInfo(null); + } + + public CompletableFuture> retrieveInfo( + RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("projects/info") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProjectInfoResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/ProjectsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/ProjectsClient.java new file mode 100644 index 0000000..b09fc87 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/ProjectsClient.java @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.projects; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.ProjectInfoResponse; + +public class ProjectsClient { + protected final ClientOptions clientOptions; + + private final RawProjectsClient rawClient; + + public ProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawProjectsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawProjectsClient withRawResponse() { + return this.rawClient; + } + + public ProjectInfoResponse retrieveInfo() { + return this.rawClient.retrieveInfo().body(); + } + + public ProjectInfoResponse retrieveInfo(RequestOptions requestOptions) { + return this.rawClient.retrieveInfo(requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java new file mode 100644 index 0000000..d09dc32 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java @@ -0,0 +1,66 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.projects; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.ProjectInfoResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawProjectsClient { + protected final ClientOptions clientOptions; + + public RawProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse retrieveInfo() { + return retrieveInfo(null); + } + + public PipedreamApiHttpResponse retrieveInfo(RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("projects/info") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProjectInfoResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/AsyncProxyClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/AsyncProxyClient.java new file mode 100644 index 0000000..61bcd21 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/AsyncProxyClient.java @@ -0,0 +1,77 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; +import com.pipedream.api.resources.proxy.requests.ProxyGetRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPatchRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPostRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPutRequest; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +public class AsyncProxyClient { + protected final ClientOptions clientOptions; + + private final AsyncRawProxyClient rawClient; + + public AsyncProxyClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawProxyClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawProxyClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> get(String url64, ProxyGetRequest request) { + return this.rawClient.get(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> get( + String url64, ProxyGetRequest request, RequestOptions requestOptions) { + return this.rawClient.get(url64, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> post(String url64, ProxyPostRequest request) { + return this.rawClient.post(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> post( + String url64, ProxyPostRequest request, RequestOptions requestOptions) { + return this.rawClient.post(url64, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> put(String url64, ProxyPutRequest request) { + return this.rawClient.put(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> put( + String url64, ProxyPutRequest request, RequestOptions requestOptions) { + return this.rawClient.put(url64, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> delete(String url64, ProxyDeleteRequest request) { + return this.rawClient.delete(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> delete( + String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(url64, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> patch(String url64, ProxyPatchRequest request) { + return this.rawClient.patch(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> patch( + String url64, ProxyPatchRequest request, RequestOptions requestOptions) { + return this.rawClient.patch(url64, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java new file mode 100644 index 0000000..d6737d6 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java @@ -0,0 +1,347 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; +import com.pipedream.api.resources.proxy.requests.ProxyGetRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPatchRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPostRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPutRequest; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawProxyClient { + protected final ClientOptions clientOptions; + + public AsyncRawProxyClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> get(String url64, ProxyGetRequest request) { + return get(url64, request, null); + } + + public CompletableFuture>> get( + String url64, ProxyGetRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> post( + String url64, ProxyPostRequest request) { + return post(url64, request, null); + } + + public CompletableFuture>> post( + String url64, ProxyPostRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> put(String url64, ProxyPutRequest request) { + return put(url64, request, null); + } + + public CompletableFuture>> put( + String url64, ProxyPutRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> delete( + String url64, ProxyDeleteRequest request) { + return delete(url64, request, null); + } + + public CompletableFuture>> delete( + String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> patch( + String url64, ProxyPatchRequest request) { + return patch(url64, request, null); + } + + public CompletableFuture>> patch( + String url64, ProxyPatchRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/ProxyClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/ProxyClient.java new file mode 100644 index 0000000..aa27dba --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/ProxyClient.java @@ -0,0 +1,71 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; +import com.pipedream.api.resources.proxy.requests.ProxyGetRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPatchRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPostRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPutRequest; +import java.util.Map; + +public class ProxyClient { + protected final ClientOptions clientOptions; + + private final RawProxyClient rawClient; + + public ProxyClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawProxyClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawProxyClient withRawResponse() { + return this.rawClient; + } + + public Map get(String url64, ProxyGetRequest request) { + return this.rawClient.get(url64, request).body(); + } + + public Map get(String url64, ProxyGetRequest request, RequestOptions requestOptions) { + return this.rawClient.get(url64, request, requestOptions).body(); + } + + public Map post(String url64, ProxyPostRequest request) { + return this.rawClient.post(url64, request).body(); + } + + public Map post(String url64, ProxyPostRequest request, RequestOptions requestOptions) { + return this.rawClient.post(url64, request, requestOptions).body(); + } + + public Map put(String url64, ProxyPutRequest request) { + return this.rawClient.put(url64, request).body(); + } + + public Map put(String url64, ProxyPutRequest request, RequestOptions requestOptions) { + return this.rawClient.put(url64, request, requestOptions).body(); + } + + public Map delete(String url64, ProxyDeleteRequest request) { + return this.rawClient.delete(url64, request).body(); + } + + public Map delete(String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(url64, request, requestOptions).body(); + } + + public Map patch(String url64, ProxyPatchRequest request) { + return this.rawClient.patch(url64, request).body(); + } + + public Map patch(String url64, ProxyPatchRequest request, RequestOptions requestOptions) { + return this.rawClient.patch(url64, request, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java new file mode 100644 index 0000000..9720f2b --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java @@ -0,0 +1,275 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; +import com.pipedream.api.resources.proxy.requests.ProxyGetRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPatchRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPostRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPutRequest; +import java.io.IOException; +import java.util.Map; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawProxyClient { + protected final ClientOptions clientOptions; + + public RawProxyClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> get(String url64, ProxyGetRequest request) { + return get(url64, request, null); + } + + public PipedreamApiHttpResponse> get( + String url64, ProxyGetRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> post(String url64, ProxyPostRequest request) { + return post(url64, request, null); + } + + public PipedreamApiHttpResponse> post( + String url64, ProxyPostRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> put(String url64, ProxyPutRequest request) { + return put(url64, request, null); + } + + public PipedreamApiHttpResponse> put( + String url64, ProxyPutRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> delete(String url64, ProxyDeleteRequest request) { + return delete(url64, request, null); + } + + public PipedreamApiHttpResponse> delete( + String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> patch(String url64, ProxyPatchRequest request) { + return patch(url64, request, null); + } + + public PipedreamApiHttpResponse> patch( + String url64, ProxyPatchRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyDeleteRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyDeleteRequest.java new file mode 100644 index 0000000..f956f17 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyDeleteRequest.java @@ -0,0 +1,146 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyDeleteRequest.Builder.class) +public final class ProxyDeleteRequest { + private final String externalUserId; + + private final String accountId; + + private final Map additionalProperties; + + private ProxyDeleteRequest(String externalUserId, String accountId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyDeleteRequest && equalTo((ProxyDeleteRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyDeleteRequest other) { + return externalUserId.equals(other.externalUserId) && accountId.equals(other.accountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID for the proxy request

+ */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyDeleteRequest other); + } + + public interface AccountIdStage { + /** + *

The account ID to use for authentication

+ */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyDeleteRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyDeleteRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + return this; + } + + /** + *

The external user ID for the proxy request

+ *

The external user ID for the proxy request

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

The account ID to use for authentication

+ *

The account ID to use for authentication

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + public ProxyDeleteRequest build() { + return new ProxyDeleteRequest(externalUserId, accountId, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyGetRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyGetRequest.java new file mode 100644 index 0000000..bf09229 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyGetRequest.java @@ -0,0 +1,146 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyGetRequest.Builder.class) +public final class ProxyGetRequest { + private final String externalUserId; + + private final String accountId; + + private final Map additionalProperties; + + private ProxyGetRequest(String externalUserId, String accountId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyGetRequest && equalTo((ProxyGetRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyGetRequest other) { + return externalUserId.equals(other.externalUserId) && accountId.equals(other.accountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID for the proxy request

+ */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyGetRequest other); + } + + public interface AccountIdStage { + /** + *

The account ID to use for authentication

+ */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyGetRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyGetRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + return this; + } + + /** + *

The external user ID for the proxy request

+ *

The external user ID for the proxy request

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

The account ID to use for authentication

+ *

The account ID to use for authentication

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + public ProxyGetRequest build() { + return new ProxyGetRequest(externalUserId, accountId, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPatchRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPatchRequest.java new file mode 100644 index 0000000..fe68355 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPatchRequest.java @@ -0,0 +1,208 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +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.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyPatchRequest.Builder.class) +public final class ProxyPatchRequest { + private final String externalUserId; + + private final String accountId; + + private final Map body; + + private final Map additionalProperties; + + private ProxyPatchRequest( + String externalUserId, + String accountId, + Map body, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Request body to forward to the target API + */ + @JsonProperty("body") + public Map getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyPatchRequest && equalTo((ProxyPatchRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyPatchRequest other) { + return externalUserId.equals(other.externalUserId) + && accountId.equals(other.accountId) + && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID for the proxy request

+ */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyPatchRequest other); + } + + public interface AccountIdStage { + /** + *

The account ID to use for authentication

+ */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyPatchRequest build(); + + /** + *

Request body to forward to the target API

+ */ + _FinalStage body(Map body); + + _FinalStage putAllBody(Map body); + + _FinalStage body(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + private Map body = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyPatchRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + body(other.getBody()); + return this; + } + + /** + *

The external user ID for the proxy request

+ *

The external user ID for the proxy request

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

The account ID to use for authentication

+ *

The account ID to use for authentication

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

Request body to forward to the target API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage body(String key, Object value) { + this.body.put(key, value); + return this; + } + + /** + *

Request body to forward to the target API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllBody(Map body) { + this.body.putAll(body); + return this; + } + + /** + *

Request body to forward to the target API

+ */ + @java.lang.Override + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public _FinalStage body(Map body) { + this.body.clear(); + this.body.putAll(body); + return this; + } + + @java.lang.Override + public ProxyPatchRequest build() { + return new ProxyPatchRequest(externalUserId, accountId, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPostRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPostRequest.java new file mode 100644 index 0000000..d648ab4 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPostRequest.java @@ -0,0 +1,208 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +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.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyPostRequest.Builder.class) +public final class ProxyPostRequest { + private final String externalUserId; + + private final String accountId; + + private final Map body; + + private final Map additionalProperties; + + private ProxyPostRequest( + String externalUserId, + String accountId, + Map body, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Request body to forward to the target API + */ + @JsonProperty("body") + public Map getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyPostRequest && equalTo((ProxyPostRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyPostRequest other) { + return externalUserId.equals(other.externalUserId) + && accountId.equals(other.accountId) + && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID for the proxy request

+ */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyPostRequest other); + } + + public interface AccountIdStage { + /** + *

The account ID to use for authentication

+ */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyPostRequest build(); + + /** + *

Request body to forward to the target API

+ */ + _FinalStage body(Map body); + + _FinalStage putAllBody(Map body); + + _FinalStage body(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + private Map body = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyPostRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + body(other.getBody()); + return this; + } + + /** + *

The external user ID for the proxy request

+ *

The external user ID for the proxy request

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

The account ID to use for authentication

+ *

The account ID to use for authentication

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

Request body to forward to the target API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage body(String key, Object value) { + this.body.put(key, value); + return this; + } + + /** + *

Request body to forward to the target API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllBody(Map body) { + this.body.putAll(body); + return this; + } + + /** + *

Request body to forward to the target API

+ */ + @java.lang.Override + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public _FinalStage body(Map body) { + this.body.clear(); + this.body.putAll(body); + return this; + } + + @java.lang.Override + public ProxyPostRequest build() { + return new ProxyPostRequest(externalUserId, accountId, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPutRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPutRequest.java new file mode 100644 index 0000000..d4aaeba --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPutRequest.java @@ -0,0 +1,208 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +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.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyPutRequest.Builder.class) +public final class ProxyPutRequest { + private final String externalUserId; + + private final String accountId; + + private final Map body; + + private final Map additionalProperties; + + private ProxyPutRequest( + String externalUserId, + String accountId, + Map body, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Request body to forward to the target API + */ + @JsonProperty("body") + public Map getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyPutRequest && equalTo((ProxyPutRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyPutRequest other) { + return externalUserId.equals(other.externalUserId) + && accountId.equals(other.accountId) + && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID for the proxy request

+ */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyPutRequest other); + } + + public interface AccountIdStage { + /** + *

The account ID to use for authentication

+ */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyPutRequest build(); + + /** + *

Request body to forward to the target API

+ */ + _FinalStage body(Map body); + + _FinalStage putAllBody(Map body); + + _FinalStage body(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + private Map body = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyPutRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + body(other.getBody()); + return this; + } + + /** + *

The external user ID for the proxy request

+ *

The external user ID for the proxy request

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

The account ID to use for authentication

+ *

The account ID to use for authentication

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

Request body to forward to the target API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage body(String key, Object value) { + this.body.put(key, value); + return this; + } + + /** + *

Request body to forward to the target API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllBody(Map body) { + this.body.putAll(body); + return this; + } + + /** + *

Request body to forward to the target API

+ */ + @java.lang.Override + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public _FinalStage body(Map body) { + this.body.clear(); + this.body.putAll(body); + return this; + } + + @java.lang.Override + public ProxyPutRequest build() { + return new ProxyPutRequest(externalUserId, accountId, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java new file mode 100644 index 0000000..9ddd525 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java @@ -0,0 +1,158 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; +import com.pipedream.api.resources.tokens.requests.TokensValidateRequest; +import com.pipedream.api.types.CreateTokenResponse; +import com.pipedream.api.types.ValidateTokenResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawTokensClient { + protected final ClientOptions clientOptions; + + public AsyncRawTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> create(CreateTokenRequest request) { + return create(request, null); + } + + public CompletableFuture> create( + CreateTokenRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/tokens") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateTokenResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> validate(String ctok) { + return validate(ctok, TokensValidateRequest.builder().build()); + } + + public CompletableFuture> validate( + String ctok, TokensValidateRequest request) { + return validate(ctok, request, null); + } + + public CompletableFuture> validate( + String ctok, TokensValidateRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/tokens") + .addPathSegment(ctok) + .addPathSegments("validate"); + if (request.getParams().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "params", request.getParams().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ValidateTokenResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/AsyncTokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/AsyncTokensClient.java new file mode 100644 index 0000000..eef98a0 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/AsyncTokensClient.java @@ -0,0 +1,51 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; +import com.pipedream.api.resources.tokens.requests.TokensValidateRequest; +import com.pipedream.api.types.CreateTokenResponse; +import com.pipedream.api.types.ValidateTokenResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncTokensClient { + protected final ClientOptions clientOptions; + + private final AsyncRawTokensClient rawClient; + + public AsyncTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawTokensClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture create(CreateTokenRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + public CompletableFuture create(CreateTokenRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture validate(String ctok) { + return this.rawClient.validate(ctok).thenApply(response -> response.body()); + } + + public CompletableFuture validate(String ctok, TokensValidateRequest request) { + return this.rawClient.validate(ctok, request).thenApply(response -> response.body()); + } + + public CompletableFuture validate( + String ctok, TokensValidateRequest request, RequestOptions requestOptions) { + return this.rawClient.validate(ctok, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java new file mode 100644 index 0000000..d20fbea --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java @@ -0,0 +1,127 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; +import com.pipedream.api.resources.tokens.requests.TokensValidateRequest; +import com.pipedream.api.types.CreateTokenResponse; +import com.pipedream.api.types.ValidateTokenResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawTokensClient { + protected final ClientOptions clientOptions; + + public RawTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse create(CreateTokenRequest request) { + return create(request, null); + } + + public PipedreamApiHttpResponse create( + CreateTokenRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/tokens") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateTokenResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse validate(String ctok) { + return validate(ctok, TokensValidateRequest.builder().build()); + } + + public PipedreamApiHttpResponse validate(String ctok, TokensValidateRequest request) { + return validate(ctok, request, null); + } + + public PipedreamApiHttpResponse validate( + String ctok, TokensValidateRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/tokens") + .addPathSegment(ctok) + .addPathSegments("validate"); + if (request.getParams().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "params", request.getParams().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ValidateTokenResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/TokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/TokensClient.java new file mode 100644 index 0000000..98801f4 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/TokensClient.java @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; +import com.pipedream.api.resources.tokens.requests.TokensValidateRequest; +import com.pipedream.api.types.CreateTokenResponse; +import com.pipedream.api.types.ValidateTokenResponse; + +public class TokensClient { + protected final ClientOptions clientOptions; + + private final RawTokensClient rawClient; + + public TokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawTokensClient withRawResponse() { + return this.rawClient; + } + + public CreateTokenResponse create(CreateTokenRequest request) { + return this.rawClient.create(request).body(); + } + + public CreateTokenResponse create(CreateTokenRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + public ValidateTokenResponse validate(String ctok) { + return this.rawClient.validate(ctok).body(); + } + + public ValidateTokenResponse validate(String ctok, TokensValidateRequest request) { + return this.rawClient.validate(ctok, request).body(); + } + + public ValidateTokenResponse validate(String ctok, TokensValidateRequest request, RequestOptions requestOptions) { + return this.rawClient.validate(ctok, request, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/requests/CreateTokenRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/requests/CreateTokenRequest.java new file mode 100644 index 0000000..9ec9c19 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/requests/CreateTokenRequest.java @@ -0,0 +1,338 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens.requests; + +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.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTokenRequest.Builder.class) +public final class CreateTokenRequest { + private final Optional> allowedOrigins; + + private final Optional errorRedirectUri; + + private final String externalUserId; + + private final String projectId; + + private final Optional successRedirectUri; + + private final Optional webhookUri; + + private final Map additionalProperties; + + private CreateTokenRequest( + Optional> allowedOrigins, + Optional errorRedirectUri, + String externalUserId, + String projectId, + Optional successRedirectUri, + Optional webhookUri, + Map additionalProperties) { + this.allowedOrigins = allowedOrigins; + this.errorRedirectUri = errorRedirectUri; + this.externalUserId = externalUserId; + this.projectId = projectId; + this.successRedirectUri = successRedirectUri; + this.webhookUri = webhookUri; + this.additionalProperties = additionalProperties; + } + + /** + * @return List of allowed origins for CORS + */ + @JsonProperty("allowed_origins") + public Optional> getAllowedOrigins() { + return allowedOrigins; + } + + /** + * @return URI to redirect to on error + */ + @JsonProperty("error_redirect_uri") + public Optional getErrorRedirectUri() { + return errorRedirectUri; + } + + /** + * @return Your end user ID, for whom you're creating the token + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The ID of the project + */ + @JsonProperty("project_id") + public String getProjectId() { + return projectId; + } + + /** + * @return URI to redirect to on success + */ + @JsonProperty("success_redirect_uri") + public Optional getSuccessRedirectUri() { + return successRedirectUri; + } + + /** + * @return Webhook URI for notifications + */ + @JsonProperty("webhook_uri") + public Optional getWebhookUri() { + return webhookUri; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTokenRequest && equalTo((CreateTokenRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTokenRequest other) { + return allowedOrigins.equals(other.allowedOrigins) + && errorRedirectUri.equals(other.errorRedirectUri) + && externalUserId.equals(other.externalUserId) + && projectId.equals(other.projectId) + && successRedirectUri.equals(other.successRedirectUri) + && webhookUri.equals(other.webhookUri); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.allowedOrigins, + this.errorRedirectUri, + this.externalUserId, + this.projectId, + this.successRedirectUri, + this.webhookUri); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

Your end user ID, for whom you're creating the token

+ */ + ProjectIdStage externalUserId(@NotNull String externalUserId); + + Builder from(CreateTokenRequest other); + } + + public interface ProjectIdStage { + /** + *

The ID of the project

+ */ + _FinalStage projectId(@NotNull String projectId); + } + + public interface _FinalStage { + CreateTokenRequest build(); + + /** + *

List of allowed origins for CORS

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

URI to redirect to on error

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

URI to redirect to on success

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

Webhook URI for notifications

+ */ + _FinalStage webhookUri(Optional webhookUri); + + _FinalStage webhookUri(String webhookUri); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, ProjectIdStage, _FinalStage { + private String externalUserId; + + private String projectId; + + private Optional webhookUri = Optional.empty(); + + private Optional successRedirectUri = Optional.empty(); + + private Optional errorRedirectUri = Optional.empty(); + + private Optional> allowedOrigins = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTokenRequest other) { + allowedOrigins(other.getAllowedOrigins()); + errorRedirectUri(other.getErrorRedirectUri()); + externalUserId(other.getExternalUserId()); + projectId(other.getProjectId()); + successRedirectUri(other.getSuccessRedirectUri()); + webhookUri(other.getWebhookUri()); + return this; + } + + /** + *

Your end user ID, for whom you're creating the token

+ *

Your end user ID, for whom you're creating the token

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

The ID of the project

+ *

The ID of the project

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

Webhook URI for notifications

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

Webhook URI for notifications

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

URI to redirect to on success

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

URI to redirect to on success

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

URI to redirect to on error

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

URI to redirect to on error

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

List of allowed origins for CORS

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

List of allowed origins for CORS

+ */ + @java.lang.Override + @JsonSetter(value = "allowed_origins", nulls = Nulls.SKIP) + public _FinalStage allowedOrigins(Optional> allowedOrigins) { + this.allowedOrigins = allowedOrigins; + return this; + } + + @java.lang.Override + public CreateTokenRequest build() { + return new CreateTokenRequest( + allowedOrigins, + errorRedirectUri, + externalUserId, + projectId, + successRedirectUri, + webhookUri, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/requests/TokensValidateRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/requests/TokensValidateRequest.java new file mode 100644 index 0000000..1479f3c --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/requests/TokensValidateRequest.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens.requests; + +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 com.pipedream.api.types.ValidateTokenParams; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TokensValidateRequest.Builder.class) +public final class TokensValidateRequest { + private final Optional params; + + private final Map additionalProperties; + + private TokensValidateRequest(Optional params, Map additionalProperties) { + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("params") + public Optional getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TokensValidateRequest && equalTo((TokensValidateRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TokensValidateRequest other) { + return params.equals(other.params); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.params); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional params = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TokensValidateRequest other) { + params(other.getParams()); + return this; + } + + @JsonSetter(value = "params", nulls = Nulls.SKIP) + public Builder params(Optional params) { + this.params = params; + return this; + } + + public Builder params(ValidateTokenParams params) { + this.params = Optional.ofNullable(params); + return this; + } + + public TokensValidateRequest build() { + return new TokensValidateRequest(params, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java new file mode 100644 index 0000000..8e4c08a --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java @@ -0,0 +1,386 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.triggers.requests.DeployTriggerOpts; +import com.pipedream.api.resources.triggers.requests.TriggersConfigurePropRequest; +import com.pipedream.api.resources.triggers.requests.TriggersListRequest; +import com.pipedream.api.resources.triggers.requests.TriggersReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.DeployTriggerResponse; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawTriggersClient { + protected final ClientOptions clientOptions; + + public AsyncRawTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(TriggersListRequest.builder().build()); + } + + public CompletableFuture>> list( + TriggersListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + TriggersListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + TriggersListRequest nextRequest = TriggersListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String componentId) { + return retrieve(componentId, null); + } + + public CompletableFuture> retrieve( + String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> configureProp( + TriggersConfigurePropRequest request) { + return configureProp(request, null); + } + + public CompletableFuture> configureProp( + TriggersConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> reloadProps( + TriggersReloadPropsRequest request) { + return reloadProps(request, null); + } + + public CompletableFuture> reloadProps( + TriggersReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> deploy(DeployTriggerOpts request) { + return deploy(request, null); + } + + public CompletableFuture> deploy( + DeployTriggerOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/deploy") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + DeployTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeployTriggerResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/AsyncTriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/AsyncTriggersClient.java new file mode 100644 index 0000000..2f3361f --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/AsyncTriggersClient.java @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.triggers.requests.DeployTriggerOpts; +import com.pipedream.api.resources.triggers.requests.TriggersConfigurePropRequest; +import com.pipedream.api.resources.triggers.requests.TriggersListRequest; +import com.pipedream.api.resources.triggers.requests.TriggersReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.ReloadPropsResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncTriggersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawTriggersClient rawClient; + + public AsyncTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawTriggersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawTriggersClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(TriggersListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + TriggersListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId) { + return this.rawClient.retrieve(componentId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp(TriggersConfigurePropRequest request) { + return this.rawClient.configureProp(request).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp( + TriggersConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps(TriggersReloadPropsRequest request) { + return this.rawClient.reloadProps(request).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps( + TriggersReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture deploy(DeployTriggerOpts request) { + return this.rawClient.deploy(request).thenApply(response -> response.body()); + } + + public CompletableFuture deploy(DeployTriggerOpts request, RequestOptions requestOptions) { + return this.rawClient.deploy(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java new file mode 100644 index 0000000..83abd08 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java @@ -0,0 +1,305 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.triggers.requests.DeployTriggerOpts; +import com.pipedream.api.resources.triggers.requests.TriggersConfigurePropRequest; +import com.pipedream.api.resources.triggers.requests.TriggersListRequest; +import com.pipedream.api.resources.triggers.requests.TriggersReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.DeployTriggerResponse; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawTriggersClient { + protected final ClientOptions clientOptions; + + public RawTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(TriggersListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(TriggersListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + TriggersListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + TriggersListRequest nextRequest = TriggersListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String componentId) { + return retrieve(componentId, null); + } + + public PipedreamApiHttpResponse retrieve(String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse configureProp(TriggersConfigurePropRequest request) { + return configureProp(request, null); + } + + public PipedreamApiHttpResponse configureProp( + TriggersConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse reloadProps(TriggersReloadPropsRequest request) { + return reloadProps(request, null); + } + + public PipedreamApiHttpResponse reloadProps( + TriggersReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse deploy(DeployTriggerOpts request) { + return deploy(request, null); + } + + public PipedreamApiHttpResponse deploy( + DeployTriggerOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/deploy") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + DeployTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeployTriggerResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/TriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/TriggersClient.java new file mode 100644 index 0000000..d16a37b --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/TriggersClient.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.triggers.requests.DeployTriggerOpts; +import com.pipedream.api.resources.triggers.requests.TriggersConfigurePropRequest; +import com.pipedream.api.resources.triggers.requests.TriggersListRequest; +import com.pipedream.api.resources.triggers.requests.TriggersReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.ReloadPropsResponse; + +public class TriggersClient { + protected final ClientOptions clientOptions; + + private final RawTriggersClient rawClient; + + public TriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawTriggersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawTriggersClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(TriggersListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(TriggersListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public Component retrieve(String componentId) { + return this.rawClient.retrieve(componentId).body(); + } + + public Component retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).body(); + } + + public ConfigurePropResponse configureProp(TriggersConfigurePropRequest request) { + return this.rawClient.configureProp(request).body(); + } + + public ConfigurePropResponse configureProp(TriggersConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).body(); + } + + public ReloadPropsResponse reloadProps(TriggersReloadPropsRequest request) { + return this.rawClient.reloadProps(request).body(); + } + + public ReloadPropsResponse reloadProps(TriggersReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).body(); + } + + public DeployedComponent deploy(DeployTriggerOpts request) { + return this.rawClient.deploy(request).body(); + } + + public DeployedComponent deploy(DeployTriggerOpts request, RequestOptions requestOptions) { + return this.rawClient.deploy(request, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/DeployTriggerOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/DeployTriggerOpts.java new file mode 100644 index 0000000..b45a651 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/DeployTriggerOpts.java @@ -0,0 +1,282 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers.requests; + +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 = DeployTriggerOpts.Builder.class) +public final class DeployTriggerOpts { + private final String id; + + private final String externalUserId; + + private final Optional> configuredProps; + + private final Optional dynamicPropsId; + + private final Optional webhookUrl; + + private final Map additionalProperties; + + private DeployTriggerOpts( + String id, + String externalUserId, + Optional> configuredProps, + Optional dynamicPropsId, + Optional webhookUrl, + Map additionalProperties) { + this.id = id; + this.externalUserId = externalUserId; + this.configuredProps = configuredProps; + this.dynamicPropsId = dynamicPropsId; + this.webhookUrl = webhookUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The trigger component ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The external user ID + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The configured properties for the trigger + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The ID for dynamic props + */ + @JsonProperty("dynamic_props_id") + public Optional getDynamicPropsId() { + return dynamicPropsId; + } + + /** + * @return Optional webhook URL to receive trigger events + */ + @JsonProperty("webhook_url") + public Optional getWebhookUrl() { + return webhookUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployTriggerOpts && equalTo((DeployTriggerOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployTriggerOpts other) { + return id.equals(other.id) + && externalUserId.equals(other.externalUserId) + && configuredProps.equals(other.configuredProps) + && dynamicPropsId.equals(other.dynamicPropsId) + && webhookUrl.equals(other.webhookUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.externalUserId, this.configuredProps, this.dynamicPropsId, this.webhookUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The trigger component ID

+ */ + ExternalUserIdStage id(@NotNull String id); + + Builder from(DeployTriggerOpts other); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID

+ */ + _FinalStage externalUserId(@NotNull String externalUserId); + } + + public interface _FinalStage { + DeployTriggerOpts build(); + + /** + *

The configured properties for the trigger

+ */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

The ID for dynamic props

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

Optional webhook URL to receive trigger events

+ */ + _FinalStage webhookUrl(Optional webhookUrl); + + _FinalStage webhookUrl(String webhookUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ExternalUserIdStage, _FinalStage { + private String id; + + private String externalUserId; + + private Optional webhookUrl = Optional.empty(); + + private Optional dynamicPropsId = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployTriggerOpts other) { + id(other.getId()); + externalUserId(other.getExternalUserId()); + configuredProps(other.getConfiguredProps()); + dynamicPropsId(other.getDynamicPropsId()); + webhookUrl(other.getWebhookUrl()); + return this; + } + + /** + *

The trigger component ID

+ *

The trigger component ID

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

The external user ID

+ *

The external user ID

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

Optional webhook URL to receive trigger events

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

Optional webhook URL to receive trigger events

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

The ID for dynamic props

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

The ID for dynamic props

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

The configured properties for the trigger

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

The configured properties for the trigger

+ */ + @java.lang.Override + @JsonSetter(value = "configured_props", nulls = Nulls.SKIP) + public _FinalStage configuredProps(Optional> configuredProps) { + this.configuredProps = configuredProps; + return this; + } + + @java.lang.Override + public DeployTriggerOpts build() { + return new DeployTriggerOpts( + id, externalUserId, configuredProps, dynamicPropsId, webhookUrl, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersConfigurePropRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersConfigurePropRequest.java new file mode 100644 index 0000000..dda960b --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersConfigurePropRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers.requests; + +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 com.pipedream.api.types.ConfigurePropOpts; +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 = TriggersConfigurePropRequest.Builder.class) +public final class TriggersConfigurePropRequest { + private final Optional asyncHandle; + + private final ConfigurePropOpts body; + + private final Map additionalProperties; + + private TriggersConfigurePropRequest( + Optional asyncHandle, ConfigurePropOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ConfigurePropOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TriggersConfigurePropRequest && equalTo((TriggersConfigurePropRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TriggersConfigurePropRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ConfigurePropOpts body); + + Builder from(TriggersConfigurePropRequest other); + } + + public interface _FinalStage { + TriggersConfigurePropRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ConfigurePropOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TriggersConfigurePropRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ConfigurePropOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public TriggersConfigurePropRequest build() { + return new TriggersConfigurePropRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersListRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersListRequest.java new file mode 100644 index 0000000..833a738 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersListRequest.java @@ -0,0 +1,223 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TriggersListRequest.Builder.class) +public final class TriggersListRequest { + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional q; + + private final Optional app; + + private final Map additionalProperties; + + private TriggersListRequest( + Optional after, + Optional before, + Optional limit, + Optional q, + Optional app, + Map additionalProperties) { + this.after = after; + this.before = before; + this.limit = limit; + this.q = q; + this.app = app; + this.additionalProperties = additionalProperties; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return A search query to filter the triggers + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return The ID or name slug of the app to filter the triggers + */ + @JsonProperty("app") + public Optional getApp() { + return app; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TriggersListRequest && equalTo((TriggersListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TriggersListRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && q.equals(other.q) + && app.equals(other.app); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.limit, this.q, this.app); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional app = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TriggersListRequest other) { + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + q(other.getQ()); + app(other.getApp()); + return this; + } + + /** + *

The cursor to start from for pagination

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The cursor to end before for pagination

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The maximum number of results to return

+ */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

A search query to filter the triggers

+ */ + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + /** + *

The ID or name slug of the app to filter the triggers

+ */ + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(String app) { + this.app = Optional.ofNullable(app); + return this; + } + + public TriggersListRequest build() { + return new TriggersListRequest(after, before, limit, q, app, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersReloadPropsRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersReloadPropsRequest.java new file mode 100644 index 0000000..b40b8ca --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersReloadPropsRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers.requests; + +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 com.pipedream.api.types.ReloadPropsOpts; +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 = TriggersReloadPropsRequest.Builder.class) +public final class TriggersReloadPropsRequest { + private final Optional asyncHandle; + + private final ReloadPropsOpts body; + + private final Map additionalProperties; + + private TriggersReloadPropsRequest( + Optional asyncHandle, ReloadPropsOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ReloadPropsOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TriggersReloadPropsRequest && equalTo((TriggersReloadPropsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TriggersReloadPropsRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ReloadPropsOpts body); + + Builder from(TriggersReloadPropsRequest other); + } + + public interface _FinalStage { + TriggersReloadPropsRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ReloadPropsOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TriggersReloadPropsRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ReloadPropsOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public TriggersReloadPropsRequest build() { + return new TriggersReloadPropsRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java new file mode 100644 index 0000000..5cb2cdb --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java @@ -0,0 +1,81 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.users; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawUsersClient { + protected final ClientOptions clientOptions; + + public AsyncRawUsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> deleteExternalUser(String externalUserId) { + return deleteExternalUser(externalUserId, null); + } + + public CompletableFuture> deleteExternalUser( + String externalUserId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("users") + .addPathSegment(externalUserId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/AsyncUsersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/AsyncUsersClient.java new file mode 100644 index 0000000..97dafe2 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/AsyncUsersClient.java @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.users; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import java.util.concurrent.CompletableFuture; + +public class AsyncUsersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawUsersClient rawClient; + + public AsyncUsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawUsersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawUsersClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture deleteExternalUser(String externalUserId) { + return this.rawClient.deleteExternalUser(externalUserId).thenApply(response -> response.body()); + } + + public CompletableFuture deleteExternalUser(String externalUserId, RequestOptions requestOptions) { + return this.rawClient.deleteExternalUser(externalUserId, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java new file mode 100644 index 0000000..7fe69c9 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java @@ -0,0 +1,63 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.users; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawUsersClient { + protected final ClientOptions clientOptions; + + public RawUsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse deleteExternalUser(String externalUserId) { + return deleteExternalUser(externalUserId, null); + } + + public PipedreamApiHttpResponse deleteExternalUser(String externalUserId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("users") + .addPathSegment(externalUserId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/UsersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/UsersClient.java new file mode 100644 index 0000000..a00362d --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/UsersClient.java @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.users; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; + +public class UsersClient { + protected final ClientOptions clientOptions; + + private final RawUsersClient rawClient; + + public UsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawUsersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawUsersClient withRawResponse() { + return this.rawClient; + } + + public void deleteExternalUser(String externalUserId) { + this.rawClient.deleteExternalUser(externalUserId).body(); + } + + public void deleteExternalUser(String externalUserId, RequestOptions requestOptions) { + this.rawClient.deleteExternalUser(externalUserId, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/Account.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/Account.java new file mode 100644 index 0000000..30c5157 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/Account.java @@ -0,0 +1,485 @@ +/** + * 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.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Account.Builder.class) +public final class Account { + private final Optional id; + + private final Optional name; + + private final Optional externalId; + + private final Optional healthy; + + private final Optional dead; + + private final Optional app; + + private final Optional createdAt; + + private final Optional updatedAt; + + private final Optional> credentials; + + private final Optional expiresAt; + + private final Optional error; + + private final Optional lastRefreshedAt; + + private final Optional nextRefreshAt; + + private final Map additionalProperties; + + private Account( + Optional id, + Optional name, + Optional externalId, + Optional healthy, + Optional dead, + Optional app, + Optional createdAt, + Optional updatedAt, + Optional> credentials, + Optional expiresAt, + Optional error, + Optional lastRefreshedAt, + Optional nextRefreshAt, + Map additionalProperties) { + this.id = id; + this.name = name; + this.externalId = externalId; + this.healthy = healthy; + this.dead = dead; + this.app = app; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.credentials = credentials; + this.expiresAt = expiresAt; + this.error = error; + this.lastRefreshedAt = lastRefreshedAt; + this.nextRefreshAt = nextRefreshAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique ID of the account. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The custom name of the account if set. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return The external ID associated with the account. + */ + @JsonProperty("external_id") + public Optional getExternalId() { + return externalId; + } + + /** + * @return Indicates if the account is healthy. Pipedream will periodically retry token refresh and test requests for unhealthy accounts + */ + @JsonProperty("healthy") + public Optional getHealthy() { + return healthy; + } + + /** + * @return Indicates if the account is no longer active + */ + @JsonProperty("dead") + public Optional getDead() { + return dead; + } + + @JsonProperty("app") + public Optional getApp() { + return app; + } + + /** + * @return The date and time the account was created, an ISO 8601 formatted string + */ + @JsonProperty("created_at") + public Optional getCreatedAt() { + return createdAt; + } + + /** + * @return The date and time the account was last updated, an ISO 8601 formatted string + */ + @JsonProperty("updated_at") + public Optional getUpdatedAt() { + return updatedAt; + } + + /** + * @return The credentials associated with the account, if the include_credentials parameter was set to true in the request + */ + @JsonProperty("credentials") + public Optional> getCredentials() { + return credentials; + } + + /** + * @return The date and time the account's credentials expiration, an ISO 8601 formatted string + */ + @JsonProperty("expires_at") + public Optional getExpiresAt() { + return expiresAt; + } + + /** + * @return The error message if the account is unhealthy or dead, null otherwise + */ + @JsonProperty("error") + public Optional getError() { + return error; + } + + /** + * @return The date and time the account was last refreshed, an ISO 8601 formatted string + */ + @JsonProperty("last_refreshed_at") + public Optional getLastRefreshedAt() { + return lastRefreshedAt; + } + + /** + * @return The date and time the account will next be refreshed, an ISO 8601 formatted string + */ + @JsonProperty("next_refresh_at") + public Optional getNextRefreshAt() { + return nextRefreshAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Account && equalTo((Account) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Account other) { + return id.equals(other.id) + && name.equals(other.name) + && externalId.equals(other.externalId) + && healthy.equals(other.healthy) + && dead.equals(other.dead) + && app.equals(other.app) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && credentials.equals(other.credentials) + && expiresAt.equals(other.expiresAt) + && error.equals(other.error) + && lastRefreshedAt.equals(other.lastRefreshedAt) + && nextRefreshAt.equals(other.nextRefreshAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.name, + this.externalId, + this.healthy, + this.dead, + this.app, + this.createdAt, + this.updatedAt, + this.credentials, + this.expiresAt, + this.error, + this.lastRefreshedAt, + this.nextRefreshAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional externalId = Optional.empty(); + + private Optional healthy = Optional.empty(); + + private Optional dead = Optional.empty(); + + private Optional app = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional updatedAt = Optional.empty(); + + private Optional> credentials = Optional.empty(); + + private Optional expiresAt = Optional.empty(); + + private Optional error = Optional.empty(); + + private Optional lastRefreshedAt = Optional.empty(); + + private Optional nextRefreshAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(Account other) { + id(other.getId()); + name(other.getName()); + externalId(other.getExternalId()); + healthy(other.getHealthy()); + dead(other.getDead()); + app(other.getApp()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + credentials(other.getCredentials()); + expiresAt(other.getExpiresAt()); + error(other.getError()); + lastRefreshedAt(other.getLastRefreshedAt()); + nextRefreshAt(other.getNextRefreshAt()); + return this; + } + + /** + *

The unique ID of the account.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

The custom name of the account if set.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The external ID associated with the account.

+ */ + @JsonSetter(value = "external_id", nulls = Nulls.SKIP) + public Builder externalId(Optional externalId) { + this.externalId = externalId; + return this; + } + + public Builder externalId(String externalId) { + this.externalId = Optional.ofNullable(externalId); + return this; + } + + /** + *

Indicates if the account is healthy. Pipedream will periodically retry token refresh and test requests for unhealthy accounts

+ */ + @JsonSetter(value = "healthy", nulls = Nulls.SKIP) + public Builder healthy(Optional healthy) { + this.healthy = healthy; + return this; + } + + public Builder healthy(Boolean healthy) { + this.healthy = Optional.ofNullable(healthy); + return this; + } + + /** + *

Indicates if the account is no longer active

+ */ + @JsonSetter(value = "dead", nulls = Nulls.SKIP) + public Builder dead(Optional dead) { + this.dead = dead; + return this; + } + + public Builder dead(Boolean dead) { + this.dead = Optional.ofNullable(dead); + return this; + } + + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(App app) { + this.app = Optional.ofNullable(app); + return this; + } + + /** + *

The date and time the account was created, an ISO 8601 formatted string

+ */ + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public Builder createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + public Builder createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

The date and time the account was last updated, an ISO 8601 formatted string

+ */ + @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) + public Builder updatedAt(Optional updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public Builder updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = Optional.ofNullable(updatedAt); + return this; + } + + /** + *

The credentials associated with the account, if the include_credentials parameter was set to true in the request

+ */ + @JsonSetter(value = "credentials", nulls = Nulls.SKIP) + public Builder credentials(Optional> credentials) { + this.credentials = credentials; + return this; + } + + public Builder credentials(Map credentials) { + this.credentials = Optional.ofNullable(credentials); + return this; + } + + /** + *

The date and time the account's credentials expiration, an ISO 8601 formatted string

+ */ + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public Builder expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + public Builder expiresAt(OffsetDateTime expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + /** + *

The error message if the account is unhealthy or dead, null otherwise

+ */ + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public Builder error(Optional error) { + this.error = error; + return this; + } + + public Builder error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + /** + *

The date and time the account was last refreshed, an ISO 8601 formatted string

+ */ + @JsonSetter(value = "last_refreshed_at", nulls = Nulls.SKIP) + public Builder lastRefreshedAt(Optional lastRefreshedAt) { + this.lastRefreshedAt = lastRefreshedAt; + return this; + } + + public Builder lastRefreshedAt(OffsetDateTime lastRefreshedAt) { + this.lastRefreshedAt = Optional.ofNullable(lastRefreshedAt); + return this; + } + + /** + *

The date and time the account will next be refreshed, an ISO 8601 formatted string

+ */ + @JsonSetter(value = "next_refresh_at", nulls = Nulls.SKIP) + public Builder nextRefreshAt(Optional nextRefreshAt) { + this.nextRefreshAt = nextRefreshAt; + return this; + } + + public Builder nextRefreshAt(OffsetDateTime nextRefreshAt) { + this.nextRefreshAt = Optional.ofNullable(nextRefreshAt); + return this; + } + + public Account build() { + return new Account( + id, + name, + externalId, + healthy, + dead, + app, + createdAt, + updatedAt, + credentials, + expiresAt, + error, + lastRefreshedAt, + nextRefreshAt, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/App.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/App.java new file mode 100644 index 0000000..2983820 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/App.java @@ -0,0 +1,472 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = App.Builder.class) +public final class App { + private final Optional id; + + private final String nameSlug; + + private final String name; + + private final Optional authType; + + private final Optional description; + + private final String imgSrc; + + private final Optional customFieldsJson; + + private final List categories; + + private final double featuredWeight; + + private final Map additionalProperties; + + private App( + Optional id, + String nameSlug, + String name, + Optional authType, + Optional description, + String imgSrc, + Optional customFieldsJson, + List categories, + double featuredWeight, + Map additionalProperties) { + this.id = id; + this.nameSlug = nameSlug; + this.name = name; + this.authType = authType; + this.description = description; + this.imgSrc = imgSrc; + this.customFieldsJson = customFieldsJson; + this.categories = categories; + this.featuredWeight = featuredWeight; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the app. Only applies for OAuth apps. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug) + */ + @JsonProperty("name_slug") + public String getNameSlug() { + return nameSlug; + } + + /** + * @return The human-readable name of the app + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The authentication type used by the app + */ + @JsonProperty("auth_type") + public Optional getAuthType() { + return authType; + } + + /** + * @return A short description of the app + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return The URL to the app's logo + */ + @JsonProperty("img_src") + public String getImgSrc() { + return imgSrc; + } + + /** + * @return A JSON string representing the custom fields for the app + */ + @JsonProperty("custom_fields_json") + public Optional getCustomFieldsJson() { + return customFieldsJson; + } + + /** + * @return Categories associated with the app + */ + @JsonProperty("categories") + public List getCategories() { + return categories; + } + + /** + * @return A rough directional ordering of app popularity, subject to changes by Pipedream + */ + @JsonProperty("featured_weight") + public double getFeaturedWeight() { + return featuredWeight; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof App && equalTo((App) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(App other) { + return id.equals(other.id) + && nameSlug.equals(other.nameSlug) + && name.equals(other.name) + && authType.equals(other.authType) + && description.equals(other.description) + && imgSrc.equals(other.imgSrc) + && customFieldsJson.equals(other.customFieldsJson) + && categories.equals(other.categories) + && featuredWeight == other.featuredWeight; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.nameSlug, + this.name, + this.authType, + this.description, + this.imgSrc, + this.customFieldsJson, + this.categories, + this.featuredWeight); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameSlugStage builder() { + return new Builder(); + } + + public interface NameSlugStage { + /** + *

The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug)

+ */ + NameStage nameSlug(@NotNull String nameSlug); + + Builder from(App other); + } + + public interface NameStage { + /** + *

The human-readable name of the app

+ */ + ImgSrcStage name(@NotNull String name); + } + + public interface ImgSrcStage { + /** + *

The URL to the app's logo

+ */ + FeaturedWeightStage imgSrc(@NotNull String imgSrc); + } + + public interface FeaturedWeightStage { + /** + *

A rough directional ordering of app popularity, subject to changes by Pipedream

+ */ + _FinalStage featuredWeight(double featuredWeight); + } + + public interface _FinalStage { + App build(); + + /** + *

ID of the app. Only applies for OAuth apps.

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

The authentication type used by the app

+ */ + _FinalStage authType(Optional authType); + + _FinalStage authType(AppAuthType authType); + + /** + *

A short description of the app

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

A JSON string representing the custom fields for the app

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

Categories associated with the app

+ */ + _FinalStage categories(List categories); + + _FinalStage addCategories(String categories); + + _FinalStage addAllCategories(List categories); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements NameSlugStage, NameStage, ImgSrcStage, FeaturedWeightStage, _FinalStage { + private String nameSlug; + + private String name; + + private String imgSrc; + + private double featuredWeight; + + private List categories = new ArrayList<>(); + + private Optional customFieldsJson = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional authType = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(App other) { + id(other.getId()); + nameSlug(other.getNameSlug()); + name(other.getName()); + authType(other.getAuthType()); + description(other.getDescription()); + imgSrc(other.getImgSrc()); + customFieldsJson(other.getCustomFieldsJson()); + categories(other.getCategories()); + featuredWeight(other.getFeaturedWeight()); + return this; + } + + /** + *

The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug)

+ *

The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug)

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

The human-readable name of the app

+ *

The human-readable name of the app

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

The URL to the app's logo

+ *

The URL to the app's logo

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

A rough directional ordering of app popularity, subject to changes by Pipedream

+ *

A rough directional ordering of app popularity, subject to changes by Pipedream

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("featured_weight") + public _FinalStage featuredWeight(double featuredWeight) { + this.featuredWeight = featuredWeight; + return this; + } + + /** + *

Categories associated with the app

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

Categories associated with the app

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

Categories associated with the app

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

A JSON string representing the custom fields for the app

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

A JSON string representing the custom fields for the app

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

A short description of the app

+ * @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 short description of the app

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

The authentication type used by the app

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

The authentication type used by the app

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

ID of the app. Only applies for OAuth apps.

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

ID of the app. Only applies for OAuth apps.

+ */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @java.lang.Override + public App build() { + return new App( + id, + nameSlug, + name, + authType, + description, + imgSrc, + customFieldsJson, + categories, + featuredWeight, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/AppAuthType.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/AppAuthType.java new file mode 100644 index 0000000..e795709 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/AppAuthType.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AppAuthType { + KEYS("keys"), + + OAUTH("oauth"), + + NONE("none"); + + private final String value; + + AppAuthType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/AppCategory.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/AppCategory.java new file mode 100644 index 0000000..12799ff --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/AppCategory.java @@ -0,0 +1,161 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppCategory.Builder.class) +public final class AppCategory { + private final Optional id; + + private final Optional name; + + private final Optional description; + + private final Map additionalProperties; + + private AppCategory( + Optional id, + Optional name, + Optional description, + Map additionalProperties) { + this.id = id; + this.name = name; + this.description = description; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the app category + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The human-readable name of the app category + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return A short description of the app category + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppCategory && equalTo((AppCategory) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppCategory other) { + return id.equals(other.id) && name.equals(other.name) && description.equals(other.description); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.description); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AppCategory other) { + id(other.getId()); + name(other.getName()); + description(other.getDescription()); + return this; + } + + /** + *

ID of the app category

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

The human-readable name of the app category

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

A short description of the app category

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + public AppCategory build() { + return new AppCategory(id, name, description, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/BackendClientOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/BackendClientOpts.java new file mode 100644 index 0000000..cdf9287 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/BackendClientOpts.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BackendClientOpts.Builder.class) +public final class BackendClientOpts { + private final Optional clientId; + + private final Optional clientSecret; + + private final Optional apiUrl; + + private final Map additionalProperties; + + private BackendClientOpts( + Optional clientId, + Optional clientSecret, + Optional apiUrl, + Map additionalProperties) { + this.clientId = clientId; + this.clientSecret = clientSecret; + this.apiUrl = apiUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The client ID for authentication + */ + @JsonProperty("client_id") + public Optional getClientId() { + return clientId; + } + + /** + * @return The client secret for authentication + */ + @JsonProperty("client_secret") + public Optional getClientSecret() { + return clientSecret; + } + + /** + * @return The API URL to use + */ + @JsonProperty("api_url") + public Optional getApiUrl() { + return apiUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BackendClientOpts && equalTo((BackendClientOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BackendClientOpts other) { + return clientId.equals(other.clientId) + && clientSecret.equals(other.clientSecret) + && apiUrl.equals(other.apiUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.clientId, this.clientSecret, this.apiUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional clientId = Optional.empty(); + + private Optional clientSecret = Optional.empty(); + + private Optional apiUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(BackendClientOpts other) { + clientId(other.getClientId()); + clientSecret(other.getClientSecret()); + apiUrl(other.getApiUrl()); + return this; + } + + /** + *

The client ID for authentication

+ */ + @JsonSetter(value = "client_id", nulls = Nulls.SKIP) + public Builder clientId(Optional clientId) { + this.clientId = clientId; + return this; + } + + public Builder clientId(String clientId) { + this.clientId = Optional.ofNullable(clientId); + return this; + } + + /** + *

The client secret for authentication

+ */ + @JsonSetter(value = "client_secret", nulls = Nulls.SKIP) + public Builder clientSecret(Optional clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + public Builder clientSecret(String clientSecret) { + this.clientSecret = Optional.ofNullable(clientSecret); + return this; + } + + /** + *

The API URL to use

+ */ + @JsonSetter(value = "api_url", nulls = Nulls.SKIP) + public Builder apiUrl(Optional apiUrl) { + this.apiUrl = apiUrl; + return this; + } + + public Builder apiUrl(String apiUrl) { + this.apiUrl = Optional.ofNullable(apiUrl); + return this; + } + + public BackendClientOpts build() { + return new BackendClientOpts(clientId, clientSecret, apiUrl, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ClientOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ClientOpts.java new file mode 100644 index 0000000..70aa6e6 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ClientOpts.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientOpts.Builder.class) +public final class ClientOpts { + private final Optional clientId; + + private final Optional clientSecret; + + private final Optional apiUrl; + + private final Map additionalProperties; + + private ClientOpts( + Optional clientId, + Optional clientSecret, + Optional apiUrl, + Map additionalProperties) { + this.clientId = clientId; + this.clientSecret = clientSecret; + this.apiUrl = apiUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The client ID for authentication + */ + @JsonProperty("client_id") + public Optional getClientId() { + return clientId; + } + + /** + * @return The client secret for authentication + */ + @JsonProperty("client_secret") + public Optional getClientSecret() { + return clientSecret; + } + + /** + * @return The API URL to use (defaults to https://api.pipedream.com/) + */ + @JsonProperty("api_url") + public Optional getApiUrl() { + return apiUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientOpts && equalTo((ClientOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClientOpts other) { + return clientId.equals(other.clientId) + && clientSecret.equals(other.clientSecret) + && apiUrl.equals(other.apiUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.clientId, this.clientSecret, this.apiUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional clientId = Optional.empty(); + + private Optional clientSecret = Optional.empty(); + + private Optional apiUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ClientOpts other) { + clientId(other.getClientId()); + clientSecret(other.getClientSecret()); + apiUrl(other.getApiUrl()); + return this; + } + + /** + *

The client ID for authentication

+ */ + @JsonSetter(value = "client_id", nulls = Nulls.SKIP) + public Builder clientId(Optional clientId) { + this.clientId = clientId; + return this; + } + + public Builder clientId(String clientId) { + this.clientId = Optional.ofNullable(clientId); + return this; + } + + /** + *

The client secret for authentication

+ */ + @JsonSetter(value = "client_secret", nulls = Nulls.SKIP) + public Builder clientSecret(Optional clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + public Builder clientSecret(String clientSecret) { + this.clientSecret = Optional.ofNullable(clientSecret); + return this; + } + + /** + *

The API URL to use (defaults to https://api.pipedream.com/)

+ */ + @JsonSetter(value = "api_url", nulls = Nulls.SKIP) + public Builder apiUrl(Optional apiUrl) { + this.apiUrl = apiUrl; + return this; + } + + public Builder apiUrl(String apiUrl) { + this.apiUrl = Optional.ofNullable(apiUrl); + return this; + } + + public ClientOpts build() { + return new ClientOpts(clientId, clientSecret, apiUrl, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/Component.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/Component.java new file mode 100644 index 0000000..95cbe86 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/Component.java @@ -0,0 +1,365 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Component.Builder.class) +public final class Component { + private final String key; + + private final String name; + + private final String version; + + private final List configurableProps; + + private final Optional description; + + private final Optional componentType; + + private final Optional stash; + + private final Map additionalProperties; + + private Component( + String key, + String name, + String version, + List configurableProps, + Optional description, + Optional componentType, + Optional stash, + Map additionalProperties) { + this.key = key; + this.name = name; + this.version = version; + this.configurableProps = configurableProps; + this.description = description; + this.componentType = componentType; + this.stash = stash; + this.additionalProperties = additionalProperties; + } + + /** + * @return The key that uniquely identifies the component. + */ + @JsonProperty("key") + public String getKey() { + return key; + } + + /** + * @return The human-readable name of the component, e.g. 'GitLab: List Commits' + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The latest version of the component, in SemVer format. + */ + @JsonProperty("version") + public String getVersion() { + return version; + } + + @JsonProperty("configurable_props") + public List getConfigurableProps() { + return configurableProps; + } + + /** + * @return A description of the component + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return The type of component (trigger or action) + */ + @JsonProperty("component_type") + public Optional getComponentType() { + return componentType; + } + + /** + * @return Indicates if a File Stash ID is optional or required to run the component + */ + @JsonProperty("stash") + public Optional getStash() { + return stash; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Component && equalTo((Component) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Component other) { + return key.equals(other.key) + && name.equals(other.name) + && version.equals(other.version) + && configurableProps.equals(other.configurableProps) + && description.equals(other.description) + && componentType.equals(other.componentType) + && stash.equals(other.stash); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.key, + this.name, + this.version, + this.configurableProps, + this.description, + this.componentType, + this.stash); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static KeyStage builder() { + return new Builder(); + } + + public interface KeyStage { + /** + *

The key that uniquely identifies the component.

+ */ + NameStage key(@NotNull String key); + + Builder from(Component other); + } + + public interface NameStage { + /** + *

The human-readable name of the component, e.g. 'GitLab: List Commits'

+ */ + VersionStage name(@NotNull String name); + } + + public interface VersionStage { + /** + *

The latest version of the component, in SemVer format.

+ */ + _FinalStage version(@NotNull String version); + } + + public interface _FinalStage { + Component build(); + + _FinalStage configurableProps(List configurableProps); + + _FinalStage addConfigurableProps(ConfigurableProp configurableProps); + + _FinalStage addAllConfigurableProps(List configurableProps); + + /** + *

A description of the component

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

The type of component (trigger or action)

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

Indicates if a File Stash ID is optional or required to run the component

+ */ + _FinalStage stash(Optional stash); + + _FinalStage stash(ComponentStash stash); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements KeyStage, NameStage, VersionStage, _FinalStage { + private String key; + + private String name; + + private String version; + + private Optional stash = Optional.empty(); + + private Optional componentType = Optional.empty(); + + private Optional description = Optional.empty(); + + private List configurableProps = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Component other) { + key(other.getKey()); + name(other.getName()); + version(other.getVersion()); + configurableProps(other.getConfigurableProps()); + description(other.getDescription()); + componentType(other.getComponentType()); + stash(other.getStash()); + return this; + } + + /** + *

The key that uniquely identifies the component.

+ *

The key that uniquely identifies the component.

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

The human-readable name of the component, e.g. 'GitLab: List Commits'

+ *

The human-readable name of the component, e.g. 'GitLab: List Commits'

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

The latest version of the component, in SemVer format.

+ *

The latest version of the component, in SemVer format.

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

Indicates if a File Stash ID is optional or required to run the component

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

Indicates if a File Stash ID is optional or required to run the component

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

The type of component (trigger or action)

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

The type of component (trigger or action)

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

A description of 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 component

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public _FinalStage addAllConfigurableProps(List configurableProps) { + this.configurableProps.addAll(configurableProps); + return this; + } + + @java.lang.Override + public _FinalStage addConfigurableProps(ConfigurableProp configurableProps) { + this.configurableProps.add(configurableProps); + return this; + } + + @java.lang.Override + @JsonSetter(value = "configurable_props", nulls = Nulls.SKIP) + public _FinalStage configurableProps(List configurableProps) { + this.configurableProps.clear(); + this.configurableProps.addAll(configurableProps); + return this; + } + + @java.lang.Override + public Component build() { + return new Component( + key, name, version, configurableProps, description, componentType, stash, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ComponentStash.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ComponentStash.java new file mode 100644 index 0000000..ffbda73 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ComponentStash.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ComponentStash { + OPTIONAL("optional"), + + REQUIRED("required"); + + private final String value; + + ComponentStash(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurableProp.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurableProp.java new file mode 100644 index 0000000..9b27278 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurableProp.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurableProp.Builder.class) +public final class ConfigurableProp { + private final Optional name; + + private final Optional type; + + 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 ConfigurableProp( + Optional name, + Optional 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; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @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; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurableProp && equalTo((ConfigurableProp) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + 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); + } + + @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); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional name = Optional.empty(); + + private Optional type = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + 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; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurableProp build() { + return new ConfigurableProp( + name, + type, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAlert.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAlert.java new file mode 100644 index 0000000..782303c --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAlert.java @@ -0,0 +1,484 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropAlert.Builder.class) +public final class ConfigurablePropAlert { + private final Optional type; + + private final Optional alertType; + + private final Optional content; + + private final Optional 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 ConfigurablePropAlert( + Optional type, + Optional alertType, + Optional content, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.alertType = alertType; + this.content = content; + 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; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return The severity level of the alert. + */ + @JsonProperty("alertType") + public Optional getAlertType() { + return alertType; + } + + /** + * @return The content of the alert, which can include HTML or plain text. + */ + @JsonProperty("content") + public Optional getContent() { + return content; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional 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") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropAlert && equalTo((ConfigurablePropAlert) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropAlert other) { + return type.equals(other.type) + && alertType.equals(other.alertType) + && content.equals(other.content) + && 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.type, + this.alertType, + this.content, + 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional alertType = Optional.empty(); + + private Optional content = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropAlert other) { + type(other.getType()); + alertType(other.getAlertType()); + content(other.getContent()); + 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; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

The severity level of the alert.

+ */ + @JsonSetter(value = "alertType", nulls = Nulls.SKIP) + public Builder alertType(Optional alertType) { + this.alertType = alertType; + return this; + } + + public Builder alertType(ConfigurablePropAlertAlertType alertType) { + this.alertType = Optional.ofNullable(alertType); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public Builder content(Optional content) { + this.content = content; + return this; + } + + public Builder content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropAlert build() { + return new ConfigurablePropAlert( + type, + alertType, + content, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAlertAlertType.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAlertAlertType.java new file mode 100644 index 0000000..539ca52 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAlertAlertType.java @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ConfigurablePropAlertAlertType { + INFO("info"), + + NEUTRAL("neutral"), + + WARNING("warning"), + + ERROR("error"); + + private final String value; + + ConfigurablePropAlertAlertType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAny.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAny.java new file mode 100644 index 0000000..87824c9 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAny.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropAny.Builder.class) +public final class ConfigurablePropAny { + private final Optional type; + + private final Optional 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 ConfigurablePropAny( + Optional type, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + 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; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional 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") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropAny && equalTo((ConfigurablePropAny) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropAny other) { + return type.equals(other.type) + && 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.type, + 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropAny other) { + type(other.getType()); + 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; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropAny build() { + return new ConfigurablePropAny( + type, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropApp.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropApp.java new file mode 100644 index 0000000..f6e4246 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropApp.java @@ -0,0 +1,452 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropApp.Builder.class) +public final class ConfigurablePropApp { + private final Optional type; + + private final Optional app; + + private final Optional 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 ConfigurablePropApp( + Optional type, + Optional app, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.app = app; + 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; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @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 Optional getApp() { + return app; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional 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") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropApp && equalTo((ConfigurablePropApp) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropApp other) { + return type.equals(other.type) + && app.equals(other.app) + && 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.type, + this.app, + 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional app = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropApp other) { + type(other.getType()); + app(other.getApp()); + 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; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + 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.

+ */ + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(String app) { + this.app = Optional.ofNullable(app); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropApp build() { + return new ConfigurablePropApp( + type, + app, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropBoolean.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropBoolean.java new file mode 100644 index 0000000..ad596d0 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropBoolean.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropBoolean.Builder.class) +public final class ConfigurablePropBoolean { + private final Optional type; + + private final Optional 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 ConfigurablePropBoolean( + Optional type, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + 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; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional 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") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropBoolean && equalTo((ConfigurablePropBoolean) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropBoolean other) { + return type.equals(other.type) + && 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.type, + 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropBoolean other) { + type(other.getType()); + 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; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropBoolean build() { + return new ConfigurablePropBoolean( + type, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropDiscord.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropDiscord.java new file mode 100644 index 0000000..91fffbf --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropDiscord.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropDiscord.Builder.class) +public final class ConfigurablePropDiscord { + private final Optional type; + + private final Optional 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 ConfigurablePropDiscord( + Optional type, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + 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; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional 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") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropDiscord && equalTo((ConfigurablePropDiscord) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropDiscord other) { + return type.equals(other.type) + && 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.type, + 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropDiscord other) { + type(other.getType()); + 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; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropDiscord build() { + return new ConfigurablePropDiscord( + type, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropInteger.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropInteger.java new file mode 100644 index 0000000..ddbdf76 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropInteger.java @@ -0,0 +1,484 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropInteger.Builder.class) +public final class ConfigurablePropInteger { + private final Optional type; + + private final Optional min; + + private final Optional max; + + private final Optional 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 ConfigurablePropInteger( + Optional type, + Optional min, + Optional max, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.min = min; + this.max = max; + 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; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @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; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional 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") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropInteger && equalTo((ConfigurablePropInteger) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropInteger other) { + return type.equals(other.type) + && min.equals(other.min) + && max.equals(other.max) + && 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.type, + this.min, + this.max, + 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional min = Optional.empty(); + + private Optional max = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropInteger other) { + type(other.getType()); + min(other.getMin()); + max(other.getMax()); + 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; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

The minimum value for this integer prop.

+ */ + @JsonSetter(value = "min", nulls = Nulls.SKIP) + public Builder min(Optional min) { + this.min = min; + return this; + } + + public Builder min(Integer min) { + this.min = Optional.ofNullable(min); + return this; + } + + /** + *

The maximum value for this integer prop.

+ */ + @JsonSetter(value = "max", nulls = Nulls.SKIP) + public Builder max(Optional max) { + this.max = max; + return this; + } + + public Builder max(Integer max) { + this.max = Optional.ofNullable(max); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropInteger build() { + return new ConfigurablePropInteger( + type, + min, + max, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropObject.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropObject.java new file mode 100644 index 0000000..0cd6fa0 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropObject.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropObject.Builder.class) +public final class ConfigurablePropObject { + private final Optional type; + + private final Optional 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 ConfigurablePropObject( + Optional type, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + 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; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional 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") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropObject && equalTo((ConfigurablePropObject) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropObject other) { + return type.equals(other.type) + && 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.type, + 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropObject other) { + type(other.getType()); + 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; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropObject build() { + return new ConfigurablePropObject( + type, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropString.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropString.java new file mode 100644 index 0000000..c85dcf4 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropString.java @@ -0,0 +1,452 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropString.Builder.class) +public final class ConfigurablePropString { + private final Optional type; + + private final Optional secret; + + private final Optional 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 ConfigurablePropString( + Optional type, + Optional secret, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.secret = secret; + 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; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return If true, this prop is a secret and should not be displayed in plain text. + */ + @JsonProperty("secret") + public Optional getSecret() { + return secret; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional 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") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropString && equalTo((ConfigurablePropString) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropString other) { + return type.equals(other.type) + && secret.equals(other.secret) + && 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.type, + this.secret, + 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional secret = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropString other) { + type(other.getType()); + secret(other.getSecret()); + 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; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "secret", nulls = Nulls.SKIP) + public Builder secret(Optional secret) { + this.secret = secret; + return this; + } + + public Builder secret(Boolean secret) { + this.secret = Optional.ofNullable(secret); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropString build() { + return new ConfigurablePropString( + type, + secret, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropStringArray.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropStringArray.java new file mode 100644 index 0000000..664fc6a --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropStringArray.java @@ -0,0 +1,452 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropStringArray.Builder.class) +public final class ConfigurablePropStringArray { + private final Optional type; + + private final Optional secret; + + private final Optional 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 ConfigurablePropStringArray( + Optional type, + Optional secret, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.secret = secret; + 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; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return If true, this prop is a secret and should not be displayed in plain text. + */ + @JsonProperty("secret") + public Optional getSecret() { + return secret; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional 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") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropStringArray && equalTo((ConfigurablePropStringArray) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropStringArray other) { + return type.equals(other.type) + && secret.equals(other.secret) + && 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.type, + this.secret, + 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional secret = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropStringArray other) { + type(other.getType()); + secret(other.getSecret()); + 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; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "secret", nulls = Nulls.SKIP) + public Builder secret(Optional secret) { + this.secret = secret; + return this; + } + + public Builder secret(Boolean secret) { + this.secret = Optional.ofNullable(secret); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropStringArray build() { + return new ConfigurablePropStringArray( + type, + secret, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurePropOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurePropOpts.java new file mode 100644 index 0000000..86455a5 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurePropOpts.java @@ -0,0 +1,509 @@ +/** + * 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 = ConfigurePropOpts.Builder.class) +public final class ConfigurePropOpts { + private final String id; + + private final String externalUserId; + + private final String propName; + + private final Optional blocking; + + private final Optional> configuredProps; + + private final Optional dynamicPropsId; + + private final Optional asyncHandle; + + private final Optional page; + + private final Optional> prevContext; + + private final Optional query; + + private final Map additionalProperties; + + private ConfigurePropOpts( + String id, + String externalUserId, + String propName, + Optional blocking, + Optional> configuredProps, + Optional dynamicPropsId, + Optional asyncHandle, + Optional page, + Optional> prevContext, + Optional query, + Map additionalProperties) { + this.id = id; + this.externalUserId = externalUserId; + this.propName = propName; + this.blocking = blocking; + this.configuredProps = configuredProps; + this.dynamicPropsId = dynamicPropsId; + this.asyncHandle = asyncHandle; + this.page = page; + this.prevContext = prevContext; + this.query = query; + this.additionalProperties = additionalProperties; + } + + /** + * @return The component ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The external user ID + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The name of the prop to configure + */ + @JsonProperty("prop_name") + public String getPropName() { + return propName; + } + + /** + * @return Whether this operation should block until completion + */ + @JsonProperty("blocking") + public Optional getBlocking() { + return blocking; + } + + /** + * @return The configured properties for the component + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The ID for dynamic props + */ + @JsonProperty("dynamic_props_id") + public Optional getDynamicPropsId() { + return dynamicPropsId; + } + + /** + * @return Handle for async operations + */ + @JsonProperty("async_handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + /** + * @return Page number for paginated results + */ + @JsonProperty("page") + public Optional getPage() { + return page; + } + + /** + * @return Previous context for pagination + */ + @JsonProperty("prev_context") + public Optional> getPrevContext() { + return prevContext; + } + + /** + * @return Search query for filtering options + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurePropOpts && equalTo((ConfigurePropOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurePropOpts other) { + return id.equals(other.id) + && externalUserId.equals(other.externalUserId) + && propName.equals(other.propName) + && blocking.equals(other.blocking) + && configuredProps.equals(other.configuredProps) + && dynamicPropsId.equals(other.dynamicPropsId) + && asyncHandle.equals(other.asyncHandle) + && page.equals(other.page) + && prevContext.equals(other.prevContext) + && query.equals(other.query); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.externalUserId, + this.propName, + this.blocking, + this.configuredProps, + this.dynamicPropsId, + this.asyncHandle, + this.page, + this.prevContext, + this.query); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The component ID

+ */ + ExternalUserIdStage id(@NotNull String id); + + Builder from(ConfigurePropOpts other); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID

+ */ + PropNameStage externalUserId(@NotNull String externalUserId); + } + + public interface PropNameStage { + /** + *

The name of the prop to configure

+ */ + _FinalStage propName(@NotNull String propName); + } + + public interface _FinalStage { + ConfigurePropOpts build(); + + /** + *

Whether this operation should block until completion

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

The configured properties for the component

+ */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

The ID for dynamic props

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

Handle for async operations

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

Page number for paginated results

+ */ + _FinalStage page(Optional page); + + _FinalStage page(Double page); + + /** + *

Previous context for pagination

+ */ + _FinalStage prevContext(Optional> prevContext); + + _FinalStage prevContext(Map prevContext); + + /** + *

Search query for filtering options

+ */ + _FinalStage query(Optional query); + + _FinalStage query(String query); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ExternalUserIdStage, PropNameStage, _FinalStage { + private String id; + + private String externalUserId; + + private String propName; + + private Optional query = Optional.empty(); + + private Optional> prevContext = Optional.empty(); + + private Optional page = Optional.empty(); + + private Optional asyncHandle = Optional.empty(); + + private Optional dynamicPropsId = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + private Optional blocking = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ConfigurePropOpts other) { + id(other.getId()); + externalUserId(other.getExternalUserId()); + propName(other.getPropName()); + blocking(other.getBlocking()); + configuredProps(other.getConfiguredProps()); + dynamicPropsId(other.getDynamicPropsId()); + asyncHandle(other.getAsyncHandle()); + page(other.getPage()); + prevContext(other.getPrevContext()); + query(other.getQuery()); + return this; + } + + /** + *

The component ID

+ *

The component ID

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

The external user ID

+ *

The external user ID

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

The name of the prop to configure

+ *

The name of the prop to configure

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

Search query for filtering options

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

Search query for filtering options

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

Previous context for pagination

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

Previous context for pagination

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

Page number for paginated results

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

Page number for paginated results

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

Handle for async operations

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

Handle for async operations

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

The ID for dynamic props

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

The ID for dynamic props

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

The configured properties for the component

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

The configured properties for the component

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

Whether this operation should block until completion

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

Whether this operation should block until completion

+ */ + @java.lang.Override + @JsonSetter(value = "blocking", nulls = Nulls.SKIP) + public _FinalStage blocking(Optional blocking) { + this.blocking = blocking; + return this; + } + + @java.lang.Override + public ConfigurePropOpts build() { + return new ConfigurePropOpts( + id, + externalUserId, + propName, + blocking, + configuredProps, + dynamicPropsId, + asyncHandle, + page, + prevContext, + query, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurePropResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurePropResponse.java new file mode 100644 index 0000000..6c1a6af --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurePropResponse.java @@ -0,0 +1,133 @@ +/** + * 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.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurePropResponse.Builder.class) +public final class ConfigurePropResponse { + private final Optional> options; + + private final Optional> errors; + + private final Map additionalProperties; + + private ConfigurePropResponse( + Optional> options, + Optional> errors, + Map additionalProperties) { + this.options = options; + this.errors = errors; + this.additionalProperties = additionalProperties; + } + + /** + * @return Available options for the configured prop + */ + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + + /** + * @return Any errors that occurred during configuration + */ + @JsonProperty("errors") + public Optional> getErrors() { + return errors; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurePropResponse && equalTo((ConfigurePropResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurePropResponse other) { + return options.equals(other.options) && errors.equals(other.errors); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.options, this.errors); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> options = Optional.empty(); + + private Optional> errors = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurePropResponse other) { + options(other.getOptions()); + errors(other.getErrors()); + return this; + } + + /** + *

Available options for the configured prop

+ */ + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public Builder options(Optional> options) { + this.options = options; + return this; + } + + public Builder options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + /** + *

Any errors that occurred during configuration

+ */ + @JsonSetter(value = "errors", nulls = Nulls.SKIP) + public Builder errors(Optional> errors) { + this.errors = errors; + return this; + } + + public Builder errors(List errors) { + this.errors = Optional.ofNullable(errors); + return this; + } + + public ConfigurePropResponse build() { + return new ConfigurePropResponse(options, errors, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConnectTokenCreateOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConnectTokenCreateOpts.java new file mode 100644 index 0000000..212cb99 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConnectTokenCreateOpts.java @@ -0,0 +1,338 @@ +/** + * 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.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConnectTokenCreateOpts.Builder.class) +public final class ConnectTokenCreateOpts { + private final String externalUserId; + + private final String projectId; + + private final Optional> allowedOrigins; + + private final Optional errorRedirectUri; + + private final Optional successRedirectUri; + + private final Optional webhookUri; + + private final Map additionalProperties; + + private ConnectTokenCreateOpts( + String externalUserId, + String projectId, + Optional> allowedOrigins, + Optional errorRedirectUri, + Optional successRedirectUri, + Optional webhookUri, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.projectId = projectId; + this.allowedOrigins = allowedOrigins; + this.errorRedirectUri = errorRedirectUri; + this.successRedirectUri = successRedirectUri; + this.webhookUri = webhookUri; + this.additionalProperties = additionalProperties; + } + + /** + * @return Your end user ID, for whom you're creating the token + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The ID of the project + */ + @JsonProperty("project_id") + public String getProjectId() { + return projectId; + } + + /** + * @return List of allowed origins for CORS + */ + @JsonProperty("allowed_origins") + public Optional> getAllowedOrigins() { + return allowedOrigins; + } + + /** + * @return URI to redirect to on error + */ + @JsonProperty("error_redirect_uri") + public Optional getErrorRedirectUri() { + return errorRedirectUri; + } + + /** + * @return URI to redirect to on success + */ + @JsonProperty("success_redirect_uri") + public Optional getSuccessRedirectUri() { + return successRedirectUri; + } + + /** + * @return Webhook URI for notifications + */ + @JsonProperty("webhook_uri") + public Optional getWebhookUri() { + return webhookUri; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConnectTokenCreateOpts && equalTo((ConnectTokenCreateOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConnectTokenCreateOpts other) { + return externalUserId.equals(other.externalUserId) + && projectId.equals(other.projectId) + && allowedOrigins.equals(other.allowedOrigins) + && errorRedirectUri.equals(other.errorRedirectUri) + && successRedirectUri.equals(other.successRedirectUri) + && webhookUri.equals(other.webhookUri); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.externalUserId, + this.projectId, + this.allowedOrigins, + this.errorRedirectUri, + this.successRedirectUri, + this.webhookUri); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

Your end user ID, for whom you're creating the token

+ */ + ProjectIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ConnectTokenCreateOpts other); + } + + public interface ProjectIdStage { + /** + *

The ID of the project

+ */ + _FinalStage projectId(@NotNull String projectId); + } + + public interface _FinalStage { + ConnectTokenCreateOpts build(); + + /** + *

List of allowed origins for CORS

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

URI to redirect to on error

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

URI to redirect to on success

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

Webhook URI for notifications

+ */ + _FinalStage webhookUri(Optional webhookUri); + + _FinalStage webhookUri(String webhookUri); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, ProjectIdStage, _FinalStage { + private String externalUserId; + + private String projectId; + + private Optional webhookUri = Optional.empty(); + + private Optional successRedirectUri = Optional.empty(); + + private Optional errorRedirectUri = Optional.empty(); + + private Optional> allowedOrigins = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ConnectTokenCreateOpts other) { + externalUserId(other.getExternalUserId()); + projectId(other.getProjectId()); + allowedOrigins(other.getAllowedOrigins()); + errorRedirectUri(other.getErrorRedirectUri()); + successRedirectUri(other.getSuccessRedirectUri()); + webhookUri(other.getWebhookUri()); + return this; + } + + /** + *

Your end user ID, for whom you're creating the token

+ *

Your end user ID, for whom you're creating the token

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

The ID of the project

+ *

The ID of the project

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

Webhook URI for notifications

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

Webhook URI for notifications

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

URI to redirect to on success

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

URI to redirect to on success

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

URI to redirect to on error

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

URI to redirect to on error

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

List of allowed origins for CORS

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

List of allowed origins for CORS

+ */ + @java.lang.Override + @JsonSetter(value = "allowed_origins", nulls = Nulls.SKIP) + public _FinalStage allowedOrigins(Optional> allowedOrigins) { + this.allowedOrigins = allowedOrigins; + return this; + } + + @java.lang.Override + public ConnectTokenCreateOpts build() { + return new ConnectTokenCreateOpts( + externalUserId, + projectId, + allowedOrigins, + errorRedirectUri, + successRedirectUri, + webhookUri, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConnectTokenResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConnectTokenResponse.java new file mode 100644 index 0000000..76aac12 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConnectTokenResponse.java @@ -0,0 +1,183 @@ +/** + * 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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConnectTokenResponse.Builder.class) +public final class ConnectTokenResponse { + private final String connectLinkUrl; + + private final OffsetDateTime expiresAt; + + private final String token; + + private final Map additionalProperties; + + private ConnectTokenResponse( + String connectLinkUrl, OffsetDateTime expiresAt, String token, Map additionalProperties) { + this.connectLinkUrl = connectLinkUrl; + this.expiresAt = expiresAt; + this.token = token; + this.additionalProperties = additionalProperties; + } + + /** + * @return The Connect Link URL + */ + @JsonProperty("connect_link_url") + public String getConnectLinkUrl() { + return connectLinkUrl; + } + + /** + * @return The expiration time of the token in ISO 8601 format + */ + @JsonProperty("expires_at") + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + /** + * @return The generated token + */ + @JsonProperty("token") + public String getToken() { + return token; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConnectTokenResponse && equalTo((ConnectTokenResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConnectTokenResponse other) { + return connectLinkUrl.equals(other.connectLinkUrl) + && expiresAt.equals(other.expiresAt) + && token.equals(other.token); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.connectLinkUrl, this.expiresAt, this.token); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ConnectLinkUrlStage builder() { + return new Builder(); + } + + public interface ConnectLinkUrlStage { + /** + *

The Connect Link URL

+ */ + ExpiresAtStage connectLinkUrl(@NotNull String connectLinkUrl); + + Builder from(ConnectTokenResponse other); + } + + public interface ExpiresAtStage { + /** + *

The expiration time of the token in ISO 8601 format

+ */ + TokenStage expiresAt(@NotNull OffsetDateTime expiresAt); + } + + public interface TokenStage { + /** + *

The generated token

+ */ + _FinalStage token(@NotNull String token); + } + + public interface _FinalStage { + ConnectTokenResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ConnectLinkUrlStage, ExpiresAtStage, TokenStage, _FinalStage { + private String connectLinkUrl; + + private OffsetDateTime expiresAt; + + private String token; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ConnectTokenResponse other) { + connectLinkUrl(other.getConnectLinkUrl()); + expiresAt(other.getExpiresAt()); + token(other.getToken()); + return this; + } + + /** + *

The Connect Link URL

+ *

The Connect Link URL

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

The expiration time of the token in ISO 8601 format

+ *

The expiration time of the token in ISO 8601 format

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

The generated token

+ *

The generated token

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("token") + public _FinalStage token(@NotNull String token) { + this.token = Objects.requireNonNull(token, "token must not be null"); + return this; + } + + @java.lang.Override + public ConnectTokenResponse build() { + return new ConnectTokenResponse(connectLinkUrl, expiresAt, token, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateBrowserClientOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateBrowserClientOpts.java new file mode 100644 index 0000000..96af1a4 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateBrowserClientOpts.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateBrowserClientOpts.Builder.class) +public final class CreateBrowserClientOpts { + private final Optional apiUrl; + + private final Map additionalProperties; + + private CreateBrowserClientOpts(Optional apiUrl, Map additionalProperties) { + this.apiUrl = apiUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The API URL to use + */ + @JsonProperty("api_url") + public Optional getApiUrl() { + return apiUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateBrowserClientOpts && equalTo((CreateBrowserClientOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateBrowserClientOpts other) { + return apiUrl.equals(other.apiUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional apiUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateBrowserClientOpts other) { + apiUrl(other.getApiUrl()); + return this; + } + + /** + *

The API URL to use

+ */ + @JsonSetter(value = "api_url", nulls = Nulls.SKIP) + public Builder apiUrl(Optional apiUrl) { + this.apiUrl = apiUrl; + return this; + } + + public Builder apiUrl(String apiUrl) { + this.apiUrl = Optional.ofNullable(apiUrl); + return this; + } + + public CreateBrowserClientOpts build() { + return new CreateBrowserClientOpts(apiUrl, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateOAuthTokenResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateOAuthTokenResponse.java new file mode 100644 index 0000000..3f50fd1 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateOAuthTokenResponse.java @@ -0,0 +1,149 @@ +/** + * 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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateOAuthTokenResponse.Builder.class) +public final class CreateOAuthTokenResponse { + private final String accessToken; + + private final String tokenType; + + private final int expiresIn; + + private final Map additionalProperties; + + private CreateOAuthTokenResponse( + String accessToken, String tokenType, int expiresIn, Map additionalProperties) { + this.accessToken = accessToken; + this.tokenType = tokenType; + this.expiresIn = expiresIn; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("access_token") + public String getAccessToken() { + return accessToken; + } + + @JsonProperty("token_type") + public String getTokenType() { + return tokenType; + } + + @JsonProperty("expires_in") + public int getExpiresIn() { + return expiresIn; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOAuthTokenResponse && equalTo((CreateOAuthTokenResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateOAuthTokenResponse other) { + return accessToken.equals(other.accessToken) + && tokenType.equals(other.tokenType) + && expiresIn == other.expiresIn; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accessToken, this.tokenType, this.expiresIn); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccessTokenStage builder() { + return new Builder(); + } + + public interface AccessTokenStage { + TokenTypeStage accessToken(@NotNull String accessToken); + + Builder from(CreateOAuthTokenResponse other); + } + + public interface TokenTypeStage { + ExpiresInStage tokenType(@NotNull String tokenType); + } + + public interface ExpiresInStage { + _FinalStage expiresIn(int expiresIn); + } + + public interface _FinalStage { + CreateOAuthTokenResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccessTokenStage, TokenTypeStage, ExpiresInStage, _FinalStage { + private String accessToken; + + private String tokenType; + + private int expiresIn; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateOAuthTokenResponse other) { + accessToken(other.getAccessToken()); + tokenType(other.getTokenType()); + expiresIn(other.getExpiresIn()); + return this; + } + + @java.lang.Override + @JsonSetter("access_token") + public TokenTypeStage accessToken(@NotNull String accessToken) { + this.accessToken = Objects.requireNonNull(accessToken, "accessToken must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("token_type") + public ExpiresInStage tokenType(@NotNull String tokenType) { + this.tokenType = Objects.requireNonNull(tokenType, "tokenType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("expires_in") + public _FinalStage expiresIn(int expiresIn) { + this.expiresIn = expiresIn; + return this; + } + + @java.lang.Override + public CreateOAuthTokenResponse build() { + return new CreateOAuthTokenResponse(accessToken, tokenType, expiresIn, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateTokenResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateTokenResponse.java new file mode 100644 index 0000000..4ce6161 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateTokenResponse.java @@ -0,0 +1,183 @@ +/** + * 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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTokenResponse.Builder.class) +public final class CreateTokenResponse { + private final String connectLinkUrl; + + private final OffsetDateTime expiresAt; + + private final String token; + + private final Map additionalProperties; + + private CreateTokenResponse( + String connectLinkUrl, OffsetDateTime expiresAt, String token, Map additionalProperties) { + this.connectLinkUrl = connectLinkUrl; + this.expiresAt = expiresAt; + this.token = token; + this.additionalProperties = additionalProperties; + } + + /** + * @return The Connect Link URL + */ + @JsonProperty("connect_link_url") + public String getConnectLinkUrl() { + return connectLinkUrl; + } + + /** + * @return The expiration time of the token in ISO 8601 format + */ + @JsonProperty("expires_at") + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + /** + * @return The generated token + */ + @JsonProperty("token") + public String getToken() { + return token; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTokenResponse && equalTo((CreateTokenResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTokenResponse other) { + return connectLinkUrl.equals(other.connectLinkUrl) + && expiresAt.equals(other.expiresAt) + && token.equals(other.token); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.connectLinkUrl, this.expiresAt, this.token); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ConnectLinkUrlStage builder() { + return new Builder(); + } + + public interface ConnectLinkUrlStage { + /** + *

The Connect Link URL

+ */ + ExpiresAtStage connectLinkUrl(@NotNull String connectLinkUrl); + + Builder from(CreateTokenResponse other); + } + + public interface ExpiresAtStage { + /** + *

The expiration time of the token in ISO 8601 format

+ */ + TokenStage expiresAt(@NotNull OffsetDateTime expiresAt); + } + + public interface TokenStage { + /** + *

The generated token

+ */ + _FinalStage token(@NotNull String token); + } + + public interface _FinalStage { + CreateTokenResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ConnectLinkUrlStage, ExpiresAtStage, TokenStage, _FinalStage { + private String connectLinkUrl; + + private OffsetDateTime expiresAt; + + private String token; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTokenResponse other) { + connectLinkUrl(other.getConnectLinkUrl()); + expiresAt(other.getExpiresAt()); + token(other.getToken()); + return this; + } + + /** + *

The Connect Link URL

+ *

The Connect Link URL

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

The expiration time of the token in ISO 8601 format

+ *

The expiration time of the token in ISO 8601 format

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

The generated token

+ *

The generated token

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("token") + public _FinalStage token(@NotNull String token) { + this.token = Objects.requireNonNull(token, "token must not be null"); + return this; + } + + @java.lang.Override + public CreateTokenResponse build() { + return new CreateTokenResponse(connectLinkUrl, expiresAt, token, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeleteTriggerOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeleteTriggerOpts.java new file mode 100644 index 0000000..70b04b4 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeleteTriggerOpts.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteTriggerOpts.Builder.class) +public final class DeleteTriggerOpts { + private final Optional ignoreHookErrors; + + private final Map additionalProperties; + + private DeleteTriggerOpts(Optional ignoreHookErrors, Map additionalProperties) { + this.ignoreHookErrors = ignoreHookErrors; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether to ignore errors during deactivation hook + */ + @JsonProperty("ignore_hook_errors") + public Optional getIgnoreHookErrors() { + return ignoreHookErrors; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteTriggerOpts && equalTo((DeleteTriggerOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteTriggerOpts other) { + return ignoreHookErrors.equals(other.ignoreHookErrors); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.ignoreHookErrors); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional ignoreHookErrors = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteTriggerOpts other) { + ignoreHookErrors(other.getIgnoreHookErrors()); + return this; + } + + /** + *

Whether to ignore errors during deactivation hook

+ */ + @JsonSetter(value = "ignore_hook_errors", nulls = Nulls.SKIP) + public Builder ignoreHookErrors(Optional ignoreHookErrors) { + this.ignoreHookErrors = ignoreHookErrors; + return this; + } + + public Builder ignoreHookErrors(Boolean ignoreHookErrors) { + this.ignoreHookErrors = Optional.ofNullable(ignoreHookErrors); + return this; + } + + public DeleteTriggerOpts build() { + return new DeleteTriggerOpts(ignoreHookErrors, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeployTriggerResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeployTriggerResponse.java new file mode 100644 index 0000000..09aac9d --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeployTriggerResponse.java @@ -0,0 +1,102 @@ +/** + * 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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployTriggerResponse.Builder.class) +public final class DeployTriggerResponse { + private final DeployedComponent data; + + private final Map additionalProperties; + + private DeployTriggerResponse(DeployedComponent data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public DeployedComponent getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployTriggerResponse && equalTo((DeployTriggerResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployTriggerResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull DeployedComponent data); + + Builder from(DeployTriggerResponse other); + } + + public interface _FinalStage { + DeployTriggerResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private DeployedComponent data; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployTriggerResponse other) { + data(other.getData()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull DeployedComponent data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public DeployTriggerResponse build() { + return new DeployTriggerResponse(data, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeployedComponent.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeployedComponent.java new file mode 100644 index 0000000..8a6e6b9 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeployedComponent.java @@ -0,0 +1,539 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedComponent.Builder.class) +public final class DeployedComponent { + private final String id; + + private final String ownerId; + + private final String componentId; + + private final List configurableProps; + + private final Map configuredProps; + + private final boolean active; + + private final int createdAt; + + private final int updatedAt; + + private final String name; + + private final String nameSlug; + + private final Optional callbackObservations; + + private final Map additionalProperties; + + private DeployedComponent( + String id, + String ownerId, + String componentId, + List configurableProps, + Map configuredProps, + boolean active, + int createdAt, + int updatedAt, + String name, + String nameSlug, + Optional callbackObservations, + Map additionalProperties) { + this.id = id; + this.ownerId = ownerId; + this.componentId = componentId; + this.configurableProps = configurableProps; + this.configuredProps = configuredProps; + this.active = active; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.name = name; + this.nameSlug = nameSlug; + this.callbackObservations = callbackObservations; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique ID of the deployed component + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The ID of the owner + */ + @JsonProperty("owner_id") + public String getOwnerId() { + return ownerId; + } + + /** + * @return The ID of the component that was deployed + */ + @JsonProperty("component_id") + public String getComponentId() { + return componentId; + } + + /** + * @return The configurable properties of the component + */ + @JsonProperty("configurable_props") + public List getConfigurableProps() { + return configurableProps; + } + + /** + * @return The configured properties of the component + */ + @JsonProperty("configured_props") + public Map getConfiguredProps() { + return configuredProps; + } + + /** + * @return Whether the deployed component is active + */ + @JsonProperty("active") + public boolean getActive() { + return active; + } + + /** + * @return The timestamp when the component was deployed (epoch milliseconds) + */ + @JsonProperty("created_at") + public int getCreatedAt() { + return createdAt; + } + + /** + * @return The timestamp when the component was last updated (epoch milliseconds) + */ + @JsonProperty("updated_at") + public int getUpdatedAt() { + return updatedAt; + } + + /** + * @return The name of the deployed component + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The name slug of the deployed component + */ + @JsonProperty("name_slug") + public String getNameSlug() { + return nameSlug; + } + + @JsonProperty("callback_observations") + public Optional getCallbackObservations() { + return callbackObservations; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedComponent && equalTo((DeployedComponent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedComponent other) { + return id.equals(other.id) + && ownerId.equals(other.ownerId) + && componentId.equals(other.componentId) + && configurableProps.equals(other.configurableProps) + && configuredProps.equals(other.configuredProps) + && active == other.active + && createdAt == other.createdAt + && updatedAt == other.updatedAt + && name.equals(other.name) + && nameSlug.equals(other.nameSlug) + && callbackObservations.equals(other.callbackObservations); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.ownerId, + this.componentId, + this.configurableProps, + this.configuredProps, + this.active, + this.createdAt, + this.updatedAt, + this.name, + this.nameSlug, + this.callbackObservations); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique ID of the deployed component

+ */ + OwnerIdStage id(@NotNull String id); + + Builder from(DeployedComponent other); + } + + public interface OwnerIdStage { + /** + *

The ID of the owner

+ */ + ComponentIdStage ownerId(@NotNull String ownerId); + } + + public interface ComponentIdStage { + /** + *

The ID of the component that was deployed

+ */ + ActiveStage componentId(@NotNull String componentId); + } + + public interface ActiveStage { + /** + *

Whether the deployed component is active

+ */ + CreatedAtStage active(boolean active); + } + + public interface CreatedAtStage { + /** + *

The timestamp when the component was deployed (epoch milliseconds)

+ */ + UpdatedAtStage createdAt(int createdAt); + } + + public interface UpdatedAtStage { + /** + *

The timestamp when the component was last updated (epoch milliseconds)

+ */ + NameStage updatedAt(int updatedAt); + } + + public interface NameStage { + /** + *

The name of the deployed component

+ */ + NameSlugStage name(@NotNull String name); + } + + public interface NameSlugStage { + /** + *

The name slug of the deployed component

+ */ + _FinalStage nameSlug(@NotNull String nameSlug); + } + + public interface _FinalStage { + DeployedComponent build(); + + /** + *

The configurable properties of the component

+ */ + _FinalStage configurableProps(List configurableProps); + + _FinalStage addConfigurableProps(ConfigurableProp configurableProps); + + _FinalStage addAllConfigurableProps(List configurableProps); + + /** + *

The configured properties of the component

+ */ + _FinalStage configuredProps(Map configuredProps); + + _FinalStage putAllConfiguredProps(Map configuredProps); + + _FinalStage configuredProps(String key, Object value); + + _FinalStage callbackObservations(Optional callbackObservations); + + _FinalStage callbackObservations(Object callbackObservations); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, + OwnerIdStage, + ComponentIdStage, + ActiveStage, + CreatedAtStage, + UpdatedAtStage, + NameStage, + NameSlugStage, + _FinalStage { + private String id; + + private String ownerId; + + private String componentId; + + private boolean active; + + private int createdAt; + + private int updatedAt; + + private String name; + + private String nameSlug; + + private Optional callbackObservations = Optional.empty(); + + private Map configuredProps = new LinkedHashMap<>(); + + private List configurableProps = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedComponent other) { + id(other.getId()); + ownerId(other.getOwnerId()); + componentId(other.getComponentId()); + configurableProps(other.getConfigurableProps()); + configuredProps(other.getConfiguredProps()); + active(other.getActive()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + name(other.getName()); + nameSlug(other.getNameSlug()); + callbackObservations(other.getCallbackObservations()); + return this; + } + + /** + *

The unique ID of the deployed component

+ *

The unique ID of the deployed component

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

The ID of the owner

+ *

The ID of the owner

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

The ID of the component that was deployed

+ *

The ID of the component that was deployed

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

Whether the deployed component is active

+ *

Whether the deployed component is active

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("active") + public CreatedAtStage active(boolean active) { + this.active = active; + return this; + } + + /** + *

The timestamp when the component was deployed (epoch milliseconds)

+ *

The timestamp when the component was deployed (epoch milliseconds)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(int createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + *

The timestamp when the component was last updated (epoch milliseconds)

+ *

The timestamp when the component was last updated (epoch milliseconds)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public NameStage updatedAt(int updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + *

The name of the deployed component

+ *

The name of the deployed component

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

The name slug of the deployed component

+ *

The name slug of the deployed component

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name_slug") + public _FinalStage nameSlug(@NotNull String nameSlug) { + this.nameSlug = Objects.requireNonNull(nameSlug, "nameSlug must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage callbackObservations(Object callbackObservations) { + this.callbackObservations = Optional.ofNullable(callbackObservations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "callback_observations", nulls = Nulls.SKIP) + public _FinalStage callbackObservations(Optional callbackObservations) { + this.callbackObservations = callbackObservations; + return this; + } + + /** + *

The configured properties of the component

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage configuredProps(String key, Object value) { + this.configuredProps.put(key, value); + return this; + } + + /** + *

The configured properties of the component

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllConfiguredProps(Map configuredProps) { + this.configuredProps.putAll(configuredProps); + return this; + } + + /** + *

The configured properties of the component

+ */ + @java.lang.Override + @JsonSetter(value = "configured_props", nulls = Nulls.SKIP) + public _FinalStage configuredProps(Map configuredProps) { + this.configuredProps.clear(); + this.configuredProps.putAll(configuredProps); + return this; + } + + /** + *

The configurable properties of the component

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

The configurable properties of the component

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addConfigurableProps(ConfigurableProp configurableProps) { + this.configurableProps.add(configurableProps); + return this; + } + + /** + *

The configurable properties of the component

+ */ + @java.lang.Override + @JsonSetter(value = "configurable_props", nulls = Nulls.SKIP) + public _FinalStage configurableProps(List configurableProps) { + this.configurableProps.clear(); + this.configurableProps.addAll(configurableProps); + return this; + } + + @java.lang.Override + public DeployedComponent build() { + return new DeployedComponent( + id, + ownerId, + componentId, + configurableProps, + configuredProps, + active, + createdAt, + updatedAt, + name, + nameSlug, + callbackObservations, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/EmittedEvent.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/EmittedEvent.java new file mode 100644 index 0000000..21eebab --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/EmittedEvent.java @@ -0,0 +1,235 @@ +/** + * 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.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EmittedEvent.Builder.class) +public final class EmittedEvent { + private final Map e; + + private final String k; + + private final int ts; + + private final String id; + + private final Map additionalProperties; + + private EmittedEvent(Map e, String k, int ts, String id, Map additionalProperties) { + this.e = e; + this.k = k; + this.ts = ts; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The event's payload + */ + @JsonProperty("e") + public Map getE() { + return e; + } + + /** + * @return The event's type (set to 'emit' currently) + */ + @JsonProperty("k") + public String getK() { + return k; + } + + /** + * @return The event's timestamp in epoch milliseconds + */ + @JsonProperty("ts") + public int getTs() { + return ts; + } + + /** + * @return The event's unique ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EmittedEvent && equalTo((EmittedEvent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EmittedEvent other) { + return e.equals(other.e) && k.equals(other.k) && ts == other.ts && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.e, this.k, this.ts, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static KStage builder() { + return new Builder(); + } + + public interface KStage { + /** + *

The event's type (set to 'emit' currently)

+ */ + TsStage k(@NotNull String k); + + Builder from(EmittedEvent other); + } + + public interface TsStage { + /** + *

The event's timestamp in epoch milliseconds

+ */ + IdStage ts(int ts); + } + + public interface IdStage { + /** + *

The event's unique ID

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + EmittedEvent build(); + + /** + *

The event's payload

+ */ + _FinalStage e(Map e); + + _FinalStage putAllE(Map e); + + _FinalStage e(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements KStage, TsStage, IdStage, _FinalStage { + private String k; + + private int ts; + + private String id; + + private Map e = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(EmittedEvent other) { + e(other.getE()); + k(other.getK()); + ts(other.getTs()); + id(other.getId()); + return this; + } + + /** + *

The event's type (set to 'emit' currently)

+ *

The event's type (set to 'emit' currently)

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

The event's timestamp in epoch milliseconds

+ *

The event's timestamp in epoch milliseconds

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ts") + public IdStage ts(int ts) { + this.ts = ts; + return this; + } + + /** + *

The event's unique ID

+ *

The event's unique ID

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

The event's payload

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage e(String key, Object value) { + this.e.put(key, value); + return this; + } + + /** + *

The event's payload

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllE(Map e) { + this.e.putAll(e); + return this; + } + + /** + *

The event's payload

+ */ + @java.lang.Override + @JsonSetter(value = "e", nulls = Nulls.SKIP) + public _FinalStage e(Map e) { + this.e.clear(); + this.e.putAll(e); + return this; + } + + @java.lang.Override + public EmittedEvent build() { + return new EmittedEvent(e, k, ts, id, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ErrorResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ErrorResponse.java new file mode 100644 index 0000000..38b2481 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ErrorResponse.java @@ -0,0 +1,201 @@ +/** + * 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 = ErrorResponse.Builder.class) +public final class ErrorResponse { + private final String error; + + private final Optional code; + + private final Optional> details; + + private final Map additionalProperties; + + private ErrorResponse( + String error, + Optional code, + Optional> details, + Map additionalProperties) { + this.error = error; + this.code = code; + this.details = details; + this.additionalProperties = additionalProperties; + } + + /** + * @return The error message + */ + @JsonProperty("error") + public String getError() { + return error; + } + + /** + * @return The error code + */ + @JsonProperty("code") + public Optional getCode() { + return code; + } + + /** + * @return Additional error details + */ + @JsonProperty("details") + public Optional> getDetails() { + return details; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ErrorResponse && equalTo((ErrorResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ErrorResponse other) { + return error.equals(other.error) && code.equals(other.code) && details.equals(other.details); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.error, this.code, this.details); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ErrorStage builder() { + return new Builder(); + } + + public interface ErrorStage { + /** + *

The error message

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

The error code

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

Additional error details

+ */ + _FinalStage details(Optional> details); + + _FinalStage details(Map details); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ErrorStage, _FinalStage { + private String error; + + private Optional> details = Optional.empty(); + + private Optional code = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ErrorResponse other) { + error(other.getError()); + code(other.getCode()); + details(other.getDetails()); + return this; + } + + /** + *

The error message

+ *

The error message

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

Additional error details

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

Additional error details

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

The error code

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

The error code

+ */ + @java.lang.Override + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public _FinalStage code(Optional code) { + this.code = code; + return this; + } + + @java.lang.Override + public ErrorResponse build() { + return new ErrorResponse(error, code, details, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAccountsResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAccountsResponse.java new file mode 100644 index 0000000..27141c1 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAccountsResponse.java @@ -0,0 +1,142 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetAccountsResponse.Builder.class) +public final class GetAccountsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private GetAccountsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetAccountsResponse && equalTo((GetAccountsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetAccountsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(GetAccountsResponse other); + } + + public interface _FinalStage { + GetAccountsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(Account data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetAccountsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(Account data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public GetAccountsResponse build() { + return new GetAccountsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAppResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAppResponse.java new file mode 100644 index 0000000..b8d680d --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAppResponse.java @@ -0,0 +1,102 @@ +/** + * 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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetAppResponse.Builder.class) +public final class GetAppResponse { + private final App data; + + private final Map additionalProperties; + + private GetAppResponse(App data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public App getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetAppResponse && equalTo((GetAppResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetAppResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull App data); + + Builder from(GetAppResponse other); + } + + public interface _FinalStage { + GetAppResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private App data; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetAppResponse other) { + data(other.getData()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull App data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public GetAppResponse build() { + return new GetAppResponse(data, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAppsResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAppsResponse.java new file mode 100644 index 0000000..9f69b14 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAppsResponse.java @@ -0,0 +1,142 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetAppsResponse.Builder.class) +public final class GetAppsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private GetAppsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetAppsResponse && equalTo((GetAppsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetAppsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(GetAppsResponse other); + } + + public interface _FinalStage { + GetAppsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(App data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetAppsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(App data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public GetAppsResponse build() { + return new GetAppsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetComponentResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetComponentResponse.java new file mode 100644 index 0000000..f2a0631 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetComponentResponse.java @@ -0,0 +1,102 @@ +/** + * 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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetComponentResponse.Builder.class) +public final class GetComponentResponse { + private final Component data; + + private final Map additionalProperties; + + private GetComponentResponse(Component data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public Component getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetComponentResponse && equalTo((GetComponentResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetComponentResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull Component data); + + Builder from(GetComponentResponse other); + } + + public interface _FinalStage { + GetComponentResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private Component data; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetComponentResponse other) { + data(other.getData()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull Component data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public GetComponentResponse build() { + return new GetComponentResponse(data, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetComponentsResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetComponentsResponse.java new file mode 100644 index 0000000..9768dbf --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetComponentsResponse.java @@ -0,0 +1,142 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetComponentsResponse.Builder.class) +public final class GetComponentsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private GetComponentsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetComponentsResponse && equalTo((GetComponentsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetComponentsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(GetComponentsResponse other); + } + + public interface _FinalStage { + GetComponentsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(Component data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetComponentsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(Component data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public GetComponentsResponse build() { + return new GetComponentsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerEventsResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerEventsResponse.java new file mode 100644 index 0000000..87d47ab --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerEventsResponse.java @@ -0,0 +1,102 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggerEventsResponse.Builder.class) +public final class GetTriggerEventsResponse { + private final List data; + + private final Map additionalProperties; + + private GetTriggerEventsResponse(List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggerEventsResponse && equalTo((GetTriggerEventsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggerEventsResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetTriggerEventsResponse other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + public Builder addData(EmittedEvent data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + this.data.addAll(data); + return this; + } + + public GetTriggerEventsResponse build() { + return new GetTriggerEventsResponse(data, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerResponse.java new file mode 100644 index 0000000..697147e --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerResponse.java @@ -0,0 +1,102 @@ +/** + * 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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggerResponse.Builder.class) +public final class GetTriggerResponse { + private final DeployedComponent data; + + private final Map additionalProperties; + + private GetTriggerResponse(DeployedComponent data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public DeployedComponent getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggerResponse && equalTo((GetTriggerResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggerResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull DeployedComponent data); + + Builder from(GetTriggerResponse other); + } + + public interface _FinalStage { + GetTriggerResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private DeployedComponent data; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetTriggerResponse other) { + data(other.getData()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull DeployedComponent data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public GetTriggerResponse build() { + return new GetTriggerResponse(data, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerWebhooksResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerWebhooksResponse.java new file mode 100644 index 0000000..1d86176 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerWebhooksResponse.java @@ -0,0 +1,102 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggerWebhooksResponse.Builder.class) +public final class GetTriggerWebhooksResponse { + private final List webhookUrls; + + private final Map additionalProperties; + + private GetTriggerWebhooksResponse(List webhookUrls, Map additionalProperties) { + this.webhookUrls = webhookUrls; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("webhook_urls") + public List getWebhookUrls() { + return webhookUrls; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggerWebhooksResponse && equalTo((GetTriggerWebhooksResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggerWebhooksResponse other) { + return webhookUrls.equals(other.webhookUrls); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.webhookUrls); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List webhookUrls = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetTriggerWebhooksResponse other) { + webhookUrls(other.getWebhookUrls()); + return this; + } + + @JsonSetter(value = "webhook_urls", nulls = Nulls.SKIP) + public Builder webhookUrls(List webhookUrls) { + this.webhookUrls.clear(); + this.webhookUrls.addAll(webhookUrls); + return this; + } + + public Builder addWebhookUrls(String webhookUrls) { + this.webhookUrls.add(webhookUrls); + return this; + } + + public Builder addAllWebhookUrls(List webhookUrls) { + this.webhookUrls.addAll(webhookUrls); + return this; + } + + public GetTriggerWebhooksResponse build() { + return new GetTriggerWebhooksResponse(webhookUrls, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerWorkflowsResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerWorkflowsResponse.java new file mode 100644 index 0000000..e14ed35 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerWorkflowsResponse.java @@ -0,0 +1,102 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggerWorkflowsResponse.Builder.class) +public final class GetTriggerWorkflowsResponse { + private final List workflowIds; + + private final Map additionalProperties; + + private GetTriggerWorkflowsResponse(List workflowIds, Map additionalProperties) { + this.workflowIds = workflowIds; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("workflow_ids") + public List getWorkflowIds() { + return workflowIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggerWorkflowsResponse && equalTo((GetTriggerWorkflowsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggerWorkflowsResponse other) { + return workflowIds.equals(other.workflowIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.workflowIds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List workflowIds = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetTriggerWorkflowsResponse other) { + workflowIds(other.getWorkflowIds()); + return this; + } + + @JsonSetter(value = "workflow_ids", nulls = Nulls.SKIP) + public Builder workflowIds(List workflowIds) { + this.workflowIds.clear(); + this.workflowIds.addAll(workflowIds); + return this; + } + + public Builder addWorkflowIds(String workflowIds) { + this.workflowIds.add(workflowIds); + return this; + } + + public Builder addAllWorkflowIds(List workflowIds) { + this.workflowIds.addAll(workflowIds); + return this; + } + + public GetTriggerWorkflowsResponse build() { + return new GetTriggerWorkflowsResponse(workflowIds, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggersResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggersResponse.java new file mode 100644 index 0000000..0c6a070 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggersResponse.java @@ -0,0 +1,143 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggersResponse.Builder.class) +public final class GetTriggersResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private GetTriggersResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggersResponse && equalTo((GetTriggersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggersResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(GetTriggersResponse other); + } + + public interface _FinalStage { + GetTriggersResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(DeployedComponent data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetTriggersResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(DeployedComponent data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public GetTriggersResponse build() { + return new GetTriggersResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ListAccountsResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ListAccountsResponse.java new file mode 100644 index 0000000..f474727 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ListAccountsResponse.java @@ -0,0 +1,142 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAccountsResponse.Builder.class) +public final class ListAccountsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListAccountsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAccountsResponse && equalTo((ListAccountsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAccountsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListAccountsResponse other); + } + + public interface _FinalStage { + ListAccountsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(Account data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAccountsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(Account data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public ListAccountsResponse build() { + return new ListAccountsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ListAppsResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ListAppsResponse.java new file mode 100644 index 0000000..85fab80 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ListAppsResponse.java @@ -0,0 +1,142 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAppsResponse.Builder.class) +public final class ListAppsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListAppsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAppsResponse && equalTo((ListAppsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAppsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListAppsResponse other); + } + + public interface _FinalStage { + ListAppsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(App data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAppsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(App data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public ListAppsResponse build() { + return new ListAppsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/PageInfo.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/PageInfo.java new file mode 100644 index 0000000..8fbda9e --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/PageInfo.java @@ -0,0 +1,169 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PageInfo.Builder.class) +public final class PageInfo { + private final Optional count; + + private final Optional totalCount; + + private final Optional startCursor; + + private final Optional endCursor; + + private final Map additionalProperties; + + private PageInfo( + Optional count, + Optional totalCount, + Optional startCursor, + Optional endCursor, + Map additionalProperties) { + this.count = count; + this.totalCount = totalCount; + this.startCursor = startCursor; + this.endCursor = endCursor; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("count") + public Optional getCount() { + return count; + } + + @JsonProperty("total_count") + public Optional getTotalCount() { + return totalCount; + } + + @JsonProperty("start_cursor") + public Optional getStartCursor() { + return startCursor; + } + + @JsonProperty("end_cursor") + public Optional getEndCursor() { + return endCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PageInfo && equalTo((PageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PageInfo other) { + return count.equals(other.count) + && totalCount.equals(other.totalCount) + && startCursor.equals(other.startCursor) + && endCursor.equals(other.endCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.count, this.totalCount, this.startCursor, this.endCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional count = Optional.empty(); + + private Optional totalCount = Optional.empty(); + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PageInfo other) { + count(other.getCount()); + totalCount(other.getTotalCount()); + startCursor(other.getStartCursor()); + endCursor(other.getEndCursor()); + return this; + } + + @JsonSetter(value = "count", nulls = Nulls.SKIP) + public Builder count(Optional count) { + this.count = count; + return this; + } + + public Builder count(Integer count) { + this.count = Optional.ofNullable(count); + return this; + } + + @JsonSetter(value = "total_count", nulls = Nulls.SKIP) + public Builder totalCount(Optional totalCount) { + this.totalCount = totalCount; + return this; + } + + public Builder totalCount(Integer totalCount) { + this.totalCount = Optional.ofNullable(totalCount); + return this; + } + + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public Builder startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + public Builder startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public Builder endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + public Builder endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + public PageInfo build() { + return new PageInfo(count, totalCount, startCursor, endCursor, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectEnvironment.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectEnvironment.java new file mode 100644 index 0000000..aceb02c --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectEnvironment.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ProjectEnvironment { + DEVELOPMENT("development"), + + PRODUCTION("production"); + + private final String value; + + ProjectEnvironment(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectInfoResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectInfoResponse.java new file mode 100644 index 0000000..c3f66ca --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectInfoResponse.java @@ -0,0 +1,102 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProjectInfoResponse.Builder.class) +public final class ProjectInfoResponse { + private final List apps; + + private final Map additionalProperties; + + private ProjectInfoResponse(List apps, Map additionalProperties) { + this.apps = apps; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("apps") + public List getApps() { + return apps; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProjectInfoResponse && equalTo((ProjectInfoResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProjectInfoResponse other) { + return apps.equals(other.apps); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apps); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List apps = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ProjectInfoResponse other) { + apps(other.getApps()); + return this; + } + + @JsonSetter(value = "apps", nulls = Nulls.SKIP) + public Builder apps(List apps) { + this.apps.clear(); + this.apps.addAll(apps); + return this; + } + + public Builder addApps(ProjectInfoResponseAppsItem apps) { + this.apps.add(apps); + return this; + } + + public Builder addAllApps(List apps) { + this.apps.addAll(apps); + return this; + } + + public ProjectInfoResponse build() { + return new ProjectInfoResponse(apps, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectInfoResponseAppsItem.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectInfoResponseAppsItem.java new file mode 100644 index 0000000..1b6412a --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectInfoResponseAppsItem.java @@ -0,0 +1,157 @@ +/** + * 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 = ProjectInfoResponseAppsItem.Builder.class) +public final class ProjectInfoResponseAppsItem { + private final Optional id; + + private final String nameSlug; + + private final Map additionalProperties; + + private ProjectInfoResponseAppsItem( + Optional id, String nameSlug, Map additionalProperties) { + this.id = id; + this.nameSlug = nameSlug; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the app. Only applies for OAuth apps. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The name slug of the target app + */ + @JsonProperty("name_slug") + public String getNameSlug() { + return nameSlug; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProjectInfoResponseAppsItem && equalTo((ProjectInfoResponseAppsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProjectInfoResponseAppsItem other) { + return id.equals(other.id) && nameSlug.equals(other.nameSlug); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.nameSlug); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameSlugStage builder() { + return new Builder(); + } + + public interface NameSlugStage { + /** + *

The name slug of the target app

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

ID of the app. Only applies for OAuth apps.

+ */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameSlugStage, _FinalStage { + private String nameSlug; + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProjectInfoResponseAppsItem other) { + id(other.getId()); + nameSlug(other.getNameSlug()); + return this; + } + + /** + *

The name slug of the target app

+ *

The name slug of the target app

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

ID of the app. Only applies for OAuth apps.

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

ID of the app. Only applies for OAuth apps.

+ */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @java.lang.Override + public ProjectInfoResponseAppsItem build() { + return new ProjectInfoResponseAppsItem(id, nameSlug, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/PropOption.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/PropOption.java new file mode 100644 index 0000000..f3fd389 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/PropOption.java @@ -0,0 +1,135 @@ +/** + * 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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PropOption.Builder.class) +public final class PropOption { + private final String label; + + private final Object value; + + private final Map additionalProperties; + + private PropOption(String label, Object value, Map additionalProperties) { + this.label = label; + this.value = value; + this.additionalProperties = additionalProperties; + } + + /** + * @return The human-readable label for the option + */ + @JsonProperty("label") + public String getLabel() { + return label; + } + + @JsonProperty("value") + public Object getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PropOption && equalTo((PropOption) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PropOption other) { + return label.equals(other.label) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.label, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LabelStage builder() { + return new Builder(); + } + + public interface LabelStage { + /** + *

The human-readable label for the option

+ */ + ValueStage label(@NotNull String label); + + Builder from(PropOption other); + } + + public interface ValueStage { + _FinalStage value(Object value); + } + + public interface _FinalStage { + PropOption build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LabelStage, ValueStage, _FinalStage { + private String label; + + private Object value; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PropOption other) { + label(other.getLabel()); + value(other.getValue()); + return this; + } + + /** + *

The human-readable label for the option

+ *

The human-readable label for the option

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("label") + public ValueStage label(@NotNull String label) { + this.label = Objects.requireNonNull(label, "label must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(Object value) { + this.value = value; + return this; + } + + @java.lang.Override + public PropOption build() { + return new PropOption(label, value, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProxyResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProxyResponse.java new file mode 100644 index 0000000..60a46ab --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProxyResponse.java @@ -0,0 +1,155 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyResponse.Builder.class) +public final class ProxyResponse { + private final Optional status; + + private final Optional> headers; + + private final Optional body; + + private final Map additionalProperties; + + private ProxyResponse( + Optional status, + Optional> headers, + Optional body, + Map additionalProperties) { + this.status = status; + this.headers = headers; + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return HTTP status code + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Response headers + */ + @JsonProperty("headers") + public Optional> getHeaders() { + return headers; + } + + @JsonProperty("body") + public Optional getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyResponse && equalTo((ProxyResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyResponse other) { + return status.equals(other.status) && headers.equals(other.headers) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.status, this.headers, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional status = Optional.empty(); + + private Optional> headers = Optional.empty(); + + private Optional body = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ProxyResponse other) { + status(other.getStatus()); + headers(other.getHeaders()); + body(other.getBody()); + return this; + } + + /** + *

HTTP status code

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(Integer status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Response headers

+ */ + @JsonSetter(value = "headers", nulls = Nulls.SKIP) + public Builder headers(Optional> headers) { + this.headers = headers; + return this; + } + + public Builder headers(Map headers) { + this.headers = Optional.ofNullable(headers); + return this; + } + + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public Builder body(Optional body) { + this.body = body; + return this; + } + + public Builder body(Object body) { + this.body = Optional.ofNullable(body); + return this; + } + + public ProxyResponse build() { + return new ProxyResponse(status, headers, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ReloadPropsOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ReloadPropsOpts.java new file mode 100644 index 0000000..c10ebce --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ReloadPropsOpts.java @@ -0,0 +1,331 @@ +/** + * 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 = ReloadPropsOpts.Builder.class) +public final class ReloadPropsOpts { + private final String id; + + private final String externalUserId; + + private final Optional blocking; + + private final Optional> configuredProps; + + private final Optional dynamicPropsId; + + private final Optional asyncHandle; + + private final Map additionalProperties; + + private ReloadPropsOpts( + String id, + String externalUserId, + Optional blocking, + Optional> configuredProps, + Optional dynamicPropsId, + Optional asyncHandle, + Map additionalProperties) { + this.id = id; + this.externalUserId = externalUserId; + this.blocking = blocking; + this.configuredProps = configuredProps; + this.dynamicPropsId = dynamicPropsId; + this.asyncHandle = asyncHandle; + this.additionalProperties = additionalProperties; + } + + /** + * @return The component ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The external user ID + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Whether this operation should block until completion + */ + @JsonProperty("blocking") + public Optional getBlocking() { + return blocking; + } + + /** + * @return The configured properties for the component + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The ID for dynamic props + */ + @JsonProperty("dynamic_props_id") + public Optional getDynamicPropsId() { + return dynamicPropsId; + } + + /** + * @return Handle for async operations + */ + @JsonProperty("async_handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReloadPropsOpts && equalTo((ReloadPropsOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReloadPropsOpts other) { + return id.equals(other.id) + && externalUserId.equals(other.externalUserId) + && blocking.equals(other.blocking) + && configuredProps.equals(other.configuredProps) + && dynamicPropsId.equals(other.dynamicPropsId) + && asyncHandle.equals(other.asyncHandle); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.externalUserId, + this.blocking, + this.configuredProps, + this.dynamicPropsId, + this.asyncHandle); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The component ID

+ */ + ExternalUserIdStage id(@NotNull String id); + + Builder from(ReloadPropsOpts other); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID

+ */ + _FinalStage externalUserId(@NotNull String externalUserId); + } + + public interface _FinalStage { + ReloadPropsOpts build(); + + /** + *

Whether this operation should block until completion

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

The configured properties for the component

+ */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

The ID for dynamic props

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

Handle for async operations

+ */ + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ExternalUserIdStage, _FinalStage { + private String id; + + private String externalUserId; + + private Optional asyncHandle = Optional.empty(); + + private Optional dynamicPropsId = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + private Optional blocking = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReloadPropsOpts other) { + id(other.getId()); + externalUserId(other.getExternalUserId()); + blocking(other.getBlocking()); + configuredProps(other.getConfiguredProps()); + dynamicPropsId(other.getDynamicPropsId()); + asyncHandle(other.getAsyncHandle()); + return this; + } + + /** + *

The component ID

+ *

The component ID

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

The external user ID

+ *

The external user ID

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

Handle for async operations

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

Handle for async operations

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

The ID for dynamic props

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

The ID for dynamic props

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

The configured properties for the component

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

The configured properties for the component

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

Whether this operation should block until completion

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

Whether this operation should block until completion

+ */ + @java.lang.Override + @JsonSetter(value = "blocking", nulls = Nulls.SKIP) + public _FinalStage blocking(Optional blocking) { + this.blocking = blocking; + return this; + } + + @java.lang.Override + public ReloadPropsOpts build() { + return new ReloadPropsOpts( + id, externalUserId, blocking, configuredProps, dynamicPropsId, asyncHandle, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ReloadPropsResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ReloadPropsResponse.java new file mode 100644 index 0000000..56e3dae --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ReloadPropsResponse.java @@ -0,0 +1,103 @@ +/** + * 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.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReloadPropsResponse.Builder.class) +public final class ReloadPropsResponse { + private final Optional> configurableProps; + + private final Map additionalProperties; + + private ReloadPropsResponse( + Optional> configurableProps, Map additionalProperties) { + this.configurableProps = configurableProps; + this.additionalProperties = additionalProperties; + } + + /** + * @return The updated configurable properties + */ + @JsonProperty("configurable_props") + public Optional> getConfigurableProps() { + return configurableProps; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReloadPropsResponse && equalTo((ReloadPropsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReloadPropsResponse other) { + return configurableProps.equals(other.configurableProps); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.configurableProps); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> configurableProps = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReloadPropsResponse other) { + configurableProps(other.getConfigurableProps()); + return this; + } + + /** + *

The updated configurable properties

+ */ + @JsonSetter(value = "configurable_props", nulls = Nulls.SKIP) + public Builder configurableProps(Optional> configurableProps) { + this.configurableProps = configurableProps; + return this; + } + + public Builder configurableProps(List configurableProps) { + this.configurableProps = Optional.ofNullable(configurableProps); + return this; + } + + public ReloadPropsResponse build() { + return new ReloadPropsResponse(configurableProps, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/RunActionResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/RunActionResponse.java new file mode 100644 index 0000000..585a35a --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/RunActionResponse.java @@ -0,0 +1,175 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RunActionResponse.Builder.class) +public final class RunActionResponse { + private final Optional exports; + + private final Optional os; + + private final Optional ret; + + private final Optional stashId; + + private final Map additionalProperties; + + private RunActionResponse( + Optional exports, + Optional os, + Optional ret, + Optional stashId, + Map additionalProperties) { + this.exports = exports; + this.os = os; + this.ret = ret; + this.stashId = stashId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("exports") + public Optional getExports() { + return exports; + } + + @JsonProperty("os") + public Optional getOs() { + return os; + } + + @JsonProperty("ret") + public Optional getRet() { + return ret; + } + + /** + * @return The ID of the File Stash that was used to sync the action's /tmp directory + */ + @JsonProperty("stash_id") + public Optional getStashId() { + return stashId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RunActionResponse && equalTo((RunActionResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RunActionResponse other) { + return exports.equals(other.exports) + && os.equals(other.os) + && ret.equals(other.ret) + && stashId.equals(other.stashId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.exports, this.os, this.ret, this.stashId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional exports = Optional.empty(); + + private Optional os = Optional.empty(); + + private Optional ret = Optional.empty(); + + private Optional stashId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RunActionResponse other) { + exports(other.getExports()); + os(other.getOs()); + ret(other.getRet()); + stashId(other.getStashId()); + return this; + } + + @JsonSetter(value = "exports", nulls = Nulls.SKIP) + public Builder exports(Optional exports) { + this.exports = exports; + return this; + } + + public Builder exports(Object exports) { + this.exports = Optional.ofNullable(exports); + return this; + } + + @JsonSetter(value = "os", nulls = Nulls.SKIP) + public Builder os(Optional os) { + this.os = os; + return this; + } + + public Builder os(Object os) { + this.os = Optional.ofNullable(os); + return this; + } + + @JsonSetter(value = "ret", nulls = Nulls.SKIP) + public Builder ret(Optional ret) { + this.ret = ret; + return this; + } + + public Builder ret(Object ret) { + this.ret = Optional.ofNullable(ret); + return this; + } + + /** + *

The ID of the File Stash that was used to sync the action's /tmp directory

+ */ + @JsonSetter(value = "stash_id", nulls = Nulls.SKIP) + public Builder stashId(Optional stashId) { + this.stashId = stashId; + return this; + } + + public Builder stashId(String stashId) { + this.stashId = Optional.ofNullable(stashId); + return this; + } + + public RunActionResponse build() { + return new RunActionResponse(exports, os, ret, stashId, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/StartConnectOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/StartConnectOpts.java new file mode 100644 index 0000000..74e494d --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/StartConnectOpts.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = StartConnectOpts.Builder.class) +public final class StartConnectOpts { + private final Optional iframe; + + private final Map additionalProperties; + + private StartConnectOpts(Optional iframe, Map additionalProperties) { + this.iframe = iframe; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the iframe element to use + */ + @JsonProperty("iframe") + public Optional getIframe() { + return iframe; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StartConnectOpts && equalTo((StartConnectOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(StartConnectOpts other) { + return iframe.equals(other.iframe); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.iframe); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional iframe = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(StartConnectOpts other) { + iframe(other.getIframe()); + return this; + } + + /** + *

ID of the iframe element to use

+ */ + @JsonSetter(value = "iframe", nulls = Nulls.SKIP) + public Builder iframe(Optional iframe) { + this.iframe = iframe; + return this; + } + + public Builder iframe(String iframe) { + this.iframe = Optional.ofNullable(iframe); + return this; + } + + public StartConnectOpts build() { + return new StartConnectOpts(iframe, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ValidateTokenParams.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ValidateTokenParams.java new file mode 100644 index 0000000..26f43cb --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ValidateTokenParams.java @@ -0,0 +1,156 @@ +/** + * 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 = ValidateTokenParams.Builder.class) +public final class ValidateTokenParams { + private final String appId; + + private final Optional oauthAppId; + + private final Map additionalProperties; + + private ValidateTokenParams(String appId, Optional oauthAppId, Map additionalProperties) { + this.appId = appId; + this.oauthAppId = oauthAppId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The app ID to validate against + */ + @JsonProperty("app_id") + public String getAppId() { + return appId; + } + + /** + * @return The OAuth app ID + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ValidateTokenParams && equalTo((ValidateTokenParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ValidateTokenParams other) { + return appId.equals(other.appId) && oauthAppId.equals(other.oauthAppId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.appId, this.oauthAppId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AppIdStage builder() { + return new Builder(); + } + + public interface AppIdStage { + /** + *

The app ID to validate against

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

The OAuth app ID

+ */ + _FinalStage oauthAppId(Optional oauthAppId); + + _FinalStage oauthAppId(String oauthAppId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AppIdStage, _FinalStage { + private String appId; + + private Optional oauthAppId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ValidateTokenParams other) { + appId(other.getAppId()); + oauthAppId(other.getOauthAppId()); + return this; + } + + /** + *

The app ID to validate against

+ *

The app ID to validate against

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

The OAuth app ID

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

The OAuth app ID

+ */ + @java.lang.Override + @JsonSetter(value = "oauth_app_id", nulls = Nulls.SKIP) + public _FinalStage oauthAppId(Optional oauthAppId) { + this.oauthAppId = oauthAppId; + return this; + } + + @java.lang.Override + public ValidateTokenParams build() { + return new ValidateTokenParams(appId, oauthAppId, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ValidateTokenResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ValidateTokenResponse.java new file mode 100644 index 0000000..5691d9d --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ValidateTokenResponse.java @@ -0,0 +1,511 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ValidateTokenResponse.Builder.class) +public final class ValidateTokenResponse { + private final Optional app; + + private final Optional error; + + private final Optional errorRedirectUri; + + private final Optional oauthAppId; + + private final Optional projectAppName; + + private final Optional projectEnvironment; + + private final Optional projectId; + + private final Optional projectSupportEmail; + + private final boolean success; + + private final Optional successRedirectUri; + + private final Map additionalProperties; + + private ValidateTokenResponse( + Optional app, + Optional error, + Optional errorRedirectUri, + Optional oauthAppId, + Optional projectAppName, + Optional projectEnvironment, + Optional projectId, + Optional projectSupportEmail, + boolean success, + Optional successRedirectUri, + Map additionalProperties) { + this.app = app; + this.error = error; + this.errorRedirectUri = errorRedirectUri; + this.oauthAppId = oauthAppId; + this.projectAppName = projectAppName; + this.projectEnvironment = projectEnvironment; + this.projectId = projectId; + this.projectSupportEmail = projectSupportEmail; + this.success = success; + this.successRedirectUri = successRedirectUri; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("app") + public Optional getApp() { + return app; + } + + /** + * @return Error message if validation failed + */ + @JsonProperty("error") + public Optional getError() { + return error; + } + + /** + * @return URI to redirect to on error + */ + @JsonProperty("error_redirect_uri") + public Optional getErrorRedirectUri() { + return errorRedirectUri; + } + + /** + * @return OAuth app ID if applicable + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + + /** + * @return Name of the project app + */ + @JsonProperty("project_app_name") + public Optional getProjectAppName() { + return projectAppName; + } + + /** + * @return Environment of the project + */ + @JsonProperty("project_environment") + public Optional getProjectEnvironment() { + return projectEnvironment; + } + + /** + * @return ID of the project + */ + @JsonProperty("project_id") + public Optional getProjectId() { + return projectId; + } + + /** + * @return Support email for the project + */ + @JsonProperty("project_support_email") + public Optional getProjectSupportEmail() { + return projectSupportEmail; + } + + /** + * @return Whether the token validation was successful + */ + @JsonProperty("success") + public boolean getSuccess() { + return success; + } + + /** + * @return URI to redirect to on success + */ + @JsonProperty("success_redirect_uri") + public Optional getSuccessRedirectUri() { + return successRedirectUri; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ValidateTokenResponse && equalTo((ValidateTokenResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ValidateTokenResponse other) { + return app.equals(other.app) + && error.equals(other.error) + && errorRedirectUri.equals(other.errorRedirectUri) + && oauthAppId.equals(other.oauthAppId) + && projectAppName.equals(other.projectAppName) + && projectEnvironment.equals(other.projectEnvironment) + && projectId.equals(other.projectId) + && projectSupportEmail.equals(other.projectSupportEmail) + && success == other.success + && successRedirectUri.equals(other.successRedirectUri); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.app, + this.error, + this.errorRedirectUri, + this.oauthAppId, + this.projectAppName, + this.projectEnvironment, + this.projectId, + this.projectSupportEmail, + this.success, + this.successRedirectUri); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SuccessStage builder() { + return new Builder(); + } + + public interface SuccessStage { + /** + *

Whether the token validation was successful

+ */ + _FinalStage success(boolean success); + + Builder from(ValidateTokenResponse other); + } + + public interface _FinalStage { + ValidateTokenResponse build(); + + _FinalStage app(Optional app); + + _FinalStage app(App app); + + /** + *

Error message if validation failed

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

URI to redirect to on error

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

OAuth app ID if applicable

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

Name of the project app

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

Environment of the project

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

ID of the project

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

Support email for the project

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

URI to redirect to on success

+ */ + _FinalStage successRedirectUri(Optional successRedirectUri); + + _FinalStage successRedirectUri(String successRedirectUri); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SuccessStage, _FinalStage { + private boolean success; + + private Optional successRedirectUri = Optional.empty(); + + private Optional projectSupportEmail = Optional.empty(); + + private Optional projectId = Optional.empty(); + + private Optional projectEnvironment = Optional.empty(); + + private Optional projectAppName = Optional.empty(); + + private Optional oauthAppId = Optional.empty(); + + private Optional errorRedirectUri = Optional.empty(); + + private Optional error = Optional.empty(); + + private Optional app = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ValidateTokenResponse other) { + app(other.getApp()); + error(other.getError()); + errorRedirectUri(other.getErrorRedirectUri()); + oauthAppId(other.getOauthAppId()); + projectAppName(other.getProjectAppName()); + projectEnvironment(other.getProjectEnvironment()); + projectId(other.getProjectId()); + projectSupportEmail(other.getProjectSupportEmail()); + success(other.getSuccess()); + successRedirectUri(other.getSuccessRedirectUri()); + return this; + } + + /** + *

Whether the token validation was successful

+ *

Whether the token validation was successful

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("success") + public _FinalStage success(boolean success) { + this.success = success; + return this; + } + + /** + *

URI to redirect to on success

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

URI to redirect to on success

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

Support email for the project

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

Support email for the project

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

ID of the project

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

ID of the project

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

Environment of the project

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

Environment of the project

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

Name of the project app

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

Name of the project app

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

OAuth app ID if applicable

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

OAuth app ID if applicable

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

URI to redirect to on error

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

URI to redirect to on error

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

Error message if validation failed

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

Error message if validation failed

+ */ + @java.lang.Override + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public _FinalStage error(Optional error) { + this.error = error; + return this; + } + + @java.lang.Override + public _FinalStage app(App app) { + this.app = Optional.ofNullable(app); + return this; + } + + @java.lang.Override + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public _FinalStage app(Optional app) { + this.app = app; + return this; + } + + @java.lang.Override + public ValidateTokenResponse build() { + return new ValidateTokenResponse( + app, + error, + errorRedirectUri, + oauthAppId, + projectAppName, + projectEnvironment, + projectId, + projectSupportEmail, + success, + successRedirectUri, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/test/java/com/pipedream/api/StreamTest.java b/build/spotless/spotlessJava/src/test/java/com/pipedream/api/StreamTest.java new file mode 100644 index 0000000..a0f9ca9 --- /dev/null +++ b/build/spotless/spotlessJava/src/test/java/com/pipedream/api/StreamTest.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import static org.junit.jupiter.api.Assertions.*; + +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.Stream; +import java.io.IOException; +import java.io.StringReader; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import org.junit.jupiter.api.Test; + +public final class StreamTest { + @Test + public void testJsonStream() { + List messages = List.of(Map.of("message", "hello"), Map.of("message", "world")); + List jsonStrings = messages.stream().map(StreamTest::mapToJson).toList(); + String input = String.join("\n", jsonStrings); + StringReader jsonInput = new StringReader(input); + Stream jsonStream = Stream.fromJson(Map.class, jsonInput); + int expectedMessages = 2; + int actualMessages = 0; + for (Map jsonObject : jsonStream) { + actualMessages++; + assertTrue(jsonObject.containsKey("message")); + } + assertEquals(expectedMessages, actualMessages); + } + + @Test + public void testSseStream() { + List events = List.of(Map.of("event", "start"), Map.of("event", "end")); + List sseStrings = events.stream().map(StreamTest::mapToSse).toList(); + String input = String.join("\n" + "\n", sseStrings); + StringReader sseInput = new StringReader(input); + Stream sseStream = Stream.fromSse(Map.class, sseInput); + int expectedEvents = 2; + int actualEvents = 0; + for (Map eventData : sseStream) { + actualEvents++; + assertTrue(eventData.containsKey("event")); + } + assertEquals(expectedEvents, actualEvents); + } + + @Test + public void testSseStreamWithTerminator() { + List events = List.of(Map.of("message", "first"), Map.of("message", "second")); + List sseStrings = events.stream().map(StreamTest::mapToSse).collect(Collectors.toList()); + sseStrings.add("data: [DONE]"); + String input = String.join("\n" + "\n", sseStrings); + StringReader sseInput = new StringReader(input); + Stream sseStream = Stream.fromSse(Map.class, sseInput, "[DONE]"); + int expectedEvents = 2; + int actualEvents = 0; + for (Map eventData : sseStream) { + actualEvents++; + assertTrue(eventData.containsKey("message")); + } + assertEquals(expectedEvents, actualEvents); + } + + @Test + public void testStreamResourceManagement() throws IOException { + StringReader testInput = new StringReader("{\"test\":\"data\"}"); + Stream testStream = Stream.fromJson(Map.class, testInput); + testStream.close(); + assertFalse(testStream.iterator().hasNext()); + } + + private static String mapToJson(Map map) { + try { + return ObjectMappers.JSON_MAPPER.writeValueAsString(map); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private static String mapToSse(Map map) { + return "data: " + mapToJson(map); + } +} diff --git a/build/spotless/spotlessJava/src/test/java/com/pipedream/api/TestClient.java b/build/spotless/spotlessJava/src/test/java/com/pipedream/api/TestClient.java new file mode 100644 index 0000000..157ade0 --- /dev/null +++ b/build/spotless/spotlessJava/src/test/java/com/pipedream/api/TestClient.java @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +public final class TestClient { + public void test() { + // Add tests here and mark this file in .fernignore + assert true; + } +} diff --git a/build/spotless/spotlessJava/src/test/java/com/pipedream/api/core/QueryStringMapperTest.java b/build/spotless/spotlessJava/src/test/java/com/pipedream/api/core/QueryStringMapperTest.java new file mode 100644 index 0000000..d8eac81 --- /dev/null +++ b/build/spotless/spotlessJava/src/test/java/com/pipedream/api/core/QueryStringMapperTest.java @@ -0,0 +1,339 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.HttpUrl; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class QueryStringMapperTest { + @Test + public void testObjectWithQuotedString_indexedArrays() { + Map map = new HashMap() { + { + put("hello", "\"world\""); + } + }; + + String expectedQueryString = "withquoted%5Bhello%5D=%22world%22"; + + String actualQueryString = queryString( + new HashMap() { + { + put("withquoted", map); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectWithQuotedString_arraysAsRepeats() { + Map map = new HashMap() { + { + put("hello", "\"world\""); + } + }; + + String expectedQueryString = "withquoted%5Bhello%5D=%22world%22"; + + String actualQueryString = queryString( + new HashMap() { + { + put("withquoted", map); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObject_indexedArrays() { + Map map = new HashMap() { + { + put("foo", "bar"); + put("baz", "qux"); + } + }; + + String expectedQueryString = "metadata%5Bfoo%5D=bar&metadata%5Bbaz%5D=qux"; + + String actualQueryString = queryString( + new HashMap() { + { + put("metadata", map); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObject_arraysAsRepeats() { + Map map = new HashMap() { + { + put("foo", "bar"); + put("baz", "qux"); + } + }; + + String expectedQueryString = "metadata%5Bfoo%5D=bar&metadata%5Bbaz%5D=qux"; + + String actualQueryString = queryString( + new HashMap() { + { + put("metadata", map); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testNestedObject_indexedArrays() { + Map> nestedMap = new HashMap>() { + { + put("mapkey1", new HashMap() { + { + put("mapkey1mapkey1", "mapkey1mapkey1value"); + put("mapkey1mapkey2", "mapkey1mapkey2value"); + } + }); + put("mapkey2", new HashMap() { + { + put("mapkey2mapkey1", "mapkey2mapkey1value"); + } + }); + } + }; + + String expectedQueryString = + "nested%5Bmapkey2%5D%5Bmapkey2mapkey1%5D=mapkey2mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey1" + + "%5D=mapkey1mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey2%5D=mapkey1mapkey2value"; + + String actualQueryString = queryString( + new HashMap() { + { + put("nested", nestedMap); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testNestedObject_arraysAsRepeats() { + Map> nestedMap = new HashMap>() { + { + put("mapkey1", new HashMap() { + { + put("mapkey1mapkey1", "mapkey1mapkey1value"); + put("mapkey1mapkey2", "mapkey1mapkey2value"); + } + }); + put("mapkey2", new HashMap() { + { + put("mapkey2mapkey1", "mapkey2mapkey1value"); + } + }); + } + }; + + String expectedQueryString = + "nested%5Bmapkey2%5D%5Bmapkey2mapkey1%5D=mapkey2mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey1" + + "%5D=mapkey1mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey2%5D=mapkey1mapkey2value"; + + String actualQueryString = queryString( + new HashMap() { + { + put("nested", nestedMap); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testDateTime_indexedArrays() { + OffsetDateTime dateTime = + OffsetDateTime.ofInstant(Instant.ofEpochSecond(1740412107L), ZoneId.of("America/New_York")); + + String expectedQueryString = "datetime=2025-02-24T10%3A48%3A27-05%3A00"; + + String actualQueryString = queryString( + new HashMap() { + { + put("datetime", dateTime); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testDateTime_arraysAsRepeats() { + OffsetDateTime dateTime = + OffsetDateTime.ofInstant(Instant.ofEpochSecond(1740412107L), ZoneId.of("America/New_York")); + + String expectedQueryString = "datetime=2025-02-24T10%3A48%3A27-05%3A00"; + + String actualQueryString = queryString( + new HashMap() { + { + put("datetime", dateTime); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectArray_indexedArrays() { + List> mapArray = new ArrayList>() { + { + add(new HashMap() { + { + put("key", "hello"); + put("value", "world"); + } + }); + add(new HashMap() { + { + put("key", "foo"); + put("value", "bar"); + } + }); + add(new HashMap<>()); + } + }; + + String expectedQueryString = "objects%5B0%5D%5Bvalue%5D=world&objects%5B0%5D%5Bkey%5D=hello&objects%5B1%5D" + + "%5Bvalue%5D=bar&objects%5B1%5D%5Bkey%5D=foo"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objects", mapArray); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectArray_arraysAsRepeats() { + List> mapArray = new ArrayList>() { + { + add(new HashMap() { + { + put("key", "hello"); + put("value", "world"); + } + }); + add(new HashMap() { + { + put("key", "foo"); + put("value", "bar"); + } + }); + add(new HashMap<>()); + } + }; + + String expectedQueryString = + "objects%5Bvalue%5D=world&objects%5Bkey%5D=hello&objects%5Bvalue" + "%5D=bar&objects%5Bkey%5D=foo"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objects", mapArray); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectWithArray_indexedArrays() { + Map objectWithArray = new HashMap() { + { + put("id", "abc123"); + put("contactIds", new ArrayList() { + { + add("id1"); + add("id2"); + add("id3"); + } + }); + } + }; + + String expectedQueryString = + "objectwitharray%5Bid%5D=abc123&objectwitharray%5BcontactIds%5D%5B0%5D=id1&objectwitharray" + + "%5BcontactIds%5D%5B1%5D=id2&objectwitharray%5BcontactIds%5D%5B2%5D=id3"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objectwitharray", objectWithArray); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectWithArray_arraysAsRepeats() { + Map objectWithArray = new HashMap() { + { + put("id", "abc123"); + put("contactIds", new ArrayList() { + { + add("id1"); + add("id2"); + add("id3"); + } + }); + } + }; + + String expectedQueryString = "objectwitharray%5Bid%5D=abc123&objectwitharray%5BcontactIds" + + "%5D=id1&objectwitharray%5BcontactIds%5D=id2&objectwitharray%5BcontactIds%5D=id3"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objectwitharray", objectWithArray); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + private static String queryString(Map params, boolean arraysAsRepeats) { + HttpUrl.Builder httpUrl = HttpUrl.parse("http://www.fakewebsite.com/").newBuilder(); + params.forEach((paramName, paramValue) -> + QueryStringMapper.addQueryParameter(httpUrl, paramName, paramValue, arraysAsRepeats)); + return httpUrl.build().encodedQuery(); + } +} diff --git a/build/tmp/spotless-register-dependencies b/build/tmp/spotless-register-dependencies new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/build/tmp/spotless-register-dependencies @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..e69de29 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..d4081da --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..23d15a9 --- /dev/null +++ b/gradlew @@ -0,0 +1,251 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH="\\\"\\\"" + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..5eed7ee --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH= + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/sample-app/build.gradle b/sample-app/build.gradle new file mode 100644 index 0000000..4ee8f22 --- /dev/null +++ b/sample-app/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'java-library' +} + +repositories { + mavenCentral() + maven { + url 'https://s01.oss.sonatype.org/content/repositories/releases/' + } +} + +dependencies { + implementation rootProject +} + + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + diff --git a/sample-app/src/main/java/sample/App.java b/sample-app/src/main/java/sample/App.java new file mode 100644 index 0000000..7587480 --- /dev/null +++ b/sample-app/src/main/java/sample/App.java @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +package sample; + +import java.lang.String; + +public final class App { + public static void main(String[] args) { + // import com.pipedream.api.AsyncPipedreamApiClient + } +} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..db2eef5 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,3 @@ +rootProject.name = 'pipedream' + +include 'sample-app' \ No newline at end of file diff --git a/src/main/java/com/pipedream/api/AsyncPipedreamApiClient.java b/src/main/java/com/pipedream/api/AsyncPipedreamApiClient.java new file mode 100644 index 0000000..ee61fa8 --- /dev/null +++ b/src/main/java/com/pipedream/api/AsyncPipedreamApiClient.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.Suppliers; +import com.pipedream.api.resources.accounts.AsyncAccountsClient; +import com.pipedream.api.resources.actions.AsyncActionsClient; +import com.pipedream.api.resources.appcategories.AsyncAppCategoriesClient; +import com.pipedream.api.resources.apps.AsyncAppsClient; +import com.pipedream.api.resources.components.AsyncComponentsClient; +import com.pipedream.api.resources.deployedtriggers.AsyncDeployedTriggersClient; +import com.pipedream.api.resources.oauthtokens.AsyncOauthTokensClient; +import com.pipedream.api.resources.projects.AsyncProjectsClient; +import com.pipedream.api.resources.proxy.AsyncProxyClient; +import com.pipedream.api.resources.tokens.AsyncTokensClient; +import com.pipedream.api.resources.triggers.AsyncTriggersClient; +import com.pipedream.api.resources.users.AsyncUsersClient; +import java.util.function.Supplier; + +public class AsyncPipedreamApiClient { + protected final ClientOptions clientOptions; + + protected final Supplier appCategoriesClient; + + protected final Supplier appsClient; + + protected final Supplier accountsClient; + + protected final Supplier usersClient; + + protected final Supplier componentsClient; + + protected final Supplier actionsClient; + + protected final Supplier triggersClient; + + protected final Supplier deployedTriggersClient; + + protected final Supplier projectsClient; + + protected final Supplier proxyClient; + + protected final Supplier tokensClient; + + protected final Supplier oauthTokensClient; + + public AsyncPipedreamApiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.appCategoriesClient = Suppliers.memoize(() -> new AsyncAppCategoriesClient(clientOptions)); + this.appsClient = Suppliers.memoize(() -> new AsyncAppsClient(clientOptions)); + this.accountsClient = Suppliers.memoize(() -> new AsyncAccountsClient(clientOptions)); + this.usersClient = Suppliers.memoize(() -> new AsyncUsersClient(clientOptions)); + this.componentsClient = Suppliers.memoize(() -> new AsyncComponentsClient(clientOptions)); + this.actionsClient = Suppliers.memoize(() -> new AsyncActionsClient(clientOptions)); + this.triggersClient = Suppliers.memoize(() -> new AsyncTriggersClient(clientOptions)); + this.deployedTriggersClient = Suppliers.memoize(() -> new AsyncDeployedTriggersClient(clientOptions)); + this.projectsClient = Suppliers.memoize(() -> new AsyncProjectsClient(clientOptions)); + this.proxyClient = Suppliers.memoize(() -> new AsyncProxyClient(clientOptions)); + this.tokensClient = Suppliers.memoize(() -> new AsyncTokensClient(clientOptions)); + this.oauthTokensClient = Suppliers.memoize(() -> new AsyncOauthTokensClient(clientOptions)); + } + + public AsyncAppCategoriesClient appCategories() { + return this.appCategoriesClient.get(); + } + + public AsyncAppsClient apps() { + return this.appsClient.get(); + } + + public AsyncAccountsClient accounts() { + return this.accountsClient.get(); + } + + public AsyncUsersClient users() { + return this.usersClient.get(); + } + + public AsyncComponentsClient components() { + return this.componentsClient.get(); + } + + public AsyncActionsClient actions() { + return this.actionsClient.get(); + } + + public AsyncTriggersClient triggers() { + return this.triggersClient.get(); + } + + public AsyncDeployedTriggersClient deployedTriggers() { + return this.deployedTriggersClient.get(); + } + + public AsyncProjectsClient projects() { + return this.projectsClient.get(); + } + + public AsyncProxyClient proxy() { + return this.proxyClient.get(); + } + + public AsyncTokensClient tokens() { + return this.tokensClient.get(); + } + + public AsyncOauthTokensClient oauthTokens() { + return this.oauthTokensClient.get(); + } + + public static AsyncPipedreamApiClientBuilder builder() { + return new AsyncPipedreamApiClientBuilder(); + } +} diff --git a/src/main/java/com/pipedream/api/AsyncPipedreamApiClientBuilder.java b/src/main/java/com/pipedream/api/AsyncPipedreamApiClientBuilder.java new file mode 100644 index 0000000..0ebee7b --- /dev/null +++ b/src/main/java/com/pipedream/api/AsyncPipedreamApiClientBuilder.java @@ -0,0 +1,99 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.Environment; +import com.pipedream.api.core.OAuthTokenSupplier; +import com.pipedream.api.resources.oauthtokens.OauthTokensClient; +import okhttp3.OkHttpClient; + +public final class AsyncPipedreamApiClientBuilder { + private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); + + private String clientId = System.getenv("PIPEDREAM_CLIENT_ID"); + + private String clientSecret = System.getenv("PIPEDREAM_CLIENT_SECRET"); + + private String projectEnvironment = null; + + private Environment environment = Environment.PROD; + + /** + * Sets clientId. + * Defaults to the PIPEDREAM_CLIENT_ID environment variable. + */ + public AsyncPipedreamApiClientBuilder clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Sets clientSecret. + * Defaults to the PIPEDREAM_CLIENT_SECRET environment variable. + */ + public AsyncPipedreamApiClientBuilder clientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Sets projectEnvironment + */ + public AsyncPipedreamApiClientBuilder projectEnvironment(String projectEnvironment) { + this.projectEnvironment = projectEnvironment; + return this; + } + + public AsyncPipedreamApiClientBuilder environment(Environment environment) { + this.environment = environment; + return this; + } + + public AsyncPipedreamApiClientBuilder url(String url) { + this.environment = Environment.custom(url); + return this; + } + + /** + * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. + */ + public AsyncPipedreamApiClientBuilder timeout(int timeout) { + this.clientOptionsBuilder.timeout(timeout); + return this; + } + + /** + * Sets the maximum number of retries for the client. Defaults to 2 retries. + */ + public AsyncPipedreamApiClientBuilder maxRetries(int maxRetries) { + this.clientOptionsBuilder.maxRetries(maxRetries); + return this; + } + + /** + * Sets the underlying OkHttp client + */ + public AsyncPipedreamApiClientBuilder httpClient(OkHttpClient httpClient) { + this.clientOptionsBuilder.httpClient(httpClient); + return this; + } + + public AsyncPipedreamApiClientBuilder projectId(String projectId) { + clientOptionsBuilder.projectId(projectId); + return this; + } + + public AsyncPipedreamApiClient build() { + OauthTokensClient authClient = new OauthTokensClient( + ClientOptions.builder().environment(this.environment).build()); + OAuthTokenSupplier oAuthTokenSupplier = new OAuthTokenSupplier(clientId, clientSecret, authClient); + this.clientOptionsBuilder.addHeader("Authorization", oAuthTokenSupplier); + if (projectEnvironment != null) { + this.clientOptionsBuilder.addHeader("x-pd-environment", this.projectEnvironment); + } + clientOptionsBuilder.environment(this.environment); + return new AsyncPipedreamApiClient(clientOptionsBuilder.build()); + } +} diff --git a/src/main/java/com/pipedream/api/PipedreamApiClient.java b/src/main/java/com/pipedream/api/PipedreamApiClient.java new file mode 100644 index 0000000..fbe892b --- /dev/null +++ b/src/main/java/com/pipedream/api/PipedreamApiClient.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.Suppliers; +import com.pipedream.api.resources.accounts.AccountsClient; +import com.pipedream.api.resources.actions.ActionsClient; +import com.pipedream.api.resources.appcategories.AppCategoriesClient; +import com.pipedream.api.resources.apps.AppsClient; +import com.pipedream.api.resources.components.ComponentsClient; +import com.pipedream.api.resources.deployedtriggers.DeployedTriggersClient; +import com.pipedream.api.resources.oauthtokens.OauthTokensClient; +import com.pipedream.api.resources.projects.ProjectsClient; +import com.pipedream.api.resources.proxy.ProxyClient; +import com.pipedream.api.resources.tokens.TokensClient; +import com.pipedream.api.resources.triggers.TriggersClient; +import com.pipedream.api.resources.users.UsersClient; +import java.util.function.Supplier; + +public class PipedreamApiClient { + protected final ClientOptions clientOptions; + + protected final Supplier appCategoriesClient; + + protected final Supplier appsClient; + + protected final Supplier accountsClient; + + protected final Supplier usersClient; + + protected final Supplier componentsClient; + + protected final Supplier actionsClient; + + protected final Supplier triggersClient; + + protected final Supplier deployedTriggersClient; + + protected final Supplier projectsClient; + + protected final Supplier proxyClient; + + protected final Supplier tokensClient; + + protected final Supplier oauthTokensClient; + + public PipedreamApiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.appCategoriesClient = Suppliers.memoize(() -> new AppCategoriesClient(clientOptions)); + this.appsClient = Suppliers.memoize(() -> new AppsClient(clientOptions)); + this.accountsClient = Suppliers.memoize(() -> new AccountsClient(clientOptions)); + this.usersClient = Suppliers.memoize(() -> new UsersClient(clientOptions)); + this.componentsClient = Suppliers.memoize(() -> new ComponentsClient(clientOptions)); + this.actionsClient = Suppliers.memoize(() -> new ActionsClient(clientOptions)); + this.triggersClient = Suppliers.memoize(() -> new TriggersClient(clientOptions)); + this.deployedTriggersClient = Suppliers.memoize(() -> new DeployedTriggersClient(clientOptions)); + this.projectsClient = Suppliers.memoize(() -> new ProjectsClient(clientOptions)); + this.proxyClient = Suppliers.memoize(() -> new ProxyClient(clientOptions)); + this.tokensClient = Suppliers.memoize(() -> new TokensClient(clientOptions)); + this.oauthTokensClient = Suppliers.memoize(() -> new OauthTokensClient(clientOptions)); + } + + public AppCategoriesClient appCategories() { + return this.appCategoriesClient.get(); + } + + public AppsClient apps() { + return this.appsClient.get(); + } + + public AccountsClient accounts() { + return this.accountsClient.get(); + } + + public UsersClient users() { + return this.usersClient.get(); + } + + public ComponentsClient components() { + return this.componentsClient.get(); + } + + public ActionsClient actions() { + return this.actionsClient.get(); + } + + public TriggersClient triggers() { + return this.triggersClient.get(); + } + + public DeployedTriggersClient deployedTriggers() { + return this.deployedTriggersClient.get(); + } + + public ProjectsClient projects() { + return this.projectsClient.get(); + } + + public ProxyClient proxy() { + return this.proxyClient.get(); + } + + public TokensClient tokens() { + return this.tokensClient.get(); + } + + public OauthTokensClient oauthTokens() { + return this.oauthTokensClient.get(); + } + + public static PipedreamApiClientBuilder builder() { + return new PipedreamApiClientBuilder(); + } +} diff --git a/src/main/java/com/pipedream/api/PipedreamApiClientBuilder.java b/src/main/java/com/pipedream/api/PipedreamApiClientBuilder.java new file mode 100644 index 0000000..9983f98 --- /dev/null +++ b/src/main/java/com/pipedream/api/PipedreamApiClientBuilder.java @@ -0,0 +1,99 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.Environment; +import com.pipedream.api.core.OAuthTokenSupplier; +import com.pipedream.api.resources.oauthtokens.OauthTokensClient; +import okhttp3.OkHttpClient; + +public final class PipedreamApiClientBuilder { + private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); + + private String clientId = System.getenv("PIPEDREAM_CLIENT_ID"); + + private String clientSecret = System.getenv("PIPEDREAM_CLIENT_SECRET"); + + private String projectEnvironment = null; + + private Environment environment = Environment.PROD; + + /** + * Sets clientId. + * Defaults to the PIPEDREAM_CLIENT_ID environment variable. + */ + public PipedreamApiClientBuilder clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Sets clientSecret. + * Defaults to the PIPEDREAM_CLIENT_SECRET environment variable. + */ + public PipedreamApiClientBuilder clientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Sets projectEnvironment + */ + public PipedreamApiClientBuilder projectEnvironment(String projectEnvironment) { + this.projectEnvironment = projectEnvironment; + return this; + } + + public PipedreamApiClientBuilder environment(Environment environment) { + this.environment = environment; + return this; + } + + public PipedreamApiClientBuilder url(String url) { + this.environment = Environment.custom(url); + return this; + } + + /** + * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. + */ + public PipedreamApiClientBuilder timeout(int timeout) { + this.clientOptionsBuilder.timeout(timeout); + return this; + } + + /** + * Sets the maximum number of retries for the client. Defaults to 2 retries. + */ + public PipedreamApiClientBuilder maxRetries(int maxRetries) { + this.clientOptionsBuilder.maxRetries(maxRetries); + return this; + } + + /** + * Sets the underlying OkHttp client + */ + public PipedreamApiClientBuilder httpClient(OkHttpClient httpClient) { + this.clientOptionsBuilder.httpClient(httpClient); + return this; + } + + public PipedreamApiClientBuilder projectId(String projectId) { + clientOptionsBuilder.projectId(projectId); + return this; + } + + public PipedreamApiClient build() { + OauthTokensClient authClient = new OauthTokensClient( + ClientOptions.builder().environment(this.environment).build()); + OAuthTokenSupplier oAuthTokenSupplier = new OAuthTokenSupplier(clientId, clientSecret, authClient); + this.clientOptionsBuilder.addHeader("Authorization", oAuthTokenSupplier); + if (projectEnvironment != null) { + this.clientOptionsBuilder.addHeader("x-pd-environment", this.projectEnvironment); + } + clientOptionsBuilder.environment(this.environment); + return new PipedreamApiClient(clientOptionsBuilder.build()); + } +} diff --git a/src/main/java/com/pipedream/api/core/ClientOptions.java b/src/main/java/com/pipedream/api/core/ClientOptions.java new file mode 100644 index 0000000..71e9632 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/ClientOptions.java @@ -0,0 +1,186 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +import okhttp3.OkHttpClient; + +public final class ClientOptions { + private final Environment environment; + + private final Map headers; + + private final Map> headerSuppliers; + + private final OkHttpClient httpClient; + + private final int timeout; + + private String projectId; + + private ClientOptions( + Environment environment, + Map headers, + Map> headerSuppliers, + OkHttpClient httpClient, + int timeout, + String projectId) { + this.environment = environment; + this.headers = new HashMap<>(); + this.headers.putAll(headers); + this.headers.putAll(new HashMap() { + { + put("X-Fern-Language", "JAVA"); + put("X-Fern-SDK-Name", "com.pipedream.fern:api-sdk"); + put("X-Fern-SDK-Version", "0.0.190"); + } + }); + this.headerSuppliers = headerSuppliers; + this.httpClient = httpClient; + this.timeout = timeout; + this.projectId = projectId; + } + + public Environment environment() { + return this.environment; + } + + public Map headers(RequestOptions requestOptions) { + Map values = new HashMap<>(this.headers); + headerSuppliers.forEach((key, supplier) -> { + values.put(key, supplier.get()); + }); + if (requestOptions != null) { + values.putAll(requestOptions.getHeaders()); + } + return values; + } + + public int timeout(RequestOptions requestOptions) { + if (requestOptions == null) { + return this.timeout; + } + return requestOptions.getTimeout().orElse(this.timeout); + } + + public OkHttpClient httpClient() { + return this.httpClient; + } + + public OkHttpClient httpClientWithTimeout(RequestOptions requestOptions) { + if (requestOptions == null) { + return this.httpClient; + } + return this.httpClient + .newBuilder() + .callTimeout(requestOptions.getTimeout().get(), requestOptions.getTimeoutTimeUnit()) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS) + .build(); + } + + public String projectId() { + return this.projectId; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private Environment environment; + + private final Map headers = new HashMap<>(); + + private final Map> headerSuppliers = new HashMap<>(); + + private int maxRetries = 2; + + private Optional timeout = Optional.empty(); + + private OkHttpClient httpClient = null; + + private String projectId; + + public Builder environment(Environment environment) { + this.environment = environment; + return this; + } + + public Builder addHeader(String key, String value) { + this.headers.put(key, value); + return this; + } + + public Builder addHeader(String key, Supplier value) { + this.headerSuppliers.put(key, value); + return this; + } + + /** + * Override the timeout in seconds. Defaults to 60 seconds. + */ + public Builder timeout(int timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + /** + * Override the timeout in seconds. Defaults to 60 seconds. + */ + public Builder timeout(Optional timeout) { + this.timeout = timeout; + return this; + } + + /** + * Override the maximum number of retries. Defaults to 2 retries. + */ + public Builder maxRetries(int maxRetries) { + this.maxRetries = maxRetries; + return this; + } + + public Builder httpClient(OkHttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + + public ClientOptions build() { + OkHttpClient.Builder httpClientBuilder = + this.httpClient != null ? this.httpClient.newBuilder() : new OkHttpClient.Builder(); + + if (this.httpClient != null) { + timeout.ifPresent(timeout -> httpClientBuilder + .callTimeout(timeout, TimeUnit.SECONDS) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS)); + } else { + httpClientBuilder + .callTimeout(this.timeout.orElse(60), TimeUnit.SECONDS) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS) + .addInterceptor(new RetryInterceptor(this.maxRetries)); + } + + this.httpClient = httpClientBuilder.build(); + this.timeout = Optional.of(httpClient.callTimeoutMillis() / 1000); + + return new ClientOptions( + environment, headers, headerSuppliers, httpClient, this.timeout.get(), this.projectId); + } + } +} diff --git a/src/main/java/com/pipedream/api/core/DateTimeDeserializer.java b/src/main/java/com/pipedream/api/core/DateTimeDeserializer.java new file mode 100644 index 0000000..e9083a3 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/DateTimeDeserializer.java @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.module.SimpleModule; +import java.io.IOException; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAccessor; +import java.time.temporal.TemporalQueries; + +/** + * Custom deserializer that handles converting ISO8601 dates into {@link OffsetDateTime} objects. + */ +class DateTimeDeserializer extends JsonDeserializer { + private static final SimpleModule MODULE; + + static { + MODULE = new SimpleModule().addDeserializer(OffsetDateTime.class, new DateTimeDeserializer()); + } + + /** + * Gets a module wrapping this deserializer as an adapter for the Jackson ObjectMapper. + * + * @return A {@link SimpleModule} to be plugged onto Jackson ObjectMapper. + */ + public static SimpleModule getModule() { + return MODULE; + } + + @Override + public OffsetDateTime deserialize(JsonParser parser, DeserializationContext context) throws IOException { + JsonToken token = parser.currentToken(); + if (token == JsonToken.VALUE_NUMBER_INT) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(parser.getValueAsLong()), ZoneOffset.UTC); + } else { + TemporalAccessor temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest( + parser.getValueAsString(), OffsetDateTime::from, LocalDateTime::from); + + if (temporal.query(TemporalQueries.offset()) == null) { + return LocalDateTime.from(temporal).atOffset(ZoneOffset.UTC); + } else { + return OffsetDateTime.from(temporal); + } + } + } +} diff --git a/src/main/java/com/pipedream/api/core/Environment.java b/src/main/java/com/pipedream/api/core/Environment.java new file mode 100644 index 0000000..def399b --- /dev/null +++ b/src/main/java/com/pipedream/api/core/Environment.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +public final class Environment { + public static final Environment CANARY = new Environment("https://api2.pipedream.com"); + + public static final Environment DEV = new Environment("https://api.${DEV_NAMESPACE}.gkes.pipedream.net"); + + public static final Environment PROD = new Environment("https://api.pipedream.com"); + + private final String url; + + private Environment(String url) { + this.url = url; + } + + public String getUrl() { + return this.url; + } + + public static Environment custom(String url) { + return new Environment(url); + } +} diff --git a/src/main/java/com/pipedream/api/core/FileStream.java b/src/main/java/com/pipedream/api/core/FileStream.java new file mode 100644 index 0000000..d5500e2 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/FileStream.java @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.InputStream; +import java.util.Objects; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import org.jetbrains.annotations.Nullable; + +/** + * Represents a file stream with associated metadata for file uploads. + */ +public class FileStream { + private final InputStream inputStream; + private final String fileName; + private final MediaType contentType; + + /** + * Constructs a FileStream with the given input stream and optional metadata. + * + * @param inputStream The input stream of the file content. Must not be null. + * @param fileName The name of the file, or null if unknown. + * @param contentType The MIME type of the file content, or null if unknown. + * @throws NullPointerException if inputStream is null + */ + public FileStream(InputStream inputStream, @Nullable String fileName, @Nullable MediaType contentType) { + this.inputStream = Objects.requireNonNull(inputStream, "Input stream cannot be null"); + this.fileName = fileName; + this.contentType = contentType; + } + + public FileStream(InputStream inputStream) { + this(inputStream, null, null); + } + + public InputStream getInputStream() { + return inputStream; + } + + @Nullable + public String getFileName() { + return fileName; + } + + @Nullable + public MediaType getContentType() { + return contentType; + } + + /** + * Creates a RequestBody suitable for use with OkHttp client. + * + * @return A RequestBody instance representing this file stream. + */ + public RequestBody toRequestBody() { + return new InputStreamRequestBody(contentType, inputStream); + } +} diff --git a/src/main/java/com/pipedream/api/core/InputStreamRequestBody.java b/src/main/java/com/pipedream/api/core/InputStreamRequestBody.java new file mode 100644 index 0000000..a91bea5 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/InputStreamRequestBody.java @@ -0,0 +1,79 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Objects; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import okhttp3.internal.Util; +import okio.BufferedSink; +import okio.Okio; +import okio.Source; +import org.jetbrains.annotations.Nullable; + +/** + * A custom implementation of OkHttp's RequestBody that wraps an InputStream. + * This class allows streaming of data from an InputStream directly to an HTTP request body, + * which is useful for file uploads or sending large amounts of data without loading it all into memory. + */ +public class InputStreamRequestBody extends RequestBody { + private final InputStream inputStream; + private final MediaType contentType; + + /** + * Constructs an InputStreamRequestBody with the specified content type and input stream. + * + * @param contentType the MediaType of the content, or null if not known + * @param inputStream the InputStream containing the data to be sent + * @throws NullPointerException if inputStream is null + */ + public InputStreamRequestBody(@Nullable MediaType contentType, InputStream inputStream) { + this.contentType = contentType; + this.inputStream = Objects.requireNonNull(inputStream, "inputStream == null"); + } + + /** + * Returns the content type of this request body. + * + * @return the MediaType of the content, or null if not specified + */ + @Nullable + @Override + public MediaType contentType() { + return contentType; + } + + /** + * Returns the content length of this request body, if known. + * This method attempts to determine the length using the InputStream's available() method, + * which may not always accurately reflect the total length of the stream. + * + * @return the content length, or -1 if the length is unknown + * @throws IOException if an I/O error occurs + */ + @Override + public long contentLength() throws IOException { + return inputStream.available() == 0 ? -1 : inputStream.available(); + } + + /** + * Writes the content of the InputStream to the given BufferedSink. + * This method is responsible for transferring the data from the InputStream to the network request. + * + * @param sink the BufferedSink to write the content to + * @throws IOException if an I/O error occurs during writing + */ + @Override + public void writeTo(BufferedSink sink) throws IOException { + Source source = null; + try { + source = Okio.source(inputStream); + sink.writeAll(source); + } finally { + Util.closeQuietly(Objects.requireNonNull(source)); + } + } +} diff --git a/src/main/java/com/pipedream/api/core/MediaTypes.java b/src/main/java/com/pipedream/api/core/MediaTypes.java new file mode 100644 index 0000000..6b6288f --- /dev/null +++ b/src/main/java/com/pipedream/api/core/MediaTypes.java @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import okhttp3.MediaType; + +public final class MediaTypes { + + public static final MediaType APPLICATION_JSON = MediaType.parse("application/json"); + + private MediaTypes() {} +} diff --git a/src/main/java/com/pipedream/api/core/Nullable.java b/src/main/java/com/pipedream/api/core/Nullable.java new file mode 100644 index 0000000..2b6af74 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/Nullable.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.Optional; +import java.util.function.Function; + +public final class Nullable { + + private final Either, Null> value; + + private Nullable() { + this.value = Either.left(Optional.empty()); + } + + private Nullable(T value) { + if (value == null) { + this.value = Either.right(Null.INSTANCE); + } else { + this.value = Either.left(Optional.of(value)); + } + } + + public static Nullable ofNull() { + return new Nullable<>(null); + } + + public static Nullable of(T value) { + return new Nullable<>(value); + } + + public static Nullable empty() { + return new Nullable<>(); + } + + public static Nullable ofOptional(Optional value) { + if (value.isPresent()) { + return of(value.get()); + } else { + return empty(); + } + } + + public boolean isNull() { + return this.value.isRight(); + } + + public boolean isEmpty() { + return this.value.isLeft() && !this.value.getLeft().isPresent(); + } + + public T get() { + if (this.isNull()) { + return null; + } + + return this.value.getLeft().get(); + } + + public Nullable map(Function mapper) { + if (this.isNull()) { + return Nullable.ofNull(); + } + + return Nullable.ofOptional(this.value.getLeft().map(mapper)); + } + + @Override + public boolean equals(Object other) { + if (!(other instanceof Nullable)) { + return false; + } + + if (((Nullable) other).isNull() && this.isNull()) { + return true; + } + + return this.value.getLeft().equals(((Nullable) other).value.getLeft()); + } + + private static final class Either { + private L left = null; + private R right = null; + + private Either(L left, R right) { + if (left != null && right != null) { + throw new IllegalArgumentException("Left and right argument cannot both be non-null."); + } + + if (left == null && right == null) { + throw new IllegalArgumentException("Left and right argument cannot both be null."); + } + + if (left != null) { + this.left = left; + } + + if (right != null) { + this.right = right; + } + } + + public static Either left(L left) { + return new Either<>(left, null); + } + + public static Either right(R right) { + return new Either<>(null, right); + } + + public boolean isLeft() { + return this.left != null; + } + + public boolean isRight() { + return this.right != null; + } + + public L getLeft() { + if (!this.isLeft()) { + throw new IllegalArgumentException("Cannot get left from right Either."); + } + return this.left; + } + + public R getRight() { + if (!this.isRight()) { + throw new IllegalArgumentException("Cannot get right from left Either."); + } + return this.right; + } + } + + private static final class Null { + private static final Null INSTANCE = new Null(); + + private Null() {} + } +} diff --git a/src/main/java/com/pipedream/api/core/NullableNonemptyFilter.java b/src/main/java/com/pipedream/api/core/NullableNonemptyFilter.java new file mode 100644 index 0000000..afad6eb --- /dev/null +++ b/src/main/java/com/pipedream/api/core/NullableNonemptyFilter.java @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.Optional; + +public final class NullableNonemptyFilter { + @Override + public boolean equals(Object o) { + boolean isOptionalEmpty = isOptionalEmpty(o); + + return isOptionalEmpty; + } + + private boolean isOptionalEmpty(Object o) { + return o instanceof Optional && !((Optional) o).isPresent(); + } +} diff --git a/src/main/java/com/pipedream/api/core/OAuthTokenSupplier.java b/src/main/java/com/pipedream/api/core/OAuthTokenSupplier.java new file mode 100644 index 0000000..ddbde79 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/OAuthTokenSupplier.java @@ -0,0 +1,54 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import com.pipedream.api.resources.oauthtokens.OauthTokensClient; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.function.Supplier; + +public final class OAuthTokenSupplier implements Supplier { + private static final long BUFFER_IN_MINUTES = 2; + + private final String clientId; + + private final String clientSecret; + + private final OauthTokensClient authClient; + + private String accessToken; + + private Instant expiresAt; + + public OAuthTokenSupplier(String clientId, String clientSecret, OauthTokensClient authClient) { + this.clientId = clientId; + this.clientSecret = clientSecret; + this.authClient = authClient; + this.expiresAt = Instant.now(); + } + + public CreateOAuthTokenResponse fetchToken() { + CreateOAuthTokenOpts getTokenRequest = CreateOAuthTokenOpts.builder() + .clientId(clientId) + .clientSecret(clientSecret) + .build(); + return authClient.create(getTokenRequest); + } + + @java.lang.Override + public String get() { + if (accessToken == null || expiresAt.isBefore(Instant.now())) { + CreateOAuthTokenResponse authResponse = fetchToken(); + this.accessToken = authResponse.getAccessToken(); + this.expiresAt = getExpiresAt(authResponse.getExpiresIn()); + } + return "Bearer " + accessToken; + } + + private Instant getExpiresAt(long expiresInSeconds) { + return Instant.now().plus(expiresInSeconds, ChronoUnit.SECONDS).minus(BUFFER_IN_MINUTES, ChronoUnit.MINUTES); + } +} diff --git a/src/main/java/com/pipedream/api/core/ObjectMappers.java b/src/main/java/com/pipedream/api/core/ObjectMappers.java new file mode 100644 index 0000000..6dd6c3c --- /dev/null +++ b/src/main/java/com/pipedream/api/core/ObjectMappers.java @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import java.io.IOException; + +public final class ObjectMappers { + public static final ObjectMapper JSON_MAPPER = JsonMapper.builder() + .addModule(new Jdk8Module()) + .addModule(new JavaTimeModule()) + .addModule(DateTimeDeserializer.getModule()) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .build(); + + private ObjectMappers() {} + + public static String stringify(Object o) { + try { + return JSON_MAPPER + .setSerializationInclusion(JsonInclude.Include.ALWAYS) + .writerWithDefaultPrettyPrinter() + .writeValueAsString(o); + } catch (IOException e) { + return o.getClass().getName() + "@" + Integer.toHexString(o.hashCode()); + } + } +} diff --git a/src/main/java/com/pipedream/api/core/PipedreamApiApiException.java b/src/main/java/com/pipedream/api/core/PipedreamApiApiException.java new file mode 100644 index 0000000..d4d2e56 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/PipedreamApiApiException.java @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.Response; + +/** + * This exception type will be thrown for any non-2XX API responses. + */ +public class PipedreamApiApiException extends PipedreamApiException { + /** + * The error code of the response that triggered the exception. + */ + private final int statusCode; + + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + private final Map> headers; + + public PipedreamApiApiException(String message, int statusCode, Object body) { + super(message); + this.statusCode = statusCode; + this.body = body; + this.headers = new HashMap<>(); + } + + public PipedreamApiApiException(String message, int statusCode, Object body, Response rawResponse) { + super(message); + this.statusCode = statusCode; + this.body = body; + this.headers = new HashMap<>(); + rawResponse.headers().forEach(header -> { + String key = header.component1(); + String value = header.component2(); + this.headers.computeIfAbsent(key, _str -> new ArrayList<>()).add(value); + }); + } + + /** + * @return the statusCode + */ + public int statusCode() { + return this.statusCode; + } + + /** + * @return the body + */ + public Object body() { + return this.body; + } + + /** + * @return the headers + */ + public Map> headers() { + return this.headers; + } + + @java.lang.Override + public String toString() { + return "PipedreamApiApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " + + body + "}"; + } +} diff --git a/src/main/java/com/pipedream/api/core/PipedreamApiException.java b/src/main/java/com/pipedream/api/core/PipedreamApiException.java new file mode 100644 index 0000000..866b47e --- /dev/null +++ b/src/main/java/com/pipedream/api/core/PipedreamApiException.java @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +/** + * This class serves as the base exception for all errors in the SDK. + */ +public class PipedreamApiException extends RuntimeException { + public PipedreamApiException(String message) { + super(message); + } + + public PipedreamApiException(String message, Exception e) { + super(message, e); + } +} diff --git a/src/main/java/com/pipedream/api/core/PipedreamApiHttpResponse.java b/src/main/java/com/pipedream/api/core/PipedreamApiHttpResponse.java new file mode 100644 index 0000000..59f2804 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/PipedreamApiHttpResponse.java @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.Response; + +public final class PipedreamApiHttpResponse { + + private final T body; + + private final Map> headers; + + public PipedreamApiHttpResponse(T body, Response rawResponse) { + this.body = body; + + Map> headers = new HashMap<>(); + rawResponse.headers().forEach(header -> { + String key = header.component1(); + String value = header.component2(); + headers.computeIfAbsent(key, _str -> new ArrayList<>()).add(value); + }); + this.headers = headers; + } + + public T body() { + return this.body; + } + + public Map> headers() { + return headers; + } +} diff --git a/src/main/java/com/pipedream/api/core/QueryStringMapper.java b/src/main/java/com/pipedream/api/core/QueryStringMapper.java new file mode 100644 index 0000000..70723d0 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/QueryStringMapper.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import okhttp3.HttpUrl; +import okhttp3.MultipartBody; + +public class QueryStringMapper { + + private static final ObjectMapper MAPPER = ObjectMappers.JSON_MAPPER; + + public static void addQueryParameter(HttpUrl.Builder httpUrl, String key, Object value, boolean arraysAsRepeats) { + JsonNode valueNode = MAPPER.valueToTree(value); + + List> flat; + if (valueNode.isObject()) { + flat = flattenObject((ObjectNode) valueNode, arraysAsRepeats); + } else if (valueNode.isArray()) { + flat = flattenArray((ArrayNode) valueNode, "", arraysAsRepeats); + } else { + if (valueNode.isTextual()) { + httpUrl.addQueryParameter(key, valueNode.textValue()); + } else { + httpUrl.addQueryParameter(key, valueNode.toString()); + } + return; + } + + for (Map.Entry field : flat) { + if (field.getValue().isTextual()) { + httpUrl.addQueryParameter(key + field.getKey(), field.getValue().textValue()); + } else { + httpUrl.addQueryParameter(key + field.getKey(), field.getValue().toString()); + } + } + } + + public static void addFormDataPart( + MultipartBody.Builder multipartBody, String key, Object value, boolean arraysAsRepeats) { + JsonNode valueNode = MAPPER.valueToTree(value); + + List> flat; + if (valueNode.isObject()) { + flat = flattenObject((ObjectNode) valueNode, arraysAsRepeats); + } else if (valueNode.isArray()) { + flat = flattenArray((ArrayNode) valueNode, "", arraysAsRepeats); + } else { + if (valueNode.isTextual()) { + multipartBody.addFormDataPart(key, valueNode.textValue()); + } else { + multipartBody.addFormDataPart(key, valueNode.toString()); + } + return; + } + + for (Map.Entry field : flat) { + if (field.getValue().isTextual()) { + multipartBody.addFormDataPart( + key + field.getKey(), field.getValue().textValue()); + } else { + multipartBody.addFormDataPart( + key + field.getKey(), field.getValue().toString()); + } + } + } + + public static List> flattenObject(ObjectNode object, boolean arraysAsRepeats) { + List> flat = new ArrayList<>(); + + Iterator> fields = object.fields(); + while (fields.hasNext()) { + Map.Entry field = fields.next(); + + String key = "[" + field.getKey() + "]"; + + if (field.getValue().isObject()) { + List> flatField = + flattenObject((ObjectNode) field.getValue(), arraysAsRepeats); + addAll(flat, flatField, key); + } else if (field.getValue().isArray()) { + List> flatField = + flattenArray((ArrayNode) field.getValue(), key, arraysAsRepeats); + addAll(flat, flatField, ""); + } else { + flat.add(new AbstractMap.SimpleEntry<>(key, field.getValue())); + } + } + + return flat; + } + + private static List> flattenArray( + ArrayNode array, String key, boolean arraysAsRepeats) { + List> flat = new ArrayList<>(); + + Iterator elements = array.elements(); + + int index = 0; + while (elements.hasNext()) { + JsonNode element = elements.next(); + + String indexKey = key + "[" + index + "]"; + + if (arraysAsRepeats) { + indexKey = key; + } + + if (element.isObject()) { + List> flatField = flattenObject((ObjectNode) element, arraysAsRepeats); + addAll(flat, flatField, indexKey); + } else if (element.isArray()) { + List> flatField = flattenArray((ArrayNode) element, "", arraysAsRepeats); + addAll(flat, flatField, indexKey); + } else { + flat.add(new AbstractMap.SimpleEntry<>(indexKey, element)); + } + + index++; + } + + return flat; + } + + private static void addAll( + List> target, List> source, String prefix) { + for (Map.Entry entry : source) { + Map.Entry entryToAdd = + new AbstractMap.SimpleEntry<>(prefix + entry.getKey(), entry.getValue()); + target.add(entryToAdd); + } + } +} diff --git a/src/main/java/com/pipedream/api/core/RequestOptions.java b/src/main/java/com/pipedream/api/core/RequestOptions.java new file mode 100644 index 0000000..559f48d --- /dev/null +++ b/src/main/java/com/pipedream/api/core/RequestOptions.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; + +public final class RequestOptions { + private final String projectEnvironment; + + private final Optional timeout; + + private final TimeUnit timeoutTimeUnit; + + private final Map headers; + + private final Map> headerSuppliers; + + private RequestOptions( + String projectEnvironment, + Optional timeout, + TimeUnit timeoutTimeUnit, + Map headers, + Map> headerSuppliers) { + this.projectEnvironment = projectEnvironment; + this.timeout = timeout; + this.timeoutTimeUnit = timeoutTimeUnit; + this.headers = headers; + this.headerSuppliers = headerSuppliers; + } + + public Optional getTimeout() { + return timeout; + } + + public TimeUnit getTimeoutTimeUnit() { + return timeoutTimeUnit; + } + + public Map getHeaders() { + Map headers = new HashMap<>(); + if (this.projectEnvironment != null) { + headers.put("x-pd-environment", this.projectEnvironment); + } + headers.putAll(this.headers); + this.headerSuppliers.forEach((key, supplier) -> { + headers.put(key, supplier.get()); + }); + return headers; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private String projectEnvironment = null; + + private Optional timeout = Optional.empty(); + + private TimeUnit timeoutTimeUnit = TimeUnit.SECONDS; + + private final Map headers = new HashMap<>(); + + private final Map> headerSuppliers = new HashMap<>(); + + public Builder projectEnvironment(String projectEnvironment) { + this.projectEnvironment = projectEnvironment; + return this; + } + + public Builder timeout(Integer timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + public Builder timeout(Integer timeout, TimeUnit timeoutTimeUnit) { + this.timeout = Optional.of(timeout); + this.timeoutTimeUnit = timeoutTimeUnit; + return this; + } + + public Builder addHeader(String key, String value) { + this.headers.put(key, value); + return this; + } + + public Builder addHeader(String key, Supplier value) { + this.headerSuppliers.put(key, value); + return this; + } + + public RequestOptions build() { + return new RequestOptions(projectEnvironment, timeout, timeoutTimeUnit, headers, headerSuppliers); + } + } +} diff --git a/src/main/java/com/pipedream/api/core/ResponseBodyInputStream.java b/src/main/java/com/pipedream/api/core/ResponseBodyInputStream.java new file mode 100644 index 0000000..56b0fb5 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/ResponseBodyInputStream.java @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.FilterInputStream; +import java.io.IOException; +import okhttp3.Response; + +/** + * A custom InputStream that wraps the InputStream from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the stream is closed. + * + * This class extends FilterInputStream and takes an OkHttp Response object as a parameter. + * It retrieves the InputStream from the Response and overrides the close method to close + * both the InputStream and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyInputStream extends FilterInputStream { + private final Response response; + + /** + * Constructs a ResponseBodyInputStream that wraps the InputStream from the given OkHttp + * Response object. + * + * @param response the OkHttp Response object from which the InputStream is retrieved + * @throws IOException if an I/O error occurs while retrieving the InputStream + */ + public ResponseBodyInputStream(Response response) throws IOException { + super(response.body().byteStream()); + this.response = response; + } + + /** + * Closes the InputStream and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the stream is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the stream is closed + } +} diff --git a/src/main/java/com/pipedream/api/core/ResponseBodyReader.java b/src/main/java/com/pipedream/api/core/ResponseBodyReader.java new file mode 100644 index 0000000..54dff9f --- /dev/null +++ b/src/main/java/com/pipedream/api/core/ResponseBodyReader.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.FilterReader; +import java.io.IOException; +import okhttp3.Response; + +/** + * A custom Reader that wraps the Reader from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the reader is closed. + * + * This class extends FilterReader and takes an OkHttp Response object as a parameter. + * It retrieves the Reader from the Response and overrides the close method to close + * both the Reader and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyReader extends FilterReader { + private final Response response; + + /** + * Constructs a ResponseBodyReader that wraps the Reader from the given OkHttp Response object. + * + * @param response the OkHttp Response object from which the Reader is retrieved + * @throws IOException if an I/O error occurs while retrieving the Reader + */ + public ResponseBodyReader(Response response) throws IOException { + super(response.body().charStream()); + this.response = response; + } + + /** + * Closes the Reader and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the reader is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the reader is closed + } +} diff --git a/src/main/java/com/pipedream/api/core/RetryInterceptor.java b/src/main/java/com/pipedream/api/core/RetryInterceptor.java new file mode 100644 index 0000000..66b6be4 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/RetryInterceptor.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.IOException; +import java.time.Duration; +import java.util.Optional; +import java.util.Random; +import okhttp3.Interceptor; +import okhttp3.Response; + +public class RetryInterceptor implements Interceptor { + + private static final Duration ONE_SECOND = Duration.ofSeconds(1); + private final ExponentialBackoff backoff; + private final Random random = new Random(); + + public RetryInterceptor(int maxRetries) { + this.backoff = new ExponentialBackoff(maxRetries); + } + + @Override + public Response intercept(Chain chain) throws IOException { + Response response = chain.proceed(chain.request()); + + if (shouldRetry(response.code())) { + return retryChain(response, chain); + } + + return response; + } + + private Response retryChain(Response response, Chain chain) throws IOException { + Optional nextBackoff = this.backoff.nextBackoff(); + while (nextBackoff.isPresent()) { + try { + Thread.sleep(nextBackoff.get().toMillis()); + } catch (InterruptedException e) { + throw new IOException("Interrupted while trying request", e); + } + response.close(); + response = chain.proceed(chain.request()); + if (shouldRetry(response.code())) { + nextBackoff = this.backoff.nextBackoff(); + } else { + return response; + } + } + + return response; + } + + private static boolean shouldRetry(int statusCode) { + return statusCode == 408 || statusCode == 429 || statusCode >= 500; + } + + private final class ExponentialBackoff { + + private final int maxNumRetries; + + private int retryNumber = 0; + + ExponentialBackoff(int maxNumRetries) { + this.maxNumRetries = maxNumRetries; + } + + public Optional nextBackoff() { + retryNumber += 1; + if (retryNumber > maxNumRetries) { + return Optional.empty(); + } + + int upperBound = (int) Math.pow(2, retryNumber); + return Optional.of(ONE_SECOND.multipliedBy(random.nextInt(upperBound))); + } + } +} diff --git a/src/main/java/com/pipedream/api/core/Stream.java b/src/main/java/com/pipedream/api/core/Stream.java new file mode 100644 index 0000000..3781dcc --- /dev/null +++ b/src/main/java/com/pipedream/api/core/Stream.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.Closeable; +import java.io.IOException; +import java.io.Reader; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.Scanner; + +/** + * The {@code Stream} class implements {@link Iterable} to provide a simple mechanism for reading and parsing + * objects of a given type from data streamed via a {@link Reader} using a specified delimiter. + *

+ * {@code Stream} assumes that data is being pushed to the provided {@link Reader} asynchronously and utilizes a + * {@code Scanner} to block during iteration if the next object is not available. + * Iterable stream for parsing JSON and Server-Sent Events (SSE) data. + * Supports both newline-delimited JSON and SSE with optional stream termination. + * + * @param The type of objects in the stream. + */ +public final class Stream implements Iterable, Closeable { + + private static final String NEWLINE = "\n"; + private static final String DATA_PREFIX = "data:"; + + public enum StreamType { + JSON, + SSE + } + + private final Class valueType; + private final Scanner scanner; + private final StreamType streamType; + private final String messageTerminator; + private final String streamTerminator; + private final Reader sseReader; + private boolean isClosed = false; + + /** + * Constructs a new {@code Stream} with the specified value type, reader, and delimiter. + * + * @param valueType The class of the objects in the stream. + * @param reader The reader that provides the streamed data. + * @param delimiter The delimiter used to separate elements in the stream. + */ + public Stream(Class valueType, Reader reader, String delimiter) { + this.valueType = valueType; + this.scanner = new Scanner(reader).useDelimiter(delimiter); + this.streamType = StreamType.JSON; + this.messageTerminator = delimiter; + this.streamTerminator = null; + this.sseReader = null; + } + + private Stream(Class valueType, StreamType type, Reader reader, String terminator) { + this.valueType = valueType; + this.streamType = type; + if (type == StreamType.JSON) { + this.scanner = new Scanner(reader).useDelimiter(terminator); + this.messageTerminator = terminator; + this.streamTerminator = null; + this.sseReader = null; + } else { + this.scanner = null; + this.messageTerminator = NEWLINE; + this.streamTerminator = terminator; + this.sseReader = reader; + } + } + + public static Stream fromJson(Class valueType, Reader reader, String delimiter) { + return new Stream<>(valueType, reader, delimiter); + } + + public static Stream fromJson(Class valueType, Reader reader) { + return new Stream<>(valueType, reader, NEWLINE); + } + + public static Stream fromSse(Class valueType, Reader sseReader) { + return new Stream<>(valueType, StreamType.SSE, sseReader, null); + } + + public static Stream fromSse(Class valueType, Reader sseReader, String streamTerminator) { + return new Stream<>(valueType, StreamType.SSE, sseReader, streamTerminator); + } + + @Override + public void close() throws IOException { + if (!isClosed) { + isClosed = true; + if (scanner != null) { + scanner.close(); + } + if (sseReader != null) { + sseReader.close(); + } + } + } + + private boolean isStreamClosed() { + return isClosed; + } + + /** + * Returns an iterator over the elements in this stream that blocks during iteration when the next object is + * not yet available. + * + * @return An iterator that can be used to traverse the elements in the stream. + */ + @Override + public Iterator iterator() { + if (streamType == StreamType.SSE) { + return new SSEIterator(); + } else { + return new JsonIterator(); + } + } + + private final class JsonIterator implements Iterator { + + /** + * Returns {@code true} if there are more elements in the stream. + *

+ * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return {@code true} if there are more elements, {@code false} otherwise. + */ + @Override + public boolean hasNext() { + if (isStreamClosed()) { + return false; + } + return scanner.hasNext(); + } + + /** + * Returns the next element in the stream. + *

+ * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return The next element in the stream. + * @throws NoSuchElementException If there are no more elements in the stream. + */ + @Override + public T next() { + if (isStreamClosed()) { + throw new NoSuchElementException("Stream is closed"); + } + + if (!scanner.hasNext()) { + throw new NoSuchElementException(); + } else { + try { + T parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(scanner.next().trim(), valueType); + return parsedResponse; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + } + + private final class SSEIterator implements Iterator { + private Scanner sseScanner; + private T nextItem; + private boolean hasNextItem = false; + private boolean endOfStream = false; + private StringBuilder buffer = new StringBuilder(); + private boolean prefixSeen = false; + + private SSEIterator() { + if (sseReader != null && !isStreamClosed()) { + this.sseScanner = new Scanner(sseReader); + } else { + this.endOfStream = true; + } + } + + @Override + public boolean hasNext() { + if (isStreamClosed() || endOfStream) { + return false; + } + + if (hasNextItem) { + return true; + } + + return readNextMessage(); + } + + @Override + public T next() { + if (!hasNext()) { + throw new NoSuchElementException("No more elements in stream"); + } + + T result = nextItem; + nextItem = null; + hasNextItem = false; + return result; + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + + private boolean readNextMessage() { + if (sseScanner == null || isStreamClosed()) { + endOfStream = true; + return false; + } + + try { + while (sseScanner.hasNextLine()) { + String chunk = sseScanner.nextLine(); + buffer.append(chunk).append(NEWLINE); + + int terminatorIndex; + while ((terminatorIndex = buffer.indexOf(messageTerminator)) >= 0) { + String line = buffer.substring(0, terminatorIndex + messageTerminator.length()); + buffer.delete(0, terminatorIndex + messageTerminator.length()); + + line = line.trim(); + if (line.isEmpty()) { + continue; + } + + if (!prefixSeen && line.startsWith(DATA_PREFIX)) { + prefixSeen = true; + line = line.substring(DATA_PREFIX.length()).trim(); + } else if (!prefixSeen) { + continue; + } + + if (streamTerminator != null && line.contains(streamTerminator)) { + endOfStream = true; + return false; + } + + try { + nextItem = ObjectMappers.JSON_MAPPER.readValue(line, valueType); + hasNextItem = true; + prefixSeen = false; + return true; + } catch (Exception parseEx) { + continue; + } + } + } + + endOfStream = true; + return false; + + } catch (Exception e) { + System.err.println("Failed to parse SSE stream: " + e.getMessage()); + endOfStream = true; + return false; + } + } + } +} diff --git a/src/main/java/com/pipedream/api/core/Suppliers.java b/src/main/java/com/pipedream/api/core/Suppliers.java new file mode 100644 index 0000000..b907552 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/Suppliers.java @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +public final class Suppliers { + private Suppliers() {} + + public static Supplier memoize(Supplier delegate) { + AtomicReference value = new AtomicReference<>(); + return () -> { + T val = value.get(); + if (val == null) { + val = value.updateAndGet(cur -> cur == null ? Objects.requireNonNull(delegate.get()) : cur); + } + return val; + }; + } +} diff --git a/src/main/java/com/pipedream/api/core/pagination/BasePage.java b/src/main/java/com/pipedream/api/core/pagination/BasePage.java new file mode 100644 index 0000000..ca83fe4 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/pagination/BasePage.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core.pagination; + +import java.util.List; + +public abstract class BasePage { + private final boolean hasNext; + private final List items; + + public BasePage(boolean hasNext, List items) { + this.hasNext = hasNext; + this.items = items; + } + + public boolean hasNext() { + return !items.isEmpty() && hasNext; + } + + public List getItems() { + return items; + } +} diff --git a/src/main/java/com/pipedream/api/core/pagination/SyncPage.java b/src/main/java/com/pipedream/api/core/pagination/SyncPage.java new file mode 100644 index 0000000..86fc5b7 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/pagination/SyncPage.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core.pagination; + +import java.util.List; +import java.util.NoSuchElementException; +import java.util.function.Supplier; + +public class SyncPage extends BasePage { + protected final Supplier> nextSupplier; + + public SyncPage(boolean hasNext, List items, Supplier> nextSupplier) { + super(hasNext, items); + this.nextSupplier = nextSupplier; + } + + public SyncPage nextPage() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + return nextSupplier.get(); + } +} diff --git a/src/main/java/com/pipedream/api/core/pagination/SyncPagingIterable.java b/src/main/java/com/pipedream/api/core/pagination/SyncPagingIterable.java new file mode 100644 index 0000000..fd5fca3 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/pagination/SyncPagingIterable.java @@ -0,0 +1,61 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core.pagination; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.Optional; +import java.util.function.Supplier; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + +public class SyncPagingIterable extends SyncPage implements Iterable { + + public SyncPagingIterable(boolean hasNext, List items, Supplier> getNext) { + super(hasNext, items, getNext); + } + + public SyncPagingIterable(boolean hasNext, Optional> items, Supplier> getNext) { + super(hasNext, items.orElse(new ArrayList<>()), getNext); + } + + public Stream streamItems() { + return StreamSupport.stream(this.spliterator(), false); + } + + @Override + public Iterator iterator() { + return new Iterator() { + private Iterator itemsIterator = getItems().iterator(); + private SyncPage currentPage = SyncPagingIterable.this; + + @Override + public boolean hasNext() { + if (itemsIterator.hasNext()) { + return true; + } + if (currentPage.hasNext()) { + advancePage(); + return itemsIterator.hasNext(); + } + return false; + } + + @Override + public T next() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + return itemsIterator.next(); + } + + private void advancePage() { + currentPage = currentPage.nextPage(); + itemsIterator = currentPage.getItems().iterator(); + } + }; + } +} diff --git a/src/main/java/com/pipedream/api/resources/accounts/AccountsClient.java b/src/main/java/com/pipedream/api/resources/accounts/AccountsClient.java new file mode 100644 index 0000000..81f9441 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/accounts/AccountsClient.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.accounts.requests.AccountsListRequest; +import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest; +import com.pipedream.api.resources.accounts.requests.CreateAccountRequest; +import com.pipedream.api.types.Account; + +public class AccountsClient { + protected final ClientOptions clientOptions; + + private final RawAccountsClient rawClient; + + public AccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAccountsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAccountsClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(AccountsListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(AccountsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public Account create(CreateAccountRequest request) { + return this.rawClient.create(request).body(); + } + + public Account create(CreateAccountRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + public Account retrieve(String accountId) { + return this.rawClient.retrieve(accountId).body(); + } + + public Account retrieve(String accountId, AccountsRetrieveRequest request) { + return this.rawClient.retrieve(accountId, request).body(); + } + + public Account retrieve(String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(accountId, request, requestOptions).body(); + } + + public void delete(String accountId) { + this.rawClient.delete(accountId).body(); + } + + public void delete(String accountId, RequestOptions requestOptions) { + this.rawClient.delete(accountId, requestOptions).body(); + } + + public void deleteByApp(String appId) { + this.rawClient.deleteByApp(appId).body(); + } + + public void deleteByApp(String appId, RequestOptions requestOptions) { + this.rawClient.deleteByApp(appId, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/accounts/AsyncAccountsClient.java b/src/main/java/com/pipedream/api/resources/accounts/AsyncAccountsClient.java new file mode 100644 index 0000000..761a206 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/accounts/AsyncAccountsClient.java @@ -0,0 +1,81 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.accounts.requests.AccountsListRequest; +import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest; +import com.pipedream.api.resources.accounts.requests.CreateAccountRequest; +import com.pipedream.api.types.Account; +import java.util.concurrent.CompletableFuture; + +public class AsyncAccountsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAccountsClient rawClient; + + public AsyncAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAccountsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAccountsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(AccountsListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + AccountsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture create(CreateAccountRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + public CompletableFuture create(CreateAccountRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String accountId) { + return this.rawClient.retrieve(accountId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String accountId, AccountsRetrieveRequest request) { + return this.rawClient.retrieve(accountId, request).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve( + String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(accountId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture delete(String accountId) { + return this.rawClient.delete(accountId).thenApply(response -> response.body()); + } + + public CompletableFuture delete(String accountId, RequestOptions requestOptions) { + return this.rawClient.delete(accountId, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture deleteByApp(String appId) { + return this.rawClient.deleteByApp(appId).thenApply(response -> response.body()); + } + + public CompletableFuture deleteByApp(String appId, RequestOptions requestOptions) { + return this.rawClient.deleteByApp(appId, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java b/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java new file mode 100644 index 0000000..1c4a9bb --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java @@ -0,0 +1,391 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.accounts.requests.AccountsListRequest; +import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest; +import com.pipedream.api.resources.accounts.requests.CreateAccountRequest; +import com.pipedream.api.types.Account; +import com.pipedream.api.types.ListAccountsResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAccountsClient { + protected final ClientOptions clientOptions; + + public AsyncRawAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(AccountsListRequest.builder().build()); + } + + public CompletableFuture>> list(AccountsListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + AccountsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts"); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getExternalUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "external_user_id", request.getExternalUserId().get(), false); + } + if (request.getOauthAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "oauth_app_id", request.getOauthAppId().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getIncludeCredentials().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_credentials", + request.getIncludeCredentials().get(), + false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + ListAccountsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAccountsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + AccountsListRequest nextRequest = AccountsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> create(CreateAccountRequest request) { + return create(request, null); + } + + public CompletableFuture> create( + CreateAccountRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts"); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getExternalUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "external_user_id", request.getExternalUserId().get(), false); + } + if (request.getOauthAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "oauth_app_id", request.getOauthAppId().get(), false); + } + Map properties = new HashMap<>(); + properties.put("app_slug", request.getAppSlug()); + properties.put("cfmap_json", request.getCfmapJson()); + properties.put("connect_token", request.getConnectToken()); + if (request.getName().isPresent()) { + properties.put("name", request.getName()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String accountId) { + return retrieve(accountId, AccountsRetrieveRequest.builder().build()); + } + + public CompletableFuture> retrieve( + String accountId, AccountsRetrieveRequest request) { + return retrieve(accountId, request, null); + } + + public CompletableFuture> retrieve( + String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts") + .addPathSegment(accountId); + if (request.getIncludeCredentials().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_credentials", + request.getIncludeCredentials().get(), + false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> delete(String accountId) { + return delete(accountId, null); + } + + public CompletableFuture> delete(String accountId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts") + .addPathSegment(accountId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> deleteByApp(String appId) { + return deleteByApp(appId, null); + } + + public CompletableFuture> deleteByApp(String appId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("apps") + .addPathSegment(appId) + .addPathSegments("accounts") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java b/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java new file mode 100644 index 0000000..114533c --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java @@ -0,0 +1,312 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.accounts.requests.AccountsListRequest; +import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest; +import com.pipedream.api.resources.accounts.requests.CreateAccountRequest; +import com.pipedream.api.types.Account; +import com.pipedream.api.types.ListAccountsResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAccountsClient { + protected final ClientOptions clientOptions; + + public RawAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(AccountsListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(AccountsListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + AccountsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts"); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getExternalUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "external_user_id", request.getExternalUserId().get(), false); + } + if (request.getOauthAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "oauth_app_id", request.getOauthAppId().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getIncludeCredentials().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_credentials", + request.getIncludeCredentials().get(), + false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + ListAccountsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAccountsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + AccountsListRequest nextRequest = AccountsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse create(CreateAccountRequest request) { + return create(request, null); + } + + public PipedreamApiHttpResponse create(CreateAccountRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts"); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getExternalUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "external_user_id", request.getExternalUserId().get(), false); + } + if (request.getOauthAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "oauth_app_id", request.getOauthAppId().get(), false); + } + Map properties = new HashMap<>(); + properties.put("app_slug", request.getAppSlug()); + properties.put("cfmap_json", request.getCfmapJson()); + properties.put("connect_token", request.getConnectToken()); + if (request.getName().isPresent()) { + properties.put("name", request.getName()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String accountId) { + return retrieve(accountId, AccountsRetrieveRequest.builder().build()); + } + + public PipedreamApiHttpResponse retrieve(String accountId, AccountsRetrieveRequest request) { + return retrieve(accountId, request, null); + } + + public PipedreamApiHttpResponse retrieve( + String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts") + .addPathSegment(accountId); + if (request.getIncludeCredentials().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_credentials", + request.getIncludeCredentials().get(), + false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse delete(String accountId) { + return delete(accountId, null); + } + + public PipedreamApiHttpResponse delete(String accountId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts") + .addPathSegment(accountId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse deleteByApp(String appId) { + return deleteByApp(appId, null); + } + + public PipedreamApiHttpResponse deleteByApp(String appId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("apps") + .addPathSegment(appId) + .addPathSegments("accounts") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsListRequest.java b/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsListRequest.java new file mode 100644 index 0000000..2d67f6d --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsListRequest.java @@ -0,0 +1,285 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountsListRequest.Builder.class) +public final class AccountsListRequest { + private final Optional appId; + + private final Optional externalUserId; + + private final Optional oauthAppId; + + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional includeCredentials; + + private final Map additionalProperties; + + private AccountsListRequest( + Optional appId, + Optional externalUserId, + Optional oauthAppId, + Optional after, + Optional before, + Optional limit, + Optional includeCredentials, + Map additionalProperties) { + this.appId = appId; + this.externalUserId = externalUserId; + this.oauthAppId = oauthAppId; + this.after = after; + this.before = before; + this.limit = limit; + this.includeCredentials = includeCredentials; + this.additionalProperties = additionalProperties; + } + + /** + * @return The app slug or ID to filter accounts by. + */ + @JsonProperty("app_id") + public Optional getAppId() { + return appId; + } + + @JsonProperty("external_user_id") + public Optional getExternalUserId() { + return externalUserId; + } + + /** + * @return The OAuth app ID to filter by, if applicable + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Whether to retrieve the account's credentials or not + */ + @JsonProperty("include_credentials") + public Optional getIncludeCredentials() { + return includeCredentials; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountsListRequest && equalTo((AccountsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountsListRequest other) { + return appId.equals(other.appId) + && externalUserId.equals(other.externalUserId) + && oauthAppId.equals(other.oauthAppId) + && after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && includeCredentials.equals(other.includeCredentials); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.appId, + this.externalUserId, + this.oauthAppId, + this.after, + this.before, + this.limit, + this.includeCredentials); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional appId = Optional.empty(); + + private Optional externalUserId = Optional.empty(); + + private Optional oauthAppId = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional includeCredentials = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AccountsListRequest other) { + appId(other.getAppId()); + externalUserId(other.getExternalUserId()); + oauthAppId(other.getOauthAppId()); + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + includeCredentials(other.getIncludeCredentials()); + return this; + } + + /** + *

The app slug or ID to filter accounts by.

+ */ + @JsonSetter(value = "app_id", nulls = Nulls.SKIP) + public Builder appId(Optional appId) { + this.appId = appId; + return this; + } + + public Builder appId(String appId) { + this.appId = Optional.ofNullable(appId); + return this; + } + + @JsonSetter(value = "external_user_id", nulls = Nulls.SKIP) + public Builder externalUserId(Optional externalUserId) { + this.externalUserId = externalUserId; + return this; + } + + public Builder externalUserId(String externalUserId) { + this.externalUserId = Optional.ofNullable(externalUserId); + return this; + } + + /** + *

The OAuth app ID to filter by, if applicable

+ */ + @JsonSetter(value = "oauth_app_id", nulls = Nulls.SKIP) + public Builder oauthAppId(Optional oauthAppId) { + this.oauthAppId = oauthAppId; + return this; + } + + public Builder oauthAppId(String oauthAppId) { + this.oauthAppId = Optional.ofNullable(oauthAppId); + return this; + } + + /** + *

The cursor to start from for pagination

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The cursor to end before for pagination

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The maximum number of results to return

+ */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

Whether to retrieve the account's credentials or not

+ */ + @JsonSetter(value = "include_credentials", nulls = Nulls.SKIP) + public Builder includeCredentials(Optional includeCredentials) { + this.includeCredentials = includeCredentials; + return this; + } + + public Builder includeCredentials(Boolean includeCredentials) { + this.includeCredentials = Optional.ofNullable(includeCredentials); + return this; + } + + public AccountsListRequest build() { + return new AccountsListRequest( + appId, externalUserId, oauthAppId, after, before, limit, includeCredentials, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsRetrieveRequest.java b/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsRetrieveRequest.java new file mode 100644 index 0000000..3844f9d --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsRetrieveRequest.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountsRetrieveRequest.Builder.class) +public final class AccountsRetrieveRequest { + private final Optional includeCredentials; + + private final Map additionalProperties; + + private AccountsRetrieveRequest(Optional includeCredentials, Map additionalProperties) { + this.includeCredentials = includeCredentials; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether to retrieve the account's credentials or not + */ + @JsonProperty("include_credentials") + public Optional getIncludeCredentials() { + return includeCredentials; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountsRetrieveRequest && equalTo((AccountsRetrieveRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountsRetrieveRequest other) { + return includeCredentials.equals(other.includeCredentials); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.includeCredentials); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional includeCredentials = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AccountsRetrieveRequest other) { + includeCredentials(other.getIncludeCredentials()); + return this; + } + + /** + *

Whether to retrieve the account's credentials or not

+ */ + @JsonSetter(value = "include_credentials", nulls = Nulls.SKIP) + public Builder includeCredentials(Optional includeCredentials) { + this.includeCredentials = includeCredentials; + return this; + } + + public Builder includeCredentials(Boolean includeCredentials) { + this.includeCredentials = Optional.ofNullable(includeCredentials); + return this; + } + + public AccountsRetrieveRequest build() { + return new AccountsRetrieveRequest(includeCredentials, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountRequest.java b/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountRequest.java new file mode 100644 index 0000000..aeec52a --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountRequest.java @@ -0,0 +1,354 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts.requests; + +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 = CreateAccountRequest.Builder.class) +public final class CreateAccountRequest { + private final Optional appId; + + private final Optional externalUserId; + + private final Optional oauthAppId; + + private final String appSlug; + + private final String cfmapJson; + + private final String connectToken; + + private final Optional name; + + private final Map additionalProperties; + + private CreateAccountRequest( + Optional appId, + Optional externalUserId, + Optional oauthAppId, + String appSlug, + String cfmapJson, + String connectToken, + Optional name, + Map additionalProperties) { + this.appId = appId; + this.externalUserId = externalUserId; + this.oauthAppId = oauthAppId; + this.appSlug = appSlug; + this.cfmapJson = cfmapJson; + this.connectToken = connectToken; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The app slug or ID to filter accounts by. + */ + @JsonProperty("app_id") + public Optional getAppId() { + return appId; + } + + @JsonProperty("external_user_id") + public Optional getExternalUserId() { + return externalUserId; + } + + /** + * @return The OAuth app ID to filter by, if applicable + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + + /** + * @return The app slug for the account + */ + @JsonProperty("app_slug") + public String getAppSlug() { + return appSlug; + } + + /** + * @return JSON string containing the custom fields mapping + */ + @JsonProperty("cfmap_json") + public String getCfmapJson() { + return cfmapJson; + } + + /** + * @return The connect token for authentication + */ + @JsonProperty("connect_token") + public String getConnectToken() { + return connectToken; + } + + /** + * @return Optional name for the account + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAccountRequest && equalTo((CreateAccountRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAccountRequest other) { + return appId.equals(other.appId) + && externalUserId.equals(other.externalUserId) + && oauthAppId.equals(other.oauthAppId) + && appSlug.equals(other.appSlug) + && cfmapJson.equals(other.cfmapJson) + && connectToken.equals(other.connectToken) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.appId, + this.externalUserId, + this.oauthAppId, + this.appSlug, + this.cfmapJson, + this.connectToken, + this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AppSlugStage builder() { + return new Builder(); + } + + public interface AppSlugStage { + /** + *

The app slug for the account

+ */ + CfmapJsonStage appSlug(@NotNull String appSlug); + + Builder from(CreateAccountRequest other); + } + + public interface CfmapJsonStage { + /** + *

JSON string containing the custom fields mapping

+ */ + ConnectTokenStage cfmapJson(@NotNull String cfmapJson); + } + + public interface ConnectTokenStage { + /** + *

The connect token for authentication

+ */ + _FinalStage connectToken(@NotNull String connectToken); + } + + public interface _FinalStage { + CreateAccountRequest build(); + + /** + *

The app slug or ID to filter accounts by.

+ */ + _FinalStage appId(Optional appId); + + _FinalStage appId(String appId); + + _FinalStage externalUserId(Optional externalUserId); + + _FinalStage externalUserId(String externalUserId); + + /** + *

The OAuth app ID to filter by, if applicable

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

Optional name for the account

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AppSlugStage, CfmapJsonStage, ConnectTokenStage, _FinalStage { + private String appSlug; + + private String cfmapJson; + + private String connectToken; + + private Optional name = Optional.empty(); + + private Optional oauthAppId = Optional.empty(); + + private Optional externalUserId = Optional.empty(); + + private Optional appId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateAccountRequest other) { + appId(other.getAppId()); + externalUserId(other.getExternalUserId()); + oauthAppId(other.getOauthAppId()); + appSlug(other.getAppSlug()); + cfmapJson(other.getCfmapJson()); + connectToken(other.getConnectToken()); + name(other.getName()); + return this; + } + + /** + *

The app slug for the account

+ *

The app slug for the account

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

JSON string containing the custom fields mapping

+ *

JSON string containing the custom fields mapping

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

The connect token for authentication

+ *

The connect token for authentication

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

Optional name for the account

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

Optional name for the account

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

The OAuth app ID to filter by, if applicable

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

The OAuth app ID to filter by, if applicable

+ */ + @java.lang.Override + @JsonSetter(value = "oauth_app_id", nulls = Nulls.SKIP) + public _FinalStage oauthAppId(Optional oauthAppId) { + this.oauthAppId = oauthAppId; + return this; + } + + @java.lang.Override + public _FinalStage externalUserId(String externalUserId) { + this.externalUserId = Optional.ofNullable(externalUserId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "external_user_id", nulls = Nulls.SKIP) + public _FinalStage externalUserId(Optional externalUserId) { + this.externalUserId = externalUserId; + return this; + } + + /** + *

The app slug or ID to filter accounts by.

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

The app slug or ID to filter accounts by.

+ */ + @java.lang.Override + @JsonSetter(value = "app_id", nulls = Nulls.SKIP) + public _FinalStage appId(Optional appId) { + this.appId = appId; + return this; + } + + @java.lang.Override + public CreateAccountRequest build() { + return new CreateAccountRequest( + appId, externalUserId, oauthAppId, appSlug, cfmapJson, connectToken, name, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java b/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java new file mode 100644 index 0000000..52efedb --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.actions.requests.ActionsConfigurePropRequest; +import com.pipedream.api.resources.actions.requests.ActionsListRequest; +import com.pipedream.api.resources.actions.requests.ActionsReloadPropsRequest; +import com.pipedream.api.resources.actions.requests.RunActionOpts; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import com.pipedream.api.types.RunActionResponse; + +public class ActionsClient { + protected final ClientOptions clientOptions; + + private final RawActionsClient rawClient; + + public ActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawActionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawActionsClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(ActionsListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(ActionsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public Component retrieve(String componentId) { + return this.rawClient.retrieve(componentId).body(); + } + + public Component retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).body(); + } + + public ConfigurePropResponse configureProp(ActionsConfigurePropRequest request) { + return this.rawClient.configureProp(request).body(); + } + + public ConfigurePropResponse configureProp(ActionsConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).body(); + } + + public ReloadPropsResponse reloadProps(ActionsReloadPropsRequest request) { + return this.rawClient.reloadProps(request).body(); + } + + public ReloadPropsResponse reloadProps(ActionsReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).body(); + } + + public RunActionResponse run(RunActionOpts request) { + return this.rawClient.run(request).body(); + } + + public RunActionResponse run(RunActionOpts request, RequestOptions requestOptions) { + return this.rawClient.run(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java b/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java new file mode 100644 index 0000000..19ff8e7 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.actions.requests.ActionsConfigurePropRequest; +import com.pipedream.api.resources.actions.requests.ActionsListRequest; +import com.pipedream.api.resources.actions.requests.ActionsReloadPropsRequest; +import com.pipedream.api.resources.actions.requests.RunActionOpts; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import com.pipedream.api.types.RunActionResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncActionsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawActionsClient rawClient; + + public AsyncActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawActionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawActionsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(ActionsListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + ActionsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId) { + return this.rawClient.retrieve(componentId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp(ActionsConfigurePropRequest request) { + return this.rawClient.configureProp(request).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp( + ActionsConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps(ActionsReloadPropsRequest request) { + return this.rawClient.reloadProps(request).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps( + ActionsReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture run(RunActionOpts request) { + return this.rawClient.run(request).thenApply(response -> response.body()); + } + + public CompletableFuture run(RunActionOpts request, RequestOptions requestOptions) { + return this.rawClient.run(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java b/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java new file mode 100644 index 0000000..9686990 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java @@ -0,0 +1,397 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.actions.requests.ActionsConfigurePropRequest; +import com.pipedream.api.resources.actions.requests.ActionsListRequest; +import com.pipedream.api.resources.actions.requests.ActionsReloadPropsRequest; +import com.pipedream.api.resources.actions.requests.RunActionOpts; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import com.pipedream.api.types.RunActionResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawActionsClient { + protected final ClientOptions clientOptions; + + public AsyncRawActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(ActionsListRequest.builder().build()); + } + + public CompletableFuture>> list(ActionsListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + ActionsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ActionsListRequest nextRequest = ActionsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String componentId) { + return retrieve(componentId, null); + } + + public CompletableFuture> retrieve( + String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> configureProp( + ActionsConfigurePropRequest request) { + return configureProp(request, null); + } + + public CompletableFuture> configureProp( + ActionsConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> reloadProps( + ActionsReloadPropsRequest request) { + return reloadProps(request, null); + } + + public CompletableFuture> reloadProps( + ActionsReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> run(RunActionOpts request) { + return run(request, null); + } + + public CompletableFuture> run( + RunActionOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/run") + .build(); + Map properties = new HashMap<>(); + properties.put("id", request.getId()); + properties.put("external_user_id", request.getExternalUserId()); + if (request.getConfiguredProps().isPresent()) { + properties.put("configured_props", request.getConfiguredProps()); + } + if (request.getDynamicPropsId().isPresent()) { + properties.put("dynamic_props_id", request.getDynamicPropsId()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), RunActionResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java b/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java new file mode 100644 index 0000000..eee1aa6 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.actions.requests.ActionsConfigurePropRequest; +import com.pipedream.api.resources.actions.requests.ActionsListRequest; +import com.pipedream.api.resources.actions.requests.ActionsReloadPropsRequest; +import com.pipedream.api.resources.actions.requests.RunActionOpts; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import com.pipedream.api.types.RunActionResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawActionsClient { + protected final ClientOptions clientOptions; + + public RawActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(ActionsListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(ActionsListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + ActionsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ActionsListRequest nextRequest = ActionsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String componentId) { + return retrieve(componentId, null); + } + + public PipedreamApiHttpResponse retrieve(String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse configureProp(ActionsConfigurePropRequest request) { + return configureProp(request, null); + } + + public PipedreamApiHttpResponse configureProp( + ActionsConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse reloadProps(ActionsReloadPropsRequest request) { + return reloadProps(request, null); + } + + public PipedreamApiHttpResponse reloadProps( + ActionsReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse run(RunActionOpts request) { + return run(request, null); + } + + public PipedreamApiHttpResponse run(RunActionOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/run") + .build(); + Map properties = new HashMap<>(); + properties.put("id", request.getId()); + properties.put("external_user_id", request.getExternalUserId()); + if (request.getConfiguredProps().isPresent()) { + properties.put("configured_props", request.getConfiguredProps()); + } + if (request.getDynamicPropsId().isPresent()) { + properties.put("dynamic_props_id", request.getDynamicPropsId()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), RunActionResponse.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/actions/requests/ActionsConfigurePropRequest.java b/src/main/java/com/pipedream/api/resources/actions/requests/ActionsConfigurePropRequest.java new file mode 100644 index 0000000..5da951b --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/actions/requests/ActionsConfigurePropRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions.requests; + +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 com.pipedream.api.types.ConfigurePropOpts; +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 = ActionsConfigurePropRequest.Builder.class) +public final class ActionsConfigurePropRequest { + private final Optional asyncHandle; + + private final ConfigurePropOpts body; + + private final Map additionalProperties; + + private ActionsConfigurePropRequest( + Optional asyncHandle, ConfigurePropOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ConfigurePropOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ActionsConfigurePropRequest && equalTo((ActionsConfigurePropRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ActionsConfigurePropRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ConfigurePropOpts body); + + Builder from(ActionsConfigurePropRequest other); + } + + public interface _FinalStage { + ActionsConfigurePropRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ConfigurePropOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ActionsConfigurePropRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ConfigurePropOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public ActionsConfigurePropRequest build() { + return new ActionsConfigurePropRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/actions/requests/ActionsListRequest.java b/src/main/java/com/pipedream/api/resources/actions/requests/ActionsListRequest.java new file mode 100644 index 0000000..60f1e37 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/actions/requests/ActionsListRequest.java @@ -0,0 +1,223 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ActionsListRequest.Builder.class) +public final class ActionsListRequest { + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional q; + + private final Optional app; + + private final Map additionalProperties; + + private ActionsListRequest( + Optional after, + Optional before, + Optional limit, + Optional q, + Optional app, + Map additionalProperties) { + this.after = after; + this.before = before; + this.limit = limit; + this.q = q; + this.app = app; + this.additionalProperties = additionalProperties; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return A search query to filter the actions + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return The ID or name slug of the app to filter the actions + */ + @JsonProperty("app") + public Optional getApp() { + return app; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ActionsListRequest && equalTo((ActionsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ActionsListRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && q.equals(other.q) + && app.equals(other.app); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.limit, this.q, this.app); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional app = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ActionsListRequest other) { + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + q(other.getQ()); + app(other.getApp()); + return this; + } + + /** + *

The cursor to start from for pagination

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The cursor to end before for pagination

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The maximum number of results to return

+ */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

A search query to filter the actions

+ */ + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + /** + *

The ID or name slug of the app to filter the actions

+ */ + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(String app) { + this.app = Optional.ofNullable(app); + return this; + } + + public ActionsListRequest build() { + return new ActionsListRequest(after, before, limit, q, app, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/actions/requests/ActionsReloadPropsRequest.java b/src/main/java/com/pipedream/api/resources/actions/requests/ActionsReloadPropsRequest.java new file mode 100644 index 0000000..afefa8a --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/actions/requests/ActionsReloadPropsRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions.requests; + +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 com.pipedream.api.types.ReloadPropsOpts; +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 = ActionsReloadPropsRequest.Builder.class) +public final class ActionsReloadPropsRequest { + private final Optional asyncHandle; + + private final ReloadPropsOpts body; + + private final Map additionalProperties; + + private ActionsReloadPropsRequest( + Optional asyncHandle, ReloadPropsOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ReloadPropsOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ActionsReloadPropsRequest && equalTo((ActionsReloadPropsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ActionsReloadPropsRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ReloadPropsOpts body); + + Builder from(ActionsReloadPropsRequest other); + } + + public interface _FinalStage { + ActionsReloadPropsRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ReloadPropsOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ActionsReloadPropsRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ReloadPropsOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public ActionsReloadPropsRequest build() { + return new ActionsReloadPropsRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/actions/requests/RunActionOpts.java b/src/main/java/com/pipedream/api/resources/actions/requests/RunActionOpts.java new file mode 100644 index 0000000..6a16af8 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/actions/requests/RunActionOpts.java @@ -0,0 +1,269 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions.requests; + +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 = RunActionOpts.Builder.class) +public final class RunActionOpts { + private final Optional asyncHandle; + + private final String id; + + private final String externalUserId; + + private final Optional> configuredProps; + + private final Optional dynamicPropsId; + + private final Map additionalProperties; + + private RunActionOpts( + Optional asyncHandle, + String id, + String externalUserId, + Optional> configuredProps, + Optional dynamicPropsId, + Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.id = id; + this.externalUserId = externalUserId; + this.configuredProps = configuredProps; + this.dynamicPropsId = dynamicPropsId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + /** + * @return The action component ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The external user ID + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The configured properties for the action + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The ID for dynamic props + */ + @JsonProperty("dynamic_props_id") + public Optional getDynamicPropsId() { + return dynamicPropsId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RunActionOpts && equalTo((RunActionOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RunActionOpts other) { + return asyncHandle.equals(other.asyncHandle) + && id.equals(other.id) + && externalUserId.equals(other.externalUserId) + && configuredProps.equals(other.configuredProps) + && dynamicPropsId.equals(other.dynamicPropsId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.id, this.externalUserId, this.configuredProps, this.dynamicPropsId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The action component ID

+ */ + ExternalUserIdStage id(@NotNull String id); + + Builder from(RunActionOpts other); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID

+ */ + _FinalStage externalUserId(@NotNull String externalUserId); + } + + public interface _FinalStage { + RunActionOpts build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + + /** + *

The configured properties for the action

+ */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

The ID for dynamic props

+ */ + _FinalStage dynamicPropsId(Optional dynamicPropsId); + + _FinalStage dynamicPropsId(String dynamicPropsId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ExternalUserIdStage, _FinalStage { + private String id; + + private String externalUserId; + + private Optional dynamicPropsId = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RunActionOpts other) { + asyncHandle(other.getAsyncHandle()); + id(other.getId()); + externalUserId(other.getExternalUserId()); + configuredProps(other.getConfiguredProps()); + dynamicPropsId(other.getDynamicPropsId()); + return this; + } + + /** + *

The action component ID

+ *

The action component ID

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

The external user ID

+ *

The external user ID

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

The ID for dynamic props

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

The ID for dynamic props

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

The configured properties for the action

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

The configured properties for the action

+ */ + @java.lang.Override + @JsonSetter(value = "configured_props", nulls = Nulls.SKIP) + public _FinalStage configuredProps(Optional> configuredProps) { + this.configuredProps = configuredProps; + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public RunActionOpts build() { + return new RunActionOpts( + asyncHandle, id, externalUserId, configuredProps, dynamicPropsId, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/appcategories/AppCategoriesClient.java b/src/main/java/com/pipedream/api/resources/appcategories/AppCategoriesClient.java new file mode 100644 index 0000000..357d245 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/appcategories/AppCategoriesClient.java @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appcategories; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.AppCategory; +import java.util.List; + +public class AppCategoriesClient { + protected final ClientOptions clientOptions; + + private final RawAppCategoriesClient rawClient; + + public AppCategoriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAppCategoriesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAppCategoriesClient withRawResponse() { + return this.rawClient; + } + + public List list() { + return this.rawClient.list().body(); + } + + public List list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + public AppCategory retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + public AppCategory retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/appcategories/AsyncAppCategoriesClient.java b/src/main/java/com/pipedream/api/resources/appcategories/AsyncAppCategoriesClient.java new file mode 100644 index 0000000..d374614 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/appcategories/AsyncAppCategoriesClient.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appcategories; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.AppCategory; +import java.util.List; +import java.util.concurrent.CompletableFuture; + +public class AsyncAppCategoriesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAppCategoriesClient rawClient; + + public AsyncAppCategoriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAppCategoriesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAppCategoriesClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java b/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java new file mode 100644 index 0000000..c7a7bf5 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appcategories; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.AppCategory; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAppCategoriesClient { + protected final ClientOptions clientOptions; + + public AsyncRawAppCategoriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(null); + } + + public CompletableFuture>> list(RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/app_categories") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String id) { + return retrieve(id, null); + } + + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/app_categories") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), AppCategory.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java b/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java new file mode 100644 index 0000000..497bd77 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appcategories; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.AppCategory; +import java.io.IOException; +import java.util.List; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAppCategoriesClient { + protected final ClientOptions clientOptions; + + public RawAppCategoriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(null); + } + + public PipedreamApiHttpResponse> list(RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/app_categories") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String id) { + return retrieve(id, null); + } + + public PipedreamApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/app_categories") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), AppCategory.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/apps/AppsClient.java b/src/main/java/com/pipedream/api/resources/apps/AppsClient.java new file mode 100644 index 0000000..39bcb35 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/apps/AppsClient.java @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.apps.requests.AppsListRequest; +import com.pipedream.api.types.App; +import com.pipedream.api.types.GetAppResponse; + +public class AppsClient { + protected final ClientOptions clientOptions; + + private final RawAppsClient rawClient; + + public AppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAppsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAppsClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(AppsListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(AppsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public GetAppResponse retrieve(String appId) { + return this.rawClient.retrieve(appId).body(); + } + + public GetAppResponse retrieve(String appId, RequestOptions requestOptions) { + return this.rawClient.retrieve(appId, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/apps/AsyncAppsClient.java b/src/main/java/com/pipedream/api/resources/apps/AsyncAppsClient.java new file mode 100644 index 0000000..fbe87f5 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/apps/AsyncAppsClient.java @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.apps.requests.AppsListRequest; +import com.pipedream.api.types.App; +import com.pipedream.api.types.GetAppResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncAppsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAppsClient rawClient; + + public AsyncAppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAppsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAppsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(AppsListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list(AppsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String appId) { + return this.rawClient.retrieve(appId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String appId, RequestOptions requestOptions) { + return this.rawClient.retrieve(appId, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java b/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java new file mode 100644 index 0000000..42967c0 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java @@ -0,0 +1,189 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.apps.requests.AppsListRequest; +import com.pipedream.api.types.App; +import com.pipedream.api.types.GetAppResponse; +import com.pipedream.api.types.ListAppsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAppsClient { + protected final ClientOptions clientOptions; + + public AsyncRawAppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(AppsListRequest.builder().build()); + } + + public CompletableFuture>> list(AppsListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + AppsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/apps"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getSortKey().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_key", request.getSortKey().get(), false); + } + if (request.getSortDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_direction", request.getSortDirection().get(), false); + } + if (request.getCategoryIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "category_ids", request.getCategoryIds().get(), true); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + ListAppsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAppsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + AppsListRequest nextRequest = AppsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String appId) { + return retrieve(appId, null); + } + + public CompletableFuture> retrieve( + String appId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/apps") + .addPathSegment(appId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetAppResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java b/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java new file mode 100644 index 0000000..37619d9 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java @@ -0,0 +1,149 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.apps.requests.AppsListRequest; +import com.pipedream.api.types.App; +import com.pipedream.api.types.GetAppResponse; +import com.pipedream.api.types.ListAppsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAppsClient { + protected final ClientOptions clientOptions; + + public RawAppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(AppsListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(AppsListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + AppsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/apps"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getSortKey().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_key", request.getSortKey().get(), false); + } + if (request.getSortDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_direction", request.getSortDirection().get(), false); + } + if (request.getCategoryIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "category_ids", request.getCategoryIds().get(), true); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + ListAppsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAppsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + AppsListRequest nextRequest = AppsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String appId) { + return retrieve(appId, null); + } + + public PipedreamApiHttpResponse retrieve(String appId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/apps") + .addPathSegment(appId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetAppResponse.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/apps/requests/AppsListRequest.java b/src/main/java/com/pipedream/api/resources/apps/requests/AppsListRequest.java new file mode 100644 index 0000000..5e13f36 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/apps/requests/AppsListRequest.java @@ -0,0 +1,294 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps.requests; + +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 com.pipedream.api.resources.apps.types.AppsListRequestSortDirection; +import com.pipedream.api.resources.apps.types.AppsListRequestSortKey; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppsListRequest.Builder.class) +public final class AppsListRequest { + private final Optional> categoryIds; + + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional q; + + private final Optional sortKey; + + private final Optional sortDirection; + + private final Map additionalProperties; + + private AppsListRequest( + Optional> categoryIds, + Optional after, + Optional before, + Optional limit, + Optional q, + Optional sortKey, + Optional sortDirection, + Map additionalProperties) { + this.categoryIds = categoryIds; + this.after = after; + this.before = before; + this.limit = limit; + this.q = q; + this.sortKey = sortKey; + this.sortDirection = sortDirection; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only return apps in these categories + */ + @JsonProperty("category_ids") + public Optional> getCategoryIds() { + return categoryIds; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return A search query to filter the apps + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return The key to sort the apps by + */ + @JsonProperty("sort_key") + public Optional getSortKey() { + return sortKey; + } + + /** + * @return The direction to sort the apps + */ + @JsonProperty("sort_direction") + public Optional getSortDirection() { + return sortDirection; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppsListRequest && equalTo((AppsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppsListRequest other) { + return categoryIds.equals(other.categoryIds) + && after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && q.equals(other.q) + && sortKey.equals(other.sortKey) + && sortDirection.equals(other.sortDirection); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.categoryIds, this.after, this.before, this.limit, this.q, this.sortKey, this.sortDirection); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> categoryIds = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional sortKey = Optional.empty(); + + private Optional sortDirection = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AppsListRequest other) { + categoryIds(other.getCategoryIds()); + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + q(other.getQ()); + sortKey(other.getSortKey()); + sortDirection(other.getSortDirection()); + return this; + } + + /** + *

Only return apps in these categories

+ */ + @JsonSetter(value = "category_ids", nulls = Nulls.SKIP) + public Builder categoryIds(Optional> categoryIds) { + this.categoryIds = categoryIds; + return this; + } + + public Builder categoryIds(List categoryIds) { + this.categoryIds = Optional.ofNullable(categoryIds); + return this; + } + + public Builder categoryIds(String categoryIds) { + this.categoryIds = Optional.of(Collections.singletonList(categoryIds)); + return this; + } + + /** + *

The cursor to start from for pagination

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The cursor to end before for pagination

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The maximum number of results to return

+ */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

A search query to filter the apps

+ */ + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + /** + *

The key to sort the apps by

+ */ + @JsonSetter(value = "sort_key", nulls = Nulls.SKIP) + public Builder sortKey(Optional sortKey) { + this.sortKey = sortKey; + return this; + } + + public Builder sortKey(AppsListRequestSortKey sortKey) { + this.sortKey = Optional.ofNullable(sortKey); + return this; + } + + /** + *

The direction to sort the apps

+ */ + @JsonSetter(value = "sort_direction", nulls = Nulls.SKIP) + public Builder sortDirection(Optional sortDirection) { + this.sortDirection = sortDirection; + return this; + } + + public Builder sortDirection(AppsListRequestSortDirection sortDirection) { + this.sortDirection = Optional.ofNullable(sortDirection); + return this; + } + + public AppsListRequest build() { + return new AppsListRequest( + categoryIds, after, before, limit, q, sortKey, sortDirection, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortDirection.java b/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortDirection.java new file mode 100644 index 0000000..18cc793 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortDirection.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AppsListRequestSortDirection { + ASC("asc"), + + DESC("desc"); + + private final String value; + + AppsListRequestSortDirection(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortKey.java b/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortKey.java new file mode 100644 index 0000000..7260231 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortKey.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AppsListRequestSortKey { + NAME("name"), + + NAME_SLUG("name_slug"), + + FEATURED_WEIGHT("featured_weight"); + + private final String value; + + AppsListRequestSortKey(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/pipedream/api/resources/components/AsyncComponentsClient.java b/src/main/java/com/pipedream/api/resources/components/AsyncComponentsClient.java new file mode 100644 index 0000000..c5934f3 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/components/AsyncComponentsClient.java @@ -0,0 +1,72 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.components.requests.ComponentsConfigurePropRequest; +import com.pipedream.api.resources.components.requests.ComponentsListRequest; +import com.pipedream.api.resources.components.requests.ComponentsReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncComponentsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawComponentsClient rawClient; + + public AsyncComponentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawComponentsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawComponentsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(ComponentsListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + ComponentsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId) { + return this.rawClient.retrieve(componentId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp(ComponentsConfigurePropRequest request) { + return this.rawClient.configureProp(request).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp( + ComponentsConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps(ComponentsReloadPropsRequest request) { + return this.rawClient.reloadProps(request).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps( + ComponentsReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java b/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java new file mode 100644 index 0000000..43e8178 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java @@ -0,0 +1,321 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.components.requests.ComponentsConfigurePropRequest; +import com.pipedream.api.resources.components.requests.ComponentsListRequest; +import com.pipedream.api.resources.components.requests.ComponentsReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawComponentsClient { + protected final ClientOptions clientOptions; + + public AsyncRawComponentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(ComponentsListRequest.builder().build()); + } + + public CompletableFuture>> list( + ComponentsListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + ComponentsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ComponentsListRequest nextRequest = ComponentsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String componentId) { + return retrieve(componentId, null); + } + + public CompletableFuture> retrieve( + String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> configureProp( + ComponentsConfigurePropRequest request) { + return configureProp(request, null); + } + + public CompletableFuture> configureProp( + ComponentsConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> reloadProps( + ComponentsReloadPropsRequest request) { + return reloadProps(request, null); + } + + public CompletableFuture> reloadProps( + ComponentsReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/components/ComponentsClient.java b/src/main/java/com/pipedream/api/resources/components/ComponentsClient.java new file mode 100644 index 0000000..f273dcb --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/components/ComponentsClient.java @@ -0,0 +1,68 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.components.requests.ComponentsConfigurePropRequest; +import com.pipedream.api.resources.components.requests.ComponentsListRequest; +import com.pipedream.api.resources.components.requests.ComponentsReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.ReloadPropsResponse; + +public class ComponentsClient { + protected final ClientOptions clientOptions; + + private final RawComponentsClient rawClient; + + public ComponentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawComponentsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawComponentsClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(ComponentsListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(ComponentsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public Component retrieve(String componentId) { + return this.rawClient.retrieve(componentId).body(); + } + + public Component retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).body(); + } + + public ConfigurePropResponse configureProp(ComponentsConfigurePropRequest request) { + return this.rawClient.configureProp(request).body(); + } + + public ConfigurePropResponse configureProp(ComponentsConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).body(); + } + + public ReloadPropsResponse reloadProps(ComponentsReloadPropsRequest request) { + return this.rawClient.reloadProps(request).body(); + } + + public ReloadPropsResponse reloadProps(ComponentsReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java b/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java new file mode 100644 index 0000000..cd8521d --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java @@ -0,0 +1,253 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.components.requests.ComponentsConfigurePropRequest; +import com.pipedream.api.resources.components.requests.ComponentsListRequest; +import com.pipedream.api.resources.components.requests.ComponentsReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawComponentsClient { + protected final ClientOptions clientOptions; + + public RawComponentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(ComponentsListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(ComponentsListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + ComponentsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ComponentsListRequest nextRequest = ComponentsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String componentId) { + return retrieve(componentId, null); + } + + public PipedreamApiHttpResponse retrieve(String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse configureProp(ComponentsConfigurePropRequest request) { + return configureProp(request, null); + } + + public PipedreamApiHttpResponse configureProp( + ComponentsConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse reloadProps(ComponentsReloadPropsRequest request) { + return reloadProps(request, null); + } + + public PipedreamApiHttpResponse reloadProps( + ComponentsReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/components/requests/ComponentsConfigurePropRequest.java b/src/main/java/com/pipedream/api/resources/components/requests/ComponentsConfigurePropRequest.java new file mode 100644 index 0000000..541a93e --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/components/requests/ComponentsConfigurePropRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components.requests; + +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 com.pipedream.api.types.ConfigurePropOpts; +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 = ComponentsConfigurePropRequest.Builder.class) +public final class ComponentsConfigurePropRequest { + private final Optional asyncHandle; + + private final ConfigurePropOpts body; + + private final Map additionalProperties; + + private ComponentsConfigurePropRequest( + Optional asyncHandle, ConfigurePropOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ConfigurePropOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ComponentsConfigurePropRequest && equalTo((ComponentsConfigurePropRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ComponentsConfigurePropRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ConfigurePropOpts body); + + Builder from(ComponentsConfigurePropRequest other); + } + + public interface _FinalStage { + ComponentsConfigurePropRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ConfigurePropOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ComponentsConfigurePropRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ConfigurePropOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public ComponentsConfigurePropRequest build() { + return new ComponentsConfigurePropRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/components/requests/ComponentsListRequest.java b/src/main/java/com/pipedream/api/resources/components/requests/ComponentsListRequest.java new file mode 100644 index 0000000..8d5b23b --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/components/requests/ComponentsListRequest.java @@ -0,0 +1,223 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ComponentsListRequest.Builder.class) +public final class ComponentsListRequest { + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional q; + + private final Optional app; + + private final Map additionalProperties; + + private ComponentsListRequest( + Optional after, + Optional before, + Optional limit, + Optional q, + Optional app, + Map additionalProperties) { + this.after = after; + this.before = before; + this.limit = limit; + this.q = q; + this.app = app; + this.additionalProperties = additionalProperties; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return A search query to filter the components + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return The ID or name slug of the app to filter the components + */ + @JsonProperty("app") + public Optional getApp() { + return app; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ComponentsListRequest && equalTo((ComponentsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ComponentsListRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && q.equals(other.q) + && app.equals(other.app); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.limit, this.q, this.app); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional app = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ComponentsListRequest other) { + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + q(other.getQ()); + app(other.getApp()); + return this; + } + + /** + *

The cursor to start from for pagination

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The cursor to end before for pagination

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The maximum number of results to return

+ */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

A search query to filter the components

+ */ + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + /** + *

The ID or name slug of the app to filter the components

+ */ + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(String app) { + this.app = Optional.ofNullable(app); + return this; + } + + public ComponentsListRequest build() { + return new ComponentsListRequest(after, before, limit, q, app, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/components/requests/ComponentsReloadPropsRequest.java b/src/main/java/com/pipedream/api/resources/components/requests/ComponentsReloadPropsRequest.java new file mode 100644 index 0000000..960dc66 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/components/requests/ComponentsReloadPropsRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components.requests; + +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 com.pipedream.api.types.ReloadPropsOpts; +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 = ComponentsReloadPropsRequest.Builder.class) +public final class ComponentsReloadPropsRequest { + private final Optional asyncHandle; + + private final ReloadPropsOpts body; + + private final Map additionalProperties; + + private ComponentsReloadPropsRequest( + Optional asyncHandle, ReloadPropsOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ReloadPropsOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ComponentsReloadPropsRequest && equalTo((ComponentsReloadPropsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ComponentsReloadPropsRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ReloadPropsOpts body); + + Builder from(ComponentsReloadPropsRequest other); + } + + public interface _FinalStage { + ComponentsReloadPropsRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ReloadPropsOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ComponentsReloadPropsRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ReloadPropsOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public ComponentsReloadPropsRequest build() { + return new ComponentsReloadPropsRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java new file mode 100644 index 0000000..bc6b458 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersDeleteRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListEventsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWebhooksOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.EmittedEvent; +import com.pipedream.api.types.GetTriggerWebhooksResponse; +import com.pipedream.api.types.GetTriggerWorkflowsResponse; +import java.util.List; +import java.util.concurrent.CompletableFuture; + +public class AsyncDeployedTriggersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawDeployedTriggersClient rawClient; + + public AsyncDeployedTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawDeployedTriggersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawDeployedTriggersClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list(DeployedTriggersListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + DeployedTriggersListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String triggerId, DeployedTriggersRetrieveRequest request) { + return this.rawClient.retrieve(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve( + String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture update(String triggerId, UpdateTriggerOpts request) { + return this.rawClient.update(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture update( + String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { + return this.rawClient.update(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture delete(String triggerId, DeployedTriggersDeleteRequest request) { + return this.rawClient.delete(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture delete( + String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> listEvents( + String triggerId, DeployedTriggersListEventsRequest request) { + return this.rawClient.listEvents(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture> listEvents( + String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { + return this.rawClient.listEvents(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request) { + return this.rawClient.listWorkflows(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { + return this.rawClient.listWorkflows(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request) { + return this.rawClient.updateWorkflows(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { + return this.rawClient + .updateWorkflows(triggerId, request, requestOptions) + .thenApply(response -> response.body()); + } + + public CompletableFuture listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request) { + return this.rawClient.listWebhooks(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.listWebhooks(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request) { + return this.rawClient.updateWebhooks(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { + return this.rawClient.updateWebhooks(triggerId, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java new file mode 100644 index 0000000..cbee597 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java @@ -0,0 +1,630 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersDeleteRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListEventsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWebhooksOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.EmittedEvent; +import com.pipedream.api.types.GetTriggerEventsResponse; +import com.pipedream.api.types.GetTriggerResponse; +import com.pipedream.api.types.GetTriggerWebhooksResponse; +import com.pipedream.api.types.GetTriggerWorkflowsResponse; +import com.pipedream.api.types.GetTriggersResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawDeployedTriggersClient { + protected final ClientOptions clientOptions; + + public AsyncRawDeployedTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list( + DeployedTriggersListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + DeployedTriggersListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetTriggersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggersResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + DeployedTriggersListRequest nextRequest = DeployedTriggersListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve( + String triggerId, DeployedTriggersRetrieveRequest request) { + return retrieve(triggerId, request, null); + } + + public CompletableFuture> retrieve( + String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> update( + String triggerId, UpdateTriggerOpts request) { + return update(triggerId, request, null); + } + + public CompletableFuture> update( + String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + if (request.getActive().isPresent()) { + properties.put("active", request.getActive()); + } + if (request.getConfiguredProps().isPresent()) { + properties.put("configured_props", request.getConfiguredProps()); + } + if (request.getName().isPresent()) { + properties.put("name", request.getName()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> delete( + String triggerId, DeployedTriggersDeleteRequest request) { + return delete(triggerId, request, null); + } + + public CompletableFuture> delete( + String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + if (request.getIgnoreHookErrors().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ignore_hook_errors", request.getIgnoreHookErrors().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> listEvents( + String triggerId, DeployedTriggersListEventsRequest request) { + return listEvents(triggerId, request, null); + } + + public CompletableFuture>> listEvents( + String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("events"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + if (request.getN().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "n", request.getN().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetTriggerEventsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerEventsResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request) { + return listWorkflows(triggerId, request, null); + } + + public CompletableFuture> listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("pipelines"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerWorkflowsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request) { + return updateWorkflows(triggerId, request, null); + } + + public CompletableFuture> updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("pipelines"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + properties.put("workflow_ids", request.getWorkflowIds()); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerWorkflowsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request) { + return listWebhooks(triggerId, request, null); + } + + public CompletableFuture> listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("webhooks"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerWebhooksResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request) { + return updateWebhooks(triggerId, request, null); + } + + public CompletableFuture> updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("webhooks"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + properties.put("webhook_urls", request.getWebhookUrls()); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerWebhooksResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java new file mode 100644 index 0000000..891ce12 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java @@ -0,0 +1,121 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersDeleteRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListEventsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWebhooksOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.EmittedEvent; +import com.pipedream.api.types.GetTriggerWebhooksResponse; +import com.pipedream.api.types.GetTriggerWorkflowsResponse; +import java.util.List; + +public class DeployedTriggersClient { + protected final ClientOptions clientOptions; + + private final RawDeployedTriggersClient rawClient; + + public DeployedTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawDeployedTriggersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawDeployedTriggersClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list(DeployedTriggersListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list( + DeployedTriggersListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public DeployedComponent retrieve(String triggerId, DeployedTriggersRetrieveRequest request) { + return this.rawClient.retrieve(triggerId, request).body(); + } + + public DeployedComponent retrieve( + String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(triggerId, request, requestOptions).body(); + } + + public DeployedComponent update(String triggerId, UpdateTriggerOpts request) { + return this.rawClient.update(triggerId, request).body(); + } + + public DeployedComponent update(String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { + return this.rawClient.update(triggerId, request, requestOptions).body(); + } + + public void delete(String triggerId, DeployedTriggersDeleteRequest request) { + this.rawClient.delete(triggerId, request).body(); + } + + public void delete(String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { + this.rawClient.delete(triggerId, request, requestOptions).body(); + } + + public List listEvents(String triggerId, DeployedTriggersListEventsRequest request) { + return this.rawClient.listEvents(triggerId, request).body(); + } + + public List listEvents( + String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { + return this.rawClient.listEvents(triggerId, request, requestOptions).body(); + } + + public GetTriggerWorkflowsResponse listWorkflows(String triggerId, DeployedTriggersListWorkflowsRequest request) { + return this.rawClient.listWorkflows(triggerId, request).body(); + } + + public GetTriggerWorkflowsResponse listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { + return this.rawClient.listWorkflows(triggerId, request, requestOptions).body(); + } + + public GetTriggerWorkflowsResponse updateWorkflows(String triggerId, UpdateTriggerWorkflowsOpts request) { + return this.rawClient.updateWorkflows(triggerId, request).body(); + } + + public GetTriggerWorkflowsResponse updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { + return this.rawClient + .updateWorkflows(triggerId, request, requestOptions) + .body(); + } + + public GetTriggerWebhooksResponse listWebhooks(String triggerId, DeployedTriggersListWebhooksRequest request) { + return this.rawClient.listWebhooks(triggerId, request).body(); + } + + public GetTriggerWebhooksResponse listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.listWebhooks(triggerId, request, requestOptions).body(); + } + + public GetTriggerWebhooksResponse updateWebhooks(String triggerId, UpdateTriggerWebhooksOpts request) { + return this.rawClient.updateWebhooks(triggerId, request).body(); + } + + public GetTriggerWebhooksResponse updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { + return this.rawClient.updateWebhooks(triggerId, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java new file mode 100644 index 0000000..0e1e09f --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java @@ -0,0 +1,493 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersDeleteRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListEventsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWebhooksOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.EmittedEvent; +import com.pipedream.api.types.GetTriggerEventsResponse; +import com.pipedream.api.types.GetTriggerResponse; +import com.pipedream.api.types.GetTriggerWebhooksResponse; +import com.pipedream.api.types.GetTriggerWorkflowsResponse; +import com.pipedream.api.types.GetTriggersResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawDeployedTriggersClient { + protected final ClientOptions clientOptions; + + public RawDeployedTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list(DeployedTriggersListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + DeployedTriggersListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetTriggersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggersResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + DeployedTriggersListRequest nextRequest = DeployedTriggersListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve( + String triggerId, DeployedTriggersRetrieveRequest request) { + return retrieve(triggerId, request, null); + } + + public PipedreamApiHttpResponse retrieve( + String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse update(String triggerId, UpdateTriggerOpts request) { + return update(triggerId, request, null); + } + + public PipedreamApiHttpResponse update( + String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + if (request.getActive().isPresent()) { + properties.put("active", request.getActive()); + } + if (request.getConfiguredProps().isPresent()) { + properties.put("configured_props", request.getConfiguredProps()); + } + if (request.getName().isPresent()) { + properties.put("name", request.getName()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse delete(String triggerId, DeployedTriggersDeleteRequest request) { + return delete(triggerId, request, null); + } + + public PipedreamApiHttpResponse delete( + String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + if (request.getIgnoreHookErrors().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ignore_hook_errors", request.getIgnoreHookErrors().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> listEvents( + String triggerId, DeployedTriggersListEventsRequest request) { + return listEvents(triggerId, request, null); + } + + public PipedreamApiHttpResponse> listEvents( + String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("events"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + if (request.getN().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "n", request.getN().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetTriggerEventsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerEventsResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request) { + return listWorkflows(triggerId, request, null); + } + + public PipedreamApiHttpResponse listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("pipelines"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWorkflowsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request) { + return updateWorkflows(triggerId, request, null); + } + + public PipedreamApiHttpResponse updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("pipelines"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + properties.put("workflow_ids", request.getWorkflowIds()); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWorkflowsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request) { + return listWebhooks(triggerId, request, null); + } + + public PipedreamApiHttpResponse listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("webhooks"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWebhooksResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request) { + return updateWebhooks(triggerId, request, null); + } + + public PipedreamApiHttpResponse updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("webhooks"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + properties.put("webhook_urls", request.getWebhookUrls()); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWebhooksResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersDeleteRequest.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersDeleteRequest.java new file mode 100644 index 0000000..3989d6e --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersDeleteRequest.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +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 = DeployedTriggersDeleteRequest.Builder.class) +public final class DeployedTriggersDeleteRequest { + private final String externalUserId; + + private final Optional ignoreHookErrors; + + private final Map additionalProperties; + + private DeployedTriggersDeleteRequest( + String externalUserId, Optional ignoreHookErrors, Map additionalProperties) { + this.externalUserId = externalUserId; + this.ignoreHookErrors = ignoreHookErrors; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Whether to ignore errors during deactivation hook + */ + @JsonProperty("ignore_hook_errors") + public Optional getIgnoreHookErrors() { + return ignoreHookErrors; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersDeleteRequest && equalTo((DeployedTriggersDeleteRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersDeleteRequest other) { + return externalUserId.equals(other.externalUserId) && ignoreHookErrors.equals(other.ignoreHookErrors); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.ignoreHookErrors); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID who owns the trigger

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

Whether to ignore errors during deactivation hook

+ */ + _FinalStage ignoreHookErrors(Optional ignoreHookErrors); + + _FinalStage ignoreHookErrors(Boolean ignoreHookErrors); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private Optional ignoreHookErrors = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersDeleteRequest other) { + externalUserId(other.getExternalUserId()); + ignoreHookErrors(other.getIgnoreHookErrors()); + return this; + } + + /** + *

The external user ID who owns the trigger

+ *

The external user ID who owns the trigger

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

Whether to ignore errors during deactivation hook

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

Whether to ignore errors during deactivation hook

+ */ + @java.lang.Override + @JsonSetter(value = "ignore_hook_errors", nulls = Nulls.SKIP) + public _FinalStage ignoreHookErrors(Optional ignoreHookErrors) { + this.ignoreHookErrors = ignoreHookErrors; + return this; + } + + @java.lang.Override + public DeployedTriggersDeleteRequest build() { + return new DeployedTriggersDeleteRequest(externalUserId, ignoreHookErrors, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListEventsRequest.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListEventsRequest.java new file mode 100644 index 0000000..e3015b2 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListEventsRequest.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +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 = DeployedTriggersListEventsRequest.Builder.class) +public final class DeployedTriggersListEventsRequest { + private final String externalUserId; + + private final Optional n; + + private final Map additionalProperties; + + private DeployedTriggersListEventsRequest( + String externalUserId, Optional n, Map additionalProperties) { + this.externalUserId = externalUserId; + this.n = n; + this.additionalProperties = additionalProperties; + } + + /** + * @return Your end user ID, for whom you deployed the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The number of events to retrieve (defaults to 20 if not provided) + */ + @JsonProperty("n") + public Optional getN() { + return n; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersListEventsRequest && equalTo((DeployedTriggersListEventsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersListEventsRequest other) { + return externalUserId.equals(other.externalUserId) && n.equals(other.n); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.n); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

Your end user ID, for whom you deployed the trigger

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

The number of events to retrieve (defaults to 20 if not provided)

+ */ + _FinalStage n(Optional n); + + _FinalStage n(Integer n); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private Optional n = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersListEventsRequest other) { + externalUserId(other.getExternalUserId()); + n(other.getN()); + return this; + } + + /** + *

Your end user ID, for whom you deployed the trigger

+ *

Your end user ID, for whom you deployed the trigger

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

The number of events to retrieve (defaults to 20 if not provided)

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

The number of events to retrieve (defaults to 20 if not provided)

+ */ + @java.lang.Override + @JsonSetter(value = "n", nulls = Nulls.SKIP) + public _FinalStage n(Optional n) { + this.n = n; + return this; + } + + @java.lang.Override + public DeployedTriggersListEventsRequest build() { + return new DeployedTriggersListEventsRequest(externalUserId, n, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListRequest.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListRequest.java new file mode 100644 index 0000000..556c4f0 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListRequest.java @@ -0,0 +1,246 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +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 = DeployedTriggersListRequest.Builder.class) +public final class DeployedTriggersListRequest { + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final String externalUserId; + + private final Map additionalProperties; + + private DeployedTriggersListRequest( + Optional after, + Optional before, + Optional limit, + String externalUserId, + Map additionalProperties) { + this.after = after; + this.before = before; + this.limit = limit; + this.externalUserId = externalUserId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Your end user ID, for whom you deployed the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersListRequest && equalTo((DeployedTriggersListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersListRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && externalUserId.equals(other.externalUserId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.limit, this.externalUserId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

Your end user ID, for whom you deployed the trigger

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

The cursor to start from for pagination

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

The cursor to end before for pagination

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

The maximum number of results to return

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(Integer limit); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private Optional limit = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersListRequest other) { + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + externalUserId(other.getExternalUserId()); + return this; + } + + /** + *

Your end user ID, for whom you deployed the trigger

+ *

Your end user ID, for whom you deployed the trigger

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

The maximum number of results to return

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

The maximum number of results to return

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

The cursor to end before for pagination

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

The cursor to end before for pagination

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

The cursor to start from for pagination

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

The cursor to start from for pagination

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public DeployedTriggersListRequest build() { + return new DeployedTriggersListRequest(after, before, limit, externalUserId, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWebhooksRequest.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWebhooksRequest.java new file mode 100644 index 0000000..62cf4dd --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWebhooksRequest.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedTriggersListWebhooksRequest.Builder.class) +public final class DeployedTriggersListWebhooksRequest { + private final String externalUserId; + + private final Map additionalProperties; + + private DeployedTriggersListWebhooksRequest(String externalUserId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersListWebhooksRequest + && equalTo((DeployedTriggersListWebhooksRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersListWebhooksRequest other) { + return externalUserId.equals(other.externalUserId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID who owns the trigger

+ */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(DeployedTriggersListWebhooksRequest other); + } + + public interface _FinalStage { + DeployedTriggersListWebhooksRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersListWebhooksRequest other) { + externalUserId(other.getExternalUserId()); + return this; + } + + /** + *

The external user ID who owns the trigger

+ *

The external user ID who owns the trigger

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + @java.lang.Override + public DeployedTriggersListWebhooksRequest build() { + return new DeployedTriggersListWebhooksRequest(externalUserId, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWorkflowsRequest.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWorkflowsRequest.java new file mode 100644 index 0000000..95979ed --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWorkflowsRequest.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedTriggersListWorkflowsRequest.Builder.class) +public final class DeployedTriggersListWorkflowsRequest { + private final String externalUserId; + + private final Map additionalProperties; + + private DeployedTriggersListWorkflowsRequest(String externalUserId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersListWorkflowsRequest + && equalTo((DeployedTriggersListWorkflowsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersListWorkflowsRequest other) { + return externalUserId.equals(other.externalUserId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID who owns the trigger

+ */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(DeployedTriggersListWorkflowsRequest other); + } + + public interface _FinalStage { + DeployedTriggersListWorkflowsRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersListWorkflowsRequest other) { + externalUserId(other.getExternalUserId()); + return this; + } + + /** + *

The external user ID who owns the trigger

+ *

The external user ID who owns the trigger

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + @java.lang.Override + public DeployedTriggersListWorkflowsRequest build() { + return new DeployedTriggersListWorkflowsRequest(externalUserId, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersRetrieveRequest.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersRetrieveRequest.java new file mode 100644 index 0000000..4aab165 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersRetrieveRequest.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedTriggersRetrieveRequest.Builder.class) +public final class DeployedTriggersRetrieveRequest { + private final String externalUserId; + + private final Map additionalProperties; + + private DeployedTriggersRetrieveRequest(String externalUserId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Your end user ID, for whom you deployed the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersRetrieveRequest && equalTo((DeployedTriggersRetrieveRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersRetrieveRequest other) { + return externalUserId.equals(other.externalUserId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

Your end user ID, for whom you deployed the trigger

+ */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(DeployedTriggersRetrieveRequest other); + } + + public interface _FinalStage { + DeployedTriggersRetrieveRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersRetrieveRequest other) { + externalUserId(other.getExternalUserId()); + return this; + } + + /** + *

Your end user ID, for whom you deployed the trigger

+ *

Your end user ID, for whom you deployed the trigger

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + @java.lang.Override + public DeployedTriggersRetrieveRequest build() { + return new DeployedTriggersRetrieveRequest(externalUserId, additionalProperties); + } + } +} 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 new file mode 100644 index 0000000..735cf4a --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerOpts.java @@ -0,0 +1,246 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +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 = UpdateTriggerOpts.Builder.class) +public final class UpdateTriggerOpts { + private final String externalUserId; + + private final Optional active; + + private final Optional> configuredProps; + + private final Optional name; + + private final Map additionalProperties; + + private UpdateTriggerOpts( + String externalUserId, + Optional active, + Optional> configuredProps, + Optional name, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.active = active; + this.configuredProps = configuredProps; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Whether the trigger should be active + */ + @JsonProperty("active") + public Optional getActive() { + return active; + } + + /** + * @return The configured properties for the trigger + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The name of the trigger + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateTriggerOpts && equalTo((UpdateTriggerOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateTriggerOpts other) { + return externalUserId.equals(other.externalUserId) + && active.equals(other.active) + && configuredProps.equals(other.configuredProps) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.active, this.configuredProps, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID who owns the trigger

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

Whether the trigger should be active

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

The configured properties for the trigger

+ */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

The name of the trigger

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private Optional name = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + private Optional active = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateTriggerOpts other) { + externalUserId(other.getExternalUserId()); + active(other.getActive()); + configuredProps(other.getConfiguredProps()); + name(other.getName()); + return this; + } + + /** + *

The external user ID who owns the trigger

+ *

The external user ID who owns the trigger

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

The name of the trigger

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

The name of the trigger

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

The configured properties for the trigger

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

The configured properties for the trigger

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

Whether the trigger should be active

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

Whether the trigger should be active

+ */ + @java.lang.Override + @JsonSetter(value = "active", nulls = Nulls.SKIP) + public _FinalStage active(Optional active) { + this.active = active; + return this; + } + + @java.lang.Override + public UpdateTriggerOpts build() { + return new UpdateTriggerOpts(externalUserId, active, configuredProps, name, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWebhooksOpts.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWebhooksOpts.java new file mode 100644 index 0000000..d00d5fb --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWebhooksOpts.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateTriggerWebhooksOpts.Builder.class) +public final class UpdateTriggerWebhooksOpts { + private final String externalUserId; + + private final List webhookUrls; + + private final Map additionalProperties; + + private UpdateTriggerWebhooksOpts( + String externalUserId, List webhookUrls, Map additionalProperties) { + this.externalUserId = externalUserId; + this.webhookUrls = webhookUrls; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Array of webhook URLs to set + */ + @JsonProperty("webhook_urls") + public List getWebhookUrls() { + return webhookUrls; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateTriggerWebhooksOpts && equalTo((UpdateTriggerWebhooksOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateTriggerWebhooksOpts other) { + return externalUserId.equals(other.externalUserId) && webhookUrls.equals(other.webhookUrls); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.webhookUrls); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID who owns the trigger

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

Array of webhook URLs to set

+ */ + _FinalStage webhookUrls(List webhookUrls); + + _FinalStage addWebhookUrls(String webhookUrls); + + _FinalStage addAllWebhookUrls(List webhookUrls); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private List webhookUrls = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateTriggerWebhooksOpts other) { + externalUserId(other.getExternalUserId()); + webhookUrls(other.getWebhookUrls()); + return this; + } + + /** + *

The external user ID who owns the trigger

+ *

The external user ID who owns the trigger

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

Array of webhook URLs to set

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

Array of webhook URLs to set

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

Array of webhook URLs to set

+ */ + @java.lang.Override + @JsonSetter(value = "webhook_urls", nulls = Nulls.SKIP) + public _FinalStage webhookUrls(List webhookUrls) { + this.webhookUrls.clear(); + this.webhookUrls.addAll(webhookUrls); + return this; + } + + @java.lang.Override + public UpdateTriggerWebhooksOpts build() { + return new UpdateTriggerWebhooksOpts(externalUserId, webhookUrls, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWorkflowsOpts.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWorkflowsOpts.java new file mode 100644 index 0000000..7022dd6 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWorkflowsOpts.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateTriggerWorkflowsOpts.Builder.class) +public final class UpdateTriggerWorkflowsOpts { + private final String externalUserId; + + private final List workflowIds; + + private final Map additionalProperties; + + private UpdateTriggerWorkflowsOpts( + String externalUserId, List workflowIds, Map additionalProperties) { + this.externalUserId = externalUserId; + this.workflowIds = workflowIds; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Array of workflow IDs to set + */ + @JsonProperty("workflow_ids") + public List getWorkflowIds() { + return workflowIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateTriggerWorkflowsOpts && equalTo((UpdateTriggerWorkflowsOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateTriggerWorkflowsOpts other) { + return externalUserId.equals(other.externalUserId) && workflowIds.equals(other.workflowIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.workflowIds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID who owns the trigger

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

Array of workflow IDs to set

+ */ + _FinalStage workflowIds(List workflowIds); + + _FinalStage addWorkflowIds(String workflowIds); + + _FinalStage addAllWorkflowIds(List workflowIds); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private List workflowIds = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateTriggerWorkflowsOpts other) { + externalUserId(other.getExternalUserId()); + workflowIds(other.getWorkflowIds()); + return this; + } + + /** + *

The external user ID who owns the trigger

+ *

The external user ID who owns the trigger

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

Array of workflow IDs to set

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

Array of workflow IDs to set

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

Array of workflow IDs to set

+ */ + @java.lang.Override + @JsonSetter(value = "workflow_ids", nulls = Nulls.SKIP) + public _FinalStage workflowIds(List workflowIds) { + this.workflowIds.clear(); + this.workflowIds.addAll(workflowIds); + return this; + } + + @java.lang.Override + public UpdateTriggerWorkflowsOpts build() { + return new UpdateTriggerWorkflowsOpts(externalUserId, workflowIds, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncOauthTokensClient.java b/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncOauthTokensClient.java new file mode 100644 index 0000000..87556e3 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncOauthTokensClient.java @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncOauthTokensClient { + protected final ClientOptions clientOptions; + + private final AsyncRawOauthTokensClient rawClient; + + public AsyncOauthTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawOauthTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawOauthTokensClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture create(CreateOAuthTokenOpts request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + public CompletableFuture create( + CreateOAuthTokenOpts request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java b/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java new file mode 100644 index 0000000..cc29bb8 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawOauthTokensClient { + protected final ClientOptions clientOptions; + + public AsyncRawOauthTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> create(CreateOAuthTokenOpts request) { + return create(request, null); + } + + public CompletableFuture> create( + CreateOAuthTokenOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/oauth/token") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), CreateOAuthTokenResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/oauthtokens/OauthTokensClient.java b/src/main/java/com/pipedream/api/resources/oauthtokens/OauthTokensClient.java new file mode 100644 index 0000000..1ae2bf1 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/oauthtokens/OauthTokensClient.java @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; + +public class OauthTokensClient { + protected final ClientOptions clientOptions; + + private final RawOauthTokensClient rawClient; + + public OauthTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawOauthTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawOauthTokensClient withRawResponse() { + return this.rawClient; + } + + public CreateOAuthTokenResponse create(CreateOAuthTokenOpts request) { + return this.rawClient.create(request).body(); + } + + public CreateOAuthTokenResponse create(CreateOAuthTokenOpts request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java b/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java new file mode 100644 index 0000000..c7096b4 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java @@ -0,0 +1,77 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawOauthTokensClient { + protected final ClientOptions clientOptions; + + public RawOauthTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse create(CreateOAuthTokenOpts request) { + return create(request, null); + } + + public PipedreamApiHttpResponse create( + CreateOAuthTokenOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/oauth/token") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateOAuthTokenResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/oauthtokens/requests/CreateOAuthTokenOpts.java b/src/main/java/com/pipedream/api/resources/oauthtokens/requests/CreateOAuthTokenOpts.java new file mode 100644 index 0000000..50ab4b2 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/oauthtokens/requests/CreateOAuthTokenOpts.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens.requests; + +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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateOAuthTokenOpts.Builder.class) +public final class CreateOAuthTokenOpts { + private final String clientId; + + private final String clientSecret; + + private final Map additionalProperties; + + private CreateOAuthTokenOpts(String clientId, String clientSecret, Map additionalProperties) { + this.clientId = clientId; + this.clientSecret = clientSecret; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("grant_type") + public String getGrantType() { + return "client_credentials"; + } + + @JsonProperty("client_id") + public String getClientId() { + return clientId; + } + + @JsonProperty("client_secret") + public String getClientSecret() { + return clientSecret; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOAuthTokenOpts && equalTo((CreateOAuthTokenOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateOAuthTokenOpts other) { + return clientId.equals(other.clientId) && clientSecret.equals(other.clientSecret); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.clientId, this.clientSecret); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ClientIdStage builder() { + return new Builder(); + } + + public interface ClientIdStage { + ClientSecretStage clientId(@NotNull String clientId); + + Builder from(CreateOAuthTokenOpts other); + } + + public interface ClientSecretStage { + _FinalStage clientSecret(@NotNull String clientSecret); + } + + public interface _FinalStage { + CreateOAuthTokenOpts build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ClientIdStage, ClientSecretStage, _FinalStage { + private String clientId; + + private String clientSecret; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateOAuthTokenOpts other) { + clientId(other.getClientId()); + clientSecret(other.getClientSecret()); + return this; + } + + @java.lang.Override + @JsonSetter("client_id") + public ClientSecretStage clientId(@NotNull String clientId) { + this.clientId = Objects.requireNonNull(clientId, "clientId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("client_secret") + public _FinalStage clientSecret(@NotNull String clientSecret) { + this.clientSecret = Objects.requireNonNull(clientSecret, "clientSecret must not be null"); + return this; + } + + @java.lang.Override + public CreateOAuthTokenOpts build() { + return new CreateOAuthTokenOpts(clientId, clientSecret, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/projects/AsyncProjectsClient.java b/src/main/java/com/pipedream/api/resources/projects/AsyncProjectsClient.java new file mode 100644 index 0000000..1d75dd6 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/projects/AsyncProjectsClient.java @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.projects; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.ProjectInfoResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncProjectsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawProjectsClient rawClient; + + public AsyncProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawProjectsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawProjectsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture retrieveInfo() { + return this.rawClient.retrieveInfo().thenApply(response -> response.body()); + } + + public CompletableFuture retrieveInfo(RequestOptions requestOptions) { + return this.rawClient.retrieveInfo(requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java b/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java new file mode 100644 index 0000000..df37ce8 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.projects; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.ProjectInfoResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawProjectsClient { + protected final ClientOptions clientOptions; + + public AsyncRawProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> retrieveInfo() { + return retrieveInfo(null); + } + + public CompletableFuture> retrieveInfo( + RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("projects/info") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProjectInfoResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/projects/ProjectsClient.java b/src/main/java/com/pipedream/api/resources/projects/ProjectsClient.java new file mode 100644 index 0000000..b09fc87 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/projects/ProjectsClient.java @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.projects; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.ProjectInfoResponse; + +public class ProjectsClient { + protected final ClientOptions clientOptions; + + private final RawProjectsClient rawClient; + + public ProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawProjectsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawProjectsClient withRawResponse() { + return this.rawClient; + } + + public ProjectInfoResponse retrieveInfo() { + return this.rawClient.retrieveInfo().body(); + } + + public ProjectInfoResponse retrieveInfo(RequestOptions requestOptions) { + return this.rawClient.retrieveInfo(requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java b/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java new file mode 100644 index 0000000..d09dc32 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java @@ -0,0 +1,66 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.projects; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.ProjectInfoResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawProjectsClient { + protected final ClientOptions clientOptions; + + public RawProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse retrieveInfo() { + return retrieveInfo(null); + } + + public PipedreamApiHttpResponse retrieveInfo(RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("projects/info") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProjectInfoResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/proxy/AsyncProxyClient.java b/src/main/java/com/pipedream/api/resources/proxy/AsyncProxyClient.java new file mode 100644 index 0000000..61bcd21 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/proxy/AsyncProxyClient.java @@ -0,0 +1,77 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; +import com.pipedream.api.resources.proxy.requests.ProxyGetRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPatchRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPostRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPutRequest; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +public class AsyncProxyClient { + protected final ClientOptions clientOptions; + + private final AsyncRawProxyClient rawClient; + + public AsyncProxyClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawProxyClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawProxyClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> get(String url64, ProxyGetRequest request) { + return this.rawClient.get(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> get( + String url64, ProxyGetRequest request, RequestOptions requestOptions) { + return this.rawClient.get(url64, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> post(String url64, ProxyPostRequest request) { + return this.rawClient.post(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> post( + String url64, ProxyPostRequest request, RequestOptions requestOptions) { + return this.rawClient.post(url64, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> put(String url64, ProxyPutRequest request) { + return this.rawClient.put(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> put( + String url64, ProxyPutRequest request, RequestOptions requestOptions) { + return this.rawClient.put(url64, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> delete(String url64, ProxyDeleteRequest request) { + return this.rawClient.delete(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> delete( + String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(url64, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> patch(String url64, ProxyPatchRequest request) { + return this.rawClient.patch(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> patch( + String url64, ProxyPatchRequest request, RequestOptions requestOptions) { + return this.rawClient.patch(url64, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java b/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java new file mode 100644 index 0000000..d6737d6 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java @@ -0,0 +1,347 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; +import com.pipedream.api.resources.proxy.requests.ProxyGetRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPatchRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPostRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPutRequest; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawProxyClient { + protected final ClientOptions clientOptions; + + public AsyncRawProxyClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> get(String url64, ProxyGetRequest request) { + return get(url64, request, null); + } + + public CompletableFuture>> get( + String url64, ProxyGetRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> post( + String url64, ProxyPostRequest request) { + return post(url64, request, null); + } + + public CompletableFuture>> post( + String url64, ProxyPostRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> put(String url64, ProxyPutRequest request) { + return put(url64, request, null); + } + + public CompletableFuture>> put( + String url64, ProxyPutRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> delete( + String url64, ProxyDeleteRequest request) { + return delete(url64, request, null); + } + + public CompletableFuture>> delete( + String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> patch( + String url64, ProxyPatchRequest request) { + return patch(url64, request, null); + } + + public CompletableFuture>> patch( + String url64, ProxyPatchRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/proxy/ProxyClient.java b/src/main/java/com/pipedream/api/resources/proxy/ProxyClient.java new file mode 100644 index 0000000..aa27dba --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/proxy/ProxyClient.java @@ -0,0 +1,71 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; +import com.pipedream.api.resources.proxy.requests.ProxyGetRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPatchRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPostRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPutRequest; +import java.util.Map; + +public class ProxyClient { + protected final ClientOptions clientOptions; + + private final RawProxyClient rawClient; + + public ProxyClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawProxyClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawProxyClient withRawResponse() { + return this.rawClient; + } + + public Map get(String url64, ProxyGetRequest request) { + return this.rawClient.get(url64, request).body(); + } + + public Map get(String url64, ProxyGetRequest request, RequestOptions requestOptions) { + return this.rawClient.get(url64, request, requestOptions).body(); + } + + public Map post(String url64, ProxyPostRequest request) { + return this.rawClient.post(url64, request).body(); + } + + public Map post(String url64, ProxyPostRequest request, RequestOptions requestOptions) { + return this.rawClient.post(url64, request, requestOptions).body(); + } + + public Map put(String url64, ProxyPutRequest request) { + return this.rawClient.put(url64, request).body(); + } + + public Map put(String url64, ProxyPutRequest request, RequestOptions requestOptions) { + return this.rawClient.put(url64, request, requestOptions).body(); + } + + public Map delete(String url64, ProxyDeleteRequest request) { + return this.rawClient.delete(url64, request).body(); + } + + public Map delete(String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(url64, request, requestOptions).body(); + } + + public Map patch(String url64, ProxyPatchRequest request) { + return this.rawClient.patch(url64, request).body(); + } + + public Map patch(String url64, ProxyPatchRequest request, RequestOptions requestOptions) { + return this.rawClient.patch(url64, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java b/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java new file mode 100644 index 0000000..9720f2b --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java @@ -0,0 +1,275 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; +import com.pipedream.api.resources.proxy.requests.ProxyGetRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPatchRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPostRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPutRequest; +import java.io.IOException; +import java.util.Map; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawProxyClient { + protected final ClientOptions clientOptions; + + public RawProxyClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> get(String url64, ProxyGetRequest request) { + return get(url64, request, null); + } + + public PipedreamApiHttpResponse> get( + String url64, ProxyGetRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> post(String url64, ProxyPostRequest request) { + return post(url64, request, null); + } + + public PipedreamApiHttpResponse> post( + String url64, ProxyPostRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> put(String url64, ProxyPutRequest request) { + return put(url64, request, null); + } + + public PipedreamApiHttpResponse> put( + String url64, ProxyPutRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> delete(String url64, ProxyDeleteRequest request) { + return delete(url64, request, null); + } + + public PipedreamApiHttpResponse> delete( + String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> patch(String url64, ProxyPatchRequest request) { + return patch(url64, request, null); + } + + public PipedreamApiHttpResponse> patch( + String url64, ProxyPatchRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyDeleteRequest.java b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyDeleteRequest.java new file mode 100644 index 0000000..f956f17 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyDeleteRequest.java @@ -0,0 +1,146 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyDeleteRequest.Builder.class) +public final class ProxyDeleteRequest { + private final String externalUserId; + + private final String accountId; + + private final Map additionalProperties; + + private ProxyDeleteRequest(String externalUserId, String accountId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyDeleteRequest && equalTo((ProxyDeleteRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyDeleteRequest other) { + return externalUserId.equals(other.externalUserId) && accountId.equals(other.accountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID for the proxy request

+ */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyDeleteRequest other); + } + + public interface AccountIdStage { + /** + *

The account ID to use for authentication

+ */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyDeleteRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyDeleteRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + return this; + } + + /** + *

The external user ID for the proxy request

+ *

The external user ID for the proxy request

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

The account ID to use for authentication

+ *

The account ID to use for authentication

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + public ProxyDeleteRequest build() { + return new ProxyDeleteRequest(externalUserId, accountId, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyGetRequest.java b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyGetRequest.java new file mode 100644 index 0000000..bf09229 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyGetRequest.java @@ -0,0 +1,146 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyGetRequest.Builder.class) +public final class ProxyGetRequest { + private final String externalUserId; + + private final String accountId; + + private final Map additionalProperties; + + private ProxyGetRequest(String externalUserId, String accountId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyGetRequest && equalTo((ProxyGetRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyGetRequest other) { + return externalUserId.equals(other.externalUserId) && accountId.equals(other.accountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID for the proxy request

+ */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyGetRequest other); + } + + public interface AccountIdStage { + /** + *

The account ID to use for authentication

+ */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyGetRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyGetRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + return this; + } + + /** + *

The external user ID for the proxy request

+ *

The external user ID for the proxy request

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

The account ID to use for authentication

+ *

The account ID to use for authentication

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + public ProxyGetRequest build() { + return new ProxyGetRequest(externalUserId, accountId, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPatchRequest.java b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPatchRequest.java new file mode 100644 index 0000000..fe68355 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPatchRequest.java @@ -0,0 +1,208 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +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.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyPatchRequest.Builder.class) +public final class ProxyPatchRequest { + private final String externalUserId; + + private final String accountId; + + private final Map body; + + private final Map additionalProperties; + + private ProxyPatchRequest( + String externalUserId, + String accountId, + Map body, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Request body to forward to the target API + */ + @JsonProperty("body") + public Map getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyPatchRequest && equalTo((ProxyPatchRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyPatchRequest other) { + return externalUserId.equals(other.externalUserId) + && accountId.equals(other.accountId) + && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID for the proxy request

+ */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyPatchRequest other); + } + + public interface AccountIdStage { + /** + *

The account ID to use for authentication

+ */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyPatchRequest build(); + + /** + *

Request body to forward to the target API

+ */ + _FinalStage body(Map body); + + _FinalStage putAllBody(Map body); + + _FinalStage body(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + private Map body = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyPatchRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + body(other.getBody()); + return this; + } + + /** + *

The external user ID for the proxy request

+ *

The external user ID for the proxy request

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

The account ID to use for authentication

+ *

The account ID to use for authentication

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

Request body to forward to the target API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage body(String key, Object value) { + this.body.put(key, value); + return this; + } + + /** + *

Request body to forward to the target API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllBody(Map body) { + this.body.putAll(body); + return this; + } + + /** + *

Request body to forward to the target API

+ */ + @java.lang.Override + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public _FinalStage body(Map body) { + this.body.clear(); + this.body.putAll(body); + return this; + } + + @java.lang.Override + public ProxyPatchRequest build() { + return new ProxyPatchRequest(externalUserId, accountId, body, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPostRequest.java b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPostRequest.java new file mode 100644 index 0000000..d648ab4 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPostRequest.java @@ -0,0 +1,208 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +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.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyPostRequest.Builder.class) +public final class ProxyPostRequest { + private final String externalUserId; + + private final String accountId; + + private final Map body; + + private final Map additionalProperties; + + private ProxyPostRequest( + String externalUserId, + String accountId, + Map body, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Request body to forward to the target API + */ + @JsonProperty("body") + public Map getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyPostRequest && equalTo((ProxyPostRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyPostRequest other) { + return externalUserId.equals(other.externalUserId) + && accountId.equals(other.accountId) + && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID for the proxy request

+ */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyPostRequest other); + } + + public interface AccountIdStage { + /** + *

The account ID to use for authentication

+ */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyPostRequest build(); + + /** + *

Request body to forward to the target API

+ */ + _FinalStage body(Map body); + + _FinalStage putAllBody(Map body); + + _FinalStage body(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + private Map body = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyPostRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + body(other.getBody()); + return this; + } + + /** + *

The external user ID for the proxy request

+ *

The external user ID for the proxy request

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

The account ID to use for authentication

+ *

The account ID to use for authentication

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

Request body to forward to the target API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage body(String key, Object value) { + this.body.put(key, value); + return this; + } + + /** + *

Request body to forward to the target API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllBody(Map body) { + this.body.putAll(body); + return this; + } + + /** + *

Request body to forward to the target API

+ */ + @java.lang.Override + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public _FinalStage body(Map body) { + this.body.clear(); + this.body.putAll(body); + return this; + } + + @java.lang.Override + public ProxyPostRequest build() { + return new ProxyPostRequest(externalUserId, accountId, body, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPutRequest.java b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPutRequest.java new file mode 100644 index 0000000..d4aaeba --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPutRequest.java @@ -0,0 +1,208 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +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.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyPutRequest.Builder.class) +public final class ProxyPutRequest { + private final String externalUserId; + + private final String accountId; + + private final Map body; + + private final Map additionalProperties; + + private ProxyPutRequest( + String externalUserId, + String accountId, + Map body, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Request body to forward to the target API + */ + @JsonProperty("body") + public Map getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyPutRequest && equalTo((ProxyPutRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyPutRequest other) { + return externalUserId.equals(other.externalUserId) + && accountId.equals(other.accountId) + && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID for the proxy request

+ */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyPutRequest other); + } + + public interface AccountIdStage { + /** + *

The account ID to use for authentication

+ */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyPutRequest build(); + + /** + *

Request body to forward to the target API

+ */ + _FinalStage body(Map body); + + _FinalStage putAllBody(Map body); + + _FinalStage body(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + private Map body = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyPutRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + body(other.getBody()); + return this; + } + + /** + *

The external user ID for the proxy request

+ *

The external user ID for the proxy request

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

The account ID to use for authentication

+ *

The account ID to use for authentication

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

Request body to forward to the target API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage body(String key, Object value) { + this.body.put(key, value); + return this; + } + + /** + *

Request body to forward to the target API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllBody(Map body) { + this.body.putAll(body); + return this; + } + + /** + *

Request body to forward to the target API

+ */ + @java.lang.Override + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public _FinalStage body(Map body) { + this.body.clear(); + this.body.putAll(body); + return this; + } + + @java.lang.Override + public ProxyPutRequest build() { + return new ProxyPutRequest(externalUserId, accountId, body, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java b/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java new file mode 100644 index 0000000..9ddd525 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java @@ -0,0 +1,158 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; +import com.pipedream.api.resources.tokens.requests.TokensValidateRequest; +import com.pipedream.api.types.CreateTokenResponse; +import com.pipedream.api.types.ValidateTokenResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawTokensClient { + protected final ClientOptions clientOptions; + + public AsyncRawTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> create(CreateTokenRequest request) { + return create(request, null); + } + + public CompletableFuture> create( + CreateTokenRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/tokens") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateTokenResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> validate(String ctok) { + return validate(ctok, TokensValidateRequest.builder().build()); + } + + public CompletableFuture> validate( + String ctok, TokensValidateRequest request) { + return validate(ctok, request, null); + } + + public CompletableFuture> validate( + String ctok, TokensValidateRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/tokens") + .addPathSegment(ctok) + .addPathSegments("validate"); + if (request.getParams().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "params", request.getParams().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ValidateTokenResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/tokens/AsyncTokensClient.java b/src/main/java/com/pipedream/api/resources/tokens/AsyncTokensClient.java new file mode 100644 index 0000000..eef98a0 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/tokens/AsyncTokensClient.java @@ -0,0 +1,51 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; +import com.pipedream.api.resources.tokens.requests.TokensValidateRequest; +import com.pipedream.api.types.CreateTokenResponse; +import com.pipedream.api.types.ValidateTokenResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncTokensClient { + protected final ClientOptions clientOptions; + + private final AsyncRawTokensClient rawClient; + + public AsyncTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawTokensClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture create(CreateTokenRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + public CompletableFuture create(CreateTokenRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture validate(String ctok) { + return this.rawClient.validate(ctok).thenApply(response -> response.body()); + } + + public CompletableFuture validate(String ctok, TokensValidateRequest request) { + return this.rawClient.validate(ctok, request).thenApply(response -> response.body()); + } + + public CompletableFuture validate( + String ctok, TokensValidateRequest request, RequestOptions requestOptions) { + return this.rawClient.validate(ctok, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java b/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java new file mode 100644 index 0000000..d20fbea --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java @@ -0,0 +1,127 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; +import com.pipedream.api.resources.tokens.requests.TokensValidateRequest; +import com.pipedream.api.types.CreateTokenResponse; +import com.pipedream.api.types.ValidateTokenResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawTokensClient { + protected final ClientOptions clientOptions; + + public RawTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse create(CreateTokenRequest request) { + return create(request, null); + } + + public PipedreamApiHttpResponse create( + CreateTokenRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/tokens") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateTokenResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse validate(String ctok) { + return validate(ctok, TokensValidateRequest.builder().build()); + } + + public PipedreamApiHttpResponse validate(String ctok, TokensValidateRequest request) { + return validate(ctok, request, null); + } + + public PipedreamApiHttpResponse validate( + String ctok, TokensValidateRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/tokens") + .addPathSegment(ctok) + .addPathSegments("validate"); + if (request.getParams().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "params", request.getParams().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ValidateTokenResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/tokens/TokensClient.java b/src/main/java/com/pipedream/api/resources/tokens/TokensClient.java new file mode 100644 index 0000000..98801f4 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/tokens/TokensClient.java @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; +import com.pipedream.api.resources.tokens.requests.TokensValidateRequest; +import com.pipedream.api.types.CreateTokenResponse; +import com.pipedream.api.types.ValidateTokenResponse; + +public class TokensClient { + protected final ClientOptions clientOptions; + + private final RawTokensClient rawClient; + + public TokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawTokensClient withRawResponse() { + return this.rawClient; + } + + public CreateTokenResponse create(CreateTokenRequest request) { + return this.rawClient.create(request).body(); + } + + public CreateTokenResponse create(CreateTokenRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + public ValidateTokenResponse validate(String ctok) { + return this.rawClient.validate(ctok).body(); + } + + public ValidateTokenResponse validate(String ctok, TokensValidateRequest request) { + return this.rawClient.validate(ctok, request).body(); + } + + public ValidateTokenResponse validate(String ctok, TokensValidateRequest request, RequestOptions requestOptions) { + return this.rawClient.validate(ctok, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/tokens/requests/CreateTokenRequest.java b/src/main/java/com/pipedream/api/resources/tokens/requests/CreateTokenRequest.java new file mode 100644 index 0000000..9ec9c19 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/tokens/requests/CreateTokenRequest.java @@ -0,0 +1,338 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens.requests; + +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.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTokenRequest.Builder.class) +public final class CreateTokenRequest { + private final Optional> allowedOrigins; + + private final Optional errorRedirectUri; + + private final String externalUserId; + + private final String projectId; + + private final Optional successRedirectUri; + + private final Optional webhookUri; + + private final Map additionalProperties; + + private CreateTokenRequest( + Optional> allowedOrigins, + Optional errorRedirectUri, + String externalUserId, + String projectId, + Optional successRedirectUri, + Optional webhookUri, + Map additionalProperties) { + this.allowedOrigins = allowedOrigins; + this.errorRedirectUri = errorRedirectUri; + this.externalUserId = externalUserId; + this.projectId = projectId; + this.successRedirectUri = successRedirectUri; + this.webhookUri = webhookUri; + this.additionalProperties = additionalProperties; + } + + /** + * @return List of allowed origins for CORS + */ + @JsonProperty("allowed_origins") + public Optional> getAllowedOrigins() { + return allowedOrigins; + } + + /** + * @return URI to redirect to on error + */ + @JsonProperty("error_redirect_uri") + public Optional getErrorRedirectUri() { + return errorRedirectUri; + } + + /** + * @return Your end user ID, for whom you're creating the token + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The ID of the project + */ + @JsonProperty("project_id") + public String getProjectId() { + return projectId; + } + + /** + * @return URI to redirect to on success + */ + @JsonProperty("success_redirect_uri") + public Optional getSuccessRedirectUri() { + return successRedirectUri; + } + + /** + * @return Webhook URI for notifications + */ + @JsonProperty("webhook_uri") + public Optional getWebhookUri() { + return webhookUri; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTokenRequest && equalTo((CreateTokenRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTokenRequest other) { + return allowedOrigins.equals(other.allowedOrigins) + && errorRedirectUri.equals(other.errorRedirectUri) + && externalUserId.equals(other.externalUserId) + && projectId.equals(other.projectId) + && successRedirectUri.equals(other.successRedirectUri) + && webhookUri.equals(other.webhookUri); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.allowedOrigins, + this.errorRedirectUri, + this.externalUserId, + this.projectId, + this.successRedirectUri, + this.webhookUri); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

Your end user ID, for whom you're creating the token

+ */ + ProjectIdStage externalUserId(@NotNull String externalUserId); + + Builder from(CreateTokenRequest other); + } + + public interface ProjectIdStage { + /** + *

The ID of the project

+ */ + _FinalStage projectId(@NotNull String projectId); + } + + public interface _FinalStage { + CreateTokenRequest build(); + + /** + *

List of allowed origins for CORS

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

URI to redirect to on error

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

URI to redirect to on success

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

Webhook URI for notifications

+ */ + _FinalStage webhookUri(Optional webhookUri); + + _FinalStage webhookUri(String webhookUri); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, ProjectIdStage, _FinalStage { + private String externalUserId; + + private String projectId; + + private Optional webhookUri = Optional.empty(); + + private Optional successRedirectUri = Optional.empty(); + + private Optional errorRedirectUri = Optional.empty(); + + private Optional> allowedOrigins = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTokenRequest other) { + allowedOrigins(other.getAllowedOrigins()); + errorRedirectUri(other.getErrorRedirectUri()); + externalUserId(other.getExternalUserId()); + projectId(other.getProjectId()); + successRedirectUri(other.getSuccessRedirectUri()); + webhookUri(other.getWebhookUri()); + return this; + } + + /** + *

Your end user ID, for whom you're creating the token

+ *

Your end user ID, for whom you're creating the token

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

The ID of the project

+ *

The ID of the project

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

Webhook URI for notifications

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

Webhook URI for notifications

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

URI to redirect to on success

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

URI to redirect to on success

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

URI to redirect to on error

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

URI to redirect to on error

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

List of allowed origins for CORS

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

List of allowed origins for CORS

+ */ + @java.lang.Override + @JsonSetter(value = "allowed_origins", nulls = Nulls.SKIP) + public _FinalStage allowedOrigins(Optional> allowedOrigins) { + this.allowedOrigins = allowedOrigins; + return this; + } + + @java.lang.Override + public CreateTokenRequest build() { + return new CreateTokenRequest( + allowedOrigins, + errorRedirectUri, + externalUserId, + projectId, + successRedirectUri, + webhookUri, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/tokens/requests/TokensValidateRequest.java b/src/main/java/com/pipedream/api/resources/tokens/requests/TokensValidateRequest.java new file mode 100644 index 0000000..1479f3c --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/tokens/requests/TokensValidateRequest.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens.requests; + +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 com.pipedream.api.types.ValidateTokenParams; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TokensValidateRequest.Builder.class) +public final class TokensValidateRequest { + private final Optional params; + + private final Map additionalProperties; + + private TokensValidateRequest(Optional params, Map additionalProperties) { + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("params") + public Optional getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TokensValidateRequest && equalTo((TokensValidateRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TokensValidateRequest other) { + return params.equals(other.params); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.params); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional params = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TokensValidateRequest other) { + params(other.getParams()); + return this; + } + + @JsonSetter(value = "params", nulls = Nulls.SKIP) + public Builder params(Optional params) { + this.params = params; + return this; + } + + public Builder params(ValidateTokenParams params) { + this.params = Optional.ofNullable(params); + return this; + } + + public TokensValidateRequest build() { + return new TokensValidateRequest(params, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java b/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java new file mode 100644 index 0000000..8e4c08a --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java @@ -0,0 +1,386 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.triggers.requests.DeployTriggerOpts; +import com.pipedream.api.resources.triggers.requests.TriggersConfigurePropRequest; +import com.pipedream.api.resources.triggers.requests.TriggersListRequest; +import com.pipedream.api.resources.triggers.requests.TriggersReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.DeployTriggerResponse; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawTriggersClient { + protected final ClientOptions clientOptions; + + public AsyncRawTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(TriggersListRequest.builder().build()); + } + + public CompletableFuture>> list( + TriggersListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + TriggersListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + TriggersListRequest nextRequest = TriggersListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String componentId) { + return retrieve(componentId, null); + } + + public CompletableFuture> retrieve( + String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> configureProp( + TriggersConfigurePropRequest request) { + return configureProp(request, null); + } + + public CompletableFuture> configureProp( + TriggersConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> reloadProps( + TriggersReloadPropsRequest request) { + return reloadProps(request, null); + } + + public CompletableFuture> reloadProps( + TriggersReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> deploy(DeployTriggerOpts request) { + return deploy(request, null); + } + + public CompletableFuture> deploy( + DeployTriggerOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/deploy") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + DeployTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeployTriggerResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/triggers/AsyncTriggersClient.java b/src/main/java/com/pipedream/api/resources/triggers/AsyncTriggersClient.java new file mode 100644 index 0000000..2f3361f --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/triggers/AsyncTriggersClient.java @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.triggers.requests.DeployTriggerOpts; +import com.pipedream.api.resources.triggers.requests.TriggersConfigurePropRequest; +import com.pipedream.api.resources.triggers.requests.TriggersListRequest; +import com.pipedream.api.resources.triggers.requests.TriggersReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.ReloadPropsResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncTriggersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawTriggersClient rawClient; + + public AsyncTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawTriggersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawTriggersClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(TriggersListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + TriggersListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId) { + return this.rawClient.retrieve(componentId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp(TriggersConfigurePropRequest request) { + return this.rawClient.configureProp(request).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp( + TriggersConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps(TriggersReloadPropsRequest request) { + return this.rawClient.reloadProps(request).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps( + TriggersReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture deploy(DeployTriggerOpts request) { + return this.rawClient.deploy(request).thenApply(response -> response.body()); + } + + public CompletableFuture deploy(DeployTriggerOpts request, RequestOptions requestOptions) { + return this.rawClient.deploy(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java b/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java new file mode 100644 index 0000000..83abd08 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java @@ -0,0 +1,305 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.triggers.requests.DeployTriggerOpts; +import com.pipedream.api.resources.triggers.requests.TriggersConfigurePropRequest; +import com.pipedream.api.resources.triggers.requests.TriggersListRequest; +import com.pipedream.api.resources.triggers.requests.TriggersReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.DeployTriggerResponse; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawTriggersClient { + protected final ClientOptions clientOptions; + + public RawTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(TriggersListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(TriggersListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + TriggersListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + TriggersListRequest nextRequest = TriggersListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String componentId) { + return retrieve(componentId, null); + } + + public PipedreamApiHttpResponse retrieve(String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse configureProp(TriggersConfigurePropRequest request) { + return configureProp(request, null); + } + + public PipedreamApiHttpResponse configureProp( + TriggersConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse reloadProps(TriggersReloadPropsRequest request) { + return reloadProps(request, null); + } + + public PipedreamApiHttpResponse reloadProps( + TriggersReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse deploy(DeployTriggerOpts request) { + return deploy(request, null); + } + + public PipedreamApiHttpResponse deploy( + DeployTriggerOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/deploy") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + DeployTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeployTriggerResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/triggers/TriggersClient.java b/src/main/java/com/pipedream/api/resources/triggers/TriggersClient.java new file mode 100644 index 0000000..d16a37b --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/triggers/TriggersClient.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.triggers.requests.DeployTriggerOpts; +import com.pipedream.api.resources.triggers.requests.TriggersConfigurePropRequest; +import com.pipedream.api.resources.triggers.requests.TriggersListRequest; +import com.pipedream.api.resources.triggers.requests.TriggersReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.ReloadPropsResponse; + +public class TriggersClient { + protected final ClientOptions clientOptions; + + private final RawTriggersClient rawClient; + + public TriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawTriggersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawTriggersClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(TriggersListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(TriggersListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public Component retrieve(String componentId) { + return this.rawClient.retrieve(componentId).body(); + } + + public Component retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).body(); + } + + public ConfigurePropResponse configureProp(TriggersConfigurePropRequest request) { + return this.rawClient.configureProp(request).body(); + } + + public ConfigurePropResponse configureProp(TriggersConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).body(); + } + + public ReloadPropsResponse reloadProps(TriggersReloadPropsRequest request) { + return this.rawClient.reloadProps(request).body(); + } + + public ReloadPropsResponse reloadProps(TriggersReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).body(); + } + + public DeployedComponent deploy(DeployTriggerOpts request) { + return this.rawClient.deploy(request).body(); + } + + public DeployedComponent deploy(DeployTriggerOpts request, RequestOptions requestOptions) { + return this.rawClient.deploy(request, requestOptions).body(); + } +} 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 new file mode 100644 index 0000000..b45a651 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/triggers/requests/DeployTriggerOpts.java @@ -0,0 +1,282 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers.requests; + +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 = DeployTriggerOpts.Builder.class) +public final class DeployTriggerOpts { + private final String id; + + private final String externalUserId; + + private final Optional> configuredProps; + + private final Optional dynamicPropsId; + + private final Optional webhookUrl; + + private final Map additionalProperties; + + private DeployTriggerOpts( + String id, + String externalUserId, + Optional> configuredProps, + Optional dynamicPropsId, + Optional webhookUrl, + Map additionalProperties) { + this.id = id; + this.externalUserId = externalUserId; + this.configuredProps = configuredProps; + this.dynamicPropsId = dynamicPropsId; + this.webhookUrl = webhookUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The trigger component ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The external user ID + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The configured properties for the trigger + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The ID for dynamic props + */ + @JsonProperty("dynamic_props_id") + public Optional getDynamicPropsId() { + return dynamicPropsId; + } + + /** + * @return Optional webhook URL to receive trigger events + */ + @JsonProperty("webhook_url") + public Optional getWebhookUrl() { + return webhookUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployTriggerOpts && equalTo((DeployTriggerOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployTriggerOpts other) { + return id.equals(other.id) + && externalUserId.equals(other.externalUserId) + && configuredProps.equals(other.configuredProps) + && dynamicPropsId.equals(other.dynamicPropsId) + && webhookUrl.equals(other.webhookUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.externalUserId, this.configuredProps, this.dynamicPropsId, this.webhookUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The trigger component ID

+ */ + ExternalUserIdStage id(@NotNull String id); + + Builder from(DeployTriggerOpts other); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID

+ */ + _FinalStage externalUserId(@NotNull String externalUserId); + } + + public interface _FinalStage { + DeployTriggerOpts build(); + + /** + *

The configured properties for the trigger

+ */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

The ID for dynamic props

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

Optional webhook URL to receive trigger events

+ */ + _FinalStage webhookUrl(Optional webhookUrl); + + _FinalStage webhookUrl(String webhookUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ExternalUserIdStage, _FinalStage { + private String id; + + private String externalUserId; + + private Optional webhookUrl = Optional.empty(); + + private Optional dynamicPropsId = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployTriggerOpts other) { + id(other.getId()); + externalUserId(other.getExternalUserId()); + configuredProps(other.getConfiguredProps()); + dynamicPropsId(other.getDynamicPropsId()); + webhookUrl(other.getWebhookUrl()); + return this; + } + + /** + *

The trigger component ID

+ *

The trigger component ID

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

The external user ID

+ *

The external user ID

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

Optional webhook URL to receive trigger events

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

Optional webhook URL to receive trigger events

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

The ID for dynamic props

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

The ID for dynamic props

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

The configured properties for the trigger

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

The configured properties for the trigger

+ */ + @java.lang.Override + @JsonSetter(value = "configured_props", nulls = Nulls.SKIP) + public _FinalStage configuredProps(Optional> configuredProps) { + this.configuredProps = configuredProps; + return this; + } + + @java.lang.Override + public DeployTriggerOpts build() { + return new DeployTriggerOpts( + id, externalUserId, configuredProps, dynamicPropsId, webhookUrl, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersConfigurePropRequest.java b/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersConfigurePropRequest.java new file mode 100644 index 0000000..dda960b --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersConfigurePropRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers.requests; + +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 com.pipedream.api.types.ConfigurePropOpts; +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 = TriggersConfigurePropRequest.Builder.class) +public final class TriggersConfigurePropRequest { + private final Optional asyncHandle; + + private final ConfigurePropOpts body; + + private final Map additionalProperties; + + private TriggersConfigurePropRequest( + Optional asyncHandle, ConfigurePropOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ConfigurePropOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TriggersConfigurePropRequest && equalTo((TriggersConfigurePropRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TriggersConfigurePropRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ConfigurePropOpts body); + + Builder from(TriggersConfigurePropRequest other); + } + + public interface _FinalStage { + TriggersConfigurePropRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ConfigurePropOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TriggersConfigurePropRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ConfigurePropOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public TriggersConfigurePropRequest build() { + return new TriggersConfigurePropRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersListRequest.java b/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersListRequest.java new file mode 100644 index 0000000..833a738 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersListRequest.java @@ -0,0 +1,223 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TriggersListRequest.Builder.class) +public final class TriggersListRequest { + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional q; + + private final Optional app; + + private final Map additionalProperties; + + private TriggersListRequest( + Optional after, + Optional before, + Optional limit, + Optional q, + Optional app, + Map additionalProperties) { + this.after = after; + this.before = before; + this.limit = limit; + this.q = q; + this.app = app; + this.additionalProperties = additionalProperties; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return A search query to filter the triggers + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return The ID or name slug of the app to filter the triggers + */ + @JsonProperty("app") + public Optional getApp() { + return app; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TriggersListRequest && equalTo((TriggersListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TriggersListRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && q.equals(other.q) + && app.equals(other.app); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.limit, this.q, this.app); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional app = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TriggersListRequest other) { + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + q(other.getQ()); + app(other.getApp()); + return this; + } + + /** + *

The cursor to start from for pagination

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The cursor to end before for pagination

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The maximum number of results to return

+ */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

A search query to filter the triggers

+ */ + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + /** + *

The ID or name slug of the app to filter the triggers

+ */ + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(String app) { + this.app = Optional.ofNullable(app); + return this; + } + + public TriggersListRequest build() { + return new TriggersListRequest(after, before, limit, q, app, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersReloadPropsRequest.java b/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersReloadPropsRequest.java new file mode 100644 index 0000000..b40b8ca --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersReloadPropsRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers.requests; + +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 com.pipedream.api.types.ReloadPropsOpts; +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 = TriggersReloadPropsRequest.Builder.class) +public final class TriggersReloadPropsRequest { + private final Optional asyncHandle; + + private final ReloadPropsOpts body; + + private final Map additionalProperties; + + private TriggersReloadPropsRequest( + Optional asyncHandle, ReloadPropsOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ReloadPropsOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TriggersReloadPropsRequest && equalTo((TriggersReloadPropsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TriggersReloadPropsRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ReloadPropsOpts body); + + Builder from(TriggersReloadPropsRequest other); + } + + public interface _FinalStage { + TriggersReloadPropsRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ReloadPropsOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TriggersReloadPropsRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ReloadPropsOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public TriggersReloadPropsRequest build() { + return new TriggersReloadPropsRequest(asyncHandle, body, 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 new file mode 100644 index 0000000..5cb2cdb --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java @@ -0,0 +1,81 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.users; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawUsersClient { + protected final ClientOptions clientOptions; + + public AsyncRawUsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> deleteExternalUser(String externalUserId) { + return deleteExternalUser(externalUserId, null); + } + + public CompletableFuture> deleteExternalUser( + String externalUserId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("users") + .addPathSegment(externalUserId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/users/AsyncUsersClient.java b/src/main/java/com/pipedream/api/resources/users/AsyncUsersClient.java new file mode 100644 index 0000000..97dafe2 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/users/AsyncUsersClient.java @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.users; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import java.util.concurrent.CompletableFuture; + +public class AsyncUsersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawUsersClient rawClient; + + public AsyncUsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawUsersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawUsersClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture deleteExternalUser(String externalUserId) { + return this.rawClient.deleteExternalUser(externalUserId).thenApply(response -> response.body()); + } + + public CompletableFuture deleteExternalUser(String externalUserId, RequestOptions requestOptions) { + return this.rawClient.deleteExternalUser(externalUserId, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java b/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java new file mode 100644 index 0000000..7fe69c9 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java @@ -0,0 +1,63 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.users; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawUsersClient { + protected final ClientOptions clientOptions; + + public RawUsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse deleteExternalUser(String externalUserId) { + return deleteExternalUser(externalUserId, null); + } + + public PipedreamApiHttpResponse deleteExternalUser(String externalUserId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("users") + .addPathSegment(externalUserId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/users/UsersClient.java b/src/main/java/com/pipedream/api/resources/users/UsersClient.java new file mode 100644 index 0000000..a00362d --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/users/UsersClient.java @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.users; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; + +public class UsersClient { + protected final ClientOptions clientOptions; + + private final RawUsersClient rawClient; + + public UsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawUsersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawUsersClient withRawResponse() { + return this.rawClient; + } + + public void deleteExternalUser(String externalUserId) { + this.rawClient.deleteExternalUser(externalUserId).body(); + } + + public void deleteExternalUser(String externalUserId, RequestOptions requestOptions) { + this.rawClient.deleteExternalUser(externalUserId, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/types/Account.java b/src/main/java/com/pipedream/api/types/Account.java new file mode 100644 index 0000000..30c5157 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/Account.java @@ -0,0 +1,485 @@ +/** + * 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.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Account.Builder.class) +public final class Account { + private final Optional id; + + private final Optional name; + + private final Optional externalId; + + private final Optional healthy; + + private final Optional dead; + + private final Optional app; + + private final Optional createdAt; + + private final Optional updatedAt; + + private final Optional> credentials; + + private final Optional expiresAt; + + private final Optional error; + + private final Optional lastRefreshedAt; + + private final Optional nextRefreshAt; + + private final Map additionalProperties; + + private Account( + Optional id, + Optional name, + Optional externalId, + Optional healthy, + Optional dead, + Optional app, + Optional createdAt, + Optional updatedAt, + Optional> credentials, + Optional expiresAt, + Optional error, + Optional lastRefreshedAt, + Optional nextRefreshAt, + Map additionalProperties) { + this.id = id; + this.name = name; + this.externalId = externalId; + this.healthy = healthy; + this.dead = dead; + this.app = app; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.credentials = credentials; + this.expiresAt = expiresAt; + this.error = error; + this.lastRefreshedAt = lastRefreshedAt; + this.nextRefreshAt = nextRefreshAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique ID of the account. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The custom name of the account if set. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return The external ID associated with the account. + */ + @JsonProperty("external_id") + public Optional getExternalId() { + return externalId; + } + + /** + * @return Indicates if the account is healthy. Pipedream will periodically retry token refresh and test requests for unhealthy accounts + */ + @JsonProperty("healthy") + public Optional getHealthy() { + return healthy; + } + + /** + * @return Indicates if the account is no longer active + */ + @JsonProperty("dead") + public Optional getDead() { + return dead; + } + + @JsonProperty("app") + public Optional getApp() { + return app; + } + + /** + * @return The date and time the account was created, an ISO 8601 formatted string + */ + @JsonProperty("created_at") + public Optional getCreatedAt() { + return createdAt; + } + + /** + * @return The date and time the account was last updated, an ISO 8601 formatted string + */ + @JsonProperty("updated_at") + public Optional getUpdatedAt() { + return updatedAt; + } + + /** + * @return The credentials associated with the account, if the include_credentials parameter was set to true in the request + */ + @JsonProperty("credentials") + public Optional> getCredentials() { + return credentials; + } + + /** + * @return The date and time the account's credentials expiration, an ISO 8601 formatted string + */ + @JsonProperty("expires_at") + public Optional getExpiresAt() { + return expiresAt; + } + + /** + * @return The error message if the account is unhealthy or dead, null otherwise + */ + @JsonProperty("error") + public Optional getError() { + return error; + } + + /** + * @return The date and time the account was last refreshed, an ISO 8601 formatted string + */ + @JsonProperty("last_refreshed_at") + public Optional getLastRefreshedAt() { + return lastRefreshedAt; + } + + /** + * @return The date and time the account will next be refreshed, an ISO 8601 formatted string + */ + @JsonProperty("next_refresh_at") + public Optional getNextRefreshAt() { + return nextRefreshAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Account && equalTo((Account) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Account other) { + return id.equals(other.id) + && name.equals(other.name) + && externalId.equals(other.externalId) + && healthy.equals(other.healthy) + && dead.equals(other.dead) + && app.equals(other.app) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && credentials.equals(other.credentials) + && expiresAt.equals(other.expiresAt) + && error.equals(other.error) + && lastRefreshedAt.equals(other.lastRefreshedAt) + && nextRefreshAt.equals(other.nextRefreshAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.name, + this.externalId, + this.healthy, + this.dead, + this.app, + this.createdAt, + this.updatedAt, + this.credentials, + this.expiresAt, + this.error, + this.lastRefreshedAt, + this.nextRefreshAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional externalId = Optional.empty(); + + private Optional healthy = Optional.empty(); + + private Optional dead = Optional.empty(); + + private Optional app = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional updatedAt = Optional.empty(); + + private Optional> credentials = Optional.empty(); + + private Optional expiresAt = Optional.empty(); + + private Optional error = Optional.empty(); + + private Optional lastRefreshedAt = Optional.empty(); + + private Optional nextRefreshAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(Account other) { + id(other.getId()); + name(other.getName()); + externalId(other.getExternalId()); + healthy(other.getHealthy()); + dead(other.getDead()); + app(other.getApp()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + credentials(other.getCredentials()); + expiresAt(other.getExpiresAt()); + error(other.getError()); + lastRefreshedAt(other.getLastRefreshedAt()); + nextRefreshAt(other.getNextRefreshAt()); + return this; + } + + /** + *

The unique ID of the account.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

The custom name of the account if set.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The external ID associated with the account.

+ */ + @JsonSetter(value = "external_id", nulls = Nulls.SKIP) + public Builder externalId(Optional externalId) { + this.externalId = externalId; + return this; + } + + public Builder externalId(String externalId) { + this.externalId = Optional.ofNullable(externalId); + return this; + } + + /** + *

Indicates if the account is healthy. Pipedream will periodically retry token refresh and test requests for unhealthy accounts

+ */ + @JsonSetter(value = "healthy", nulls = Nulls.SKIP) + public Builder healthy(Optional healthy) { + this.healthy = healthy; + return this; + } + + public Builder healthy(Boolean healthy) { + this.healthy = Optional.ofNullable(healthy); + return this; + } + + /** + *

Indicates if the account is no longer active

+ */ + @JsonSetter(value = "dead", nulls = Nulls.SKIP) + public Builder dead(Optional dead) { + this.dead = dead; + return this; + } + + public Builder dead(Boolean dead) { + this.dead = Optional.ofNullable(dead); + return this; + } + + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(App app) { + this.app = Optional.ofNullable(app); + return this; + } + + /** + *

The date and time the account was created, an ISO 8601 formatted string

+ */ + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public Builder createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + public Builder createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

The date and time the account was last updated, an ISO 8601 formatted string

+ */ + @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) + public Builder updatedAt(Optional updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public Builder updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = Optional.ofNullable(updatedAt); + return this; + } + + /** + *

The credentials associated with the account, if the include_credentials parameter was set to true in the request

+ */ + @JsonSetter(value = "credentials", nulls = Nulls.SKIP) + public Builder credentials(Optional> credentials) { + this.credentials = credentials; + return this; + } + + public Builder credentials(Map credentials) { + this.credentials = Optional.ofNullable(credentials); + return this; + } + + /** + *

The date and time the account's credentials expiration, an ISO 8601 formatted string

+ */ + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public Builder expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + public Builder expiresAt(OffsetDateTime expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + /** + *

The error message if the account is unhealthy or dead, null otherwise

+ */ + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public Builder error(Optional error) { + this.error = error; + return this; + } + + public Builder error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + /** + *

The date and time the account was last refreshed, an ISO 8601 formatted string

+ */ + @JsonSetter(value = "last_refreshed_at", nulls = Nulls.SKIP) + public Builder lastRefreshedAt(Optional lastRefreshedAt) { + this.lastRefreshedAt = lastRefreshedAt; + return this; + } + + public Builder lastRefreshedAt(OffsetDateTime lastRefreshedAt) { + this.lastRefreshedAt = Optional.ofNullable(lastRefreshedAt); + return this; + } + + /** + *

The date and time the account will next be refreshed, an ISO 8601 formatted string

+ */ + @JsonSetter(value = "next_refresh_at", nulls = Nulls.SKIP) + public Builder nextRefreshAt(Optional nextRefreshAt) { + this.nextRefreshAt = nextRefreshAt; + return this; + } + + public Builder nextRefreshAt(OffsetDateTime nextRefreshAt) { + this.nextRefreshAt = Optional.ofNullable(nextRefreshAt); + return this; + } + + public Account build() { + return new Account( + id, + name, + externalId, + healthy, + dead, + app, + createdAt, + updatedAt, + credentials, + expiresAt, + error, + lastRefreshedAt, + nextRefreshAt, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/App.java b/src/main/java/com/pipedream/api/types/App.java new file mode 100644 index 0000000..2983820 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/App.java @@ -0,0 +1,472 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = App.Builder.class) +public final class App { + private final Optional id; + + private final String nameSlug; + + private final String name; + + private final Optional authType; + + private final Optional description; + + private final String imgSrc; + + private final Optional customFieldsJson; + + private final List categories; + + private final double featuredWeight; + + private final Map additionalProperties; + + private App( + Optional id, + String nameSlug, + String name, + Optional authType, + Optional description, + String imgSrc, + Optional customFieldsJson, + List categories, + double featuredWeight, + Map additionalProperties) { + this.id = id; + this.nameSlug = nameSlug; + this.name = name; + this.authType = authType; + this.description = description; + this.imgSrc = imgSrc; + this.customFieldsJson = customFieldsJson; + this.categories = categories; + this.featuredWeight = featuredWeight; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the app. Only applies for OAuth apps. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug) + */ + @JsonProperty("name_slug") + public String getNameSlug() { + return nameSlug; + } + + /** + * @return The human-readable name of the app + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The authentication type used by the app + */ + @JsonProperty("auth_type") + public Optional getAuthType() { + return authType; + } + + /** + * @return A short description of the app + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return The URL to the app's logo + */ + @JsonProperty("img_src") + public String getImgSrc() { + return imgSrc; + } + + /** + * @return A JSON string representing the custom fields for the app + */ + @JsonProperty("custom_fields_json") + public Optional getCustomFieldsJson() { + return customFieldsJson; + } + + /** + * @return Categories associated with the app + */ + @JsonProperty("categories") + public List getCategories() { + return categories; + } + + /** + * @return A rough directional ordering of app popularity, subject to changes by Pipedream + */ + @JsonProperty("featured_weight") + public double getFeaturedWeight() { + return featuredWeight; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof App && equalTo((App) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(App other) { + return id.equals(other.id) + && nameSlug.equals(other.nameSlug) + && name.equals(other.name) + && authType.equals(other.authType) + && description.equals(other.description) + && imgSrc.equals(other.imgSrc) + && customFieldsJson.equals(other.customFieldsJson) + && categories.equals(other.categories) + && featuredWeight == other.featuredWeight; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.nameSlug, + this.name, + this.authType, + this.description, + this.imgSrc, + this.customFieldsJson, + this.categories, + this.featuredWeight); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameSlugStage builder() { + return new Builder(); + } + + public interface NameSlugStage { + /** + *

The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug)

+ */ + NameStage nameSlug(@NotNull String nameSlug); + + Builder from(App other); + } + + public interface NameStage { + /** + *

The human-readable name of the app

+ */ + ImgSrcStage name(@NotNull String name); + } + + public interface ImgSrcStage { + /** + *

The URL to the app's logo

+ */ + FeaturedWeightStage imgSrc(@NotNull String imgSrc); + } + + public interface FeaturedWeightStage { + /** + *

A rough directional ordering of app popularity, subject to changes by Pipedream

+ */ + _FinalStage featuredWeight(double featuredWeight); + } + + public interface _FinalStage { + App build(); + + /** + *

ID of the app. Only applies for OAuth apps.

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

The authentication type used by the app

+ */ + _FinalStage authType(Optional authType); + + _FinalStage authType(AppAuthType authType); + + /** + *

A short description of the app

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

A JSON string representing the custom fields for the app

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

Categories associated with the app

+ */ + _FinalStage categories(List categories); + + _FinalStage addCategories(String categories); + + _FinalStage addAllCategories(List categories); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements NameSlugStage, NameStage, ImgSrcStage, FeaturedWeightStage, _FinalStage { + private String nameSlug; + + private String name; + + private String imgSrc; + + private double featuredWeight; + + private List categories = new ArrayList<>(); + + private Optional customFieldsJson = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional authType = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(App other) { + id(other.getId()); + nameSlug(other.getNameSlug()); + name(other.getName()); + authType(other.getAuthType()); + description(other.getDescription()); + imgSrc(other.getImgSrc()); + customFieldsJson(other.getCustomFieldsJson()); + categories(other.getCategories()); + featuredWeight(other.getFeaturedWeight()); + return this; + } + + /** + *

The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug)

+ *

The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug)

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

The human-readable name of the app

+ *

The human-readable name of the app

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

The URL to the app's logo

+ *

The URL to the app's logo

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

A rough directional ordering of app popularity, subject to changes by Pipedream

+ *

A rough directional ordering of app popularity, subject to changes by Pipedream

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("featured_weight") + public _FinalStage featuredWeight(double featuredWeight) { + this.featuredWeight = featuredWeight; + return this; + } + + /** + *

Categories associated with the app

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

Categories associated with the app

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

Categories associated with the app

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

A JSON string representing the custom fields for the app

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

A JSON string representing the custom fields for the app

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

A short description of the app

+ * @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 short description of the app

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

The authentication type used by the app

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

The authentication type used by the app

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

ID of the app. Only applies for OAuth apps.

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

ID of the app. Only applies for OAuth apps.

+ */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @java.lang.Override + public App build() { + return new App( + id, + nameSlug, + name, + authType, + description, + imgSrc, + customFieldsJson, + categories, + featuredWeight, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/AppAuthType.java b/src/main/java/com/pipedream/api/types/AppAuthType.java new file mode 100644 index 0000000..e795709 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/AppAuthType.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AppAuthType { + KEYS("keys"), + + OAUTH("oauth"), + + NONE("none"); + + private final String value; + + AppAuthType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/pipedream/api/types/AppCategory.java b/src/main/java/com/pipedream/api/types/AppCategory.java new file mode 100644 index 0000000..12799ff --- /dev/null +++ b/src/main/java/com/pipedream/api/types/AppCategory.java @@ -0,0 +1,161 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppCategory.Builder.class) +public final class AppCategory { + private final Optional id; + + private final Optional name; + + private final Optional description; + + private final Map additionalProperties; + + private AppCategory( + Optional id, + Optional name, + Optional description, + Map additionalProperties) { + this.id = id; + this.name = name; + this.description = description; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the app category + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The human-readable name of the app category + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return A short description of the app category + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppCategory && equalTo((AppCategory) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppCategory other) { + return id.equals(other.id) && name.equals(other.name) && description.equals(other.description); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.description); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AppCategory other) { + id(other.getId()); + name(other.getName()); + description(other.getDescription()); + return this; + } + + /** + *

ID of the app category

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

The human-readable name of the app category

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

A short description of the app category

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + public AppCategory build() { + return new AppCategory(id, name, description, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/BackendClientOpts.java b/src/main/java/com/pipedream/api/types/BackendClientOpts.java new file mode 100644 index 0000000..cdf9287 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/BackendClientOpts.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BackendClientOpts.Builder.class) +public final class BackendClientOpts { + private final Optional clientId; + + private final Optional clientSecret; + + private final Optional apiUrl; + + private final Map additionalProperties; + + private BackendClientOpts( + Optional clientId, + Optional clientSecret, + Optional apiUrl, + Map additionalProperties) { + this.clientId = clientId; + this.clientSecret = clientSecret; + this.apiUrl = apiUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The client ID for authentication + */ + @JsonProperty("client_id") + public Optional getClientId() { + return clientId; + } + + /** + * @return The client secret for authentication + */ + @JsonProperty("client_secret") + public Optional getClientSecret() { + return clientSecret; + } + + /** + * @return The API URL to use + */ + @JsonProperty("api_url") + public Optional getApiUrl() { + return apiUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BackendClientOpts && equalTo((BackendClientOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BackendClientOpts other) { + return clientId.equals(other.clientId) + && clientSecret.equals(other.clientSecret) + && apiUrl.equals(other.apiUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.clientId, this.clientSecret, this.apiUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional clientId = Optional.empty(); + + private Optional clientSecret = Optional.empty(); + + private Optional apiUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(BackendClientOpts other) { + clientId(other.getClientId()); + clientSecret(other.getClientSecret()); + apiUrl(other.getApiUrl()); + return this; + } + + /** + *

The client ID for authentication

+ */ + @JsonSetter(value = "client_id", nulls = Nulls.SKIP) + public Builder clientId(Optional clientId) { + this.clientId = clientId; + return this; + } + + public Builder clientId(String clientId) { + this.clientId = Optional.ofNullable(clientId); + return this; + } + + /** + *

The client secret for authentication

+ */ + @JsonSetter(value = "client_secret", nulls = Nulls.SKIP) + public Builder clientSecret(Optional clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + public Builder clientSecret(String clientSecret) { + this.clientSecret = Optional.ofNullable(clientSecret); + return this; + } + + /** + *

The API URL to use

+ */ + @JsonSetter(value = "api_url", nulls = Nulls.SKIP) + public Builder apiUrl(Optional apiUrl) { + this.apiUrl = apiUrl; + return this; + } + + public Builder apiUrl(String apiUrl) { + this.apiUrl = Optional.ofNullable(apiUrl); + return this; + } + + public BackendClientOpts build() { + return new BackendClientOpts(clientId, clientSecret, apiUrl, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ClientOpts.java b/src/main/java/com/pipedream/api/types/ClientOpts.java new file mode 100644 index 0000000..70aa6e6 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ClientOpts.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientOpts.Builder.class) +public final class ClientOpts { + private final Optional clientId; + + private final Optional clientSecret; + + private final Optional apiUrl; + + private final Map additionalProperties; + + private ClientOpts( + Optional clientId, + Optional clientSecret, + Optional apiUrl, + Map additionalProperties) { + this.clientId = clientId; + this.clientSecret = clientSecret; + this.apiUrl = apiUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The client ID for authentication + */ + @JsonProperty("client_id") + public Optional getClientId() { + return clientId; + } + + /** + * @return The client secret for authentication + */ + @JsonProperty("client_secret") + public Optional getClientSecret() { + return clientSecret; + } + + /** + * @return The API URL to use (defaults to https://api.pipedream.com/) + */ + @JsonProperty("api_url") + public Optional getApiUrl() { + return apiUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientOpts && equalTo((ClientOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClientOpts other) { + return clientId.equals(other.clientId) + && clientSecret.equals(other.clientSecret) + && apiUrl.equals(other.apiUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.clientId, this.clientSecret, this.apiUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional clientId = Optional.empty(); + + private Optional clientSecret = Optional.empty(); + + private Optional apiUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ClientOpts other) { + clientId(other.getClientId()); + clientSecret(other.getClientSecret()); + apiUrl(other.getApiUrl()); + return this; + } + + /** + *

The client ID for authentication

+ */ + @JsonSetter(value = "client_id", nulls = Nulls.SKIP) + public Builder clientId(Optional clientId) { + this.clientId = clientId; + return this; + } + + public Builder clientId(String clientId) { + this.clientId = Optional.ofNullable(clientId); + return this; + } + + /** + *

The client secret for authentication

+ */ + @JsonSetter(value = "client_secret", nulls = Nulls.SKIP) + public Builder clientSecret(Optional clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + public Builder clientSecret(String clientSecret) { + this.clientSecret = Optional.ofNullable(clientSecret); + return this; + } + + /** + *

The API URL to use (defaults to https://api.pipedream.com/)

+ */ + @JsonSetter(value = "api_url", nulls = Nulls.SKIP) + public Builder apiUrl(Optional apiUrl) { + this.apiUrl = apiUrl; + return this; + } + + public Builder apiUrl(String apiUrl) { + this.apiUrl = Optional.ofNullable(apiUrl); + return this; + } + + public ClientOpts build() { + return new ClientOpts(clientId, clientSecret, apiUrl, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/Component.java b/src/main/java/com/pipedream/api/types/Component.java new file mode 100644 index 0000000..95cbe86 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/Component.java @@ -0,0 +1,365 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Component.Builder.class) +public final class Component { + private final String key; + + private final String name; + + private final String version; + + private final List configurableProps; + + private final Optional description; + + private final Optional componentType; + + private final Optional stash; + + private final Map additionalProperties; + + private Component( + String key, + String name, + String version, + List configurableProps, + Optional description, + Optional componentType, + Optional stash, + Map additionalProperties) { + this.key = key; + this.name = name; + this.version = version; + this.configurableProps = configurableProps; + this.description = description; + this.componentType = componentType; + this.stash = stash; + this.additionalProperties = additionalProperties; + } + + /** + * @return The key that uniquely identifies the component. + */ + @JsonProperty("key") + public String getKey() { + return key; + } + + /** + * @return The human-readable name of the component, e.g. 'GitLab: List Commits' + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The latest version of the component, in SemVer format. + */ + @JsonProperty("version") + public String getVersion() { + return version; + } + + @JsonProperty("configurable_props") + public List getConfigurableProps() { + return configurableProps; + } + + /** + * @return A description of the component + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return The type of component (trigger or action) + */ + @JsonProperty("component_type") + public Optional getComponentType() { + return componentType; + } + + /** + * @return Indicates if a File Stash ID is optional or required to run the component + */ + @JsonProperty("stash") + public Optional getStash() { + return stash; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Component && equalTo((Component) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Component other) { + return key.equals(other.key) + && name.equals(other.name) + && version.equals(other.version) + && configurableProps.equals(other.configurableProps) + && description.equals(other.description) + && componentType.equals(other.componentType) + && stash.equals(other.stash); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.key, + this.name, + this.version, + this.configurableProps, + this.description, + this.componentType, + this.stash); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static KeyStage builder() { + return new Builder(); + } + + public interface KeyStage { + /** + *

The key that uniquely identifies the component.

+ */ + NameStage key(@NotNull String key); + + Builder from(Component other); + } + + public interface NameStage { + /** + *

The human-readable name of the component, e.g. 'GitLab: List Commits'

+ */ + VersionStage name(@NotNull String name); + } + + public interface VersionStage { + /** + *

The latest version of the component, in SemVer format.

+ */ + _FinalStage version(@NotNull String version); + } + + public interface _FinalStage { + Component build(); + + _FinalStage configurableProps(List configurableProps); + + _FinalStage addConfigurableProps(ConfigurableProp configurableProps); + + _FinalStage addAllConfigurableProps(List configurableProps); + + /** + *

A description of the component

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

The type of component (trigger or action)

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

Indicates if a File Stash ID is optional or required to run the component

+ */ + _FinalStage stash(Optional stash); + + _FinalStage stash(ComponentStash stash); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements KeyStage, NameStage, VersionStage, _FinalStage { + private String key; + + private String name; + + private String version; + + private Optional stash = Optional.empty(); + + private Optional componentType = Optional.empty(); + + private Optional description = Optional.empty(); + + private List configurableProps = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Component other) { + key(other.getKey()); + name(other.getName()); + version(other.getVersion()); + configurableProps(other.getConfigurableProps()); + description(other.getDescription()); + componentType(other.getComponentType()); + stash(other.getStash()); + return this; + } + + /** + *

The key that uniquely identifies the component.

+ *

The key that uniquely identifies the component.

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

The human-readable name of the component, e.g. 'GitLab: List Commits'

+ *

The human-readable name of the component, e.g. 'GitLab: List Commits'

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

The latest version of the component, in SemVer format.

+ *

The latest version of the component, in SemVer format.

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

Indicates if a File Stash ID is optional or required to run the component

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

Indicates if a File Stash ID is optional or required to run the component

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

The type of component (trigger or action)

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

The type of component (trigger or action)

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

A description of 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 component

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public _FinalStage addAllConfigurableProps(List configurableProps) { + this.configurableProps.addAll(configurableProps); + return this; + } + + @java.lang.Override + public _FinalStage addConfigurableProps(ConfigurableProp configurableProps) { + this.configurableProps.add(configurableProps); + return this; + } + + @java.lang.Override + @JsonSetter(value = "configurable_props", nulls = Nulls.SKIP) + public _FinalStage configurableProps(List configurableProps) { + this.configurableProps.clear(); + this.configurableProps.addAll(configurableProps); + return this; + } + + @java.lang.Override + public Component build() { + return new Component( + key, name, version, configurableProps, description, componentType, stash, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ComponentStash.java b/src/main/java/com/pipedream/api/types/ComponentStash.java new file mode 100644 index 0000000..ffbda73 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ComponentStash.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ComponentStash { + OPTIONAL("optional"), + + REQUIRED("required"); + + private final String value; + + ComponentStash(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurableProp.java b/src/main/java/com/pipedream/api/types/ConfigurableProp.java new file mode 100644 index 0000000..9b27278 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurableProp.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurableProp.Builder.class) +public final class ConfigurableProp { + private final Optional name; + + private final Optional type; + + 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 ConfigurableProp( + Optional name, + Optional 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; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @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; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurableProp && equalTo((ConfigurableProp) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + 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); + } + + @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); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional name = Optional.empty(); + + private Optional type = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + 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; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurableProp build() { + return new ConfigurableProp( + name, + type, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropAlert.java b/src/main/java/com/pipedream/api/types/ConfigurablePropAlert.java new file mode 100644 index 0000000..782303c --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropAlert.java @@ -0,0 +1,484 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropAlert.Builder.class) +public final class ConfigurablePropAlert { + private final Optional type; + + private final Optional alertType; + + private final Optional content; + + private final Optional 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 ConfigurablePropAlert( + Optional type, + Optional alertType, + Optional content, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.alertType = alertType; + this.content = content; + 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; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return The severity level of the alert. + */ + @JsonProperty("alertType") + public Optional getAlertType() { + return alertType; + } + + /** + * @return The content of the alert, which can include HTML or plain text. + */ + @JsonProperty("content") + public Optional getContent() { + return content; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional 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") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropAlert && equalTo((ConfigurablePropAlert) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropAlert other) { + return type.equals(other.type) + && alertType.equals(other.alertType) + && content.equals(other.content) + && 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.type, + this.alertType, + this.content, + 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional alertType = Optional.empty(); + + private Optional content = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropAlert other) { + type(other.getType()); + alertType(other.getAlertType()); + content(other.getContent()); + 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; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

The severity level of the alert.

+ */ + @JsonSetter(value = "alertType", nulls = Nulls.SKIP) + public Builder alertType(Optional alertType) { + this.alertType = alertType; + return this; + } + + public Builder alertType(ConfigurablePropAlertAlertType alertType) { + this.alertType = Optional.ofNullable(alertType); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public Builder content(Optional content) { + this.content = content; + return this; + } + + public Builder content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropAlert build() { + return new ConfigurablePropAlert( + type, + alertType, + content, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropAlertAlertType.java b/src/main/java/com/pipedream/api/types/ConfigurablePropAlertAlertType.java new file mode 100644 index 0000000..539ca52 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropAlertAlertType.java @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ConfigurablePropAlertAlertType { + INFO("info"), + + NEUTRAL("neutral"), + + WARNING("warning"), + + ERROR("error"); + + private final String value; + + ConfigurablePropAlertAlertType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropAny.java b/src/main/java/com/pipedream/api/types/ConfigurablePropAny.java new file mode 100644 index 0000000..87824c9 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropAny.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropAny.Builder.class) +public final class ConfigurablePropAny { + private final Optional type; + + private final Optional 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 ConfigurablePropAny( + Optional type, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + 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; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional 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") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropAny && equalTo((ConfigurablePropAny) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropAny other) { + return type.equals(other.type) + && 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.type, + 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropAny other) { + type(other.getType()); + 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; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropAny build() { + return new ConfigurablePropAny( + type, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropApp.java b/src/main/java/com/pipedream/api/types/ConfigurablePropApp.java new file mode 100644 index 0000000..f6e4246 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropApp.java @@ -0,0 +1,452 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropApp.Builder.class) +public final class ConfigurablePropApp { + private final Optional type; + + private final Optional app; + + private final Optional 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 ConfigurablePropApp( + Optional type, + Optional app, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.app = app; + 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; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @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 Optional getApp() { + return app; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional 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") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropApp && equalTo((ConfigurablePropApp) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropApp other) { + return type.equals(other.type) + && app.equals(other.app) + && 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.type, + this.app, + 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional app = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropApp other) { + type(other.getType()); + app(other.getApp()); + 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; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + 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.

+ */ + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(String app) { + this.app = Optional.ofNullable(app); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropApp build() { + return new ConfigurablePropApp( + type, + app, + 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 new file mode 100644 index 0000000..ad596d0 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropBoolean.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropBoolean.Builder.class) +public final class ConfigurablePropBoolean { + private final Optional type; + + private final Optional 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 ConfigurablePropBoolean( + Optional type, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + 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; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional 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") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropBoolean && equalTo((ConfigurablePropBoolean) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropBoolean other) { + return type.equals(other.type) + && 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.type, + 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropBoolean other) { + type(other.getType()); + 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; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropBoolean build() { + return new ConfigurablePropBoolean( + type, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropDiscord.java b/src/main/java/com/pipedream/api/types/ConfigurablePropDiscord.java new file mode 100644 index 0000000..91fffbf --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropDiscord.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropDiscord.Builder.class) +public final class ConfigurablePropDiscord { + private final Optional type; + + private final Optional 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 ConfigurablePropDiscord( + Optional type, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + 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; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional 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") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropDiscord && equalTo((ConfigurablePropDiscord) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropDiscord other) { + return type.equals(other.type) + && 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.type, + 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropDiscord other) { + type(other.getType()); + 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; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropDiscord build() { + return new ConfigurablePropDiscord( + type, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropInteger.java b/src/main/java/com/pipedream/api/types/ConfigurablePropInteger.java new file mode 100644 index 0000000..ddbdf76 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropInteger.java @@ -0,0 +1,484 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropInteger.Builder.class) +public final class ConfigurablePropInteger { + private final Optional type; + + private final Optional min; + + private final Optional max; + + private final Optional 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 ConfigurablePropInteger( + Optional type, + Optional min, + Optional max, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.min = min; + this.max = max; + 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; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @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; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional 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") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropInteger && equalTo((ConfigurablePropInteger) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropInteger other) { + return type.equals(other.type) + && min.equals(other.min) + && max.equals(other.max) + && 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.type, + this.min, + this.max, + 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional min = Optional.empty(); + + private Optional max = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropInteger other) { + type(other.getType()); + min(other.getMin()); + max(other.getMax()); + 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; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

The minimum value for this integer prop.

+ */ + @JsonSetter(value = "min", nulls = Nulls.SKIP) + public Builder min(Optional min) { + this.min = min; + return this; + } + + public Builder min(Integer min) { + this.min = Optional.ofNullable(min); + return this; + } + + /** + *

The maximum value for this integer prop.

+ */ + @JsonSetter(value = "max", nulls = Nulls.SKIP) + public Builder max(Optional max) { + this.max = max; + return this; + } + + public Builder max(Integer max) { + this.max = Optional.ofNullable(max); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropInteger build() { + return new ConfigurablePropInteger( + type, + min, + max, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropObject.java b/src/main/java/com/pipedream/api/types/ConfigurablePropObject.java new file mode 100644 index 0000000..0cd6fa0 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropObject.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropObject.Builder.class) +public final class ConfigurablePropObject { + private final Optional type; + + private final Optional 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 ConfigurablePropObject( + Optional type, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + 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; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional 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") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropObject && equalTo((ConfigurablePropObject) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropObject other) { + return type.equals(other.type) + && 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.type, + 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropObject other) { + type(other.getType()); + 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; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropObject build() { + return new ConfigurablePropObject( + type, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropString.java b/src/main/java/com/pipedream/api/types/ConfigurablePropString.java new file mode 100644 index 0000000..c85dcf4 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropString.java @@ -0,0 +1,452 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropString.Builder.class) +public final class ConfigurablePropString { + private final Optional type; + + private final Optional secret; + + private final Optional 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 ConfigurablePropString( + Optional type, + Optional secret, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.secret = secret; + 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; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return If true, this prop is a secret and should not be displayed in plain text. + */ + @JsonProperty("secret") + public Optional getSecret() { + return secret; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional 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") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropString && equalTo((ConfigurablePropString) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropString other) { + return type.equals(other.type) + && secret.equals(other.secret) + && 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.type, + this.secret, + 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional secret = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropString other) { + type(other.getType()); + secret(other.getSecret()); + 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; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "secret", nulls = Nulls.SKIP) + public Builder secret(Optional secret) { + this.secret = secret; + return this; + } + + public Builder secret(Boolean secret) { + this.secret = Optional.ofNullable(secret); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropString build() { + return new ConfigurablePropString( + type, + secret, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropStringArray.java b/src/main/java/com/pipedream/api/types/ConfigurablePropStringArray.java new file mode 100644 index 0000000..664fc6a --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropStringArray.java @@ -0,0 +1,452 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropStringArray.Builder.class) +public final class ConfigurablePropStringArray { + private final Optional type; + + private final Optional secret; + + private final Optional 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 ConfigurablePropStringArray( + Optional type, + Optional secret, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.secret = secret; + 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; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return If true, this prop is a secret and should not be displayed in plain text. + */ + @JsonProperty("secret") + public Optional getSecret() { + return secret; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional 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") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + 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") + 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") + 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; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropStringArray && equalTo((ConfigurablePropStringArray) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropStringArray other) { + return type.equals(other.type) + && secret.equals(other.secret) + && 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.type, + this.secret, + 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional secret = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropStringArray other) { + type(other.getType()); + secret(other.getSecret()); + 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; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "secret", nulls = Nulls.SKIP) + public Builder secret(Optional secret) { + this.secret = secret; + return this; + } + + public Builder secret(Boolean secret) { + this.secret = Optional.ofNullable(secret); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + 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.

+ */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

If true, this prop will be ignored.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

If true, should not expose this prop to the user

+ */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + 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

+ */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

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

+ */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + 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

+ */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + 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

+ */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropStringArray build() { + return new ConfigurablePropStringArray( + type, + secret, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurePropOpts.java b/src/main/java/com/pipedream/api/types/ConfigurePropOpts.java new file mode 100644 index 0000000..86455a5 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurePropOpts.java @@ -0,0 +1,509 @@ +/** + * 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 = ConfigurePropOpts.Builder.class) +public final class ConfigurePropOpts { + private final String id; + + private final String externalUserId; + + private final String propName; + + private final Optional blocking; + + private final Optional> configuredProps; + + private final Optional dynamicPropsId; + + private final Optional asyncHandle; + + private final Optional page; + + private final Optional> prevContext; + + private final Optional query; + + private final Map additionalProperties; + + private ConfigurePropOpts( + String id, + String externalUserId, + String propName, + Optional blocking, + Optional> configuredProps, + Optional dynamicPropsId, + Optional asyncHandle, + Optional page, + Optional> prevContext, + Optional query, + Map additionalProperties) { + this.id = id; + this.externalUserId = externalUserId; + this.propName = propName; + this.blocking = blocking; + this.configuredProps = configuredProps; + this.dynamicPropsId = dynamicPropsId; + this.asyncHandle = asyncHandle; + this.page = page; + this.prevContext = prevContext; + this.query = query; + this.additionalProperties = additionalProperties; + } + + /** + * @return The component ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The external user ID + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The name of the prop to configure + */ + @JsonProperty("prop_name") + public String getPropName() { + return propName; + } + + /** + * @return Whether this operation should block until completion + */ + @JsonProperty("blocking") + public Optional getBlocking() { + return blocking; + } + + /** + * @return The configured properties for the component + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The ID for dynamic props + */ + @JsonProperty("dynamic_props_id") + public Optional getDynamicPropsId() { + return dynamicPropsId; + } + + /** + * @return Handle for async operations + */ + @JsonProperty("async_handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + /** + * @return Page number for paginated results + */ + @JsonProperty("page") + public Optional getPage() { + return page; + } + + /** + * @return Previous context for pagination + */ + @JsonProperty("prev_context") + public Optional> getPrevContext() { + return prevContext; + } + + /** + * @return Search query for filtering options + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurePropOpts && equalTo((ConfigurePropOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurePropOpts other) { + return id.equals(other.id) + && externalUserId.equals(other.externalUserId) + && propName.equals(other.propName) + && blocking.equals(other.blocking) + && configuredProps.equals(other.configuredProps) + && dynamicPropsId.equals(other.dynamicPropsId) + && asyncHandle.equals(other.asyncHandle) + && page.equals(other.page) + && prevContext.equals(other.prevContext) + && query.equals(other.query); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.externalUserId, + this.propName, + this.blocking, + this.configuredProps, + this.dynamicPropsId, + this.asyncHandle, + this.page, + this.prevContext, + this.query); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The component ID

+ */ + ExternalUserIdStage id(@NotNull String id); + + Builder from(ConfigurePropOpts other); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID

+ */ + PropNameStage externalUserId(@NotNull String externalUserId); + } + + public interface PropNameStage { + /** + *

The name of the prop to configure

+ */ + _FinalStage propName(@NotNull String propName); + } + + public interface _FinalStage { + ConfigurePropOpts build(); + + /** + *

Whether this operation should block until completion

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

The configured properties for the component

+ */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

The ID for dynamic props

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

Handle for async operations

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

Page number for paginated results

+ */ + _FinalStage page(Optional page); + + _FinalStage page(Double page); + + /** + *

Previous context for pagination

+ */ + _FinalStage prevContext(Optional> prevContext); + + _FinalStage prevContext(Map prevContext); + + /** + *

Search query for filtering options

+ */ + _FinalStage query(Optional query); + + _FinalStage query(String query); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ExternalUserIdStage, PropNameStage, _FinalStage { + private String id; + + private String externalUserId; + + private String propName; + + private Optional query = Optional.empty(); + + private Optional> prevContext = Optional.empty(); + + private Optional page = Optional.empty(); + + private Optional asyncHandle = Optional.empty(); + + private Optional dynamicPropsId = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + private Optional blocking = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ConfigurePropOpts other) { + id(other.getId()); + externalUserId(other.getExternalUserId()); + propName(other.getPropName()); + blocking(other.getBlocking()); + configuredProps(other.getConfiguredProps()); + dynamicPropsId(other.getDynamicPropsId()); + asyncHandle(other.getAsyncHandle()); + page(other.getPage()); + prevContext(other.getPrevContext()); + query(other.getQuery()); + return this; + } + + /** + *

The component ID

+ *

The component ID

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

The external user ID

+ *

The external user ID

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

The name of the prop to configure

+ *

The name of the prop to configure

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

Search query for filtering options

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

Search query for filtering options

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

Previous context for pagination

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

Previous context for pagination

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

Page number for paginated results

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

Page number for paginated results

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

Handle for async operations

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

Handle for async operations

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

The ID for dynamic props

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

The ID for dynamic props

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

The configured properties for the component

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

The configured properties for the component

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

Whether this operation should block until completion

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

Whether this operation should block until completion

+ */ + @java.lang.Override + @JsonSetter(value = "blocking", nulls = Nulls.SKIP) + public _FinalStage blocking(Optional blocking) { + this.blocking = blocking; + return this; + } + + @java.lang.Override + public ConfigurePropOpts build() { + return new ConfigurePropOpts( + id, + externalUserId, + propName, + blocking, + configuredProps, + dynamicPropsId, + asyncHandle, + page, + prevContext, + query, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurePropResponse.java b/src/main/java/com/pipedream/api/types/ConfigurePropResponse.java new file mode 100644 index 0000000..6c1a6af --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurePropResponse.java @@ -0,0 +1,133 @@ +/** + * 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.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurePropResponse.Builder.class) +public final class ConfigurePropResponse { + private final Optional> options; + + private final Optional> errors; + + private final Map additionalProperties; + + private ConfigurePropResponse( + Optional> options, + Optional> errors, + Map additionalProperties) { + this.options = options; + this.errors = errors; + this.additionalProperties = additionalProperties; + } + + /** + * @return Available options for the configured prop + */ + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + + /** + * @return Any errors that occurred during configuration + */ + @JsonProperty("errors") + public Optional> getErrors() { + return errors; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurePropResponse && equalTo((ConfigurePropResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurePropResponse other) { + return options.equals(other.options) && errors.equals(other.errors); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.options, this.errors); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> options = Optional.empty(); + + private Optional> errors = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurePropResponse other) { + options(other.getOptions()); + errors(other.getErrors()); + return this; + } + + /** + *

Available options for the configured prop

+ */ + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public Builder options(Optional> options) { + this.options = options; + return this; + } + + public Builder options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + /** + *

Any errors that occurred during configuration

+ */ + @JsonSetter(value = "errors", nulls = Nulls.SKIP) + public Builder errors(Optional> errors) { + this.errors = errors; + return this; + } + + public Builder errors(List errors) { + this.errors = Optional.ofNullable(errors); + return this; + } + + public ConfigurePropResponse build() { + return new ConfigurePropResponse(options, errors, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConnectTokenCreateOpts.java b/src/main/java/com/pipedream/api/types/ConnectTokenCreateOpts.java new file mode 100644 index 0000000..212cb99 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConnectTokenCreateOpts.java @@ -0,0 +1,338 @@ +/** + * 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.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConnectTokenCreateOpts.Builder.class) +public final class ConnectTokenCreateOpts { + private final String externalUserId; + + private final String projectId; + + private final Optional> allowedOrigins; + + private final Optional errorRedirectUri; + + private final Optional successRedirectUri; + + private final Optional webhookUri; + + private final Map additionalProperties; + + private ConnectTokenCreateOpts( + String externalUserId, + String projectId, + Optional> allowedOrigins, + Optional errorRedirectUri, + Optional successRedirectUri, + Optional webhookUri, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.projectId = projectId; + this.allowedOrigins = allowedOrigins; + this.errorRedirectUri = errorRedirectUri; + this.successRedirectUri = successRedirectUri; + this.webhookUri = webhookUri; + this.additionalProperties = additionalProperties; + } + + /** + * @return Your end user ID, for whom you're creating the token + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The ID of the project + */ + @JsonProperty("project_id") + public String getProjectId() { + return projectId; + } + + /** + * @return List of allowed origins for CORS + */ + @JsonProperty("allowed_origins") + public Optional> getAllowedOrigins() { + return allowedOrigins; + } + + /** + * @return URI to redirect to on error + */ + @JsonProperty("error_redirect_uri") + public Optional getErrorRedirectUri() { + return errorRedirectUri; + } + + /** + * @return URI to redirect to on success + */ + @JsonProperty("success_redirect_uri") + public Optional getSuccessRedirectUri() { + return successRedirectUri; + } + + /** + * @return Webhook URI for notifications + */ + @JsonProperty("webhook_uri") + public Optional getWebhookUri() { + return webhookUri; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConnectTokenCreateOpts && equalTo((ConnectTokenCreateOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConnectTokenCreateOpts other) { + return externalUserId.equals(other.externalUserId) + && projectId.equals(other.projectId) + && allowedOrigins.equals(other.allowedOrigins) + && errorRedirectUri.equals(other.errorRedirectUri) + && successRedirectUri.equals(other.successRedirectUri) + && webhookUri.equals(other.webhookUri); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.externalUserId, + this.projectId, + this.allowedOrigins, + this.errorRedirectUri, + this.successRedirectUri, + this.webhookUri); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

Your end user ID, for whom you're creating the token

+ */ + ProjectIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ConnectTokenCreateOpts other); + } + + public interface ProjectIdStage { + /** + *

The ID of the project

+ */ + _FinalStage projectId(@NotNull String projectId); + } + + public interface _FinalStage { + ConnectTokenCreateOpts build(); + + /** + *

List of allowed origins for CORS

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

URI to redirect to on error

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

URI to redirect to on success

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

Webhook URI for notifications

+ */ + _FinalStage webhookUri(Optional webhookUri); + + _FinalStage webhookUri(String webhookUri); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, ProjectIdStage, _FinalStage { + private String externalUserId; + + private String projectId; + + private Optional webhookUri = Optional.empty(); + + private Optional successRedirectUri = Optional.empty(); + + private Optional errorRedirectUri = Optional.empty(); + + private Optional> allowedOrigins = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ConnectTokenCreateOpts other) { + externalUserId(other.getExternalUserId()); + projectId(other.getProjectId()); + allowedOrigins(other.getAllowedOrigins()); + errorRedirectUri(other.getErrorRedirectUri()); + successRedirectUri(other.getSuccessRedirectUri()); + webhookUri(other.getWebhookUri()); + return this; + } + + /** + *

Your end user ID, for whom you're creating the token

+ *

Your end user ID, for whom you're creating the token

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

The ID of the project

+ *

The ID of the project

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

Webhook URI for notifications

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

Webhook URI for notifications

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

URI to redirect to on success

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

URI to redirect to on success

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

URI to redirect to on error

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

URI to redirect to on error

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

List of allowed origins for CORS

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

List of allowed origins for CORS

+ */ + @java.lang.Override + @JsonSetter(value = "allowed_origins", nulls = Nulls.SKIP) + public _FinalStage allowedOrigins(Optional> allowedOrigins) { + this.allowedOrigins = allowedOrigins; + return this; + } + + @java.lang.Override + public ConnectTokenCreateOpts build() { + return new ConnectTokenCreateOpts( + externalUserId, + projectId, + allowedOrigins, + errorRedirectUri, + successRedirectUri, + webhookUri, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConnectTokenResponse.java b/src/main/java/com/pipedream/api/types/ConnectTokenResponse.java new file mode 100644 index 0000000..76aac12 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConnectTokenResponse.java @@ -0,0 +1,183 @@ +/** + * 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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConnectTokenResponse.Builder.class) +public final class ConnectTokenResponse { + private final String connectLinkUrl; + + private final OffsetDateTime expiresAt; + + private final String token; + + private final Map additionalProperties; + + private ConnectTokenResponse( + String connectLinkUrl, OffsetDateTime expiresAt, String token, Map additionalProperties) { + this.connectLinkUrl = connectLinkUrl; + this.expiresAt = expiresAt; + this.token = token; + this.additionalProperties = additionalProperties; + } + + /** + * @return The Connect Link URL + */ + @JsonProperty("connect_link_url") + public String getConnectLinkUrl() { + return connectLinkUrl; + } + + /** + * @return The expiration time of the token in ISO 8601 format + */ + @JsonProperty("expires_at") + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + /** + * @return The generated token + */ + @JsonProperty("token") + public String getToken() { + return token; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConnectTokenResponse && equalTo((ConnectTokenResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConnectTokenResponse other) { + return connectLinkUrl.equals(other.connectLinkUrl) + && expiresAt.equals(other.expiresAt) + && token.equals(other.token); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.connectLinkUrl, this.expiresAt, this.token); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ConnectLinkUrlStage builder() { + return new Builder(); + } + + public interface ConnectLinkUrlStage { + /** + *

The Connect Link URL

+ */ + ExpiresAtStage connectLinkUrl(@NotNull String connectLinkUrl); + + Builder from(ConnectTokenResponse other); + } + + public interface ExpiresAtStage { + /** + *

The expiration time of the token in ISO 8601 format

+ */ + TokenStage expiresAt(@NotNull OffsetDateTime expiresAt); + } + + public interface TokenStage { + /** + *

The generated token

+ */ + _FinalStage token(@NotNull String token); + } + + public interface _FinalStage { + ConnectTokenResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ConnectLinkUrlStage, ExpiresAtStage, TokenStage, _FinalStage { + private String connectLinkUrl; + + private OffsetDateTime expiresAt; + + private String token; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ConnectTokenResponse other) { + connectLinkUrl(other.getConnectLinkUrl()); + expiresAt(other.getExpiresAt()); + token(other.getToken()); + return this; + } + + /** + *

The Connect Link URL

+ *

The Connect Link URL

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

The expiration time of the token in ISO 8601 format

+ *

The expiration time of the token in ISO 8601 format

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

The generated token

+ *

The generated token

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("token") + public _FinalStage token(@NotNull String token) { + this.token = Objects.requireNonNull(token, "token must not be null"); + return this; + } + + @java.lang.Override + public ConnectTokenResponse build() { + return new ConnectTokenResponse(connectLinkUrl, expiresAt, token, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/CreateBrowserClientOpts.java b/src/main/java/com/pipedream/api/types/CreateBrowserClientOpts.java new file mode 100644 index 0000000..96af1a4 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/CreateBrowserClientOpts.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateBrowserClientOpts.Builder.class) +public final class CreateBrowserClientOpts { + private final Optional apiUrl; + + private final Map additionalProperties; + + private CreateBrowserClientOpts(Optional apiUrl, Map additionalProperties) { + this.apiUrl = apiUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The API URL to use + */ + @JsonProperty("api_url") + public Optional getApiUrl() { + return apiUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateBrowserClientOpts && equalTo((CreateBrowserClientOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateBrowserClientOpts other) { + return apiUrl.equals(other.apiUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional apiUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateBrowserClientOpts other) { + apiUrl(other.getApiUrl()); + return this; + } + + /** + *

The API URL to use

+ */ + @JsonSetter(value = "api_url", nulls = Nulls.SKIP) + public Builder apiUrl(Optional apiUrl) { + this.apiUrl = apiUrl; + return this; + } + + public Builder apiUrl(String apiUrl) { + this.apiUrl = Optional.ofNullable(apiUrl); + return this; + } + + public CreateBrowserClientOpts build() { + return new CreateBrowserClientOpts(apiUrl, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/CreateOAuthTokenResponse.java b/src/main/java/com/pipedream/api/types/CreateOAuthTokenResponse.java new file mode 100644 index 0000000..3f50fd1 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/CreateOAuthTokenResponse.java @@ -0,0 +1,149 @@ +/** + * 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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateOAuthTokenResponse.Builder.class) +public final class CreateOAuthTokenResponse { + private final String accessToken; + + private final String tokenType; + + private final int expiresIn; + + private final Map additionalProperties; + + private CreateOAuthTokenResponse( + String accessToken, String tokenType, int expiresIn, Map additionalProperties) { + this.accessToken = accessToken; + this.tokenType = tokenType; + this.expiresIn = expiresIn; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("access_token") + public String getAccessToken() { + return accessToken; + } + + @JsonProperty("token_type") + public String getTokenType() { + return tokenType; + } + + @JsonProperty("expires_in") + public int getExpiresIn() { + return expiresIn; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOAuthTokenResponse && equalTo((CreateOAuthTokenResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateOAuthTokenResponse other) { + return accessToken.equals(other.accessToken) + && tokenType.equals(other.tokenType) + && expiresIn == other.expiresIn; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accessToken, this.tokenType, this.expiresIn); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccessTokenStage builder() { + return new Builder(); + } + + public interface AccessTokenStage { + TokenTypeStage accessToken(@NotNull String accessToken); + + Builder from(CreateOAuthTokenResponse other); + } + + public interface TokenTypeStage { + ExpiresInStage tokenType(@NotNull String tokenType); + } + + public interface ExpiresInStage { + _FinalStage expiresIn(int expiresIn); + } + + public interface _FinalStage { + CreateOAuthTokenResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccessTokenStage, TokenTypeStage, ExpiresInStage, _FinalStage { + private String accessToken; + + private String tokenType; + + private int expiresIn; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateOAuthTokenResponse other) { + accessToken(other.getAccessToken()); + tokenType(other.getTokenType()); + expiresIn(other.getExpiresIn()); + return this; + } + + @java.lang.Override + @JsonSetter("access_token") + public TokenTypeStage accessToken(@NotNull String accessToken) { + this.accessToken = Objects.requireNonNull(accessToken, "accessToken must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("token_type") + public ExpiresInStage tokenType(@NotNull String tokenType) { + this.tokenType = Objects.requireNonNull(tokenType, "tokenType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("expires_in") + public _FinalStage expiresIn(int expiresIn) { + this.expiresIn = expiresIn; + return this; + } + + @java.lang.Override + public CreateOAuthTokenResponse build() { + return new CreateOAuthTokenResponse(accessToken, tokenType, expiresIn, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/CreateTokenResponse.java b/src/main/java/com/pipedream/api/types/CreateTokenResponse.java new file mode 100644 index 0000000..4ce6161 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/CreateTokenResponse.java @@ -0,0 +1,183 @@ +/** + * 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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTokenResponse.Builder.class) +public final class CreateTokenResponse { + private final String connectLinkUrl; + + private final OffsetDateTime expiresAt; + + private final String token; + + private final Map additionalProperties; + + private CreateTokenResponse( + String connectLinkUrl, OffsetDateTime expiresAt, String token, Map additionalProperties) { + this.connectLinkUrl = connectLinkUrl; + this.expiresAt = expiresAt; + this.token = token; + this.additionalProperties = additionalProperties; + } + + /** + * @return The Connect Link URL + */ + @JsonProperty("connect_link_url") + public String getConnectLinkUrl() { + return connectLinkUrl; + } + + /** + * @return The expiration time of the token in ISO 8601 format + */ + @JsonProperty("expires_at") + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + /** + * @return The generated token + */ + @JsonProperty("token") + public String getToken() { + return token; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTokenResponse && equalTo((CreateTokenResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTokenResponse other) { + return connectLinkUrl.equals(other.connectLinkUrl) + && expiresAt.equals(other.expiresAt) + && token.equals(other.token); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.connectLinkUrl, this.expiresAt, this.token); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ConnectLinkUrlStage builder() { + return new Builder(); + } + + public interface ConnectLinkUrlStage { + /** + *

The Connect Link URL

+ */ + ExpiresAtStage connectLinkUrl(@NotNull String connectLinkUrl); + + Builder from(CreateTokenResponse other); + } + + public interface ExpiresAtStage { + /** + *

The expiration time of the token in ISO 8601 format

+ */ + TokenStage expiresAt(@NotNull OffsetDateTime expiresAt); + } + + public interface TokenStage { + /** + *

The generated token

+ */ + _FinalStage token(@NotNull String token); + } + + public interface _FinalStage { + CreateTokenResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ConnectLinkUrlStage, ExpiresAtStage, TokenStage, _FinalStage { + private String connectLinkUrl; + + private OffsetDateTime expiresAt; + + private String token; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTokenResponse other) { + connectLinkUrl(other.getConnectLinkUrl()); + expiresAt(other.getExpiresAt()); + token(other.getToken()); + return this; + } + + /** + *

The Connect Link URL

+ *

The Connect Link URL

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

The expiration time of the token in ISO 8601 format

+ *

The expiration time of the token in ISO 8601 format

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

The generated token

+ *

The generated token

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("token") + public _FinalStage token(@NotNull String token) { + this.token = Objects.requireNonNull(token, "token must not be null"); + return this; + } + + @java.lang.Override + public CreateTokenResponse build() { + return new CreateTokenResponse(connectLinkUrl, expiresAt, token, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/DeleteTriggerOpts.java b/src/main/java/com/pipedream/api/types/DeleteTriggerOpts.java new file mode 100644 index 0000000..70b04b4 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/DeleteTriggerOpts.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteTriggerOpts.Builder.class) +public final class DeleteTriggerOpts { + private final Optional ignoreHookErrors; + + private final Map additionalProperties; + + private DeleteTriggerOpts(Optional ignoreHookErrors, Map additionalProperties) { + this.ignoreHookErrors = ignoreHookErrors; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether to ignore errors during deactivation hook + */ + @JsonProperty("ignore_hook_errors") + public Optional getIgnoreHookErrors() { + return ignoreHookErrors; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteTriggerOpts && equalTo((DeleteTriggerOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteTriggerOpts other) { + return ignoreHookErrors.equals(other.ignoreHookErrors); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.ignoreHookErrors); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional ignoreHookErrors = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteTriggerOpts other) { + ignoreHookErrors(other.getIgnoreHookErrors()); + return this; + } + + /** + *

Whether to ignore errors during deactivation hook

+ */ + @JsonSetter(value = "ignore_hook_errors", nulls = Nulls.SKIP) + public Builder ignoreHookErrors(Optional ignoreHookErrors) { + this.ignoreHookErrors = ignoreHookErrors; + return this; + } + + public Builder ignoreHookErrors(Boolean ignoreHookErrors) { + this.ignoreHookErrors = Optional.ofNullable(ignoreHookErrors); + return this; + } + + public DeleteTriggerOpts build() { + return new DeleteTriggerOpts(ignoreHookErrors, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/DeployTriggerResponse.java b/src/main/java/com/pipedream/api/types/DeployTriggerResponse.java new file mode 100644 index 0000000..09aac9d --- /dev/null +++ b/src/main/java/com/pipedream/api/types/DeployTriggerResponse.java @@ -0,0 +1,102 @@ +/** + * 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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployTriggerResponse.Builder.class) +public final class DeployTriggerResponse { + private final DeployedComponent data; + + private final Map additionalProperties; + + private DeployTriggerResponse(DeployedComponent data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public DeployedComponent getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployTriggerResponse && equalTo((DeployTriggerResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployTriggerResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull DeployedComponent data); + + Builder from(DeployTriggerResponse other); + } + + public interface _FinalStage { + DeployTriggerResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private DeployedComponent data; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployTriggerResponse other) { + data(other.getData()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull DeployedComponent data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public DeployTriggerResponse build() { + return new DeployTriggerResponse(data, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/DeployedComponent.java b/src/main/java/com/pipedream/api/types/DeployedComponent.java new file mode 100644 index 0000000..8a6e6b9 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/DeployedComponent.java @@ -0,0 +1,539 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedComponent.Builder.class) +public final class DeployedComponent { + private final String id; + + private final String ownerId; + + private final String componentId; + + private final List configurableProps; + + private final Map configuredProps; + + private final boolean active; + + private final int createdAt; + + private final int updatedAt; + + private final String name; + + private final String nameSlug; + + private final Optional callbackObservations; + + private final Map additionalProperties; + + private DeployedComponent( + String id, + String ownerId, + String componentId, + List configurableProps, + Map configuredProps, + boolean active, + int createdAt, + int updatedAt, + String name, + String nameSlug, + Optional callbackObservations, + Map additionalProperties) { + this.id = id; + this.ownerId = ownerId; + this.componentId = componentId; + this.configurableProps = configurableProps; + this.configuredProps = configuredProps; + this.active = active; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.name = name; + this.nameSlug = nameSlug; + this.callbackObservations = callbackObservations; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique ID of the deployed component + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The ID of the owner + */ + @JsonProperty("owner_id") + public String getOwnerId() { + return ownerId; + } + + /** + * @return The ID of the component that was deployed + */ + @JsonProperty("component_id") + public String getComponentId() { + return componentId; + } + + /** + * @return The configurable properties of the component + */ + @JsonProperty("configurable_props") + public List getConfigurableProps() { + return configurableProps; + } + + /** + * @return The configured properties of the component + */ + @JsonProperty("configured_props") + public Map getConfiguredProps() { + return configuredProps; + } + + /** + * @return Whether the deployed component is active + */ + @JsonProperty("active") + public boolean getActive() { + return active; + } + + /** + * @return The timestamp when the component was deployed (epoch milliseconds) + */ + @JsonProperty("created_at") + public int getCreatedAt() { + return createdAt; + } + + /** + * @return The timestamp when the component was last updated (epoch milliseconds) + */ + @JsonProperty("updated_at") + public int getUpdatedAt() { + return updatedAt; + } + + /** + * @return The name of the deployed component + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The name slug of the deployed component + */ + @JsonProperty("name_slug") + public String getNameSlug() { + return nameSlug; + } + + @JsonProperty("callback_observations") + public Optional getCallbackObservations() { + return callbackObservations; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedComponent && equalTo((DeployedComponent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedComponent other) { + return id.equals(other.id) + && ownerId.equals(other.ownerId) + && componentId.equals(other.componentId) + && configurableProps.equals(other.configurableProps) + && configuredProps.equals(other.configuredProps) + && active == other.active + && createdAt == other.createdAt + && updatedAt == other.updatedAt + && name.equals(other.name) + && nameSlug.equals(other.nameSlug) + && callbackObservations.equals(other.callbackObservations); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.ownerId, + this.componentId, + this.configurableProps, + this.configuredProps, + this.active, + this.createdAt, + this.updatedAt, + this.name, + this.nameSlug, + this.callbackObservations); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique ID of the deployed component

+ */ + OwnerIdStage id(@NotNull String id); + + Builder from(DeployedComponent other); + } + + public interface OwnerIdStage { + /** + *

The ID of the owner

+ */ + ComponentIdStage ownerId(@NotNull String ownerId); + } + + public interface ComponentIdStage { + /** + *

The ID of the component that was deployed

+ */ + ActiveStage componentId(@NotNull String componentId); + } + + public interface ActiveStage { + /** + *

Whether the deployed component is active

+ */ + CreatedAtStage active(boolean active); + } + + public interface CreatedAtStage { + /** + *

The timestamp when the component was deployed (epoch milliseconds)

+ */ + UpdatedAtStage createdAt(int createdAt); + } + + public interface UpdatedAtStage { + /** + *

The timestamp when the component was last updated (epoch milliseconds)

+ */ + NameStage updatedAt(int updatedAt); + } + + public interface NameStage { + /** + *

The name of the deployed component

+ */ + NameSlugStage name(@NotNull String name); + } + + public interface NameSlugStage { + /** + *

The name slug of the deployed component

+ */ + _FinalStage nameSlug(@NotNull String nameSlug); + } + + public interface _FinalStage { + DeployedComponent build(); + + /** + *

The configurable properties of the component

+ */ + _FinalStage configurableProps(List configurableProps); + + _FinalStage addConfigurableProps(ConfigurableProp configurableProps); + + _FinalStage addAllConfigurableProps(List configurableProps); + + /** + *

The configured properties of the component

+ */ + _FinalStage configuredProps(Map configuredProps); + + _FinalStage putAllConfiguredProps(Map configuredProps); + + _FinalStage configuredProps(String key, Object value); + + _FinalStage callbackObservations(Optional callbackObservations); + + _FinalStage callbackObservations(Object callbackObservations); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, + OwnerIdStage, + ComponentIdStage, + ActiveStage, + CreatedAtStage, + UpdatedAtStage, + NameStage, + NameSlugStage, + _FinalStage { + private String id; + + private String ownerId; + + private String componentId; + + private boolean active; + + private int createdAt; + + private int updatedAt; + + private String name; + + private String nameSlug; + + private Optional callbackObservations = Optional.empty(); + + private Map configuredProps = new LinkedHashMap<>(); + + private List configurableProps = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedComponent other) { + id(other.getId()); + ownerId(other.getOwnerId()); + componentId(other.getComponentId()); + configurableProps(other.getConfigurableProps()); + configuredProps(other.getConfiguredProps()); + active(other.getActive()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + name(other.getName()); + nameSlug(other.getNameSlug()); + callbackObservations(other.getCallbackObservations()); + return this; + } + + /** + *

The unique ID of the deployed component

+ *

The unique ID of the deployed component

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

The ID of the owner

+ *

The ID of the owner

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

The ID of the component that was deployed

+ *

The ID of the component that was deployed

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

Whether the deployed component is active

+ *

Whether the deployed component is active

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("active") + public CreatedAtStage active(boolean active) { + this.active = active; + return this; + } + + /** + *

The timestamp when the component was deployed (epoch milliseconds)

+ *

The timestamp when the component was deployed (epoch milliseconds)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(int createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + *

The timestamp when the component was last updated (epoch milliseconds)

+ *

The timestamp when the component was last updated (epoch milliseconds)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public NameStage updatedAt(int updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + *

The name of the deployed component

+ *

The name of the deployed component

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

The name slug of the deployed component

+ *

The name slug of the deployed component

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name_slug") + public _FinalStage nameSlug(@NotNull String nameSlug) { + this.nameSlug = Objects.requireNonNull(nameSlug, "nameSlug must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage callbackObservations(Object callbackObservations) { + this.callbackObservations = Optional.ofNullable(callbackObservations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "callback_observations", nulls = Nulls.SKIP) + public _FinalStage callbackObservations(Optional callbackObservations) { + this.callbackObservations = callbackObservations; + return this; + } + + /** + *

The configured properties of the component

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage configuredProps(String key, Object value) { + this.configuredProps.put(key, value); + return this; + } + + /** + *

The configured properties of the component

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllConfiguredProps(Map configuredProps) { + this.configuredProps.putAll(configuredProps); + return this; + } + + /** + *

The configured properties of the component

+ */ + @java.lang.Override + @JsonSetter(value = "configured_props", nulls = Nulls.SKIP) + public _FinalStage configuredProps(Map configuredProps) { + this.configuredProps.clear(); + this.configuredProps.putAll(configuredProps); + return this; + } + + /** + *

The configurable properties of the component

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

The configurable properties of the component

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addConfigurableProps(ConfigurableProp configurableProps) { + this.configurableProps.add(configurableProps); + return this; + } + + /** + *

The configurable properties of the component

+ */ + @java.lang.Override + @JsonSetter(value = "configurable_props", nulls = Nulls.SKIP) + public _FinalStage configurableProps(List configurableProps) { + this.configurableProps.clear(); + this.configurableProps.addAll(configurableProps); + return this; + } + + @java.lang.Override + public DeployedComponent build() { + return new DeployedComponent( + id, + ownerId, + componentId, + configurableProps, + configuredProps, + active, + createdAt, + updatedAt, + name, + nameSlug, + callbackObservations, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/EmittedEvent.java b/src/main/java/com/pipedream/api/types/EmittedEvent.java new file mode 100644 index 0000000..21eebab --- /dev/null +++ b/src/main/java/com/pipedream/api/types/EmittedEvent.java @@ -0,0 +1,235 @@ +/** + * 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.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EmittedEvent.Builder.class) +public final class EmittedEvent { + private final Map e; + + private final String k; + + private final int ts; + + private final String id; + + private final Map additionalProperties; + + private EmittedEvent(Map e, String k, int ts, String id, Map additionalProperties) { + this.e = e; + this.k = k; + this.ts = ts; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The event's payload + */ + @JsonProperty("e") + public Map getE() { + return e; + } + + /** + * @return The event's type (set to 'emit' currently) + */ + @JsonProperty("k") + public String getK() { + return k; + } + + /** + * @return The event's timestamp in epoch milliseconds + */ + @JsonProperty("ts") + public int getTs() { + return ts; + } + + /** + * @return The event's unique ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EmittedEvent && equalTo((EmittedEvent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EmittedEvent other) { + return e.equals(other.e) && k.equals(other.k) && ts == other.ts && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.e, this.k, this.ts, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static KStage builder() { + return new Builder(); + } + + public interface KStage { + /** + *

The event's type (set to 'emit' currently)

+ */ + TsStage k(@NotNull String k); + + Builder from(EmittedEvent other); + } + + public interface TsStage { + /** + *

The event's timestamp in epoch milliseconds

+ */ + IdStage ts(int ts); + } + + public interface IdStage { + /** + *

The event's unique ID

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + EmittedEvent build(); + + /** + *

The event's payload

+ */ + _FinalStage e(Map e); + + _FinalStage putAllE(Map e); + + _FinalStage e(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements KStage, TsStage, IdStage, _FinalStage { + private String k; + + private int ts; + + private String id; + + private Map e = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(EmittedEvent other) { + e(other.getE()); + k(other.getK()); + ts(other.getTs()); + id(other.getId()); + return this; + } + + /** + *

The event's type (set to 'emit' currently)

+ *

The event's type (set to 'emit' currently)

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

The event's timestamp in epoch milliseconds

+ *

The event's timestamp in epoch milliseconds

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ts") + public IdStage ts(int ts) { + this.ts = ts; + return this; + } + + /** + *

The event's unique ID

+ *

The event's unique ID

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

The event's payload

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage e(String key, Object value) { + this.e.put(key, value); + return this; + } + + /** + *

The event's payload

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllE(Map e) { + this.e.putAll(e); + return this; + } + + /** + *

The event's payload

+ */ + @java.lang.Override + @JsonSetter(value = "e", nulls = Nulls.SKIP) + public _FinalStage e(Map e) { + this.e.clear(); + this.e.putAll(e); + return this; + } + + @java.lang.Override + public EmittedEvent build() { + return new EmittedEvent(e, k, ts, id, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ErrorResponse.java b/src/main/java/com/pipedream/api/types/ErrorResponse.java new file mode 100644 index 0000000..38b2481 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ErrorResponse.java @@ -0,0 +1,201 @@ +/** + * 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 = ErrorResponse.Builder.class) +public final class ErrorResponse { + private final String error; + + private final Optional code; + + private final Optional> details; + + private final Map additionalProperties; + + private ErrorResponse( + String error, + Optional code, + Optional> details, + Map additionalProperties) { + this.error = error; + this.code = code; + this.details = details; + this.additionalProperties = additionalProperties; + } + + /** + * @return The error message + */ + @JsonProperty("error") + public String getError() { + return error; + } + + /** + * @return The error code + */ + @JsonProperty("code") + public Optional getCode() { + return code; + } + + /** + * @return Additional error details + */ + @JsonProperty("details") + public Optional> getDetails() { + return details; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ErrorResponse && equalTo((ErrorResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ErrorResponse other) { + return error.equals(other.error) && code.equals(other.code) && details.equals(other.details); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.error, this.code, this.details); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ErrorStage builder() { + return new Builder(); + } + + public interface ErrorStage { + /** + *

The error message

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

The error code

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

Additional error details

+ */ + _FinalStage details(Optional> details); + + _FinalStage details(Map details); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ErrorStage, _FinalStage { + private String error; + + private Optional> details = Optional.empty(); + + private Optional code = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ErrorResponse other) { + error(other.getError()); + code(other.getCode()); + details(other.getDetails()); + return this; + } + + /** + *

The error message

+ *

The error message

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

Additional error details

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

Additional error details

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

The error code

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

The error code

+ */ + @java.lang.Override + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public _FinalStage code(Optional code) { + this.code = code; + return this; + } + + @java.lang.Override + public ErrorResponse build() { + return new ErrorResponse(error, code, details, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetAccountsResponse.java b/src/main/java/com/pipedream/api/types/GetAccountsResponse.java new file mode 100644 index 0000000..27141c1 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetAccountsResponse.java @@ -0,0 +1,142 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetAccountsResponse.Builder.class) +public final class GetAccountsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private GetAccountsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetAccountsResponse && equalTo((GetAccountsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetAccountsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(GetAccountsResponse other); + } + + public interface _FinalStage { + GetAccountsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(Account data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetAccountsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(Account data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public GetAccountsResponse build() { + return new GetAccountsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetAppResponse.java b/src/main/java/com/pipedream/api/types/GetAppResponse.java new file mode 100644 index 0000000..b8d680d --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetAppResponse.java @@ -0,0 +1,102 @@ +/** + * 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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetAppResponse.Builder.class) +public final class GetAppResponse { + private final App data; + + private final Map additionalProperties; + + private GetAppResponse(App data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public App getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetAppResponse && equalTo((GetAppResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetAppResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull App data); + + Builder from(GetAppResponse other); + } + + public interface _FinalStage { + GetAppResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private App data; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetAppResponse other) { + data(other.getData()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull App data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public GetAppResponse build() { + return new GetAppResponse(data, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetAppsResponse.java b/src/main/java/com/pipedream/api/types/GetAppsResponse.java new file mode 100644 index 0000000..9f69b14 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetAppsResponse.java @@ -0,0 +1,142 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetAppsResponse.Builder.class) +public final class GetAppsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private GetAppsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetAppsResponse && equalTo((GetAppsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetAppsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(GetAppsResponse other); + } + + public interface _FinalStage { + GetAppsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(App data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetAppsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(App data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public GetAppsResponse build() { + return new GetAppsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetComponentResponse.java b/src/main/java/com/pipedream/api/types/GetComponentResponse.java new file mode 100644 index 0000000..f2a0631 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetComponentResponse.java @@ -0,0 +1,102 @@ +/** + * 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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetComponentResponse.Builder.class) +public final class GetComponentResponse { + private final Component data; + + private final Map additionalProperties; + + private GetComponentResponse(Component data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public Component getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetComponentResponse && equalTo((GetComponentResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetComponentResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull Component data); + + Builder from(GetComponentResponse other); + } + + public interface _FinalStage { + GetComponentResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private Component data; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetComponentResponse other) { + data(other.getData()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull Component data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public GetComponentResponse build() { + return new GetComponentResponse(data, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetComponentsResponse.java b/src/main/java/com/pipedream/api/types/GetComponentsResponse.java new file mode 100644 index 0000000..9768dbf --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetComponentsResponse.java @@ -0,0 +1,142 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetComponentsResponse.Builder.class) +public final class GetComponentsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private GetComponentsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetComponentsResponse && equalTo((GetComponentsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetComponentsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(GetComponentsResponse other); + } + + public interface _FinalStage { + GetComponentsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(Component data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetComponentsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(Component data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public GetComponentsResponse build() { + return new GetComponentsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetTriggerEventsResponse.java b/src/main/java/com/pipedream/api/types/GetTriggerEventsResponse.java new file mode 100644 index 0000000..87d47ab --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetTriggerEventsResponse.java @@ -0,0 +1,102 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggerEventsResponse.Builder.class) +public final class GetTriggerEventsResponse { + private final List data; + + private final Map additionalProperties; + + private GetTriggerEventsResponse(List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggerEventsResponse && equalTo((GetTriggerEventsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggerEventsResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetTriggerEventsResponse other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + public Builder addData(EmittedEvent data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + this.data.addAll(data); + return this; + } + + public GetTriggerEventsResponse build() { + return new GetTriggerEventsResponse(data, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetTriggerResponse.java b/src/main/java/com/pipedream/api/types/GetTriggerResponse.java new file mode 100644 index 0000000..697147e --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetTriggerResponse.java @@ -0,0 +1,102 @@ +/** + * 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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggerResponse.Builder.class) +public final class GetTriggerResponse { + private final DeployedComponent data; + + private final Map additionalProperties; + + private GetTriggerResponse(DeployedComponent data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public DeployedComponent getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggerResponse && equalTo((GetTriggerResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggerResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull DeployedComponent data); + + Builder from(GetTriggerResponse other); + } + + public interface _FinalStage { + GetTriggerResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private DeployedComponent data; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetTriggerResponse other) { + data(other.getData()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull DeployedComponent data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public GetTriggerResponse build() { + return new GetTriggerResponse(data, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetTriggerWebhooksResponse.java b/src/main/java/com/pipedream/api/types/GetTriggerWebhooksResponse.java new file mode 100644 index 0000000..1d86176 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetTriggerWebhooksResponse.java @@ -0,0 +1,102 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggerWebhooksResponse.Builder.class) +public final class GetTriggerWebhooksResponse { + private final List webhookUrls; + + private final Map additionalProperties; + + private GetTriggerWebhooksResponse(List webhookUrls, Map additionalProperties) { + this.webhookUrls = webhookUrls; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("webhook_urls") + public List getWebhookUrls() { + return webhookUrls; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggerWebhooksResponse && equalTo((GetTriggerWebhooksResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggerWebhooksResponse other) { + return webhookUrls.equals(other.webhookUrls); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.webhookUrls); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List webhookUrls = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetTriggerWebhooksResponse other) { + webhookUrls(other.getWebhookUrls()); + return this; + } + + @JsonSetter(value = "webhook_urls", nulls = Nulls.SKIP) + public Builder webhookUrls(List webhookUrls) { + this.webhookUrls.clear(); + this.webhookUrls.addAll(webhookUrls); + return this; + } + + public Builder addWebhookUrls(String webhookUrls) { + this.webhookUrls.add(webhookUrls); + return this; + } + + public Builder addAllWebhookUrls(List webhookUrls) { + this.webhookUrls.addAll(webhookUrls); + return this; + } + + public GetTriggerWebhooksResponse build() { + return new GetTriggerWebhooksResponse(webhookUrls, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetTriggerWorkflowsResponse.java b/src/main/java/com/pipedream/api/types/GetTriggerWorkflowsResponse.java new file mode 100644 index 0000000..e14ed35 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetTriggerWorkflowsResponse.java @@ -0,0 +1,102 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggerWorkflowsResponse.Builder.class) +public final class GetTriggerWorkflowsResponse { + private final List workflowIds; + + private final Map additionalProperties; + + private GetTriggerWorkflowsResponse(List workflowIds, Map additionalProperties) { + this.workflowIds = workflowIds; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("workflow_ids") + public List getWorkflowIds() { + return workflowIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggerWorkflowsResponse && equalTo((GetTriggerWorkflowsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggerWorkflowsResponse other) { + return workflowIds.equals(other.workflowIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.workflowIds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List workflowIds = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetTriggerWorkflowsResponse other) { + workflowIds(other.getWorkflowIds()); + return this; + } + + @JsonSetter(value = "workflow_ids", nulls = Nulls.SKIP) + public Builder workflowIds(List workflowIds) { + this.workflowIds.clear(); + this.workflowIds.addAll(workflowIds); + return this; + } + + public Builder addWorkflowIds(String workflowIds) { + this.workflowIds.add(workflowIds); + return this; + } + + public Builder addAllWorkflowIds(List workflowIds) { + this.workflowIds.addAll(workflowIds); + return this; + } + + public GetTriggerWorkflowsResponse build() { + return new GetTriggerWorkflowsResponse(workflowIds, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetTriggersResponse.java b/src/main/java/com/pipedream/api/types/GetTriggersResponse.java new file mode 100644 index 0000000..0c6a070 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetTriggersResponse.java @@ -0,0 +1,143 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggersResponse.Builder.class) +public final class GetTriggersResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private GetTriggersResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggersResponse && equalTo((GetTriggersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggersResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(GetTriggersResponse other); + } + + public interface _FinalStage { + GetTriggersResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(DeployedComponent data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetTriggersResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(DeployedComponent data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public GetTriggersResponse build() { + return new GetTriggersResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ListAccountsResponse.java b/src/main/java/com/pipedream/api/types/ListAccountsResponse.java new file mode 100644 index 0000000..f474727 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ListAccountsResponse.java @@ -0,0 +1,142 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAccountsResponse.Builder.class) +public final class ListAccountsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListAccountsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAccountsResponse && equalTo((ListAccountsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAccountsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListAccountsResponse other); + } + + public interface _FinalStage { + ListAccountsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(Account data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAccountsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(Account data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public ListAccountsResponse build() { + return new ListAccountsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ListAppsResponse.java b/src/main/java/com/pipedream/api/types/ListAppsResponse.java new file mode 100644 index 0000000..85fab80 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ListAppsResponse.java @@ -0,0 +1,142 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAppsResponse.Builder.class) +public final class ListAppsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListAppsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAppsResponse && equalTo((ListAppsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAppsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListAppsResponse other); + } + + public interface _FinalStage { + ListAppsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(App data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAppsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(App data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public ListAppsResponse build() { + return new ListAppsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/PageInfo.java b/src/main/java/com/pipedream/api/types/PageInfo.java new file mode 100644 index 0000000..8fbda9e --- /dev/null +++ b/src/main/java/com/pipedream/api/types/PageInfo.java @@ -0,0 +1,169 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PageInfo.Builder.class) +public final class PageInfo { + private final Optional count; + + private final Optional totalCount; + + private final Optional startCursor; + + private final Optional endCursor; + + private final Map additionalProperties; + + private PageInfo( + Optional count, + Optional totalCount, + Optional startCursor, + Optional endCursor, + Map additionalProperties) { + this.count = count; + this.totalCount = totalCount; + this.startCursor = startCursor; + this.endCursor = endCursor; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("count") + public Optional getCount() { + return count; + } + + @JsonProperty("total_count") + public Optional getTotalCount() { + return totalCount; + } + + @JsonProperty("start_cursor") + public Optional getStartCursor() { + return startCursor; + } + + @JsonProperty("end_cursor") + public Optional getEndCursor() { + return endCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PageInfo && equalTo((PageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PageInfo other) { + return count.equals(other.count) + && totalCount.equals(other.totalCount) + && startCursor.equals(other.startCursor) + && endCursor.equals(other.endCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.count, this.totalCount, this.startCursor, this.endCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional count = Optional.empty(); + + private Optional totalCount = Optional.empty(); + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PageInfo other) { + count(other.getCount()); + totalCount(other.getTotalCount()); + startCursor(other.getStartCursor()); + endCursor(other.getEndCursor()); + return this; + } + + @JsonSetter(value = "count", nulls = Nulls.SKIP) + public Builder count(Optional count) { + this.count = count; + return this; + } + + public Builder count(Integer count) { + this.count = Optional.ofNullable(count); + return this; + } + + @JsonSetter(value = "total_count", nulls = Nulls.SKIP) + public Builder totalCount(Optional totalCount) { + this.totalCount = totalCount; + return this; + } + + public Builder totalCount(Integer totalCount) { + this.totalCount = Optional.ofNullable(totalCount); + return this; + } + + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public Builder startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + public Builder startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public Builder endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + public Builder endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + public PageInfo build() { + return new PageInfo(count, totalCount, startCursor, endCursor, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ProjectEnvironment.java b/src/main/java/com/pipedream/api/types/ProjectEnvironment.java new file mode 100644 index 0000000..aceb02c --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ProjectEnvironment.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ProjectEnvironment { + DEVELOPMENT("development"), + + PRODUCTION("production"); + + private final String value; + + ProjectEnvironment(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/pipedream/api/types/ProjectInfoResponse.java b/src/main/java/com/pipedream/api/types/ProjectInfoResponse.java new file mode 100644 index 0000000..c3f66ca --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ProjectInfoResponse.java @@ -0,0 +1,102 @@ +/** + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProjectInfoResponse.Builder.class) +public final class ProjectInfoResponse { + private final List apps; + + private final Map additionalProperties; + + private ProjectInfoResponse(List apps, Map additionalProperties) { + this.apps = apps; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("apps") + public List getApps() { + return apps; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProjectInfoResponse && equalTo((ProjectInfoResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProjectInfoResponse other) { + return apps.equals(other.apps); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apps); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List apps = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ProjectInfoResponse other) { + apps(other.getApps()); + return this; + } + + @JsonSetter(value = "apps", nulls = Nulls.SKIP) + public Builder apps(List apps) { + this.apps.clear(); + this.apps.addAll(apps); + return this; + } + + public Builder addApps(ProjectInfoResponseAppsItem apps) { + this.apps.add(apps); + return this; + } + + public Builder addAllApps(List apps) { + this.apps.addAll(apps); + return this; + } + + public ProjectInfoResponse build() { + return new ProjectInfoResponse(apps, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ProjectInfoResponseAppsItem.java b/src/main/java/com/pipedream/api/types/ProjectInfoResponseAppsItem.java new file mode 100644 index 0000000..1b6412a --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ProjectInfoResponseAppsItem.java @@ -0,0 +1,157 @@ +/** + * 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 = ProjectInfoResponseAppsItem.Builder.class) +public final class ProjectInfoResponseAppsItem { + private final Optional id; + + private final String nameSlug; + + private final Map additionalProperties; + + private ProjectInfoResponseAppsItem( + Optional id, String nameSlug, Map additionalProperties) { + this.id = id; + this.nameSlug = nameSlug; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the app. Only applies for OAuth apps. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The name slug of the target app + */ + @JsonProperty("name_slug") + public String getNameSlug() { + return nameSlug; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProjectInfoResponseAppsItem && equalTo((ProjectInfoResponseAppsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProjectInfoResponseAppsItem other) { + return id.equals(other.id) && nameSlug.equals(other.nameSlug); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.nameSlug); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameSlugStage builder() { + return new Builder(); + } + + public interface NameSlugStage { + /** + *

The name slug of the target app

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

ID of the app. Only applies for OAuth apps.

+ */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameSlugStage, _FinalStage { + private String nameSlug; + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProjectInfoResponseAppsItem other) { + id(other.getId()); + nameSlug(other.getNameSlug()); + return this; + } + + /** + *

The name slug of the target app

+ *

The name slug of the target app

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

ID of the app. Only applies for OAuth apps.

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

ID of the app. Only applies for OAuth apps.

+ */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @java.lang.Override + public ProjectInfoResponseAppsItem build() { + return new ProjectInfoResponseAppsItem(id, nameSlug, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/PropOption.java b/src/main/java/com/pipedream/api/types/PropOption.java new file mode 100644 index 0000000..f3fd389 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/PropOption.java @@ -0,0 +1,135 @@ +/** + * 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.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PropOption.Builder.class) +public final class PropOption { + private final String label; + + private final Object value; + + private final Map additionalProperties; + + private PropOption(String label, Object value, Map additionalProperties) { + this.label = label; + this.value = value; + this.additionalProperties = additionalProperties; + } + + /** + * @return The human-readable label for the option + */ + @JsonProperty("label") + public String getLabel() { + return label; + } + + @JsonProperty("value") + public Object getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PropOption && equalTo((PropOption) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PropOption other) { + return label.equals(other.label) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.label, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LabelStage builder() { + return new Builder(); + } + + public interface LabelStage { + /** + *

The human-readable label for the option

+ */ + ValueStage label(@NotNull String label); + + Builder from(PropOption other); + } + + public interface ValueStage { + _FinalStage value(Object value); + } + + public interface _FinalStage { + PropOption build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LabelStage, ValueStage, _FinalStage { + private String label; + + private Object value; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PropOption other) { + label(other.getLabel()); + value(other.getValue()); + return this; + } + + /** + *

The human-readable label for the option

+ *

The human-readable label for the option

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("label") + public ValueStage label(@NotNull String label) { + this.label = Objects.requireNonNull(label, "label must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(Object value) { + this.value = value; + return this; + } + + @java.lang.Override + public PropOption build() { + return new PropOption(label, value, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ProxyResponse.java b/src/main/java/com/pipedream/api/types/ProxyResponse.java new file mode 100644 index 0000000..60a46ab --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ProxyResponse.java @@ -0,0 +1,155 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyResponse.Builder.class) +public final class ProxyResponse { + private final Optional status; + + private final Optional> headers; + + private final Optional body; + + private final Map additionalProperties; + + private ProxyResponse( + Optional status, + Optional> headers, + Optional body, + Map additionalProperties) { + this.status = status; + this.headers = headers; + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return HTTP status code + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Response headers + */ + @JsonProperty("headers") + public Optional> getHeaders() { + return headers; + } + + @JsonProperty("body") + public Optional getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyResponse && equalTo((ProxyResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyResponse other) { + return status.equals(other.status) && headers.equals(other.headers) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.status, this.headers, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional status = Optional.empty(); + + private Optional> headers = Optional.empty(); + + private Optional body = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ProxyResponse other) { + status(other.getStatus()); + headers(other.getHeaders()); + body(other.getBody()); + return this; + } + + /** + *

HTTP status code

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(Integer status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Response headers

+ */ + @JsonSetter(value = "headers", nulls = Nulls.SKIP) + public Builder headers(Optional> headers) { + this.headers = headers; + return this; + } + + public Builder headers(Map headers) { + this.headers = Optional.ofNullable(headers); + return this; + } + + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public Builder body(Optional body) { + this.body = body; + return this; + } + + public Builder body(Object body) { + this.body = Optional.ofNullable(body); + return this; + } + + public ProxyResponse build() { + return new ProxyResponse(status, headers, body, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ReloadPropsOpts.java b/src/main/java/com/pipedream/api/types/ReloadPropsOpts.java new file mode 100644 index 0000000..c10ebce --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ReloadPropsOpts.java @@ -0,0 +1,331 @@ +/** + * 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 = ReloadPropsOpts.Builder.class) +public final class ReloadPropsOpts { + private final String id; + + private final String externalUserId; + + private final Optional blocking; + + private final Optional> configuredProps; + + private final Optional dynamicPropsId; + + private final Optional asyncHandle; + + private final Map additionalProperties; + + private ReloadPropsOpts( + String id, + String externalUserId, + Optional blocking, + Optional> configuredProps, + Optional dynamicPropsId, + Optional asyncHandle, + Map additionalProperties) { + this.id = id; + this.externalUserId = externalUserId; + this.blocking = blocking; + this.configuredProps = configuredProps; + this.dynamicPropsId = dynamicPropsId; + this.asyncHandle = asyncHandle; + this.additionalProperties = additionalProperties; + } + + /** + * @return The component ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The external user ID + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Whether this operation should block until completion + */ + @JsonProperty("blocking") + public Optional getBlocking() { + return blocking; + } + + /** + * @return The configured properties for the component + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The ID for dynamic props + */ + @JsonProperty("dynamic_props_id") + public Optional getDynamicPropsId() { + return dynamicPropsId; + } + + /** + * @return Handle for async operations + */ + @JsonProperty("async_handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReloadPropsOpts && equalTo((ReloadPropsOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReloadPropsOpts other) { + return id.equals(other.id) + && externalUserId.equals(other.externalUserId) + && blocking.equals(other.blocking) + && configuredProps.equals(other.configuredProps) + && dynamicPropsId.equals(other.dynamicPropsId) + && asyncHandle.equals(other.asyncHandle); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.externalUserId, + this.blocking, + this.configuredProps, + this.dynamicPropsId, + this.asyncHandle); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The component ID

+ */ + ExternalUserIdStage id(@NotNull String id); + + Builder from(ReloadPropsOpts other); + } + + public interface ExternalUserIdStage { + /** + *

The external user ID

+ */ + _FinalStage externalUserId(@NotNull String externalUserId); + } + + public interface _FinalStage { + ReloadPropsOpts build(); + + /** + *

Whether this operation should block until completion

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

The configured properties for the component

+ */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

The ID for dynamic props

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

Handle for async operations

+ */ + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ExternalUserIdStage, _FinalStage { + private String id; + + private String externalUserId; + + private Optional asyncHandle = Optional.empty(); + + private Optional dynamicPropsId = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + private Optional blocking = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReloadPropsOpts other) { + id(other.getId()); + externalUserId(other.getExternalUserId()); + blocking(other.getBlocking()); + configuredProps(other.getConfiguredProps()); + dynamicPropsId(other.getDynamicPropsId()); + asyncHandle(other.getAsyncHandle()); + return this; + } + + /** + *

The component ID

+ *

The component ID

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

The external user ID

+ *

The external user ID

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

Handle for async operations

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

Handle for async operations

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

The ID for dynamic props

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

The ID for dynamic props

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

The configured properties for the component

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

The configured properties for the component

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

Whether this operation should block until completion

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

Whether this operation should block until completion

+ */ + @java.lang.Override + @JsonSetter(value = "blocking", nulls = Nulls.SKIP) + public _FinalStage blocking(Optional blocking) { + this.blocking = blocking; + return this; + } + + @java.lang.Override + public ReloadPropsOpts build() { + return new ReloadPropsOpts( + id, externalUserId, blocking, configuredProps, dynamicPropsId, asyncHandle, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ReloadPropsResponse.java b/src/main/java/com/pipedream/api/types/ReloadPropsResponse.java new file mode 100644 index 0000000..56e3dae --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ReloadPropsResponse.java @@ -0,0 +1,103 @@ +/** + * 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.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReloadPropsResponse.Builder.class) +public final class ReloadPropsResponse { + private final Optional> configurableProps; + + private final Map additionalProperties; + + private ReloadPropsResponse( + Optional> configurableProps, Map additionalProperties) { + this.configurableProps = configurableProps; + this.additionalProperties = additionalProperties; + } + + /** + * @return The updated configurable properties + */ + @JsonProperty("configurable_props") + public Optional> getConfigurableProps() { + return configurableProps; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReloadPropsResponse && equalTo((ReloadPropsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReloadPropsResponse other) { + return configurableProps.equals(other.configurableProps); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.configurableProps); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> configurableProps = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReloadPropsResponse other) { + configurableProps(other.getConfigurableProps()); + return this; + } + + /** + *

The updated configurable properties

+ */ + @JsonSetter(value = "configurable_props", nulls = Nulls.SKIP) + public Builder configurableProps(Optional> configurableProps) { + this.configurableProps = configurableProps; + return this; + } + + public Builder configurableProps(List configurableProps) { + this.configurableProps = Optional.ofNullable(configurableProps); + return this; + } + + public ReloadPropsResponse build() { + return new ReloadPropsResponse(configurableProps, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/RunActionResponse.java b/src/main/java/com/pipedream/api/types/RunActionResponse.java new file mode 100644 index 0000000..585a35a --- /dev/null +++ b/src/main/java/com/pipedream/api/types/RunActionResponse.java @@ -0,0 +1,175 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RunActionResponse.Builder.class) +public final class RunActionResponse { + private final Optional exports; + + private final Optional os; + + private final Optional ret; + + private final Optional stashId; + + private final Map additionalProperties; + + private RunActionResponse( + Optional exports, + Optional os, + Optional ret, + Optional stashId, + Map additionalProperties) { + this.exports = exports; + this.os = os; + this.ret = ret; + this.stashId = stashId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("exports") + public Optional getExports() { + return exports; + } + + @JsonProperty("os") + public Optional getOs() { + return os; + } + + @JsonProperty("ret") + public Optional getRet() { + return ret; + } + + /** + * @return The ID of the File Stash that was used to sync the action's /tmp directory + */ + @JsonProperty("stash_id") + public Optional getStashId() { + return stashId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RunActionResponse && equalTo((RunActionResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RunActionResponse other) { + return exports.equals(other.exports) + && os.equals(other.os) + && ret.equals(other.ret) + && stashId.equals(other.stashId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.exports, this.os, this.ret, this.stashId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional exports = Optional.empty(); + + private Optional os = Optional.empty(); + + private Optional ret = Optional.empty(); + + private Optional stashId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RunActionResponse other) { + exports(other.getExports()); + os(other.getOs()); + ret(other.getRet()); + stashId(other.getStashId()); + return this; + } + + @JsonSetter(value = "exports", nulls = Nulls.SKIP) + public Builder exports(Optional exports) { + this.exports = exports; + return this; + } + + public Builder exports(Object exports) { + this.exports = Optional.ofNullable(exports); + return this; + } + + @JsonSetter(value = "os", nulls = Nulls.SKIP) + public Builder os(Optional os) { + this.os = os; + return this; + } + + public Builder os(Object os) { + this.os = Optional.ofNullable(os); + return this; + } + + @JsonSetter(value = "ret", nulls = Nulls.SKIP) + public Builder ret(Optional ret) { + this.ret = ret; + return this; + } + + public Builder ret(Object ret) { + this.ret = Optional.ofNullable(ret); + return this; + } + + /** + *

The ID of the File Stash that was used to sync the action's /tmp directory

+ */ + @JsonSetter(value = "stash_id", nulls = Nulls.SKIP) + public Builder stashId(Optional stashId) { + this.stashId = stashId; + return this; + } + + public Builder stashId(String stashId) { + this.stashId = Optional.ofNullable(stashId); + return this; + } + + public RunActionResponse build() { + return new RunActionResponse(exports, os, ret, stashId, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/StartConnectOpts.java b/src/main/java/com/pipedream/api/types/StartConnectOpts.java new file mode 100644 index 0000000..74e494d --- /dev/null +++ b/src/main/java/com/pipedream/api/types/StartConnectOpts.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = StartConnectOpts.Builder.class) +public final class StartConnectOpts { + private final Optional iframe; + + private final Map additionalProperties; + + private StartConnectOpts(Optional iframe, Map additionalProperties) { + this.iframe = iframe; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the iframe element to use + */ + @JsonProperty("iframe") + public Optional getIframe() { + return iframe; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StartConnectOpts && equalTo((StartConnectOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(StartConnectOpts other) { + return iframe.equals(other.iframe); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.iframe); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional iframe = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(StartConnectOpts other) { + iframe(other.getIframe()); + return this; + } + + /** + *

ID of the iframe element to use

+ */ + @JsonSetter(value = "iframe", nulls = Nulls.SKIP) + public Builder iframe(Optional iframe) { + this.iframe = iframe; + return this; + } + + public Builder iframe(String iframe) { + this.iframe = Optional.ofNullable(iframe); + return this; + } + + public StartConnectOpts build() { + return new StartConnectOpts(iframe, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ValidateTokenParams.java b/src/main/java/com/pipedream/api/types/ValidateTokenParams.java new file mode 100644 index 0000000..26f43cb --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ValidateTokenParams.java @@ -0,0 +1,156 @@ +/** + * 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 = ValidateTokenParams.Builder.class) +public final class ValidateTokenParams { + private final String appId; + + private final Optional oauthAppId; + + private final Map additionalProperties; + + private ValidateTokenParams(String appId, Optional oauthAppId, Map additionalProperties) { + this.appId = appId; + this.oauthAppId = oauthAppId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The app ID to validate against + */ + @JsonProperty("app_id") + public String getAppId() { + return appId; + } + + /** + * @return The OAuth app ID + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ValidateTokenParams && equalTo((ValidateTokenParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ValidateTokenParams other) { + return appId.equals(other.appId) && oauthAppId.equals(other.oauthAppId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.appId, this.oauthAppId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AppIdStage builder() { + return new Builder(); + } + + public interface AppIdStage { + /** + *

The app ID to validate against

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

The OAuth app ID

+ */ + _FinalStage oauthAppId(Optional oauthAppId); + + _FinalStage oauthAppId(String oauthAppId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AppIdStage, _FinalStage { + private String appId; + + private Optional oauthAppId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ValidateTokenParams other) { + appId(other.getAppId()); + oauthAppId(other.getOauthAppId()); + return this; + } + + /** + *

The app ID to validate against

+ *

The app ID to validate against

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

The OAuth app ID

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

The OAuth app ID

+ */ + @java.lang.Override + @JsonSetter(value = "oauth_app_id", nulls = Nulls.SKIP) + public _FinalStage oauthAppId(Optional oauthAppId) { + this.oauthAppId = oauthAppId; + return this; + } + + @java.lang.Override + public ValidateTokenParams build() { + return new ValidateTokenParams(appId, oauthAppId, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ValidateTokenResponse.java b/src/main/java/com/pipedream/api/types/ValidateTokenResponse.java new file mode 100644 index 0000000..5691d9d --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ValidateTokenResponse.java @@ -0,0 +1,511 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ValidateTokenResponse.Builder.class) +public final class ValidateTokenResponse { + private final Optional app; + + private final Optional error; + + private final Optional errorRedirectUri; + + private final Optional oauthAppId; + + private final Optional projectAppName; + + private final Optional projectEnvironment; + + private final Optional projectId; + + private final Optional projectSupportEmail; + + private final boolean success; + + private final Optional successRedirectUri; + + private final Map additionalProperties; + + private ValidateTokenResponse( + Optional app, + Optional error, + Optional errorRedirectUri, + Optional oauthAppId, + Optional projectAppName, + Optional projectEnvironment, + Optional projectId, + Optional projectSupportEmail, + boolean success, + Optional successRedirectUri, + Map additionalProperties) { + this.app = app; + this.error = error; + this.errorRedirectUri = errorRedirectUri; + this.oauthAppId = oauthAppId; + this.projectAppName = projectAppName; + this.projectEnvironment = projectEnvironment; + this.projectId = projectId; + this.projectSupportEmail = projectSupportEmail; + this.success = success; + this.successRedirectUri = successRedirectUri; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("app") + public Optional getApp() { + return app; + } + + /** + * @return Error message if validation failed + */ + @JsonProperty("error") + public Optional getError() { + return error; + } + + /** + * @return URI to redirect to on error + */ + @JsonProperty("error_redirect_uri") + public Optional getErrorRedirectUri() { + return errorRedirectUri; + } + + /** + * @return OAuth app ID if applicable + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + + /** + * @return Name of the project app + */ + @JsonProperty("project_app_name") + public Optional getProjectAppName() { + return projectAppName; + } + + /** + * @return Environment of the project + */ + @JsonProperty("project_environment") + public Optional getProjectEnvironment() { + return projectEnvironment; + } + + /** + * @return ID of the project + */ + @JsonProperty("project_id") + public Optional getProjectId() { + return projectId; + } + + /** + * @return Support email for the project + */ + @JsonProperty("project_support_email") + public Optional getProjectSupportEmail() { + return projectSupportEmail; + } + + /** + * @return Whether the token validation was successful + */ + @JsonProperty("success") + public boolean getSuccess() { + return success; + } + + /** + * @return URI to redirect to on success + */ + @JsonProperty("success_redirect_uri") + public Optional getSuccessRedirectUri() { + return successRedirectUri; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ValidateTokenResponse && equalTo((ValidateTokenResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ValidateTokenResponse other) { + return app.equals(other.app) + && error.equals(other.error) + && errorRedirectUri.equals(other.errorRedirectUri) + && oauthAppId.equals(other.oauthAppId) + && projectAppName.equals(other.projectAppName) + && projectEnvironment.equals(other.projectEnvironment) + && projectId.equals(other.projectId) + && projectSupportEmail.equals(other.projectSupportEmail) + && success == other.success + && successRedirectUri.equals(other.successRedirectUri); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.app, + this.error, + this.errorRedirectUri, + this.oauthAppId, + this.projectAppName, + this.projectEnvironment, + this.projectId, + this.projectSupportEmail, + this.success, + this.successRedirectUri); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SuccessStage builder() { + return new Builder(); + } + + public interface SuccessStage { + /** + *

Whether the token validation was successful

+ */ + _FinalStage success(boolean success); + + Builder from(ValidateTokenResponse other); + } + + public interface _FinalStage { + ValidateTokenResponse build(); + + _FinalStage app(Optional app); + + _FinalStage app(App app); + + /** + *

Error message if validation failed

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

URI to redirect to on error

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

OAuth app ID if applicable

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

Name of the project app

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

Environment of the project

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

ID of the project

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

Support email for the project

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

URI to redirect to on success

+ */ + _FinalStage successRedirectUri(Optional successRedirectUri); + + _FinalStage successRedirectUri(String successRedirectUri); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SuccessStage, _FinalStage { + private boolean success; + + private Optional successRedirectUri = Optional.empty(); + + private Optional projectSupportEmail = Optional.empty(); + + private Optional projectId = Optional.empty(); + + private Optional projectEnvironment = Optional.empty(); + + private Optional projectAppName = Optional.empty(); + + private Optional oauthAppId = Optional.empty(); + + private Optional errorRedirectUri = Optional.empty(); + + private Optional error = Optional.empty(); + + private Optional app = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ValidateTokenResponse other) { + app(other.getApp()); + error(other.getError()); + errorRedirectUri(other.getErrorRedirectUri()); + oauthAppId(other.getOauthAppId()); + projectAppName(other.getProjectAppName()); + projectEnvironment(other.getProjectEnvironment()); + projectId(other.getProjectId()); + projectSupportEmail(other.getProjectSupportEmail()); + success(other.getSuccess()); + successRedirectUri(other.getSuccessRedirectUri()); + return this; + } + + /** + *

Whether the token validation was successful

+ *

Whether the token validation was successful

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("success") + public _FinalStage success(boolean success) { + this.success = success; + return this; + } + + /** + *

URI to redirect to on success

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

URI to redirect to on success

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

Support email for the project

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

Support email for the project

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

ID of the project

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

ID of the project

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

Environment of the project

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

Environment of the project

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

Name of the project app

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

Name of the project app

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

OAuth app ID if applicable

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

OAuth app ID if applicable

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

URI to redirect to on error

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

URI to redirect to on error

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

Error message if validation failed

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

Error message if validation failed

+ */ + @java.lang.Override + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public _FinalStage error(Optional error) { + this.error = error; + return this; + } + + @java.lang.Override + public _FinalStage app(App app) { + this.app = Optional.ofNullable(app); + return this; + } + + @java.lang.Override + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public _FinalStage app(Optional app) { + this.app = app; + return this; + } + + @java.lang.Override + public ValidateTokenResponse build() { + return new ValidateTokenResponse( + app, + error, + errorRedirectUri, + oauthAppId, + projectAppName, + projectEnvironment, + projectId, + projectSupportEmail, + success, + successRedirectUri, + additionalProperties); + } + } +} diff --git a/src/test/java/com/pipedream/api/StreamTest.java b/src/test/java/com/pipedream/api/StreamTest.java new file mode 100644 index 0000000..a0f9ca9 --- /dev/null +++ b/src/test/java/com/pipedream/api/StreamTest.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import static org.junit.jupiter.api.Assertions.*; + +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.Stream; +import java.io.IOException; +import java.io.StringReader; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import org.junit.jupiter.api.Test; + +public final class StreamTest { + @Test + public void testJsonStream() { + List messages = List.of(Map.of("message", "hello"), Map.of("message", "world")); + List jsonStrings = messages.stream().map(StreamTest::mapToJson).toList(); + String input = String.join("\n", jsonStrings); + StringReader jsonInput = new StringReader(input); + Stream jsonStream = Stream.fromJson(Map.class, jsonInput); + int expectedMessages = 2; + int actualMessages = 0; + for (Map jsonObject : jsonStream) { + actualMessages++; + assertTrue(jsonObject.containsKey("message")); + } + assertEquals(expectedMessages, actualMessages); + } + + @Test + public void testSseStream() { + List events = List.of(Map.of("event", "start"), Map.of("event", "end")); + List sseStrings = events.stream().map(StreamTest::mapToSse).toList(); + String input = String.join("\n" + "\n", sseStrings); + StringReader sseInput = new StringReader(input); + Stream sseStream = Stream.fromSse(Map.class, sseInput); + int expectedEvents = 2; + int actualEvents = 0; + for (Map eventData : sseStream) { + actualEvents++; + assertTrue(eventData.containsKey("event")); + } + assertEquals(expectedEvents, actualEvents); + } + + @Test + public void testSseStreamWithTerminator() { + List events = List.of(Map.of("message", "first"), Map.of("message", "second")); + List sseStrings = events.stream().map(StreamTest::mapToSse).collect(Collectors.toList()); + sseStrings.add("data: [DONE]"); + String input = String.join("\n" + "\n", sseStrings); + StringReader sseInput = new StringReader(input); + Stream sseStream = Stream.fromSse(Map.class, sseInput, "[DONE]"); + int expectedEvents = 2; + int actualEvents = 0; + for (Map eventData : sseStream) { + actualEvents++; + assertTrue(eventData.containsKey("message")); + } + assertEquals(expectedEvents, actualEvents); + } + + @Test + public void testStreamResourceManagement() throws IOException { + StringReader testInput = new StringReader("{\"test\":\"data\"}"); + Stream testStream = Stream.fromJson(Map.class, testInput); + testStream.close(); + assertFalse(testStream.iterator().hasNext()); + } + + private static String mapToJson(Map map) { + try { + return ObjectMappers.JSON_MAPPER.writeValueAsString(map); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private static String mapToSse(Map map) { + return "data: " + mapToJson(map); + } +} diff --git a/src/test/java/com/pipedream/api/TestClient.java b/src/test/java/com/pipedream/api/TestClient.java new file mode 100644 index 0000000..157ade0 --- /dev/null +++ b/src/test/java/com/pipedream/api/TestClient.java @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +public final class TestClient { + public void test() { + // Add tests here and mark this file in .fernignore + assert true; + } +} diff --git a/src/test/java/com/pipedream/api/core/QueryStringMapperTest.java b/src/test/java/com/pipedream/api/core/QueryStringMapperTest.java new file mode 100644 index 0000000..d8eac81 --- /dev/null +++ b/src/test/java/com/pipedream/api/core/QueryStringMapperTest.java @@ -0,0 +1,339 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.HttpUrl; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class QueryStringMapperTest { + @Test + public void testObjectWithQuotedString_indexedArrays() { + Map map = new HashMap() { + { + put("hello", "\"world\""); + } + }; + + String expectedQueryString = "withquoted%5Bhello%5D=%22world%22"; + + String actualQueryString = queryString( + new HashMap() { + { + put("withquoted", map); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectWithQuotedString_arraysAsRepeats() { + Map map = new HashMap() { + { + put("hello", "\"world\""); + } + }; + + String expectedQueryString = "withquoted%5Bhello%5D=%22world%22"; + + String actualQueryString = queryString( + new HashMap() { + { + put("withquoted", map); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObject_indexedArrays() { + Map map = new HashMap() { + { + put("foo", "bar"); + put("baz", "qux"); + } + }; + + String expectedQueryString = "metadata%5Bfoo%5D=bar&metadata%5Bbaz%5D=qux"; + + String actualQueryString = queryString( + new HashMap() { + { + put("metadata", map); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObject_arraysAsRepeats() { + Map map = new HashMap() { + { + put("foo", "bar"); + put("baz", "qux"); + } + }; + + String expectedQueryString = "metadata%5Bfoo%5D=bar&metadata%5Bbaz%5D=qux"; + + String actualQueryString = queryString( + new HashMap() { + { + put("metadata", map); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testNestedObject_indexedArrays() { + Map> nestedMap = new HashMap>() { + { + put("mapkey1", new HashMap() { + { + put("mapkey1mapkey1", "mapkey1mapkey1value"); + put("mapkey1mapkey2", "mapkey1mapkey2value"); + } + }); + put("mapkey2", new HashMap() { + { + put("mapkey2mapkey1", "mapkey2mapkey1value"); + } + }); + } + }; + + String expectedQueryString = + "nested%5Bmapkey2%5D%5Bmapkey2mapkey1%5D=mapkey2mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey1" + + "%5D=mapkey1mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey2%5D=mapkey1mapkey2value"; + + String actualQueryString = queryString( + new HashMap() { + { + put("nested", nestedMap); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testNestedObject_arraysAsRepeats() { + Map> nestedMap = new HashMap>() { + { + put("mapkey1", new HashMap() { + { + put("mapkey1mapkey1", "mapkey1mapkey1value"); + put("mapkey1mapkey2", "mapkey1mapkey2value"); + } + }); + put("mapkey2", new HashMap() { + { + put("mapkey2mapkey1", "mapkey2mapkey1value"); + } + }); + } + }; + + String expectedQueryString = + "nested%5Bmapkey2%5D%5Bmapkey2mapkey1%5D=mapkey2mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey1" + + "%5D=mapkey1mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey2%5D=mapkey1mapkey2value"; + + String actualQueryString = queryString( + new HashMap() { + { + put("nested", nestedMap); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testDateTime_indexedArrays() { + OffsetDateTime dateTime = + OffsetDateTime.ofInstant(Instant.ofEpochSecond(1740412107L), ZoneId.of("America/New_York")); + + String expectedQueryString = "datetime=2025-02-24T10%3A48%3A27-05%3A00"; + + String actualQueryString = queryString( + new HashMap() { + { + put("datetime", dateTime); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testDateTime_arraysAsRepeats() { + OffsetDateTime dateTime = + OffsetDateTime.ofInstant(Instant.ofEpochSecond(1740412107L), ZoneId.of("America/New_York")); + + String expectedQueryString = "datetime=2025-02-24T10%3A48%3A27-05%3A00"; + + String actualQueryString = queryString( + new HashMap() { + { + put("datetime", dateTime); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectArray_indexedArrays() { + List> mapArray = new ArrayList>() { + { + add(new HashMap() { + { + put("key", "hello"); + put("value", "world"); + } + }); + add(new HashMap() { + { + put("key", "foo"); + put("value", "bar"); + } + }); + add(new HashMap<>()); + } + }; + + String expectedQueryString = "objects%5B0%5D%5Bvalue%5D=world&objects%5B0%5D%5Bkey%5D=hello&objects%5B1%5D" + + "%5Bvalue%5D=bar&objects%5B1%5D%5Bkey%5D=foo"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objects", mapArray); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectArray_arraysAsRepeats() { + List> mapArray = new ArrayList>() { + { + add(new HashMap() { + { + put("key", "hello"); + put("value", "world"); + } + }); + add(new HashMap() { + { + put("key", "foo"); + put("value", "bar"); + } + }); + add(new HashMap<>()); + } + }; + + String expectedQueryString = + "objects%5Bvalue%5D=world&objects%5Bkey%5D=hello&objects%5Bvalue" + "%5D=bar&objects%5Bkey%5D=foo"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objects", mapArray); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectWithArray_indexedArrays() { + Map objectWithArray = new HashMap() { + { + put("id", "abc123"); + put("contactIds", new ArrayList() { + { + add("id1"); + add("id2"); + add("id3"); + } + }); + } + }; + + String expectedQueryString = + "objectwitharray%5Bid%5D=abc123&objectwitharray%5BcontactIds%5D%5B0%5D=id1&objectwitharray" + + "%5BcontactIds%5D%5B1%5D=id2&objectwitharray%5BcontactIds%5D%5B2%5D=id3"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objectwitharray", objectWithArray); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectWithArray_arraysAsRepeats() { + Map objectWithArray = new HashMap() { + { + put("id", "abc123"); + put("contactIds", new ArrayList() { + { + add("id1"); + add("id2"); + add("id3"); + } + }); + } + }; + + String expectedQueryString = "objectwitharray%5Bid%5D=abc123&objectwitharray%5BcontactIds" + + "%5D=id1&objectwitharray%5BcontactIds%5D=id2&objectwitharray%5BcontactIds%5D=id3"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objectwitharray", objectWithArray); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + private static String queryString(Map params, boolean arraysAsRepeats) { + HttpUrl.Builder httpUrl = HttpUrl.parse("http://www.fakewebsite.com/").newBuilder(); + params.forEach((paramName, paramValue) -> + QueryStringMapper.addQueryParameter(httpUrl, paramName, paramValue, arraysAsRepeats)); + return httpUrl.build().encodedQuery(); + } +}