Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Java SDK for Pipedream

License

NotificationsYou must be signed in to change notification settings

PipedreamHQ/pipedream-sdk-java

Repository files navigation

fern shieldMaven Central

The Pipedream Java library provides convenient access to the Pipedream APIs from Java.

Table of Contents

Installation

Gradle

Add the dependency in yourbuild.gradle file:

dependencies {  implementation'com.pipedream:pipedream'}

Maven

Add the dependency in yourpom.xml file:

<dependency>  <groupId>com.pipedream</groupId>  <artifactId>pipedream</artifactId>  <version>1.1.5</version></dependency>

Usage

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()        );    }}

Environments

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();

Base Url

You can set a custom base URL when constructing the client.

importcom.pipedream.api.BaseClient;BaseClientclient =BaseClient    .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.

importcom.pipedream.api.core.PipedreamApiApiException;try{client.actions().run(...);}catch (PipedreamApiApiExceptione){// Do something with the API exception...}

Advanced

Custom Client

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();

Retries

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:

  • 408 (Timeout)
  • 429 (Too Many Requests)
  • 5XX (Internal Server Errors)

Use themaxRetries client option to configure this behavior.

importcom.pipedream.api.BaseClient;BaseClientclient =BaseClient    .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.

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());

Custom Headers

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());

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 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!

Reference

A full reference for this library is availablehere.

About

Java SDK for Pipedream

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors3

  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp