Skip to content

🌿 Fern Regeneration -- July 25, 2025 #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .gradle/8.14.3/checksums/checksums.lock
Binary file not shown.
Binary file modified .gradle/8.14.3/checksums/md5-checksums.bin
Binary file not shown.
Binary file modified .gradle/8.14.3/checksums/sha1-checksums.bin
Binary file not shown.
Binary file modified .gradle/8.14.3/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/8.14.3/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/8.14.3/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/8.14.3/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
2 changes: 1 addition & 1 deletion .gradle/buildOutputCleanup/cache.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Thu Jul 24 19:20:25 UTC 2025
#Fri Jul 25 19:16:14 UTC 2025
gradle.version=8.14.3
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Add the dependency in your `pom.xml` file:
<dependency>
<groupId>com.pipedream</groupId>
<artifactId>pipedream</artifactId>
<version>0.0.237</version>
<version>0.0.246</version>
</dependency>
```

Expand All @@ -37,7 +37,7 @@ Instantiate and use the client with the following:
package com.example.usage;

import com.pipedream.api.BaseClient;
import com.pipedream.api.resources.accounts.requests.CreateAccountRequest;
import com.pipedream.api.resources.accounts.requests.CreateAccountOpts;

public class Example {
public static void main(String[] args) {
Expand All @@ -49,7 +49,7 @@ public class Example {

client.accounts().create(
"project_id",
CreateAccountRequest
CreateAccountOpts
.builder()
.appSlug("app_slug")
.cfmapJson("cfmap_json")
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ java {

group = 'com.pipedream'

version = '0.0.237'
version = '0.0.246'

jar {
dependsOn(":generatePomFileForMavenPublication")
Expand Down Expand Up @@ -79,7 +79,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.pipedream'
artifactId = 'pipedream'
version = '0.0.237'
version = '0.0.246'
from components.java
pom {
name = 'pipedream'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
import com.pipedream.api.core.Environment;
import com.pipedream.api.core.OAuthTokenSupplier;
import com.pipedream.api.resources.oauthtokens.OauthTokensClient;
import java.util.Optional;
import okhttp3.OkHttpClient;

public class AsyncBaseClientBuilder {
private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder();
private Optional<Integer> timeout = Optional.empty();

private Optional<Integer> maxRetries = Optional.empty();

private String clientId = System.getenv("PIPEDREAM_CLIENT_ID");

Expand All @@ -20,6 +23,8 @@ public class AsyncBaseClientBuilder {

private Environment environment = Environment.PROD;

private OkHttpClient httpClient;

/**
* Sets clientId.
* Defaults to the PIPEDREAM_CLIENT_ID environment variable.
Expand Down Expand Up @@ -60,23 +65,23 @@ public AsyncBaseClientBuilder url(String url) {
* Sets the timeout (in seconds) for the client. Defaults to 60 seconds.
*/
public AsyncBaseClientBuilder timeout(int timeout) {
this.clientOptionsBuilder.timeout(timeout);
this.timeout = Optional.of(timeout);
return this;
}

/**
* Sets the maximum number of retries for the client. Defaults to 2 retries.
*/
public AsyncBaseClientBuilder maxRetries(int maxRetries) {
this.clientOptionsBuilder.maxRetries(maxRetries);
this.maxRetries = Optional.of(maxRetries);
return this;
}

/**
* Sets the underlying OkHttp client
*/
public AsyncBaseClientBuilder httpClient(OkHttpClient httpClient) {
this.clientOptionsBuilder.httpClient(httpClient);
this.httpClient = httpClient;
return this;
}

Expand All @@ -86,18 +91,156 @@ public AsyncBaseClientBuilder projectId(String projectId) {
}

protected ClientOptions buildClientOptions() {
clientOptionsBuilder.environment(this.environment);
return clientOptionsBuilder.build();
ClientOptions.Builder builder = ClientOptions.builder();
setEnvironment(builder);
setAuthentication(builder);
setCustomHeaders(builder);
setVariables(builder);
setHttpClient(builder);
setTimeouts(builder);
setRetries(builder);
setAdditional(builder);
return builder.build();
}

public AsyncBaseClient 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);
/**
* Sets the environment configuration for the client.
* Override this method to modify URLs or add environment-specific logic.
*
* @param builder The ClientOptions.Builder to configure
*/
protected void setEnvironment(ClientOptions.Builder builder) {
builder.environment(this.environment);
}

/**
* Override this method to customize authentication.
* This method is called during client options construction to set up authentication headers.
*
* @param builder The ClientOptions.Builder to configure
*
* Example:
* <pre>{@code
* @Override
* protected void setAuthentication(ClientOptions.Builder builder) {
* super.setAuthentication(builder); // Keep existing auth
* builder.addHeader("X-API-Key", this.apiKey);
* }
* }</pre>
*/
protected void setAuthentication(ClientOptions.Builder builder) {
if (this.clientId != null && this.clientSecret != null) {
OauthTokensClient authClient = new OauthTokensClient(
ClientOptions.builder().environment(this.environment).build());
OAuthTokenSupplier oAuthTokenSupplier =
new OAuthTokenSupplier(this.clientId, this.clientSecret, authClient);
builder.addHeader("Authorization", oAuthTokenSupplier);
}
}

/**
* Override this method to add or modify custom headers.
* This method is called during client options construction to set up custom headers defined in the API.
*
* @param builder The ClientOptions.Builder to configure
*
* Example:
* <pre>{@code
* @Override
* protected void setCustomHeaders(ClientOptions.Builder builder) {
* super.setCustomHeaders(builder); // Keep existing headers
* builder.addHeader("X-Trace-ID", generateTraceId());
* }
* }</pre>
*/
protected void setCustomHeaders(ClientOptions.Builder builder) {
if (this.projectEnvironment != null) {
builder.addHeader("x-pd-environment", this.projectEnvironment);
}
}

/**
* Override this method to configure API variables defined in the specification.
* Available variables: projectId
*
* @param builder The ClientOptions.Builder to configure
*/
protected void setVariables(ClientOptions.Builder builder) {}

/**
* Sets the request timeout configuration.
* Override this method to customize timeout behavior.
*
* @param builder The ClientOptions.Builder to configure
*/
protected void setTimeouts(ClientOptions.Builder builder) {
if (this.timeout.isPresent()) {
builder.timeout(this.timeout.get());
}
}

/**
* Sets the retry configuration for failed requests.
* Override this method to implement custom retry strategies.
*
* @param builder The ClientOptions.Builder to configure
*/
protected void setRetries(ClientOptions.Builder builder) {
if (this.maxRetries.isPresent()) {
builder.maxRetries(this.maxRetries.get());
}
}

/**
* Sets the OkHttp client configuration.
* Override this method to customize HTTP client behavior (interceptors, connection pools, etc).
*
* @param builder The ClientOptions.Builder to configure
*/
protected void setHttpClient(ClientOptions.Builder builder) {
if (this.httpClient != null) {
builder.httpClient(this.httpClient);
}
}

/**
* Override this method to add any additional configuration to the client.
* This method is called at the end of the configuration chain, allowing you to add
* custom headers, modify settings, or perform any other client customization.
*
* @param builder The ClientOptions.Builder to configure
*
* Example:
* <pre>{@code
* @Override
* protected void setAdditional(ClientOptions.Builder builder) {
* builder.addHeader("X-Request-ID", () -> UUID.randomUUID().toString());
* builder.addHeader("X-Client-Version", "1.0.0");
* }
* }</pre>
*/
protected void setAdditional(ClientOptions.Builder builder) {}

/**
* Override this method to add custom validation logic before the client is built.
* This method is called at the beginning of the build() method to ensure the configuration is valid.
* Throw an exception to prevent client creation if validation fails.
*
* Example:
* <pre>{@code
* @Override
* protected void validateConfiguration() {
* super.validateConfiguration(); // Run parent validations
* if (tenantId == null || tenantId.isEmpty()) {
* throw new IllegalStateException("tenantId is required");
* }
* }
* }</pre>
*/
protected void validateConfiguration() {}

public AsyncBaseClient build() {
validateConfiguration();
return new AsyncBaseClient(buildClientOptions());
}
}
Loading