{@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..ea6cbb9 100644
--- a/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java
+++ b/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java
@@ -68,10 +68,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 +88,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 +124,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 +183,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);
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..61469b7 100644
--- a/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java
+++ b/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java
@@ -63,10 +63,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 +83,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 +115,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 +155,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);
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/AsyncRawActionsClient.java b/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java
index cd9c018..caee715 100644
--- a/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java
+++ b/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java
@@ -115,15 +115,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;
}
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..a983c10 100644
--- a/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java
+++ b/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java
@@ -106,9 +106,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() : "{}";
diff --git a/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java b/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java
index 12b0e07..bfc2fde 100644
--- a/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java
+++ b/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java
@@ -112,7 +112,7 @@ 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, () -> {
+ new SyncPagingIterable(startingAfter.isPresent(), result, parsedResponse, () -> {
try {
return list(nextRequest, requestOptions)
.get()
diff --git a/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java b/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java
index e435a99..1a8e637 100644
--- a/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java
+++ b/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java
@@ -103,9 +103,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() : "{}";
diff --git a/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortDirection.java b/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortDirection.java
index 18cc793..0e84e8f 100644
--- a/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortDirection.java
+++ b/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortDirection.java
@@ -3,22 +3,82 @@
*/
package com.pipedream.api.resources.apps.types;
+import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
-public enum AppsListRequestSortDirection {
- ASC("asc"),
+public final class AppsListRequestSortDirection {
+ public static final AppsListRequestSortDirection ASC = new AppsListRequestSortDirection(Value.ASC, "asc");
- DESC("desc");
+ public static final AppsListRequestSortDirection DESC = new AppsListRequestSortDirection(Value.DESC, "desc");
- private final String value;
+ private final Value value;
- AppsListRequestSortDirection(String value) {
+ private final String string;
+
+ AppsListRequestSortDirection(Value value, String string) {
this.value = value;
+ this.string = string;
+ }
+
+ public Value getEnumValue() {
+ return value;
}
- @JsonValue
@java.lang.Override
+ @JsonValue
public String toString() {
- return this.value;
+ return this.string;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ return (this == other)
+ || (other instanceof AppsListRequestSortDirection
+ && this.string.equals(((AppsListRequestSortDirection) other).string));
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return this.string.hashCode();
+ }
+
+ public T visit(Visitor visitor) {
+ switch (value) {
+ case ASC:
+ return visitor.visitAsc();
+ case DESC:
+ return visitor.visitDesc();
+ case UNKNOWN:
+ default:
+ return visitor.visitUnknown(string);
+ }
+ }
+
+ @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
+ public static AppsListRequestSortDirection valueOf(String value) {
+ switch (value) {
+ case "asc":
+ return ASC;
+ case "desc":
+ return DESC;
+ default:
+ return new AppsListRequestSortDirection(Value.UNKNOWN, value);
+ }
+ }
+
+ public enum Value {
+ ASC,
+
+ DESC,
+
+ UNKNOWN
+ }
+
+ public interface Visitor {
+ T visitAsc();
+
+ T visitDesc();
+
+ T visitUnknown(String unknownType);
}
}
diff --git a/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortKey.java b/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortKey.java
index 7260231..16800bb 100644
--- a/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortKey.java
+++ b/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortKey.java
@@ -3,24 +3,93 @@
*/
package com.pipedream.api.resources.apps.types;
+import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
-public enum AppsListRequestSortKey {
- NAME("name"),
+public final class AppsListRequestSortKey {
+ public static final AppsListRequestSortKey NAME_SLUG = new AppsListRequestSortKey(Value.NAME_SLUG, "name_slug");
- NAME_SLUG("name_slug"),
+ public static final AppsListRequestSortKey FEATURED_WEIGHT =
+ new AppsListRequestSortKey(Value.FEATURED_WEIGHT, "featured_weight");
- FEATURED_WEIGHT("featured_weight");
+ public static final AppsListRequestSortKey NAME = new AppsListRequestSortKey(Value.NAME, "name");
- private final String value;
+ private final Value value;
- AppsListRequestSortKey(String value) {
+ private final String string;
+
+ AppsListRequestSortKey(Value value, String string) {
this.value = value;
+ this.string = string;
+ }
+
+ public Value getEnumValue() {
+ return value;
}
- @JsonValue
@java.lang.Override
+ @JsonValue
public String toString() {
- return this.value;
+ return this.string;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ return (this == other)
+ || (other instanceof AppsListRequestSortKey
+ && this.string.equals(((AppsListRequestSortKey) other).string));
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return this.string.hashCode();
+ }
+
+ public T visit(Visitor visitor) {
+ switch (value) {
+ case NAME_SLUG:
+ return visitor.visitNameSlug();
+ case FEATURED_WEIGHT:
+ return visitor.visitFeaturedWeight();
+ case NAME:
+ return visitor.visitName();
+ case UNKNOWN:
+ default:
+ return visitor.visitUnknown(string);
+ }
+ }
+
+ @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
+ public static AppsListRequestSortKey valueOf(String value) {
+ switch (value) {
+ case "name_slug":
+ return NAME_SLUG;
+ case "featured_weight":
+ return FEATURED_WEIGHT;
+ case "name":
+ return NAME;
+ default:
+ return new AppsListRequestSortKey(Value.UNKNOWN, value);
+ }
+ }
+
+ public enum Value {
+ NAME,
+
+ NAME_SLUG,
+
+ FEATURED_WEIGHT,
+
+ UNKNOWN
+ }
+
+ public interface Visitor {
+ T visitName();
+
+ T visitNameSlug();
+
+ T visitFeaturedWeight();
+
+ T visitUnknown(String unknownType);
}
}
diff --git a/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java b/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java
index f9290c2..ee4bdfa 100644
--- a/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java
+++ b/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java
@@ -118,15 +118,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;
}
diff --git a/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java b/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java
index d9debeb..12eb6b7 100644
--- a/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java
+++ b/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java
@@ -108,9 +108,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() : "{}";
diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java
index f069900..916aa4e 100644
--- a/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java
+++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java
@@ -17,6 +17,7 @@
import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts;
import com.pipedream.api.types.DeployedComponent;
import com.pipedream.api.types.EmittedEvent;
+import com.pipedream.api.types.Emitter;
import com.pipedream.api.types.GetTriggerWebhooksResponse;
import com.pipedream.api.types.GetTriggerWorkflowsResponse;
import java.util.List;
@@ -42,14 +43,14 @@ public AsyncRawDeployedTriggersClient withRawResponse() {
/**
* Retrieve all deployed triggers for a specific external user
*/
- public CompletableFuture> list(DeployedTriggersListRequest request) {
+ public CompletableFuture> list(DeployedTriggersListRequest request) {
return this.rawClient.list(request).thenApply(response -> response.body());
}
/**
* Retrieve all deployed triggers for a specific external user
*/
- public CompletableFuture> list(
+ public CompletableFuture> list(
DeployedTriggersListRequest request, RequestOptions requestOptions) {
return this.rawClient.list(request, requestOptions).thenApply(response -> response.body());
}
diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java
index d350311..f10c1ef 100644
--- a/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java
+++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java
@@ -25,6 +25,7 @@
import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts;
import com.pipedream.api.types.DeployedComponent;
import com.pipedream.api.types.EmittedEvent;
+import com.pipedream.api.types.Emitter;
import com.pipedream.api.types.GetTriggerEventsResponse;
import com.pipedream.api.types.GetTriggerResponse;
import com.pipedream.api.types.GetTriggerWebhooksResponse;
@@ -58,7 +59,7 @@ public AsyncRawDeployedTriggersClient(ClientOptions clientOptions) {
/**
* Retrieve all deployed triggers for a specific external user
*/
- public CompletableFuture>> list(
+ public CompletableFuture>> list(
DeployedTriggersListRequest request) {
return list(request, null);
}
@@ -66,7 +67,7 @@ public CompletableFuture>> list(
+ public CompletableFuture>> list(
DeployedTriggersListRequest request, RequestOptions requestOptions) {
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
@@ -86,6 +87,10 @@ public CompletableFuture>> future =
- new CompletableFuture<>();
+ CompletableFuture>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
@@ -111,17 +115,18 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
.from(request)
.after(startingAfter)
.build();
- List result = parsedResponse.getData();
+ 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;
}
diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java
index aa09ce2..fa03526 100644
--- a/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java
+++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java
@@ -17,6 +17,7 @@
import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts;
import com.pipedream.api.types.DeployedComponent;
import com.pipedream.api.types.EmittedEvent;
+import com.pipedream.api.types.Emitter;
import com.pipedream.api.types.GetTriggerWebhooksResponse;
import com.pipedream.api.types.GetTriggerWorkflowsResponse;
import java.util.List;
@@ -41,15 +42,14 @@ public RawDeployedTriggersClient withRawResponse() {
/**
* Retrieve all deployed triggers for a specific external user
*/
- public SyncPagingIterable list(DeployedTriggersListRequest request) {
+ public SyncPagingIterable list(DeployedTriggersListRequest request) {
return this.rawClient.list(request).body();
}
/**
* Retrieve all deployed triggers for a specific external user
*/
- public SyncPagingIterable list(
- DeployedTriggersListRequest request, RequestOptions requestOptions) {
+ public SyncPagingIterable list(DeployedTriggersListRequest request, RequestOptions requestOptions) {
return this.rawClient.list(request, requestOptions).body();
}
diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java
index 3134f2c..5301e3a 100644
--- a/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java
+++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java
@@ -25,6 +25,7 @@
import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts;
import com.pipedream.api.types.DeployedComponent;
import com.pipedream.api.types.EmittedEvent;
+import com.pipedream.api.types.Emitter;
import com.pipedream.api.types.GetTriggerEventsResponse;
import com.pipedream.api.types.GetTriggerResponse;
import com.pipedream.api.types.GetTriggerWebhooksResponse;
@@ -53,14 +54,14 @@ public RawDeployedTriggersClient(ClientOptions clientOptions) {
/**
* Retrieve all deployed triggers for a specific external user
*/
- public BaseClientHttpResponse> list(DeployedTriggersListRequest request) {
+ public BaseClientHttpResponse> list(DeployedTriggersListRequest request) {
return list(request, null);
}
/**
* Retrieve all deployed triggers for a specific external user
*/
- public BaseClientHttpResponse> list(
+ public BaseClientHttpResponse> list(
DeployedTriggersListRequest request, RequestOptions requestOptions) {
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
@@ -80,6 +81,10 @@ public BaseClientHttpResponse> list(
httpUrl, "limit", request.getLimit().get(), false);
}
QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false);
+ if (request.getEmitterType().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "emitter_type", request.getEmitterType().get(), false);
+ }
Request.Builder _requestBuilder = new Request.Builder()
.url(httpUrl.build())
.method("GET", null)
@@ -100,11 +105,11 @@ public BaseClientHttpResponse> list(
.from(request)
.after(startingAfter)
.build();
- List result = parsedResponse.getData();
+ 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() : "{}";
diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListRequest.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListRequest.java
index 556c4f0..f360934 100644
--- a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListRequest.java
+++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListRequest.java
@@ -12,6 +12,7 @@
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.pipedream.api.core.ObjectMappers;
+import com.pipedream.api.resources.deployedtriggers.types.DeployedTriggersListRequestEmitterType;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@@ -29,6 +30,8 @@ public final class DeployedTriggersListRequest {
private final String externalUserId;
+ private final Optional emitterType;
+
private final Map additionalProperties;
private DeployedTriggersListRequest(
@@ -36,11 +39,13 @@ private DeployedTriggersListRequest(
Optional before,
Optional limit,
String externalUserId,
+ Optional emitterType,
Map additionalProperties) {
this.after = after;
this.before = before;
this.limit = limit;
this.externalUserId = externalUserId;
+ this.emitterType = emitterType;
this.additionalProperties = additionalProperties;
}
@@ -76,6 +81,14 @@ public String getExternalUserId() {
return externalUserId;
}
+ /**
+ * @return Filter deployed triggers by emitter type (defaults to 'source' if not provided)
+ */
+ @JsonProperty("emitter_type")
+ public Optional getEmitterType() {
+ return emitterType;
+ }
+
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
@@ -91,12 +104,13 @@ private boolean equalTo(DeployedTriggersListRequest other) {
return after.equals(other.after)
&& before.equals(other.before)
&& limit.equals(other.limit)
- && externalUserId.equals(other.externalUserId);
+ && externalUserId.equals(other.externalUserId)
+ && emitterType.equals(other.emitterType);
}
@java.lang.Override
public int hashCode() {
- return Objects.hash(this.after, this.before, this.limit, this.externalUserId);
+ return Objects.hash(this.after, this.before, this.limit, this.externalUserId, this.emitterType);
}
@java.lang.Override
@@ -140,12 +154,21 @@ public interface _FinalStage {
_FinalStage limit(Optional limit);
_FinalStage limit(Integer limit);
+
+ /**
+ * Filter deployed triggers by emitter type (defaults to 'source' if not provided)
+ */
+ _FinalStage emitterType(Optional emitterType);
+
+ _FinalStage emitterType(DeployedTriggersListRequestEmitterType emitterType);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements ExternalUserIdStage, _FinalStage {
private String externalUserId;
+ private Optional emitterType = Optional.empty();
+
private Optional limit = Optional.empty();
private Optional before = Optional.empty();
@@ -163,6 +186,7 @@ public Builder from(DeployedTriggersListRequest other) {
before(other.getBefore());
limit(other.getLimit());
externalUserId(other.getExternalUserId());
+ emitterType(other.getEmitterType());
return this;
}
@@ -178,6 +202,26 @@ public _FinalStage externalUserId(@NotNull String externalUserId) {
return this;
}
+ /**
+ * Filter deployed triggers by emitter type (defaults to 'source' if not provided)
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ public _FinalStage emitterType(DeployedTriggersListRequestEmitterType emitterType) {
+ this.emitterType = Optional.ofNullable(emitterType);
+ return this;
+ }
+
+ /**
+ * Filter deployed triggers by emitter type (defaults to 'source' if not provided)
+ */
+ @java.lang.Override
+ @JsonSetter(value = "emitter_type", nulls = Nulls.SKIP)
+ public _FinalStage emitterType(Optional emitterType) {
+ this.emitterType = emitterType;
+ return this;
+ }
+
/**
* The maximum number of results to return
* @return Reference to {@code this} so that method calls can be chained together.
@@ -240,7 +284,8 @@ public _FinalStage after(Optional after) {
@java.lang.Override
public DeployedTriggersListRequest build() {
- return new DeployedTriggersListRequest(after, before, limit, externalUserId, additionalProperties);
+ return new DeployedTriggersListRequest(
+ after, before, limit, externalUserId, emitterType, additionalProperties);
}
}
}
diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWebhooksOpts.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWebhooksOpts.java
index bf5b6a7..9c84d03 100644
--- a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWebhooksOpts.java
+++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWebhooksOpts.java
@@ -161,7 +161,9 @@ public _FinalStage addWebhookUrls(String webhookUrls) {
@JsonSetter(value = "webhook_urls", nulls = Nulls.SKIP)
public _FinalStage webhookUrls(List webhookUrls) {
this.webhookUrls.clear();
- this.webhookUrls.addAll(webhookUrls);
+ if (webhookUrls != null) {
+ this.webhookUrls.addAll(webhookUrls);
+ }
return this;
}
diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWorkflowsOpts.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWorkflowsOpts.java
index 6d042d9..eed070d 100644
--- a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWorkflowsOpts.java
+++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWorkflowsOpts.java
@@ -161,7 +161,9 @@ public _FinalStage addWorkflowIds(String workflowIds) {
@JsonSetter(value = "workflow_ids", nulls = Nulls.SKIP)
public _FinalStage workflowIds(List workflowIds) {
this.workflowIds.clear();
- this.workflowIds.addAll(workflowIds);
+ if (workflowIds != null) {
+ this.workflowIds.addAll(workflowIds);
+ }
return this;
}
diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/types/DeployedTriggersListRequestEmitterType.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/types/DeployedTriggersListRequestEmitterType.java
new file mode 100644
index 0000000..0391e7a
--- /dev/null
+++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/types/DeployedTriggersListRequestEmitterType.java
@@ -0,0 +1,108 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.pipedream.api.resources.deployedtriggers.types;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+public final class DeployedTriggersListRequestEmitterType {
+ public static final DeployedTriggersListRequestEmitterType SOURCE =
+ new DeployedTriggersListRequestEmitterType(Value.SOURCE, "source");
+
+ public static final DeployedTriggersListRequestEmitterType EMAIL =
+ new DeployedTriggersListRequestEmitterType(Value.EMAIL, "email");
+
+ public static final DeployedTriggersListRequestEmitterType HTTP =
+ new DeployedTriggersListRequestEmitterType(Value.HTTP, "http");
+
+ public static final DeployedTriggersListRequestEmitterType TIMER =
+ new DeployedTriggersListRequestEmitterType(Value.TIMER, "timer");
+
+ private final Value value;
+
+ private final String string;
+
+ DeployedTriggersListRequestEmitterType(Value value, String string) {
+ this.value = value;
+ this.string = string;
+ }
+
+ public Value getEnumValue() {
+ return value;
+ }
+
+ @java.lang.Override
+ @JsonValue
+ public String toString() {
+ return this.string;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ return (this == other)
+ || (other instanceof DeployedTriggersListRequestEmitterType
+ && this.string.equals(((DeployedTriggersListRequestEmitterType) other).string));
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return this.string.hashCode();
+ }
+
+ public T visit(Visitor visitor) {
+ switch (value) {
+ case SOURCE:
+ return visitor.visitSource();
+ case EMAIL:
+ return visitor.visitEmail();
+ case HTTP:
+ return visitor.visitHttp();
+ case TIMER:
+ return visitor.visitTimer();
+ case UNKNOWN:
+ default:
+ return visitor.visitUnknown(string);
+ }
+ }
+
+ @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
+ public static DeployedTriggersListRequestEmitterType valueOf(String value) {
+ switch (value) {
+ case "source":
+ return SOURCE;
+ case "email":
+ return EMAIL;
+ case "http":
+ return HTTP;
+ case "timer":
+ return TIMER;
+ default:
+ return new DeployedTriggersListRequestEmitterType(Value.UNKNOWN, value);
+ }
+ }
+
+ public enum Value {
+ SOURCE,
+
+ TIMER,
+
+ HTTP,
+
+ EMAIL,
+
+ UNKNOWN
+ }
+
+ public interface Visitor {
+ T visitSource();
+
+ T visitTimer();
+
+ T visitHttp();
+
+ T visitEmail();
+
+ T visitUnknown(String unknownType);
+ }
+}
diff --git a/src/main/java/com/pipedream/api/resources/filestash/AsyncFileStashClient.java b/src/main/java/com/pipedream/api/resources/filestash/AsyncFileStashClient.java
index 72caf81..40ca561 100644
--- a/src/main/java/com/pipedream/api/resources/filestash/AsyncFileStashClient.java
+++ b/src/main/java/com/pipedream/api/resources/filestash/AsyncFileStashClient.java
@@ -6,6 +6,7 @@
import com.pipedream.api.core.ClientOptions;
import com.pipedream.api.core.RequestOptions;
import com.pipedream.api.resources.filestash.requests.FileStashDownloadFileRequest;
+import java.io.InputStream;
import java.util.concurrent.CompletableFuture;
public class AsyncFileStashClient {
@@ -28,14 +29,15 @@ public AsyncRawFileStashClient withRawResponse() {
/**
* Download a file from File Stash
*/
- public CompletableFuture downloadFile(FileStashDownloadFileRequest request) {
+ public CompletableFuture downloadFile(FileStashDownloadFileRequest request) {
return this.rawClient.downloadFile(request).thenApply(response -> response.body());
}
/**
* Download a file from File Stash
*/
- public CompletableFuture downloadFile(FileStashDownloadFileRequest request, RequestOptions requestOptions) {
+ public CompletableFuture downloadFile(
+ FileStashDownloadFileRequest request, RequestOptions requestOptions) {
return this.rawClient.downloadFile(request, requestOptions).thenApply(response -> response.body());
}
}
diff --git a/src/main/java/com/pipedream/api/resources/filestash/AsyncRawFileStashClient.java b/src/main/java/com/pipedream/api/resources/filestash/AsyncRawFileStashClient.java
index 89668b6..aa73f5d 100644
--- a/src/main/java/com/pipedream/api/resources/filestash/AsyncRawFileStashClient.java
+++ b/src/main/java/com/pipedream/api/resources/filestash/AsyncRawFileStashClient.java
@@ -11,9 +11,11 @@
import com.pipedream.api.core.ObjectMappers;
import com.pipedream.api.core.QueryStringMapper;
import com.pipedream.api.core.RequestOptions;
+import com.pipedream.api.core.ResponseBodyInputStream;
import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.resources.filestash.requests.FileStashDownloadFileRequest;
import java.io.IOException;
+import java.io.InputStream;
import java.util.concurrent.CompletableFuture;
import okhttp3.Call;
import okhttp3.Callback;
@@ -35,14 +37,14 @@ public AsyncRawFileStashClient(ClientOptions clientOptions) {
/**
* Download a file from File Stash
*/
- public CompletableFuture> downloadFile(FileStashDownloadFileRequest request) {
+ public CompletableFuture> downloadFile(FileStashDownloadFileRequest request) {
return downloadFile(request, null);
}
/**
* Download a file from File Stash
*/
- public CompletableFuture> downloadFile(
+ public CompletableFuture> downloadFile(
FileStashDownloadFileRequest request, RequestOptions requestOptions) {
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
@@ -60,13 +62,14 @@ public CompletableFuture> downloadFile(
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
- CompletableFuture> future = new CompletableFuture<>();
+ CompletableFuture> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
- try (ResponseBody responseBody = response.body()) {
+ try {
+ ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
- future.complete(new BaseClientHttpResponse<>(null, response));
+ future.complete(new BaseClientHttpResponse<>(new ResponseBodyInputStream(response), response));
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
diff --git a/src/main/java/com/pipedream/api/resources/filestash/FileStashClient.java b/src/main/java/com/pipedream/api/resources/filestash/FileStashClient.java
index f889b1e..3e08288 100644
--- a/src/main/java/com/pipedream/api/resources/filestash/FileStashClient.java
+++ b/src/main/java/com/pipedream/api/resources/filestash/FileStashClient.java
@@ -6,6 +6,7 @@
import com.pipedream.api.core.ClientOptions;
import com.pipedream.api.core.RequestOptions;
import com.pipedream.api.resources.filestash.requests.FileStashDownloadFileRequest;
+import java.io.InputStream;
public class FileStashClient {
protected final ClientOptions clientOptions;
@@ -27,14 +28,14 @@ public RawFileStashClient withRawResponse() {
/**
* Download a file from File Stash
*/
- public void downloadFile(FileStashDownloadFileRequest request) {
- this.rawClient.downloadFile(request).body();
+ public InputStream downloadFile(FileStashDownloadFileRequest request) {
+ return this.rawClient.downloadFile(request).body();
}
/**
* Download a file from File Stash
*/
- public void downloadFile(FileStashDownloadFileRequest request, RequestOptions requestOptions) {
- this.rawClient.downloadFile(request, requestOptions).body();
+ public InputStream downloadFile(FileStashDownloadFileRequest request, RequestOptions requestOptions) {
+ return this.rawClient.downloadFile(request, requestOptions).body();
}
}
diff --git a/src/main/java/com/pipedream/api/resources/filestash/RawFileStashClient.java b/src/main/java/com/pipedream/api/resources/filestash/RawFileStashClient.java
index 777c227..2bd5052 100644
--- a/src/main/java/com/pipedream/api/resources/filestash/RawFileStashClient.java
+++ b/src/main/java/com/pipedream/api/resources/filestash/RawFileStashClient.java
@@ -11,9 +11,11 @@
import com.pipedream.api.core.ObjectMappers;
import com.pipedream.api.core.QueryStringMapper;
import com.pipedream.api.core.RequestOptions;
+import com.pipedream.api.core.ResponseBodyInputStream;
import com.pipedream.api.errors.TooManyRequestsError;
import com.pipedream.api.resources.filestash.requests.FileStashDownloadFileRequest;
import java.io.IOException;
+import java.io.InputStream;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
@@ -31,14 +33,14 @@ public RawFileStashClient(ClientOptions clientOptions) {
/**
* Download a file from File Stash
*/
- public BaseClientHttpResponse downloadFile(FileStashDownloadFileRequest request) {
+ public BaseClientHttpResponse downloadFile(FileStashDownloadFileRequest request) {
return downloadFile(request, null);
}
/**
* Download a file from File Stash
*/
- public BaseClientHttpResponse downloadFile(
+ public BaseClientHttpResponse downloadFile(
FileStashDownloadFileRequest request, RequestOptions requestOptions) {
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
@@ -56,10 +58,11 @@ public BaseClientHttpResponse downloadFile(
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
- try (Response response = client.newCall(okhttpRequest).execute()) {
+ try {
+ Response response = client.newCall(okhttpRequest).execute();
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
- return new BaseClientHttpResponse<>(null, response);
+ return new BaseClientHttpResponse<>(new ResponseBodyInputStream(response), response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
diff --git a/src/main/java/com/pipedream/api/resources/oauthtokens/requests/CreateOAuthTokenOpts.java b/src/main/java/com/pipedream/api/resources/oauthtokens/requests/CreateOAuthTokenOpts.java
index 50ab4b2..191f8cb 100644
--- a/src/main/java/com/pipedream/api/resources/oauthtokens/requests/CreateOAuthTokenOpts.java
+++ b/src/main/java/com/pipedream/api/resources/oauthtokens/requests/CreateOAuthTokenOpts.java
@@ -9,11 +9,13 @@
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;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@@ -23,11 +25,15 @@ public final class CreateOAuthTokenOpts {
private final String clientSecret;
+ private final Optional scope;
+
private final Map additionalProperties;
- private CreateOAuthTokenOpts(String clientId, String clientSecret, Map additionalProperties) {
+ private CreateOAuthTokenOpts(
+ String clientId, String clientSecret, Optional scope, Map additionalProperties) {
this.clientId = clientId;
this.clientSecret = clientSecret;
+ this.scope = scope;
this.additionalProperties = additionalProperties;
}
@@ -46,6 +52,14 @@ public String getClientSecret() {
return clientSecret;
}
+ /**
+ * @return Optional space-separated scopes for the access token. Defaults to '*'.
+ */
+ @JsonProperty("scope")
+ public Optional getScope() {
+ return scope;
+ }
+
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
@@ -58,12 +72,12 @@ public Map getAdditionalProperties() {
}
private boolean equalTo(CreateOAuthTokenOpts other) {
- return clientId.equals(other.clientId) && clientSecret.equals(other.clientSecret);
+ return clientId.equals(other.clientId) && clientSecret.equals(other.clientSecret) && scope.equals(other.scope);
}
@java.lang.Override
public int hashCode() {
- return Objects.hash(this.clientId, this.clientSecret);
+ return Objects.hash(this.clientId, this.clientSecret, this.scope);
}
@java.lang.Override
@@ -87,6 +101,13 @@ public interface ClientSecretStage {
public interface _FinalStage {
CreateOAuthTokenOpts build();
+
+ /**
+ * Optional space-separated scopes for the access token. Defaults to '*'.
+ */
+ _FinalStage scope(Optional scope);
+
+ _FinalStage scope(String scope);
}
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -95,6 +116,8 @@ public static final class Builder implements ClientIdStage, ClientSecretStage, _
private String clientSecret;
+ private Optional scope = Optional.empty();
+
@JsonAnySetter
private Map additionalProperties = new HashMap<>();
@@ -104,6 +127,7 @@ private Builder() {}
public Builder from(CreateOAuthTokenOpts other) {
clientId(other.getClientId());
clientSecret(other.getClientSecret());
+ scope(other.getScope());
return this;
}
@@ -121,9 +145,29 @@ public _FinalStage clientSecret(@NotNull String clientSecret) {
return this;
}
+ /**
+ * Optional space-separated scopes for the access token. Defaults to '*'.
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ public _FinalStage scope(String scope) {
+ this.scope = Optional.ofNullable(scope);
+ return this;
+ }
+
+ /**
+ * Optional space-separated scopes for the access token. Defaults to '*'.
+ */
+ @java.lang.Override
+ @JsonSetter(value = "scope", nulls = Nulls.SKIP)
+ public _FinalStage scope(Optional scope) {
+ this.scope = scope;
+ return this;
+ }
+
@java.lang.Override
public CreateOAuthTokenOpts build() {
- return new CreateOAuthTokenOpts(clientId, clientSecret, additionalProperties);
+ return new CreateOAuthTokenOpts(clientId, clientSecret, scope, additionalProperties);
}
}
}
diff --git a/src/main/java/com/pipedream/api/resources/proxy/AsyncProxyClient.java b/src/main/java/com/pipedream/api/resources/proxy/AsyncProxyClient.java
index bb0aa7f..d37deb9 100644
--- a/src/main/java/com/pipedream/api/resources/proxy/AsyncProxyClient.java
+++ b/src/main/java/com/pipedream/api/resources/proxy/AsyncProxyClient.java
@@ -10,7 +10,6 @@
import com.pipedream.api.resources.proxy.requests.ProxyPatchRequest;
import com.pipedream.api.resources.proxy.requests.ProxyPostRequest;
import com.pipedream.api.resources.proxy.requests.ProxyPutRequest;
-import java.util.Base64;
import java.util.concurrent.CompletableFuture;
public class AsyncProxyClient {
@@ -30,57 +29,73 @@ public AsyncRawProxyClient withRawResponse() {
return this.rawClient;
}
- private String encodeUrl(String url) {
- return Base64.getUrlEncoder().encodeToString(url.getBytes());
- }
-
- public CompletableFuture