diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock
index 7555f78b..eedeb835 100644
--- a/.speakeasy/gen.lock
+++ b/.speakeasy/gen.lock
@@ -1,12 +1,12 @@
lockVersion: 2.0.0
id: 5bbaa3a9-baa0-471b-ba6a-13fd88e8c119
management:
- docChecksum: 18c6516bb55583b76843d64969c1d642
+ docChecksum: a4d06247bade58b8661c12eb32510ab9
docVersion: 1.0.0
speakeasyVersion: 1.555.2
generationVersion: 2.620.2
- releaseVersion: 1.0.0-beta.8
- configChecksum: d043c1b0c3ee14241ba7dac567c4ae76
+ releaseVersion: 1.0.0-beta.9
+ configChecksum: 9123943b77564dbc2f8133074085750d
repoURL: https://github.com/gr4vy/gr4vy-java.git
published: true
features:
diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml
index 99b62bff..79a4d3d1 100644
--- a/.speakeasy/gen.yaml
+++ b/.speakeasy/gen.yaml
@@ -18,7 +18,7 @@ generation:
oAuth2PasswordEnabled: false
sdkHooksConfigAccess: true
java:
- version: 1.0.0-beta.8
+ version: 1.0.0-beta.9
additionalDependencies:
- testImplementation:org.junit.jupiter:junit-jupiter:5.10.0
- implementation:com.auth0:java-jwt:4.5.0
diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock
index 8f18bf48..fcdbf811 100644
--- a/.speakeasy/workflow.lock
+++ b/.speakeasy/workflow.lock
@@ -9,11 +9,11 @@ sources:
- 1.0.0
openapi:
sourceNamespace: openapi
- sourceRevisionDigest: sha256:8ee4f196bee9bb7ac2297c1865f961c5394e4118a0e74feec1bb9f9137b99504
- sourceBlobDigest: sha256:bbf37bd476f9d17978dbed983ca325a3bc61bd1703c9888c7fbbc9a35abe1414
+ sourceRevisionDigest: sha256:a5bb1f10a71ceb70e09f7d5ace55b855e0667707c965d1ad4ccaae9894db455e
+ sourceBlobDigest: sha256:d11f98c39257effd8d29572fdac509c18610e712baedbba3428dba7c10f118c7
tags:
- latest
- - speakeasy-sdk-regen-1749027924
+ - speakeasy-sdk-regen-1749045087
- 1.0.0
targets:
gr-4-vy:
@@ -26,10 +26,10 @@ targets:
java:
source: openapi
sourceNamespace: openapi
- sourceRevisionDigest: sha256:8ee4f196bee9bb7ac2297c1865f961c5394e4118a0e74feec1bb9f9137b99504
- sourceBlobDigest: sha256:bbf37bd476f9d17978dbed983ca325a3bc61bd1703c9888c7fbbc9a35abe1414
+ sourceRevisionDigest: sha256:a5bb1f10a71ceb70e09f7d5ace55b855e0667707c965d1ad4ccaae9894db455e
+ sourceBlobDigest: sha256:d11f98c39257effd8d29572fdac509c18610e712baedbba3428dba7c10f118c7
codeSamplesNamespace: openapi-java-code-samples
- codeSamplesRevisionDigest: sha256:dd03b1de57b4f1255a4a7ce668d92adf247960f509c5dadc47198860a7eecc75
+ codeSamplesRevisionDigest: sha256:dccda131d29f78e7908f422223df1575023dea36b4e53d6cfa809a80a5a4bd2b
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
diff --git a/README.md b/README.md
index 4c1ad52f..cf7516da 100644
--- a/README.md
+++ b/README.md
@@ -60,7 +60,7 @@ The samples below show how a published SDK artifact is used:
Gradle:
```groovy
-implementation 'com.gr4vy:sdk:1.0.0-beta.8'
+implementation 'com.gr4vy:sdk:1.0.0-beta.9'
```
Maven:
@@ -68,7 +68,7 @@ Maven:
com.gr4vy
sdk
- 1.0.0-beta.8
+ 1.0.0-beta.9
```
diff --git a/RELEASES.md b/RELEASES.md
index 518ed7a6..4b18a0b1 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -68,4 +68,14 @@ Based on:
### Generated
- [java v1.0.0-beta.8] .
### Releases
-- [Maven Central v1.0.0-beta.8] https://central.sonatype.com/artifact/com.gr4vy/sdk/1.0.0-beta.8 - .
\ No newline at end of file
+- [Maven Central v1.0.0-beta.8] https://central.sonatype.com/artifact/com.gr4vy/sdk/1.0.0-beta.8 - .
+
+## 2025-06-04 13:51:08
+### Changes
+Based on:
+- OpenAPI Doc
+- Speakeasy CLI 1.555.2 (2.620.2) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [java v1.0.0-beta.9] .
+### Releases
+- [Maven Central v1.0.0-beta.9] https://central.sonatype.com/artifact/com.gr4vy/sdk/1.0.0-beta.9 - .
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 43ee6315..558d869f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -103,7 +103,7 @@ publishing {
// https://github.com/gradle/gradle/issues/18619
groupId = "com.gr4vy"
artifactId = "sdk"
- version = "1.0.0-beta.8"
+ version = "1.0.0-beta.9"
from components.java
diff --git a/docs/sdks/reportsexecutions/README.md b/docs/sdks/reportsexecutions/README.md
index d46d837d..b4f1b24f 100644
--- a/docs/sdks/reportsexecutions/README.md
+++ b/docs/sdks/reportsexecutions/README.md
@@ -20,7 +20,6 @@ package hello.world;
import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.ListAllReportExecutionsRequest;
-import com.gr4vy.sdk.models.operations.ListAllReportExecutionsResponse;
import java.lang.Exception;
public class Application {
@@ -35,13 +34,13 @@ public class Application {
ListAllReportExecutionsRequest req = ListAllReportExecutionsRequest.builder()
.build();
- ListAllReportExecutionsResponse res = sdk.reportsExecutions().list()
+ sdk.reportsExecutions().list()
.request(req)
- .call();
+ .callAsStream()
+ .forEach(item -> {
+ // handle item
+ });
- if (res.reportExecutions().isPresent()) {
- // handle response
- }
}
}
```
diff --git a/gradle.properties b/gradle.properties
index 6d28fc78..426ee276 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,3 +1,3 @@
groupId=com.gr4vy
artifactId=sdk
-version=1.0.0-beta.8
\ No newline at end of file
+version=1.0.0-beta.9
\ No newline at end of file
diff --git a/src/main/java/com/gr4vy/sdk/ReportsExecutions.java b/src/main/java/com/gr4vy/sdk/ReportsExecutions.java
index e9851756..07c58906 100644
--- a/src/main/java/com/gr4vy/sdk/ReportsExecutions.java
+++ b/src/main/java/com/gr4vy/sdk/ReportsExecutions.java
@@ -37,11 +37,17 @@
import com.gr4vy.sdk.utils.Retries;
import com.gr4vy.sdk.utils.RetryConfig;
import com.gr4vy.sdk.utils.Utils;
+import com.jayway.jsonpath.Configuration;
+import com.jayway.jsonpath.JsonPath;
+import com.jayway.jsonpath.Option;
+import com.jayway.jsonpath.ReadContext;
import java.io.InputStream;
import java.lang.Exception;
import java.lang.String;
+import java.lang.SuppressWarnings;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -189,19 +195,47 @@ public ListAllReportExecutionsResponse list(
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
+ byte[] _fullResponse = Utils.extractByteArrayFromBody(_httpRes);
+
+ @SuppressWarnings("deprecation")
ListAllReportExecutionsResponse.Builder _resBuilder =
ListAllReportExecutionsResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
- .rawResponse(_httpRes);
+ .rawResponse(_httpRes)
+ .next(() -> {
+ if (request == null) {
+ return Optional.empty();
+ }
+ String _stringBody = new String(_fullResponse, StandardCharsets.UTF_8);
+ Configuration _config = Configuration.defaultConfiguration()
+ .addOptions(Option.SUPPRESS_EXCEPTIONS);
+ ReadContext _body = JsonPath.using(_config).parse(_stringBody);
+ String _nextCursor = _body.read("$.next_cursor", String.class);
+ if (_nextCursor == null) {
+ return Optional.empty();
+ }
+ ListAllReportExecutionsRequestBuilder _nextRequest = list()
+ .request(new ListAllReportExecutionsRequest(
+ JsonNullable.of(_nextCursor),
+ request.limit(),
+ request.reportName(),
+ request.createdAtLte(),
+ request.createdAtGte(),
+ request.status(),
+ request.creatorId(),
+ request.merchantAccountId()
+ ));
+ return Optional.of(_nextRequest.call());
+ });
ListAllReportExecutionsResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
ReportExecutions _out = Utils.mapper().readValue(
- Utils.toUtf8AndClose(_httpRes.body()),
+ new String(_fullResponse, StandardCharsets.UTF_8),
new TypeReference() {});
_res.withReportExecutions(Optional.ofNullable(_out));
return _res;
@@ -210,13 +244,13 @@ public ListAllReportExecutionsResponse list(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
- Utils.extractByteArrayFromBody(_httpRes));
+ _fullResponse);
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
Error400 _out = Utils.mapper().readValue(
- Utils.toUtf8AndClose(_httpRes.body()),
+ new String(_fullResponse, StandardCharsets.UTF_8),
new TypeReference() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
@@ -226,13 +260,13 @@ public ListAllReportExecutionsResponse list(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
- Utils.extractByteArrayFromBody(_httpRes));
+ _fullResponse);
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
Error401 _out = Utils.mapper().readValue(
- Utils.toUtf8AndClose(_httpRes.body()),
+ new String(_fullResponse, StandardCharsets.UTF_8),
new TypeReference() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
@@ -242,13 +276,13 @@ public ListAllReportExecutionsResponse list(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
- Utils.extractByteArrayFromBody(_httpRes));
+ _fullResponse);
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "403")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
Error403 _out = Utils.mapper().readValue(
- Utils.toUtf8AndClose(_httpRes.body()),
+ new String(_fullResponse, StandardCharsets.UTF_8),
new TypeReference() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
@@ -258,13 +292,13 @@ public ListAllReportExecutionsResponse list(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
- Utils.extractByteArrayFromBody(_httpRes));
+ _fullResponse);
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "404")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
Error404 _out = Utils.mapper().readValue(
- Utils.toUtf8AndClose(_httpRes.body()),
+ new String(_fullResponse, StandardCharsets.UTF_8),
new TypeReference() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
@@ -274,13 +308,13 @@ public ListAllReportExecutionsResponse list(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
- Utils.extractByteArrayFromBody(_httpRes));
+ _fullResponse);
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "405")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
Error405 _out = Utils.mapper().readValue(
- Utils.toUtf8AndClose(_httpRes.body()),
+ new String(_fullResponse, StandardCharsets.UTF_8),
new TypeReference() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
@@ -290,13 +324,13 @@ public ListAllReportExecutionsResponse list(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
- Utils.extractByteArrayFromBody(_httpRes));
+ _fullResponse);
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "409")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
Error409 _out = Utils.mapper().readValue(
- Utils.toUtf8AndClose(_httpRes.body()),
+ new String(_fullResponse, StandardCharsets.UTF_8),
new TypeReference() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
@@ -306,13 +340,13 @@ public ListAllReportExecutionsResponse list(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
- Utils.extractByteArrayFromBody(_httpRes));
+ _fullResponse);
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "422")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
HTTPValidationError _out = Utils.mapper().readValue(
- Utils.toUtf8AndClose(_httpRes.body()),
+ new String(_fullResponse, StandardCharsets.UTF_8),
new TypeReference() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
@@ -322,13 +356,13 @@ public ListAllReportExecutionsResponse list(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
- Utils.extractByteArrayFromBody(_httpRes));
+ _fullResponse);
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "425")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
Error425 _out = Utils.mapper().readValue(
- Utils.toUtf8AndClose(_httpRes.body()),
+ new String(_fullResponse, StandardCharsets.UTF_8),
new TypeReference() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
@@ -338,13 +372,13 @@ public ListAllReportExecutionsResponse list(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
- Utils.extractByteArrayFromBody(_httpRes));
+ _fullResponse);
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "429")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
Error429 _out = Utils.mapper().readValue(
- Utils.toUtf8AndClose(_httpRes.body()),
+ new String(_fullResponse, StandardCharsets.UTF_8),
new TypeReference() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
@@ -354,13 +388,13 @@ public ListAllReportExecutionsResponse list(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
- Utils.extractByteArrayFromBody(_httpRes));
+ _fullResponse);
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "500")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
Error500 _out = Utils.mapper().readValue(
- Utils.toUtf8AndClose(_httpRes.body()),
+ new String(_fullResponse, StandardCharsets.UTF_8),
new TypeReference() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
@@ -370,13 +404,13 @@ public ListAllReportExecutionsResponse list(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
- Utils.extractByteArrayFromBody(_httpRes));
+ _fullResponse);
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "502")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
Error502 _out = Utils.mapper().readValue(
- Utils.toUtf8AndClose(_httpRes.body()),
+ new String(_fullResponse, StandardCharsets.UTF_8),
new TypeReference() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
@@ -386,13 +420,13 @@ public ListAllReportExecutionsResponse list(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
- Utils.extractByteArrayFromBody(_httpRes));
+ _fullResponse);
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "504")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
Error504 _out = Utils.mapper().readValue(
- Utils.toUtf8AndClose(_httpRes.body()),
+ new String(_fullResponse, StandardCharsets.UTF_8),
new TypeReference() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
@@ -402,7 +436,7 @@ public ListAllReportExecutionsResponse list(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
- Utils.extractByteArrayFromBody(_httpRes));
+ _fullResponse);
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
@@ -411,7 +445,7 @@ public ListAllReportExecutionsResponse list(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
- Utils.extractByteArrayFromBody(_httpRes));
+ _fullResponse);
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
@@ -419,13 +453,13 @@ public ListAllReportExecutionsResponse list(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
- Utils.extractByteArrayFromBody(_httpRes));
+ _fullResponse);
}
throw new APIException(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
- Utils.extractByteArrayFromBody(_httpRes));
+ _fullResponse);
}
diff --git a/src/main/java/com/gr4vy/sdk/SDKConfiguration.java b/src/main/java/com/gr4vy/sdk/SDKConfiguration.java
index 8140e03e..333e905a 100644
--- a/src/main/java/com/gr4vy/sdk/SDKConfiguration.java
+++ b/src/main/java/com/gr4vy/sdk/SDKConfiguration.java
@@ -19,7 +19,7 @@ public class SDKConfiguration {
private static final String LANGUAGE = "java";
public static final String OPENAPI_DOC_VERSION = "1.0.0";
- public static final String SDK_VERSION = "1.0.0-beta.8";
+ public static final String SDK_VERSION = "1.0.0-beta.9";
public static final String GEN_VERSION = "2.620.2";
private static final String BASE_PACKAGE = "com.gr4vy.sdk";
public static final String USER_AGENT =
diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsRequestBuilder.java
index 87641236..19d0b5b2 100644
--- a/src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsRequestBuilder.java
+++ b/src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsRequestBuilder.java
@@ -3,11 +3,13 @@
*/
package com.gr4vy.sdk.models.operations;
+import com.gr4vy.sdk.models.errors.APIException;
import com.gr4vy.sdk.utils.Options;
import com.gr4vy.sdk.utils.RetryConfig;
import com.gr4vy.sdk.utils.Utils;
import java.lang.Exception;
import java.util.Optional;
+import java.util.stream.Stream;
public class ListAllReportExecutionsRequestBuilder {
@@ -45,4 +47,25 @@ public ListAllReportExecutionsResponse call() throws Exception {
request,
options);
}
+
+ /**
+ * Returns a stream that performs next page calls till no more pages
+ * are returned. Unlike the {@link #call()} method this method will
+ * throw an {@link APIException} if any page retrieval has an HTTP status
+ * code >= 300 (Note that 3XX is not an error range but will need
+ * special handling by the user if for example the HTTP client is
+ * not configured to follow redirects).
+ *
+ * @throws {@link APIException} if HTTP status code >= 300 is encountered
+ **/
+ public Stream callAsStream() {
+ return Utils.stream(() -> Optional.of(call()), x -> {
+ if (x.statusCode() >= 300) {
+ byte[] body = Utils.toByteArrayAndClose(x.rawResponse().body());
+ throw new APIException(x.rawResponse(), x.statusCode(), x.contentType(), body);
+ } else {
+ return x.next();
+ }
+ });
+ }
}
diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsResponse.java
index c07b9e72..09fd1020 100644
--- a/src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsResponse.java
+++ b/src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsResponse.java
@@ -9,6 +9,8 @@
import com.gr4vy.sdk.utils.Response;
import com.gr4vy.sdk.utils.Utils;
import java.io.InputStream;
+import java.lang.Deprecated;
+import java.lang.Exception;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
@@ -16,6 +18,7 @@
import java.net.http.HttpResponse;
import java.util.Objects;
import java.util.Optional;
+import java.util.concurrent.Callable;
public class ListAllReportExecutionsResponse implements Response {
@@ -39,6 +42,8 @@ public class ListAllReportExecutionsResponse implements Response {
*/
private Optional extends ReportExecutions> reportExecutions;
+ private Callable> next = () -> Optional.empty();
+
@JsonCreator
public ListAllReportExecutionsResponse(
String contentType,
@@ -95,6 +100,16 @@ public Optional reportExecutions() {
return (Optional) reportExecutions;
}
+ public Optional next() throws Exception {
+ return this.next.call();
+ }
+
+ // internal use only
+ private ListAllReportExecutionsResponse withNext(Callable> next) {
+ this.next = next;
+ return this;
+ }
+
public final static Builder builder() {
return new Builder();
}
@@ -180,6 +195,7 @@ public String toString() {
}
public final static class Builder {
+ private Callable> next;
private String contentType;
@@ -237,13 +253,26 @@ public Builder reportExecutions(Optional extends ReportExecutions> reportExecu
this.reportExecutions = reportExecutions;
return this;
}
+
+ /**
+ * Internal API. Not for public use. Sets the provider of the next page.
+ *
+ * @deprecated not part of the public API, may be removed without notice
+ */
+ @Deprecated
+ public Builder next(Callable> next) {
+ Utils.checkNotNull(next, "next");
+ this.next = next;
+ return this;
+ }
public ListAllReportExecutionsResponse build() {
return new ListAllReportExecutionsResponse(
contentType,
statusCode,
rawResponse,
- reportExecutions);
+ reportExecutions)
+ .withNext(next);
}
}
}