Skip to content

Commit b11ab6a

Browse files
SDK regeneration
1 parent caa554c commit b11ab6a

File tree

106 files changed

+4450
-2082
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+4450
-2082
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Add the dependency in your `pom.xml` file:
2525
<dependency>
2626
<groupId>com.pipedream</groupId>
2727
<artifactId>pipedream</artifactId>
28-
<version>1.0.5</version>
28+
<version>1.0.6</version>
2929
</dependency>
3030
```
3131

@@ -45,10 +45,10 @@ public class Example {
4545
.builder()
4646
.clientId("<clientId>")
4747
.clientSecret("<clientSecret>")
48+
.projectId("YOUR_PROJECT_ID")
4849
.build();
4950

5051
client.actions().run(
51-
"project_id",
5252
RunActionOpts
5353
.builder()
5454
.id("id")
@@ -93,9 +93,9 @@ When the API returns a non-success status code (4xx or 5xx response), an API exc
9393
```java
9494
import com.pipedream.api.core.PipedreamApiApiException;
9595

96-
try {
96+
try{
9797
client.actions().run(...);
98-
} catch (PipedreamApiApiException e) {
98+
} catch (PipedreamApiApiException e){
9999
// Do something with the API exception...
100100
}
101101
```

build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ dependencies {
2222
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
2323
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2'
2424
api 'org.apache.commons:commons-text:1.13.1'
25+
testImplementation 'com.squareup.okhttp3:mockwebserver:4.12.0'
2526
}
2627

2728

@@ -48,7 +49,7 @@ java {
4849

4950
group = 'com.pipedream'
5051

51-
version = '1.0.5'
52+
version = '1.0.6'
5253

5354
jar {
5455
dependsOn(":generatePomFileForMavenPublication")
@@ -79,7 +80,7 @@ publishing {
7980
maven(MavenPublication) {
8081
groupId = 'com.pipedream'
8182
artifactId = 'pipedream'
82-
version = '1.0.5'
83+
version = '1.0.6'
8384
from components.java
8485
pom {
8586
name = 'pipedream'

src/main/java/com/pipedream/api/AsyncBaseClient.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.pipedream.api.resources.apps.AsyncAppsClient;
1212
import com.pipedream.api.resources.components.AsyncComponentsClient;
1313
import com.pipedream.api.resources.deployedtriggers.AsyncDeployedTriggersClient;
14+
import com.pipedream.api.resources.filestash.AsyncFileStashClient;
1415
import com.pipedream.api.resources.oauthtokens.AsyncOauthTokensClient;
1516
import com.pipedream.api.resources.projects.AsyncProjectsClient;
1617
import com.pipedream.api.resources.proxy.AsyncProxyClient;
@@ -40,6 +41,8 @@ public class AsyncBaseClient {
4041

4142
protected final Supplier<AsyncProjectsClient> projectsClient;
4243

44+
protected final Supplier<AsyncFileStashClient> fileStashClient;
45+
4346
protected final Supplier<AsyncProxyClient> proxyClient;
4447

4548
protected final Supplier<AsyncTokensClient> tokensClient;
@@ -57,6 +60,7 @@ public AsyncBaseClient(ClientOptions clientOptions) {
5760
this.triggersClient = Suppliers.memoize(() -> new AsyncTriggersClient(clientOptions));
5861
this.deployedTriggersClient = Suppliers.memoize(() -> new AsyncDeployedTriggersClient(clientOptions));
5962
this.projectsClient = Suppliers.memoize(() -> new AsyncProjectsClient(clientOptions));
63+
this.fileStashClient = Suppliers.memoize(() -> new AsyncFileStashClient(clientOptions));
6064
this.proxyClient = Suppliers.memoize(() -> new AsyncProxyClient(clientOptions));
6165
this.tokensClient = Suppliers.memoize(() -> new AsyncTokensClient(clientOptions));
6266
this.oauthTokensClient = Suppliers.memoize(() -> new AsyncOauthTokensClient(clientOptions));
@@ -98,6 +102,10 @@ public AsyncProjectsClient projects() {
98102
return this.projectsClient.get();
99103
}
100104

105+
public AsyncFileStashClient fileStash() {
106+
return this.fileStashClient.get();
107+
}
108+
101109
public AsyncProxyClient proxy() {
102110
return this.proxyClient.get();
103111
}

src/main/java/com/pipedream/api/AsyncBaseClientBuilder.java

Lines changed: 60 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@
77
import com.pipedream.api.core.Environment;
88
import com.pipedream.api.core.OAuthTokenSupplier;
99
import com.pipedream.api.resources.oauthtokens.OauthTokensClient;
10+
import java.util.HashMap;
11+
import java.util.Map;
1012
import java.util.Optional;
1113
import okhttp3.OkHttpClient;
1214

13-
public class AsyncBaseClientBuilder<T extends AsyncBaseClientBuilder<T>> {
15+
public class AsyncBaseClientBuilder {
1416
private Optional<Integer> timeout = Optional.empty();
1517

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

20+
private final Map<String, String> customHeaders = new HashMap<>();
21+
1822
private String clientId = System.getenv("PIPEDREAM_CLIENT_ID");
1923

2024
private String clientSecret = System.getenv("PIPEDREAM_CLIENT_SECRET");
@@ -25,72 +29,84 @@ public class AsyncBaseClientBuilder<T extends AsyncBaseClientBuilder<T>> {
2529

2630
private OkHttpClient httpClient;
2731

32+
private String projectId;
33+
2834
/**
2935
* Sets clientId.
3036
* Defaults to the PIPEDREAM_CLIENT_ID environment variable.
3137
*/
32-
@SuppressWarnings("unchecked")
33-
public T clientId(String clientId) {
38+
public AsyncBaseClientBuilder clientId(String clientId) {
3439
this.clientId = clientId;
35-
return (T) this;
40+
return this;
3641
}
3742

3843
/**
3944
* Sets clientSecret.
4045
* Defaults to the PIPEDREAM_CLIENT_SECRET environment variable.
4146
*/
42-
@SuppressWarnings("unchecked")
43-
public T clientSecret(String clientSecret) {
47+
public AsyncBaseClientBuilder clientSecret(String clientSecret) {
4448
this.clientSecret = clientSecret;
45-
return (T) this;
49+
return this;
4650
}
4751

4852
/**
4953
* Sets projectEnvironment
5054
*/
51-
@SuppressWarnings("unchecked")
52-
public T projectEnvironment(String projectEnvironment) {
55+
public AsyncBaseClientBuilder projectEnvironment(String projectEnvironment) {
5356
this.projectEnvironment = projectEnvironment;
54-
return (T) this;
57+
return this;
5558
}
5659

57-
@SuppressWarnings("unchecked")
58-
public T environment(Environment environment) {
60+
public AsyncBaseClientBuilder environment(Environment environment) {
5961
this.environment = environment;
60-
return (T) this;
62+
return this;
6163
}
6264

63-
@SuppressWarnings("unchecked")
64-
public T url(String url) {
65+
public AsyncBaseClientBuilder url(String url) {
6566
this.environment = Environment.custom(url);
66-
return (T) this;
67+
return this;
6768
}
6869

6970
/**
7071
* Sets the timeout (in seconds) for the client. Defaults to 60 seconds.
7172
*/
72-
@SuppressWarnings("unchecked")
73-
public T timeout(int timeout) {
73+
public AsyncBaseClientBuilder timeout(int timeout) {
7474
this.timeout = Optional.of(timeout);
75-
return (T) this;
75+
return this;
7676
}
7777

7878
/**
7979
* Sets the maximum number of retries for the client. Defaults to 2 retries.
8080
*/
81-
@SuppressWarnings("unchecked")
82-
public T maxRetries(int maxRetries) {
81+
public AsyncBaseClientBuilder maxRetries(int maxRetries) {
8382
this.maxRetries = Optional.of(maxRetries);
84-
return (T) this;
83+
return this;
8584
}
8685

8786
/**
8887
* Sets the underlying OkHttp client
8988
*/
90-
@SuppressWarnings("unchecked")
91-
public T httpClient(OkHttpClient httpClient) {
89+
public AsyncBaseClientBuilder httpClient(OkHttpClient httpClient) {
9290
this.httpClient = httpClient;
93-
return (T) this;
91+
return this;
92+
}
93+
94+
/**
95+
* Add a custom header to be sent with all requests.
96+
* For headers that need to be computed dynamically or conditionally, use the setAdditional() method override instead.
97+
*
98+
* @param name The header name
99+
* @param value The header value
100+
* @return This builder for method chaining
101+
*/
102+
public AsyncBaseClientBuilder addHeader(String name, String value) {
103+
this.customHeaders.put(name, value);
104+
return this;
105+
}
106+
107+
public AsyncBaseClientBuilder projectId(String projectId) {
108+
this.projectId = projectId;
109+
return this;
94110
}
95111

96112
protected ClientOptions buildClientOptions() {
@@ -102,6 +118,9 @@ protected ClientOptions buildClientOptions() {
102118
setHttpClient(builder);
103119
setTimeouts(builder);
104120
setRetries(builder);
121+
for (Map.Entry<String, String> header : this.customHeaders.entrySet()) {
122+
builder.addHeader(header.getKey(), header.getValue());
123+
}
105124
setAdditional(builder);
106125
return builder.build();
107126
}
@@ -124,7 +143,7 @@ protected void setEnvironment(ClientOptions.Builder builder) {
124143
*
125144
* Example:
126145
* <pre>{@code
127-
* @Override
146+
* &#64;Override
128147
* protected void setAuthentication(ClientOptions.Builder builder) {
129148
* super.setAuthentication(builder); // Keep existing auth
130149
* builder.addHeader("X-API-Key", this.apiKey);
@@ -133,8 +152,12 @@ protected void setEnvironment(ClientOptions.Builder builder) {
133152
*/
134153
protected void setAuthentication(ClientOptions.Builder builder) {
135154
if (this.clientId != null && this.clientSecret != null) {
136-
OauthTokensClient authClient = new OauthTokensClient(
137-
ClientOptions.builder().environment(this.environment).build());
155+
ClientOptions.Builder authClientOptionsBuilder =
156+
ClientOptions.builder().environment(this.environment);
157+
if (this.projectId != null) {
158+
authClientOptionsBuilder.projectId(this.projectId);
159+
}
160+
OauthTokensClient authClient = new OauthTokensClient(authClientOptionsBuilder.build());
138161
OAuthTokenSupplier oAuthTokenSupplier =
139162
new OAuthTokenSupplier(this.clientId, this.clientSecret, authClient);
140163
builder.addHeader("Authorization", oAuthTokenSupplier);
@@ -149,7 +172,7 @@ protected void setAuthentication(ClientOptions.Builder builder) {
149172
*
150173
* Example:
151174
* <pre>{@code
152-
* @Override
175+
* &#64;Override
153176
* protected void setCustomHeaders(ClientOptions.Builder builder) {
154177
* super.setCustomHeaders(builder); // Keep existing headers
155178
* builder.addHeader("X-Trace-ID", generateTraceId());
@@ -168,7 +191,11 @@ protected void setCustomHeaders(ClientOptions.Builder builder) {
168191
*
169192
* @param builder The ClientOptions.Builder to configure
170193
*/
171-
protected void setVariables(ClientOptions.Builder builder) {}
194+
protected void setVariables(ClientOptions.Builder builder) {
195+
if (this.projectId != null) {
196+
builder.projectId(this.projectId);
197+
}
198+
}
172199

173200
/**
174201
* Sets the request timeout configuration.
@@ -215,9 +242,9 @@ protected void setHttpClient(ClientOptions.Builder builder) {
215242
*
216243
* Example:
217244
* <pre>{@code
218-
* @Override
245+
* &#64;Override
219246
* protected void setAdditional(ClientOptions.Builder builder) {
220-
* builder.addHeader("X-Request-ID", () -> UUID.randomUUID().toString());
247+
* builder.addHeader("X-Request-ID", () -&gt; UUID.randomUUID().toString());
221248
* builder.addHeader("X-Client-Version", "1.0.0");
222249
* }
223250
* }</pre>
@@ -231,7 +258,7 @@ protected void setAdditional(ClientOptions.Builder builder) {}
231258
*
232259
* Example:
233260
* <pre>{@code
234-
* @Override
261+
* &#64;Override
235262
* protected void validateConfiguration() {
236263
* super.validateConfiguration(); // Run parent validations
237264
* if (tenantId == null || tenantId.isEmpty()) {

src/main/java/com/pipedream/api/AsyncPipedreamClient.java

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/main/java/com/pipedream/api/AsyncPipedreamClientBuilder.java

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)