- Notifications
You must be signed in to change notification settings - Fork2
PipedreamHQ/pipedream-sdk-java
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
The Pipedream Java library provides convenient access to the Pipedream APIs from Java.
Add the dependency in yourbuild.gradle file:
dependencies { implementation'com.pipedream:pipedream'}Add the dependency in yourpom.xml file:
<dependency> <groupId>com.pipedream</groupId> <artifactId>pipedream</artifactId> <version>1.1.5</version></dependency>
Instantiate and use the client with the following:
packagecom.example.usage;importcom.pipedream.api.BaseClient;importcom.pipedream.api.resources.actions.requests.RunActionOpts;publicclassExample {publicstaticvoidmain(String[]args) {BaseClientclient =BaseClient .builder() .clientId("<clientId>") .clientSecret("<clientSecret>") .projectId("YOUR_PROJECT_ID") .build();client.actions().run(RunActionOpts .builder() .id("id") .externalUserId("external_user_id") .build() ); }}
This SDK allows you to configure different environments for API requests.
importcom.pipedream.api.BaseClient;importcom.pipedream.api.core.Environment;BaseClientclient =BaseClient .builder() .environment(Environment.Prod) .build();
You can set a custom base URL when constructing the client.
importcom.pipedream.api.BaseClient;BaseClientclient =BaseClient .builder() .url("https://example.com") .build();
When the API returns a non-success status code (4xx or 5xx response), an API exception will be thrown.
importcom.pipedream.api.core.PipedreamApiApiException;try{client.actions().run(...);}catch (PipedreamApiApiExceptione){// Do something with the API exception...}
This SDK is built to work with any instance ofOkHttpClient. By default, if no client is provided, the SDK will construct one.However, you can pass your own client like so:
importcom.pipedream.api.BaseClient;importokhttp3.OkHttpClient;OkHttpClientcustomClient = ...;BaseClientclient =BaseClient .builder() .httpClient(customClient) .build();
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as longas the request is deemed retryable and the number of retry attempts has not grown larger than the configuredretry limit (default: 2).
A request is deemed retryable when any of the following HTTP status codes is returned:
Use themaxRetries client option to configure this behavior.
importcom.pipedream.api.BaseClient;BaseClientclient =BaseClient .builder() .maxRetries(1) .build();
The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
importcom.pipedream.api.BaseClient;importcom.pipedream.api.core.RequestOptions;// Client levelBaseClientclient =BaseClient .builder() .timeout(10) .build();// Request levelclient.actions().run( ...,RequestOptions .builder() .timeout(10) .build());
The SDK allows you to add custom headers to requests. You can configure headers at the client level or at the request level.
importcom.pipedream.api.BaseClient;importcom.pipedream.api.core.RequestOptions;// Client levelBaseClientclient =BaseClient .builder() .addHeader("X-Custom-Header","custom-value") .addHeader("X-Request-Id","abc-123") .build();;// Request levelclient.actions().run( ...,RequestOptions .builder() .addHeader("X-Request-Header","request-value") .build());
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 asa proof of concept, but know that we will not be able to merge it as-is. We suggest openingan issue first to discuss with us!
On the other hand, contributions to the README are always very welcome!
A full reference for this library is availablehere.
About
Java SDK for Pipedream
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.