@@ -17,6 +17,7 @@ The Pipedream Java library provides convenient access to the Pipedream APIs from
1717 - [ Retries] ( #retries )
1818 - [ Timeouts] ( #timeouts )
1919 - [ Custom Headers] ( #custom-headers )
20+ - [ Access Raw Response Data] ( #access-raw-response-data )
2021- [ Contributing] ( #contributing )
2122- [ Reference] ( #reference )
2223
@@ -40,7 +41,7 @@ Add the dependency in your `pom.xml` file:
4041<dependency >
4142 <groupId >com.pipedream</groupId >
4243 <artifactId >pipedream</artifactId >
43- <version >1.1.5 </version >
44+ <version >1.1.6 </version >
4445</dependency >
4546```
4647
@@ -56,12 +57,10 @@ import com.pipedream.api.resources.actions.requests.RunActionOpts;
5657
5758public class Example {
5859 public static void main (String [] args ) {
59- BaseClient client = BaseClient
60- .builder()
61- .clientId(" <clientId>" )
62- .clientSecret(" <clientSecret>" )
60+ BaseClient client = BaseClient . withCredentials(" <clientId>" , " <clientSecret>" )
6361 .projectId(" YOUR_PROJECT_ID" )
64- .build();
62+ .build()
63+ ;
6564
6665 client. actions(). run(
6766 RunActionOpts
@@ -73,6 +72,29 @@ public class Example {
7372 }
7473}
7574```
75+ ## Authentication
76+
77+ This SDK supports two authentication methods:
78+
79+ ### Option 1: Direct Bearer Token
80+
81+ If you already have a valid access token, you can use it directly:
82+
83+ ``` java
84+ BaseClient client = BaseClient . withToken(" your-access-token" )
85+ .url(" https://api.example.com" )
86+ .build();
87+ ```
88+
89+ ### Option 2: OAuth Client Credentials
90+
91+ The SDK can automatically handle token acquisition and refresh:
92+
93+ ``` java
94+ BaseClient client = BaseClient . withCredentials(" client-id" , " client-secret" )
95+ .url(" https://api.example.com" )
96+ .build();
97+ ```
7698
7799## Environments
78100
@@ -138,7 +160,9 @@ BaseClient client = BaseClient
138160
139161The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
140162as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
141- retry limit (default: 2).
163+ retry limit (default: 2). Before defaulting to exponential backoff, the SDK will first attempt to respect
164+ the ` Retry-After ` header (as either in seconds or as an HTTP date), and then the ` X-RateLimit-Reset ` header
165+ (as a Unix timestamp in epoch seconds); failing both of those, it will fall back to exponential backoff.
142166
143167A request is deemed retryable when any of the following HTTP status codes is returned:
144168
@@ -160,23 +184,22 @@ BaseClient client = BaseClient
160184### Timeouts
161185
162186The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
163-
164187``` java
165188import com.pipedream.api.BaseClient ;
166189import com.pipedream.api.core.RequestOptions ;
167190
168191// Client level
169192BaseClient client = BaseClient
170193 .builder()
171- .timeout(10 )
194+ .timeout(60 )
172195 .build();
173196
174197// Request level
175198client. actions(). run(
176199 ... ,
177200 RequestOptions
178201 .builder()
179- .timeout(10 )
202+ .timeout(60 )
180203 .build()
181204);
182205```
@@ -207,6 +230,19 @@ client.actions().run(
207230);
208231```
209232
233+ ### Access Raw Response Data
234+
235+ The SDK provides access to raw response data, including headers, through the ` withRawResponse() ` method.
236+ The ` withRawResponse() ` method returns a raw client that wraps all responses with ` body() ` and ` headers() ` methods.
237+ (A normal client's ` response ` is identical to a raw client's ` response.body() ` .)
238+
239+ ``` java
240+ RunHttpResponse response = client. actions(). withRawResponse(). run(... );
241+
242+ System . out. println(response. body());
243+ System . out. println(response. headers(). get(" X-My-Header" ));
244+ ```
245+
210246## Contributing
211247
212248While we value open-source contributions to this SDK, this library is generated programmatically.
0 commit comments