{@code
- * @Override
+ * @Override
* protected void setAuthentication(ClientOptions.Builder builder) {
* super.setAuthentication(builder); // Keep existing auth
* builder.addHeader("X-API-Key", this.apiKey);
@@ -133,8 +152,12 @@ protected void setEnvironment(ClientOptions.Builder builder) {
*/
protected void setAuthentication(ClientOptions.Builder builder) {
if (this.clientId != null && this.clientSecret != null) {
- OauthTokensClient authClient = new OauthTokensClient(
- ClientOptions.builder().environment(this.environment).build());
+ ClientOptions.Builder authClientOptionsBuilder =
+ ClientOptions.builder().environment(this.environment);
+ if (this.projectId != null) {
+ authClientOptionsBuilder.projectId(this.projectId);
+ }
+ OauthTokensClient authClient = new OauthTokensClient(authClientOptionsBuilder.build());
OAuthTokenSupplier oAuthTokenSupplier =
new OAuthTokenSupplier(this.clientId, this.clientSecret, authClient);
builder.addHeader("Authorization", oAuthTokenSupplier);
@@ -149,7 +172,7 @@ protected void setAuthentication(ClientOptions.Builder builder) {
*
* Example:
* {@code
- * @Override
+ * @Override
* protected void setCustomHeaders(ClientOptions.Builder builder) {
* super.setCustomHeaders(builder); // Keep existing headers
* builder.addHeader("X-Trace-ID", generateTraceId());
@@ -168,7 +191,11 @@ protected void setCustomHeaders(ClientOptions.Builder builder) {
*
* @param builder The ClientOptions.Builder to configure
*/
- protected void setVariables(ClientOptions.Builder builder) {}
+ protected void setVariables(ClientOptions.Builder builder) {
+ if (this.projectId != null) {
+ builder.projectId(this.projectId);
+ }
+ }
/**
* Sets the request timeout configuration.
@@ -215,9 +242,9 @@ protected void setHttpClient(ClientOptions.Builder builder) {
*
* Example:
* {@code
- * @Override
+ * @Override
* protected void setAdditional(ClientOptions.Builder builder) {
- * builder.addHeader("X-Request-ID", () -> UUID.randomUUID().toString());
+ * builder.addHeader("X-Request-ID", () -> UUID.randomUUID().toString());
* builder.addHeader("X-Client-Version", "1.0.0");
* }
* }
@@ -231,7 +258,7 @@ protected void setAdditional(ClientOptions.Builder builder) {}
*
* Example:
* {@code
- * @Override
+ * @Override
* protected void validateConfiguration() {
* super.validateConfiguration(); // Run parent validations
* if (tenantId == null || tenantId.isEmpty()) {
diff --git a/src/main/java/com/pipedream/api/AsyncPipedreamClient.java b/src/main/java/com/pipedream/api/AsyncPipedreamClient.java
deleted file mode 100644
index c0464da..0000000
--- a/src/main/java/com/pipedream/api/AsyncPipedreamClient.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.pipedream.api;
-
-import com.pipedream.api.core.ClientOptions;
-import com.pipedream.api.core.Environment;
-import com.pipedream.api.core.Suppliers;
-import com.pipedream.api.resources.workflows.WorkflowsClient;
-import java.util.Optional;
-import java.util.function.Supplier;
-
-public class AsyncPipedreamClient extends AsyncBaseClient {
- private final Supplier workflowsClient;
-
- public AsyncPipedreamClient(final ClientOptions clientOptions) {
- super(clientOptions);
- this.workflowsClient = Suppliers.memoize(() -> new WorkflowsClient(clientOptions));
- }
-
- public static AsyncPipedreamClientBuilder builder() {
- return new AsyncPipedreamClientBuilder()
- .clientId(System.getenv("PIPEDREAM_CLIENT_ID"))
- .clientSecret(System.getenv("PIPEDREAM_CLIENT_SECRET"))
- .environment(Environment.PROD)
- .projectEnvironment(System.getenv("PIPEDREAM_PROJECT_ENVIRONMENT"))
- .projectId(System.getenv("PIPEDREAM_PROJECT_ID"));
- }
-
- /**
- * Returns an access token that can be used to authenticate API requests
- *
- * @return the access token string (if available)
- */
- public Optional rawAccessToken() {
- final String authorizationHeader = this.clientOptions.headers(null).get("Authorization");
-
- // The header might not be defined, so we wrap it as an Optional to
- // further process it. The processing consists of removing the `Bearer`
- // or `Basic` prefix from the header value.
- return Optional.ofNullable(authorizationHeader).map(h -> h.replaceFirst("^.*?\\s+", ""));
- }
-
- public WorkflowsClient workflows() {
- return this.workflowsClient.get();
- }
-}
diff --git a/src/main/java/com/pipedream/api/AsyncPipedreamClientBuilder.java b/src/main/java/com/pipedream/api/AsyncPipedreamClientBuilder.java
deleted file mode 100644
index 8dc55ad..0000000
--- a/src/main/java/com/pipedream/api/AsyncPipedreamClientBuilder.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.pipedream.api;
-
-import com.pipedream.api.core.ClientOptions;
-import com.pipedream.api.core.Environment;
-import org.apache.commons.text.StringSubstitutor;
-import org.apache.commons.text.lookup.StringLookupFactory;
-
-/**
- * Builder for creating AsyncPipedreamClient instances.
- */
-public final class AsyncPipedreamClientBuilder extends AsyncBaseClientBuilder {
- private String projectId;
-
- public AsyncPipedreamClient build() {
- return new AsyncPipedreamClient(buildClientOptions());
- }
-
- public AsyncPipedreamClientBuilder environment(final Environment environment) {
- final String patchedUrl = patchUrl(environment.getUrl());
- final Environment withPatchedUrl = Environment.custom(patchedUrl);
- super.environment(withPatchedUrl);
- return this;
- }
-
- public AsyncPipedreamClientBuilder projectId(final String projectId) {
- this.projectId = projectId;
- return this;
- }
-
- @Override
- public void setVariables(ClientOptions.Builder builder) {
- builder.projectId(this.projectId);
- }
-
- private static String patchUrl(final String templateUrl) {
- StringSubstitutor sub = new StringSubstitutor(StringLookupFactory.INSTANCE.environmentVariableStringLookup());
-
- return sub.replace(templateUrl);
- }
-}
diff --git a/src/main/java/com/pipedream/api/BaseClient.java b/src/main/java/com/pipedream/api/BaseClient.java
index 69e5677..387fe22 100644
--- a/src/main/java/com/pipedream/api/BaseClient.java
+++ b/src/main/java/com/pipedream/api/BaseClient.java
@@ -11,6 +11,7 @@
import com.pipedream.api.resources.apps.AppsClient;
import com.pipedream.api.resources.components.ComponentsClient;
import com.pipedream.api.resources.deployedtriggers.DeployedTriggersClient;
+import com.pipedream.api.resources.filestash.FileStashClient;
import com.pipedream.api.resources.oauthtokens.OauthTokensClient;
import com.pipedream.api.resources.projects.ProjectsClient;
import com.pipedream.api.resources.proxy.ProxyClient;
@@ -40,6 +41,8 @@ public class BaseClient {
protected final Supplier projectsClient;
+ protected final Supplier fileStashClient;
+
protected final Supplier proxyClient;
protected final Supplier tokensClient;
@@ -57,6 +60,7 @@ public BaseClient(ClientOptions clientOptions) {
this.triggersClient = Suppliers.memoize(() -> new TriggersClient(clientOptions));
this.deployedTriggersClient = Suppliers.memoize(() -> new DeployedTriggersClient(clientOptions));
this.projectsClient = Suppliers.memoize(() -> new ProjectsClient(clientOptions));
+ this.fileStashClient = Suppliers.memoize(() -> new FileStashClient(clientOptions));
this.proxyClient = Suppliers.memoize(() -> new ProxyClient(clientOptions));
this.tokensClient = Suppliers.memoize(() -> new TokensClient(clientOptions));
this.oauthTokensClient = Suppliers.memoize(() -> new OauthTokensClient(clientOptions));
@@ -98,6 +102,10 @@ public ProjectsClient projects() {
return this.projectsClient.get();
}
+ public FileStashClient fileStash() {
+ return this.fileStashClient.get();
+ }
+
public ProxyClient proxy() {
return this.proxyClient.get();
}
diff --git a/src/main/java/com/pipedream/api/BaseClientBuilder.java b/src/main/java/com/pipedream/api/BaseClientBuilder.java
index 79c1350..ba2a069 100644
--- a/src/main/java/com/pipedream/api/BaseClientBuilder.java
+++ b/src/main/java/com/pipedream/api/BaseClientBuilder.java
@@ -7,14 +7,18 @@
import com.pipedream.api.core.Environment;
import com.pipedream.api.core.OAuthTokenSupplier;
import com.pipedream.api.resources.oauthtokens.OauthTokensClient;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Optional;
import okhttp3.OkHttpClient;
-public class BaseClientBuilder> {
+public class BaseClientBuilder {
private Optional timeout = Optional.empty();
private Optional maxRetries = Optional.empty();
+ private final Map customHeaders = new HashMap<>();
+
private String clientId = System.getenv("PIPEDREAM_CLIENT_ID");
private String clientSecret = System.getenv("PIPEDREAM_CLIENT_SECRET");
@@ -25,72 +29,84 @@ public class BaseClientBuilder> {
private OkHttpClient httpClient;
+ private String projectId;
+
/**
* Sets clientId.
* Defaults to the PIPEDREAM_CLIENT_ID environment variable.
*/
- @SuppressWarnings("unchecked")
- public T clientId(String clientId) {
+ public BaseClientBuilder clientId(String clientId) {
this.clientId = clientId;
- return (T) this;
+ return this;
}
/**
* Sets clientSecret.
* Defaults to the PIPEDREAM_CLIENT_SECRET environment variable.
*/
- @SuppressWarnings("unchecked")
- public T clientSecret(String clientSecret) {
+ public BaseClientBuilder clientSecret(String clientSecret) {
this.clientSecret = clientSecret;
- return (T) this;
+ return this;
}
/**
* Sets projectEnvironment
*/
- @SuppressWarnings("unchecked")
- public T projectEnvironment(String projectEnvironment) {
+ public BaseClientBuilder projectEnvironment(String projectEnvironment) {
this.projectEnvironment = projectEnvironment;
- return (T) this;
+ return this;
}
- @SuppressWarnings("unchecked")
- public T environment(Environment environment) {
+ public BaseClientBuilder environment(Environment environment) {
this.environment = environment;
- return (T) this;
+ return this;
}
- @SuppressWarnings("unchecked")
- public T url(String url) {
+ public BaseClientBuilder url(String url) {
this.environment = Environment.custom(url);
- return (T) this;
+ return this;
}
/**
* Sets the timeout (in seconds) for the client. Defaults to 60 seconds.
*/
- @SuppressWarnings("unchecked")
- public T timeout(int timeout) {
+ public BaseClientBuilder timeout(int timeout) {
this.timeout = Optional.of(timeout);
- return (T) this;
+ return this;
}
/**
* Sets the maximum number of retries for the client. Defaults to 2 retries.
*/
- @SuppressWarnings("unchecked")
- public T maxRetries(int maxRetries) {
+ public BaseClientBuilder maxRetries(int maxRetries) {
this.maxRetries = Optional.of(maxRetries);
- return (T) this;
+ return this;
}
/**
* Sets the underlying OkHttp client
*/
- @SuppressWarnings("unchecked")
- public T httpClient(OkHttpClient httpClient) {
+ public BaseClientBuilder httpClient(OkHttpClient httpClient) {
this.httpClient = httpClient;
- return (T) this;
+ return this;
+ }
+
+ /**
+ * Add a custom header to be sent with all requests.
+ * For headers that need to be computed dynamically or conditionally, use the setAdditional() method override instead.
+ *
+ * @param name The header name
+ * @param value The header value
+ * @return This builder for method chaining
+ */
+ public BaseClientBuilder addHeader(String name, String value) {
+ this.customHeaders.put(name, value);
+ return this;
+ }
+
+ public BaseClientBuilder projectId(String projectId) {
+ this.projectId = projectId;
+ return this;
}
protected ClientOptions buildClientOptions() {
@@ -102,6 +118,9 @@ protected ClientOptions buildClientOptions() {
setHttpClient(builder);
setTimeouts(builder);
setRetries(builder);
+ for (Map.Entry header : this.customHeaders.entrySet()) {
+ builder.addHeader(header.getKey(), header.getValue());
+ }
setAdditional(builder);
return builder.build();
}
@@ -124,7 +143,7 @@ protected void setEnvironment(ClientOptions.Builder builder) {
*
* Example:
* {@code
- * @Override
+ * @Override
* protected void setAuthentication(ClientOptions.Builder builder) {
* super.setAuthentication(builder); // Keep existing auth
* builder.addHeader("X-API-Key", this.apiKey);
@@ -133,8 +152,12 @@ protected void setEnvironment(ClientOptions.Builder builder) {
*/
protected void setAuthentication(ClientOptions.Builder builder) {
if (this.clientId != null && this.clientSecret != null) {
- OauthTokensClient authClient = new OauthTokensClient(
- ClientOptions.builder().environment(this.environment).build());
+ ClientOptions.Builder authClientOptionsBuilder =
+ ClientOptions.builder().environment(this.environment);
+ if (this.projectId != null) {
+ authClientOptionsBuilder.projectId(this.projectId);
+ }
+ OauthTokensClient authClient = new OauthTokensClient(authClientOptionsBuilder.build());
OAuthTokenSupplier oAuthTokenSupplier =
new OAuthTokenSupplier(this.clientId, this.clientSecret, authClient);
builder.addHeader("Authorization", oAuthTokenSupplier);
@@ -149,7 +172,7 @@ protected void setAuthentication(ClientOptions.Builder builder) {
*
* Example:
* {@code
- * @Override
+ * @Override
* protected void setCustomHeaders(ClientOptions.Builder builder) {
* super.setCustomHeaders(builder); // Keep existing headers
* builder.addHeader("X-Trace-ID", generateTraceId());
@@ -168,7 +191,11 @@ protected void setCustomHeaders(ClientOptions.Builder builder) {
*
* @param builder The ClientOptions.Builder to configure
*/
- protected void setVariables(ClientOptions.Builder builder) {}
+ protected void setVariables(ClientOptions.Builder builder) {
+ if (this.projectId != null) {
+ builder.projectId(this.projectId);
+ }
+ }
/**
* Sets the request timeout configuration.
@@ -215,9 +242,9 @@ protected void setHttpClient(ClientOptions.Builder builder) {
*
* Example:
* {@code
- * @Override
+ * @Override
* protected void setAdditional(ClientOptions.Builder builder) {
- * builder.addHeader("X-Request-ID", () -> UUID.randomUUID().toString());
+ * builder.addHeader("X-Request-ID", () -> UUID.randomUUID().toString());
* builder.addHeader("X-Client-Version", "1.0.0");
* }
* }
@@ -231,7 +258,7 @@ protected void setAdditional(ClientOptions.Builder builder) {}
*
* Example:
* {@code
- * @Override
+ * @Override
* protected void validateConfiguration() {
* super.validateConfiguration(); // Run parent validations
* if (tenantId == null || tenantId.isEmpty()) {
diff --git a/src/main/java/com/pipedream/api/PipedreamClient.java b/src/main/java/com/pipedream/api/PipedreamClient.java
deleted file mode 100644
index 8e916c9..0000000
--- a/src/main/java/com/pipedream/api/PipedreamClient.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.pipedream.api;
-
-import com.pipedream.api.core.ClientOptions;
-import com.pipedream.api.core.Environment;
-import com.pipedream.api.core.Suppliers;
-import com.pipedream.api.resources.workflows.WorkflowsClient;
-import java.util.Optional;
-import java.util.function.Supplier;
-
-public class PipedreamClient extends BaseClient {
- private final Supplier workflowsClient;
-
- public PipedreamClient(final ClientOptions clientOptions) {
- super(clientOptions);
- this.workflowsClient = Suppliers.memoize(() -> new WorkflowsClient(clientOptions));
- }
-
- public static PipedreamClientBuilder builder() {
- return new PipedreamClientBuilder()
- .clientId(System.getenv("PIPEDREAM_CLIENT_ID"))
- .clientSecret(System.getenv("PIPEDREAM_CLIENT_SECRET"))
- .environment(Environment.PROD)
- .projectEnvironment(System.getenv("PIPEDREAM_PROJECT_ENVIRONMENT"))
- .projectId(System.getenv("PIPEDREAM_PROJECT_ID"));
- }
-
- /**
- * Returns an access token that can be used to authenticate API requests
- *
- * @return the access token string (if available)
- */
- public Optional rawAccessToken() {
- final String authorizationHeader = this.clientOptions.headers(null).get("Authorization");
-
- // The header might not be defined, so we wrap it as an Optional to
- // further process it. The processing consists of removing the `Bearer`
- // or `Basic` prefix from the header value.
- return Optional.ofNullable(authorizationHeader).map(h -> h.replaceFirst("^.*?\\s+", ""));
- }
-
- public WorkflowsClient workflows() {
- return this.workflowsClient.get();
- }
-}
diff --git a/src/main/java/com/pipedream/api/PipedreamClientBuilder.java b/src/main/java/com/pipedream/api/PipedreamClientBuilder.java
deleted file mode 100644
index 2722b8b..0000000
--- a/src/main/java/com/pipedream/api/PipedreamClientBuilder.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.pipedream.api;
-
-import com.pipedream.api.core.ClientOptions;
-import com.pipedream.api.core.Environment;
-import org.apache.commons.text.StringSubstitutor;
-import org.apache.commons.text.lookup.StringLookupFactory;
-
-/**
- * Builder for creating PipedreamClient instances.
- */
-public final class PipedreamClientBuilder extends BaseClientBuilder {
- private String projectId;
-
- public PipedreamClient build() {
- return new PipedreamClient(buildClientOptions());
- }
-
- public PipedreamClientBuilder environment(final Environment environment) {
- final String patchedUrl = patchUrl(environment.getUrl());
- final Environment withPatchedUrl = Environment.custom(patchedUrl);
- super.environment(withPatchedUrl);
- return this;
- }
-
- public PipedreamClientBuilder projectId(final String projectId) {
- this.projectId = projectId;
- return this;
- }
-
- @Override
- public void setVariables(ClientOptions.Builder builder) {
- builder.projectId(this.projectId);
- }
-
- private static String patchUrl(final String templateUrl) {
- StringSubstitutor sub = new StringSubstitutor(StringLookupFactory.INSTANCE.environmentVariableStringLookup());
-
- return sub.replace(templateUrl);
- }
-}
diff --git a/src/main/java/com/pipedream/api/core/ClientOptions.java b/src/main/java/com/pipedream/api/core/ClientOptions.java
index 1dd75f9..8e17e45 100644
--- a/src/main/java/com/pipedream/api/core/ClientOptions.java
+++ b/src/main/java/com/pipedream/api/core/ClientOptions.java
@@ -35,10 +35,10 @@ private ClientOptions(
this.headers.putAll(headers);
this.headers.putAll(new HashMap() {
{
- put("User-Agent", "com.pipedream:pipedream/1.0.5");
+ put("User-Agent", "com.pipedream:pipedream/1.0.6");
put("X-Fern-Language", "JAVA");
put("X-Fern-SDK-Name", "com.pipedream.fern:api-sdk");
- put("X-Fern-SDK-Version", "1.0.5");
+ put("X-Fern-SDK-Version", "1.0.6");
}
});
this.headerSuppliers = headerSuppliers;
diff --git a/src/main/java/com/pipedream/api/core/Stream.java b/src/main/java/com/pipedream/api/core/Stream.java
index 3781dcc..c6cba9f 100644
--- a/src/main/java/com/pipedream/api/core/Stream.java
+++ b/src/main/java/com/pipedream/api/core/Stream.java
@@ -174,8 +174,8 @@ private final class SSEIterator implements Iterator {
private T nextItem;
private boolean hasNextItem = false;
private boolean endOfStream = false;
- private StringBuilder buffer = new StringBuilder();
- private boolean prefixSeen = false;
+ private StringBuilder eventDataBuffer = new StringBuilder();
+ private String currentEventType = null;
private SSEIterator() {
if (sseReader != null && !isStreamClosed()) {
@@ -223,39 +223,69 @@ private boolean readNextMessage() {
try {
while (sseScanner.hasNextLine()) {
- String chunk = sseScanner.nextLine();
- buffer.append(chunk).append(NEWLINE);
-
- int terminatorIndex;
- while ((terminatorIndex = buffer.indexOf(messageTerminator)) >= 0) {
- String line = buffer.substring(0, terminatorIndex + messageTerminator.length());
- buffer.delete(0, terminatorIndex + messageTerminator.length());
-
- line = line.trim();
- if (line.isEmpty()) {
- continue;
+ String line = sseScanner.nextLine();
+
+ if (line.trim().isEmpty()) {
+ if (eventDataBuffer.length() > 0) {
+ try {
+ nextItem = ObjectMappers.JSON_MAPPER.readValue(eventDataBuffer.toString(), valueType);
+ hasNextItem = true;
+ eventDataBuffer.setLength(0);
+ currentEventType = null;
+ return true;
+ } catch (Exception parseEx) {
+ System.err.println("Failed to parse SSE event: " + parseEx.getMessage());
+ eventDataBuffer.setLength(0);
+ currentEventType = null;
+ continue;
+ }
}
+ continue;
+ }
- if (!prefixSeen && line.startsWith(DATA_PREFIX)) {
- prefixSeen = true;
- line = line.substring(DATA_PREFIX.length()).trim();
- } else if (!prefixSeen) {
- continue;
+ if (line.startsWith(DATA_PREFIX)) {
+ String dataContent = line.substring(DATA_PREFIX.length());
+ if (dataContent.startsWith(" ")) {
+ dataContent = dataContent.substring(1);
}
- if (streamTerminator != null && line.contains(streamTerminator)) {
+ if (eventDataBuffer.length() == 0
+ && streamTerminator != null
+ && dataContent.trim().equals(streamTerminator)) {
endOfStream = true;
return false;
}
- try {
- nextItem = ObjectMappers.JSON_MAPPER.readValue(line, valueType);
- hasNextItem = true;
- prefixSeen = false;
- return true;
- } catch (Exception parseEx) {
- continue;
+ if (eventDataBuffer.length() > 0) {
+ eventDataBuffer.append('\n');
+ }
+ eventDataBuffer.append(dataContent);
+ } else if (line.startsWith("event:")) {
+ String eventValue = line.length() > 6 ? line.substring(6) : "";
+ if (eventValue.startsWith(" ")) {
+ eventValue = eventValue.substring(1);
}
+ currentEventType = eventValue;
+ } else if (line.startsWith("id:")) {
+ // Event ID field (ignored)
+ } else if (line.startsWith("retry:")) {
+ // Retry field (ignored)
+ } else if (line.startsWith(":")) {
+ // Comment line (ignored)
+ }
+ }
+
+ if (eventDataBuffer.length() > 0) {
+ try {
+ nextItem = ObjectMappers.JSON_MAPPER.readValue(eventDataBuffer.toString(), valueType);
+ hasNextItem = true;
+ eventDataBuffer.setLength(0);
+ currentEventType = null;
+ return true;
+ } catch (Exception parseEx) {
+ System.err.println("Failed to parse final SSE event: " + parseEx.getMessage());
+ eventDataBuffer.setLength(0);
+ currentEventType = null;
}
}
diff --git a/src/main/java/com/pipedream/api/core/pagination/BasePage.java b/src/main/java/com/pipedream/api/core/pagination/BasePage.java
index ca83fe4..caaf807 100644
--- a/src/main/java/com/pipedream/api/core/pagination/BasePage.java
+++ b/src/main/java/com/pipedream/api/core/pagination/BasePage.java
@@ -4,14 +4,17 @@
package com.pipedream.api.core.pagination;
import java.util.List;
+import java.util.Optional;
public abstract class BasePage {
private final boolean hasNext;
private final List items;
+ private final Object response;
- public BasePage(boolean hasNext, List items) {
+ public BasePage(boolean hasNext, List items, Object response) {
this.hasNext = hasNext;
this.items = items;
+ this.response = response;
}
public boolean hasNext() {
@@ -21,4 +24,15 @@ public boolean hasNext() {
public List getItems() {
return items;
}
+
+ /**
+ * Returns the full response object for accessing pagination metadata like cursor tokens.
+ *
+ * @return Optional containing the response, or empty if unavailable
+ */
+ public Optional getResponse() {
+ @SuppressWarnings("unchecked")
+ R typedResponse = (R) response;
+ return Optional.ofNullable(typedResponse);
+ }
}
diff --git a/src/main/java/com/pipedream/api/core/pagination/SyncPage.java b/src/main/java/com/pipedream/api/core/pagination/SyncPage.java
index 86fc5b7..ec28347 100644
--- a/src/main/java/com/pipedream/api/core/pagination/SyncPage.java
+++ b/src/main/java/com/pipedream/api/core/pagination/SyncPage.java
@@ -10,8 +10,8 @@
public class SyncPage extends BasePage {
protected final Supplier extends SyncPage> nextSupplier;
- public SyncPage(boolean hasNext, List items, Supplier extends SyncPage> nextSupplier) {
- super(hasNext, items);
+ public SyncPage(boolean hasNext, List items, Object response, Supplier extends SyncPage> nextSupplier) {
+ super(hasNext, items, response);
this.nextSupplier = nextSupplier;
}
diff --git a/src/main/java/com/pipedream/api/core/pagination/SyncPagingIterable.java b/src/main/java/com/pipedream/api/core/pagination/SyncPagingIterable.java
index fd5fca3..09f7ca1 100644
--- a/src/main/java/com/pipedream/api/core/pagination/SyncPagingIterable.java
+++ b/src/main/java/com/pipedream/api/core/pagination/SyncPagingIterable.java
@@ -14,12 +14,14 @@
public class SyncPagingIterable extends SyncPage implements Iterable {
- public SyncPagingIterable(boolean hasNext, List items, Supplier extends SyncPage> getNext) {
- super(hasNext, items, getNext);
+ public SyncPagingIterable(
+ boolean hasNext, List items, Object response, Supplier extends SyncPage> getNext) {
+ super(hasNext, items, response, getNext);
}
- public SyncPagingIterable(boolean hasNext, Optional> items, Supplier extends SyncPage> getNext) {
- super(hasNext, items.orElse(new ArrayList<>()), getNext);
+ public SyncPagingIterable(
+ boolean hasNext, Optional> items, Object response, Supplier extends SyncPage> getNext) {
+ super(hasNext, items.orElse(new ArrayList<>()), response, getNext);
}
public Stream streamItems() {
diff --git a/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java b/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java
index 3aff3e1..dd95b5f 100644
--- a/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java
+++ b/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java
@@ -20,9 +20,7 @@
import com.pipedream.api.types.Account;
import com.pipedream.api.types.ListAccountsResponse;
import java.io.IOException;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
@@ -68,10 +66,6 @@ public CompletableFuture>> li
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
.addPathSegments("accounts");
- if (request.getAppId().isPresent()) {
- QueryStringMapper.addQueryParameter(
- httpUrl, "app_id", request.getAppId().get(), false);
- }
if (request.getExternalUserId().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "external_user_id", request.getExternalUserId().get(), false);
@@ -92,6 +86,9 @@ public CompletableFuture>> li
QueryStringMapper.addQueryParameter(
httpUrl, "limit", request.getLimit().get(), false);
}
+ if (request.getApp().isPresent()) {
+ QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false);
+ }
if (request.getIncludeCredentials().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl,
@@ -125,15 +122,16 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
.build();
List result = parsedResponse.getData();
future.complete(new BaseClientHttpResponse<>(
- new SyncPagingIterable(startingAfter.isPresent(), result, () -> {
- try {
- return list(nextRequest, requestOptions)
- .get()
- .body();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }),
+ new SyncPagingIterable(
+ startingAfter.isPresent(), result, parsedResponse, () -> {
+ try {
+ return list(nextRequest, requestOptions)
+ .get()
+ .body();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }),
response));
return;
}
@@ -183,10 +181,6 @@ public CompletableFuture> create(
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
.addPathSegments("accounts");
- if (request.getAppId().isPresent()) {
- QueryStringMapper.addQueryParameter(
- httpUrl, "app_id", request.getAppId().get(), false);
- }
if (request.getExternalUserId().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "external_user_id", request.getExternalUserId().get(), false);
@@ -195,17 +189,10 @@ public CompletableFuture> create(
QueryStringMapper.addQueryParameter(
httpUrl, "oauth_app_id", request.getOauthAppId().get(), false);
}
- Map properties = new HashMap<>();
- properties.put("app_slug", request.getAppSlug());
- properties.put("cfmap_json", request.getCfmapJson());
- properties.put("connect_token", request.getConnectToken());
- if (request.getName().isPresent()) {
- properties.put("name", request.getName());
- }
RequestBody body;
try {
body = RequestBody.create(
- ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON);
+ ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
} catch (Exception e) {
throw new RuntimeException(e);
}
diff --git a/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java b/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java
index 9692016..777be36 100644
--- a/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java
+++ b/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java
@@ -20,9 +20,7 @@
import com.pipedream.api.types.Account;
import com.pipedream.api.types.ListAccountsResponse;
import java.io.IOException;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import java.util.Optional;
import okhttp3.Headers;
import okhttp3.HttpUrl;
@@ -63,10 +61,6 @@ public BaseClientHttpResponse> list(
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
.addPathSegments("accounts");
- if (request.getAppId().isPresent()) {
- QueryStringMapper.addQueryParameter(
- httpUrl, "app_id", request.getAppId().get(), false);
- }
if (request.getExternalUserId().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "external_user_id", request.getExternalUserId().get(), false);
@@ -87,6 +81,9 @@ public BaseClientHttpResponse> list(
QueryStringMapper.addQueryParameter(
httpUrl, "limit", request.getLimit().get(), false);
}
+ if (request.getApp().isPresent()) {
+ QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false);
+ }
if (request.getIncludeCredentials().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl,
@@ -116,9 +113,9 @@ public BaseClientHttpResponse> list(
.build();
List result = parsedResponse.getData();
return new BaseClientHttpResponse<>(
- new SyncPagingIterable(
- startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions)
- .body()),
+ new SyncPagingIterable(startingAfter.isPresent(), result, parsedResponse, () -> list(
+ nextRequest, requestOptions)
+ .body()),
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
@@ -156,10 +153,6 @@ public BaseClientHttpResponse create(CreateAccountOpts request, Request
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
.addPathSegments("accounts");
- if (request.getAppId().isPresent()) {
- QueryStringMapper.addQueryParameter(
- httpUrl, "app_id", request.getAppId().get(), false);
- }
if (request.getExternalUserId().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "external_user_id", request.getExternalUserId().get(), false);
@@ -168,17 +161,10 @@ public BaseClientHttpResponse create(CreateAccountOpts request, Request
QueryStringMapper.addQueryParameter(
httpUrl, "oauth_app_id", request.getOauthAppId().get(), false);
}
- Map properties = new HashMap<>();
- properties.put("app_slug", request.getAppSlug());
- properties.put("cfmap_json", request.getCfmapJson());
- properties.put("connect_token", request.getConnectToken());
- if (request.getName().isPresent()) {
- properties.put("name", request.getName());
- }
RequestBody body;
try {
body = RequestBody.create(
- ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON);
+ ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
} catch (Exception e) {
throw new RuntimeException(e);
}
diff --git a/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsListRequest.java b/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsListRequest.java
index 2d67f6d..bfba211 100644
--- a/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsListRequest.java
+++ b/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsListRequest.java
@@ -20,8 +20,6 @@
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = AccountsListRequest.Builder.class)
public final class AccountsListRequest {
- private final Optional appId;
-
private final Optional externalUserId;
private final Optional oauthAppId;
@@ -32,37 +30,31 @@ public final class AccountsListRequest {
private final Optional limit;
+ private final Optional app;
+
private final Optional includeCredentials;
private final Map additionalProperties;
private AccountsListRequest(
- Optional appId,
Optional externalUserId,
Optional oauthAppId,
Optional after,
Optional before,
Optional limit,
+ Optional app,
Optional includeCredentials,
Map additionalProperties) {
- this.appId = appId;
this.externalUserId = externalUserId;
this.oauthAppId = oauthAppId;
this.after = after;
this.before = before;
this.limit = limit;
+ this.app = app;
this.includeCredentials = includeCredentials;
this.additionalProperties = additionalProperties;
}
- /**
- * @return The app slug or ID to filter accounts by.
- */
- @JsonProperty("app_id")
- public Optional getAppId() {
- return appId;
- }
-
@JsonProperty("external_user_id")
public Optional getExternalUserId() {
return externalUserId;
@@ -100,6 +92,14 @@ public Optional getLimit() {
return limit;
}
+ /**
+ * @return The app slug or ID to filter accounts by.
+ */
+ @JsonProperty("app")
+ public Optional getApp() {
+ return app;
+ }
+
/**
* @return Whether to retrieve the account's credentials or not
*/
@@ -120,24 +120,24 @@ public Map getAdditionalProperties() {
}
private boolean equalTo(AccountsListRequest other) {
- return appId.equals(other.appId)
- && externalUserId.equals(other.externalUserId)
+ return externalUserId.equals(other.externalUserId)
&& oauthAppId.equals(other.oauthAppId)
&& after.equals(other.after)
&& before.equals(other.before)
&& limit.equals(other.limit)
+ && app.equals(other.app)
&& includeCredentials.equals(other.includeCredentials);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(
- this.appId,
this.externalUserId,
this.oauthAppId,
this.after,
this.before,
this.limit,
+ this.app,
this.includeCredentials);
}
@@ -152,8 +152,6 @@ public static Builder builder() {
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
- private Optional appId = Optional.empty();
-
private Optional externalUserId = Optional.empty();
private Optional oauthAppId = Optional.empty();
@@ -164,6 +162,8 @@ public static final class Builder {
private Optional limit = Optional.empty();
+ private Optional app = Optional.empty();
+
private Optional includeCredentials = Optional.empty();
@JsonAnySetter
@@ -172,30 +172,16 @@ public static final class Builder {
private Builder() {}
public Builder from(AccountsListRequest other) {
- appId(other.getAppId());
externalUserId(other.getExternalUserId());
oauthAppId(other.getOauthAppId());
after(other.getAfter());
before(other.getBefore());
limit(other.getLimit());
+ app(other.getApp());
includeCredentials(other.getIncludeCredentials());
return this;
}
- /**
- * The app slug or ID to filter accounts by.
- */
- @JsonSetter(value = "app_id", nulls = Nulls.SKIP)
- public Builder appId(Optional appId) {
- this.appId = appId;
- return this;
- }
-
- public Builder appId(String appId) {
- this.appId = Optional.ofNullable(appId);
- return this;
- }
-
@JsonSetter(value = "external_user_id", nulls = Nulls.SKIP)
public Builder externalUserId(Optional externalUserId) {
this.externalUserId = externalUserId;
@@ -263,6 +249,20 @@ public Builder limit(Integer limit) {
return this;
}
+ /**
+ * The app slug or ID to filter accounts by.
+ */
+ @JsonSetter(value = "app", nulls = Nulls.SKIP)
+ public Builder app(Optional app) {
+ this.app = app;
+ return this;
+ }
+
+ public Builder app(String app) {
+ this.app = Optional.ofNullable(app);
+ return this;
+ }
+
/**
* Whether to retrieve the account's credentials or not
*/
@@ -279,7 +279,7 @@ public Builder includeCredentials(Boolean includeCredentials) {
public AccountsListRequest build() {
return new AccountsListRequest(
- appId, externalUserId, oauthAppId, after, before, limit, includeCredentials, additionalProperties);
+ externalUserId, oauthAppId, after, before, limit, app, includeCredentials, additionalProperties);
}
}
}
diff --git a/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountOpts.java b/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountOpts.java
index 79cef5e..d168d25 100644
--- a/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountOpts.java
+++ b/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountOpts.java
@@ -21,8 +21,6 @@
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = CreateAccountOpts.Builder.class)
public final class CreateAccountOpts {
- private final Optional appId;
-
private final Optional externalUserId;
private final Optional oauthAppId;
@@ -38,7 +36,6 @@ public final class CreateAccountOpts {
private final Map additionalProperties;
private CreateAccountOpts(
- Optional appId,
Optional externalUserId,
Optional oauthAppId,
String appSlug,
@@ -46,7 +43,6 @@ private CreateAccountOpts(
String connectToken,
Optional name,
Map additionalProperties) {
- this.appId = appId;
this.externalUserId = externalUserId;
this.oauthAppId = oauthAppId;
this.appSlug = appSlug;
@@ -56,14 +52,6 @@ private CreateAccountOpts(
this.additionalProperties = additionalProperties;
}
- /**
- * @return The app slug or ID to filter accounts by.
- */
- @JsonProperty("app_id")
- public Optional getAppId() {
- return appId;
- }
-
@JsonProperty("external_user_id")
public Optional getExternalUserId() {
return externalUserId;
@@ -121,8 +109,7 @@ public Map getAdditionalProperties() {
}
private boolean equalTo(CreateAccountOpts other) {
- return appId.equals(other.appId)
- && externalUserId.equals(other.externalUserId)
+ return externalUserId.equals(other.externalUserId)
&& oauthAppId.equals(other.oauthAppId)
&& appSlug.equals(other.appSlug)
&& cfmapJson.equals(other.cfmapJson)
@@ -133,13 +120,7 @@ private boolean equalTo(CreateAccountOpts other) {
@java.lang.Override
public int hashCode() {
return Objects.hash(
- this.appId,
- this.externalUserId,
- this.oauthAppId,
- this.appSlug,
- this.cfmapJson,
- this.connectToken,
- this.name);
+ this.externalUserId, this.oauthAppId, this.appSlug, this.cfmapJson, this.connectToken, this.name);
}
@java.lang.Override
@@ -177,13 +158,6 @@ public interface ConnectTokenStage {
public interface _FinalStage {
CreateAccountOpts build();
- /**
- * The app slug or ID to filter accounts by.
- */
- _FinalStage appId(Optional appId);
-
- _FinalStage appId(String appId);
-
_FinalStage externalUserId(Optional externalUserId);
_FinalStage externalUserId(String externalUserId);
@@ -217,8 +191,6 @@ public static final class Builder implements AppSlugStage, CfmapJsonStage, Conne
private Optional externalUserId = Optional.empty();
- private Optional appId = Optional.empty();
-
@JsonAnySetter
private Map additionalProperties = new HashMap<>();
@@ -226,7 +198,6 @@ private Builder() {}
@java.lang.Override
public Builder from(CreateAccountOpts other) {
- appId(other.getAppId());
externalUserId(other.getExternalUserId());
oauthAppId(other.getOauthAppId());
appSlug(other.getAppSlug());
@@ -325,30 +296,10 @@ public _FinalStage externalUserId(Optional externalUserId) {
return this;
}
- /**
- * The app slug or ID to filter accounts by.
- * @return Reference to {@code this} so that method calls can be chained together.
- */
- @java.lang.Override
- public _FinalStage appId(String appId) {
- this.appId = Optional.ofNullable(appId);
- return this;
- }
-
- /**
- * The app slug or ID to filter accounts by.
- */
- @java.lang.Override
- @JsonSetter(value = "app_id", nulls = Nulls.SKIP)
- public _FinalStage appId(Optional appId) {
- this.appId = appId;
- return this;
- }
-
@java.lang.Override
public CreateAccountOpts build() {
return new CreateAccountOpts(
- appId, externalUserId, oauthAppId, appSlug, cfmapJson, connectToken, name, additionalProperties);
+ externalUserId, oauthAppId, appSlug, cfmapJson, connectToken, name, additionalProperties);
}
}
}
diff --git a/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java b/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java
index 42af7b3..18b750a 100644
--- a/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java
+++ b/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java
@@ -7,6 +7,7 @@
import com.pipedream.api.core.RequestOptions;
import com.pipedream.api.core.pagination.SyncPagingIterable;
import com.pipedream.api.resources.actions.requests.ActionsListRequest;
+import com.pipedream.api.resources.actions.requests.ActionsRetrieveRequest;
import com.pipedream.api.resources.actions.requests.RunActionOpts;
import com.pipedream.api.types.Component;
import com.pipedream.api.types.ConfigurePropOpts;
@@ -63,8 +64,15 @@ public Component retrieve(String componentId) {
/**
* Get detailed configuration for a specific action by its key
*/
- public Component retrieve(String componentId, RequestOptions requestOptions) {
- return this.rawClient.retrieve(componentId, requestOptions).body();
+ public Component retrieve(String componentId, ActionsRetrieveRequest request) {
+ return this.rawClient.retrieve(componentId, request).body();
+ }
+
+ /**
+ * Get detailed configuration for a specific action by its key
+ */
+ public Component retrieve(String componentId, ActionsRetrieveRequest request, RequestOptions requestOptions) {
+ return this.rawClient.retrieve(componentId, request, requestOptions).body();
}
/**
diff --git a/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java b/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java
index c398848..442f0b5 100644
--- a/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java
+++ b/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java
@@ -7,6 +7,7 @@
import com.pipedream.api.core.RequestOptions;
import com.pipedream.api.core.pagination.SyncPagingIterable;
import com.pipedream.api.resources.actions.requests.ActionsListRequest;
+import com.pipedream.api.resources.actions.requests.ActionsRetrieveRequest;
import com.pipedream.api.resources.actions.requests.RunActionOpts;
import com.pipedream.api.types.Component;
import com.pipedream.api.types.ConfigurePropOpts;
@@ -65,8 +66,16 @@ public CompletableFuture retrieve(String componentId) {
/**
* Get detailed configuration for a specific action by its key
*/
- public CompletableFuture retrieve(String componentId, RequestOptions requestOptions) {
- return this.rawClient.retrieve(componentId, requestOptions).thenApply(response -> response.body());
+ public CompletableFuture retrieve(String componentId, ActionsRetrieveRequest request) {
+ return this.rawClient.retrieve(componentId, request).thenApply(response -> response.body());
+ }
+
+ /**
+ * Get detailed configuration for a specific action by its key
+ */
+ public CompletableFuture retrieve(
+ String componentId, ActionsRetrieveRequest request, RequestOptions requestOptions) {
+ return this.rawClient.retrieve(componentId, request, requestOptions).thenApply(response -> response.body());
}
/**
diff --git a/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java b/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java
index cd9c018..72dfcab 100644
--- a/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java
+++ b/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java
@@ -15,6 +15,7 @@
import com.pipedream.api.core.pagination.SyncPagingIterable;
import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.resources.actions.requests.ActionsListRequest;
+import com.pipedream.api.resources.actions.requests.ActionsRetrieveRequest;
import com.pipedream.api.resources.actions.requests.RunActionOpts;
import com.pipedream.api.types.Component;
import com.pipedream.api.types.ConfigurePropOpts;
@@ -115,15 +116,16 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
.build();
List result = parsedResponse.getData();
future.complete(new BaseClientHttpResponse<>(
- new SyncPagingIterable(startingAfter.isPresent(), result, () -> {
- try {
- return list(nextRequest, requestOptions)
- .get()
- .body();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }),
+ new SyncPagingIterable(
+ startingAfter.isPresent(), result, parsedResponse, () -> {
+ try {
+ return list(nextRequest, requestOptions)
+ .get()
+ .body();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }),
response));
return;
}
@@ -160,27 +162,38 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
* Get detailed configuration for a specific action by its key
*/
public CompletableFuture> retrieve(String componentId) {
- return retrieve(componentId, null);
+ return retrieve(componentId, ActionsRetrieveRequest.builder().build());
}
/**
* Get detailed configuration for a specific action by its key
*/
public CompletableFuture> retrieve(
- String componentId, RequestOptions requestOptions) {
- HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ String componentId, ActionsRetrieveRequest request) {
+ return retrieve(componentId, request, null);
+ }
+
+ /**
+ * Get detailed configuration for a specific action by its key
+ */
+ public CompletableFuture> retrieve(
+ String componentId, ActionsRetrieveRequest request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
.addPathSegments("actions")
- .addPathSegment(componentId)
- .build();
- Request okhttpRequest = new Request.Builder()
- .url(httpUrl)
+ .addPathSegment(componentId);
+ if (request.getVersion().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "version", request.getVersion().get(), false);
+ }
+ Request.Builder _requestBuilder = new Request.Builder()
+ .url(httpUrl.build())
.method("GET", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
- .addHeader("Accept", "application/json")
- .build();
+ .addHeader("Accept", "application/json");
+ Request okhttpRequest = _requestBuilder.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
diff --git a/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java b/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java
index 8fb543b..249368b 100644
--- a/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java
+++ b/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java
@@ -15,6 +15,7 @@
import com.pipedream.api.core.pagination.SyncPagingIterable;
import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.resources.actions.requests.ActionsListRequest;
+import com.pipedream.api.resources.actions.requests.ActionsRetrieveRequest;
import com.pipedream.api.resources.actions.requests.RunActionOpts;
import com.pipedream.api.types.Component;
import com.pipedream.api.types.ConfigurePropOpts;
@@ -106,9 +107,9 @@ public BaseClientHttpResponse> list(
.build();
List result = parsedResponse.getData();
return new BaseClientHttpResponse<>(
- new SyncPagingIterable(
- startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions)
- .body()),
+ new SyncPagingIterable(startingAfter.isPresent(), result, parsedResponse, () -> list(
+ nextRequest, requestOptions)
+ .body()),
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
@@ -134,26 +135,37 @@ public BaseClientHttpResponse> list(
* Get detailed configuration for a specific action by its key
*/
public BaseClientHttpResponse retrieve(String componentId) {
- return retrieve(componentId, null);
+ return retrieve(componentId, ActionsRetrieveRequest.builder().build());
}
/**
* Get detailed configuration for a specific action by its key
*/
- public BaseClientHttpResponse retrieve(String componentId, RequestOptions requestOptions) {
- HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ public BaseClientHttpResponse retrieve(String componentId, ActionsRetrieveRequest request) {
+ return retrieve(componentId, request, null);
+ }
+
+ /**
+ * Get detailed configuration for a specific action by its key
+ */
+ public BaseClientHttpResponse retrieve(
+ String componentId, ActionsRetrieveRequest request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("v1/connect")
.addPathSegment(clientOptions.projectId())
.addPathSegments("actions")
- .addPathSegment(componentId)
- .build();
- Request okhttpRequest = new Request.Builder()
- .url(httpUrl)
+ .addPathSegment(componentId);
+ if (request.getVersion().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "version", request.getVersion().get(), false);
+ }
+ Request.Builder _requestBuilder = new Request.Builder()
+ .url(httpUrl.build())
.method("GET", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
- .addHeader("Accept", "application/json")
- .build();
+ .addHeader("Accept", "application/json");
+ Request okhttpRequest = _requestBuilder.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
diff --git a/src/main/java/com/pipedream/api/resources/actions/requests/ActionsRetrieveRequest.java b/src/main/java/com/pipedream/api/resources/actions/requests/ActionsRetrieveRequest.java
new file mode 100644
index 0000000..b72eb6c
--- /dev/null
+++ b/src/main/java/com/pipedream/api/resources/actions/requests/ActionsRetrieveRequest.java
@@ -0,0 +1,101 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.pipedream.api.resources.actions.requests;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.annotation.Nulls;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.pipedream.api.core.ObjectMappers;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = ActionsRetrieveRequest.Builder.class)
+public final class ActionsRetrieveRequest {
+ private final Optional version;
+
+ private final Map additionalProperties;
+
+ private ActionsRetrieveRequest(Optional version, Map additionalProperties) {
+ this.version = version;
+ this.additionalProperties = additionalProperties;
+ }
+
+ /**
+ * @return Optional semantic version of the component to retrieve (for example '1.0.0')
+ */
+ @JsonProperty("version")
+ public Optional getVersion() {
+ return version;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof ActionsRetrieveRequest && equalTo((ActionsRetrieveRequest) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(ActionsRetrieveRequest other) {
+ return version.equals(other.version);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.version);
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return ObjectMappers.stringify(this);
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static final class Builder {
+ private Optional version = Optional.empty();
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ public Builder from(ActionsRetrieveRequest other) {
+ version(other.getVersion());
+ return this;
+ }
+
+ /**
+ * Optional semantic version of the component to retrieve (for example '1.0.0')
+ */
+ @JsonSetter(value = "version", nulls = Nulls.SKIP)
+ public Builder version(Optional version) {
+ this.version = version;
+ return this;
+ }
+
+ public Builder version(String version) {
+ this.version = Optional.ofNullable(version);
+ return this;
+ }
+
+ public ActionsRetrieveRequest build() {
+ return new ActionsRetrieveRequest(version, additionalProperties);
+ }
+ }
+}
diff --git a/src/main/java/com/pipedream/api/resources/actions/requests/RunActionOpts.java b/src/main/java/com/pipedream/api/resources/actions/requests/RunActionOpts.java
index bb339b5..acc258b 100644
--- a/src/main/java/com/pipedream/api/resources/actions/requests/RunActionOpts.java
+++ b/src/main/java/com/pipedream/api/resources/actions/requests/RunActionOpts.java
@@ -25,6 +25,8 @@
public final class RunActionOpts {
private final String id;
+ private final Optional version;
+
private final String externalUserId;
private final Optional