diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index ec847edc6..16b219fd3 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.369.0"
+ ".": "0.370.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index fa77aa9b3..b52e8c7d7 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 229
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-bd464d151612058d8029150b376949b22d5515af23621465c0ce1c1069b91644.yml
openapi_spec_hash: e60e1548c523a0ee7c9daa1bd988cbc5
-config_hash: eecc5886c26d07c167f37f30ae505a2c
+config_hash: ca1425272e17fa23d4466d33492334fa
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f876af3aa..fb5a34338 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 0.370.0 (2025-11-26)
+
+Full Changelog: [v0.369.0...v0.370.0](https://github.com/Increase/increase-java/compare/v0.369.0...v0.370.0)
+
+### Features
+
+* **api:** api update ([3816f9a](https://github.com/Increase/increase-java/commit/3816f9a2dde3a34697bb0b289b5dd543152aadb3))
+
## 0.369.0 (2025-11-26)
Full Changelog: [v0.368.0...v0.369.0](https://github.com/Increase/increase-java/compare/v0.368.0...v0.369.0)
diff --git a/README.md b/README.md
index bbb7a419c..932bcb81d 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.369.0)
-[](https://javadoc.io/doc/com.increase.api/increase-java/0.369.0)
+[](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.370.0)
+[](https://javadoc.io/doc/com.increase.api/increase-java/0.370.0)
@@ -13,7 +13,7 @@ The Increase Java SDK is similar to the Increase Kotlin SDK but with minor diffe
-The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.369.0).
+The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.370.0).
@@ -24,7 +24,7 @@ The REST API documentation can be found on [increase.com](https://increase.com/d
### Gradle
```kotlin
-implementation("com.increase.api:increase-java:0.369.0")
+implementation("com.increase.api:increase-java:0.370.0")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.369.0")
com.increase.api
increase-java
- 0.369.0
+ 0.370.0
```
@@ -57,6 +57,8 @@ IncreaseClient client = IncreaseOkHttpClient.fromEnv();
AccountCreateParams params = AccountCreateParams.builder()
.name("New Account!")
+ .entityId("entity_n8y8tnk2p9339ti393yi")
+ .programId("program_i2v2os4mwza1oetokh9i")
.build();
Account account = client.accounts().create(params);
```
@@ -159,6 +161,8 @@ IncreaseClient client = IncreaseOkHttpClient.fromEnv();
AccountCreateParams params = AccountCreateParams.builder()
.name("New Account!")
+ .entityId("entity_n8y8tnk2p9339ti393yi")
+ .programId("program_i2v2os4mwza1oetokh9i")
.build();
CompletableFuture account = client.async().accounts().create(params);
```
@@ -178,6 +182,8 @@ IncreaseClientAsync client = IncreaseOkHttpClientAsync.fromEnv();
AccountCreateParams params = AccountCreateParams.builder()
.name("New Account!")
+ .entityId("entity_n8y8tnk2p9339ti393yi")
+ .programId("program_i2v2os4mwza1oetokh9i")
.build();
CompletableFuture account = client.accounts().create(params);
```
@@ -262,6 +268,8 @@ import com.increase.api.models.accounts.AccountCreateParams;
AccountCreateParams params = AccountCreateParams.builder()
.name("New Account!")
+ .entityId("entity_n8y8tnk2p9339ti393yi")
+ .programId("program_i2v2os4mwza1oetokh9i")
.build();
HttpResponseFor account = client.accounts().withRawResponse().create(params);
@@ -302,6 +310,106 @@ The SDK throws custom unchecked exception types:
- [`IncreaseException`](increase-java-core/src/main/kotlin/com/increase/api/errors/IncreaseException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class.
+## Pagination
+
+The SDK defines methods that return a paginated lists of results. It provides convenient ways to access the results either one page at a time or item-by-item across all pages.
+
+### Auto-pagination
+
+To iterate through all results across all pages, use the `autoPager()` method, which automatically fetches more pages as needed.
+
+When using the synchronous client, the method returns an [`Iterable`](https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html)
+
+```java
+import com.increase.api.models.accounts.Account;
+import com.increase.api.models.accounts.AccountListPage;
+
+AccountListPage page = client.accounts().list();
+
+// Process as an Iterable
+for (Account account : page.autoPager()) {
+ System.out.println(account);
+}
+
+// Process as a Stream
+page.autoPager()
+ .stream()
+ .limit(50)
+ .forEach(account -> System.out.println(account));
+```
+
+When using the asynchronous client, the method returns an [`AsyncStreamResponse`](increase-java-core/src/main/kotlin/com/increase/api/core/http/AsyncStreamResponse.kt):
+
+```java
+import com.increase.api.core.http.AsyncStreamResponse;
+import com.increase.api.models.accounts.Account;
+import com.increase.api.models.accounts.AccountListPageAsync;
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+
+CompletableFuture pageFuture = client.async().accounts().list();
+
+pageFuture.thenRun(page -> page.autoPager().subscribe(account -> {
+ System.out.println(account);
+}));
+
+// If you need to handle errors or completion of the stream
+pageFuture.thenRun(page -> page.autoPager().subscribe(new AsyncStreamResponse.Handler<>() {
+ @Override
+ public void onNext(Account account) {
+ System.out.println(account);
+ }
+
+ @Override
+ public void onComplete(Optional error) {
+ if (error.isPresent()) {
+ System.out.println("Something went wrong!");
+ throw new RuntimeException(error.get());
+ } else {
+ System.out.println("No more!");
+ }
+ }
+}));
+
+// Or use futures
+pageFuture.thenRun(page -> page.autoPager()
+ .subscribe(account -> {
+ System.out.println(account);
+ })
+ .onCompleteFuture()
+ .whenComplete((unused, error) -> {
+ if (error != null) {
+ System.out.println("Something went wrong!");
+ throw new RuntimeException(error);
+ } else {
+ System.out.println("No more!");
+ }
+ }));
+```
+
+### Manual pagination
+
+To access individual page items and manually request the next page, use the `items()`,
+`hasNextPage()`, and `nextPage()` methods:
+
+```java
+import com.increase.api.models.accounts.Account;
+import com.increase.api.models.accounts.AccountListPage;
+
+AccountListPage page = client.accounts().list();
+while (true) {
+ for (Account account : page.items()) {
+ System.out.println(account);
+ }
+
+ if (!page.hasNextPage()) {
+ break;
+ }
+
+ page = page.nextPage();
+}
+```
+
## Logging
The SDK uses the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor).
@@ -520,6 +628,8 @@ import com.increase.api.models.accounts.AccountCreateParams;
AccountCreateParams params = AccountCreateParams.builder()
.name(JsonValue.from(42))
+ .entityId("entity_n8y8tnk2p9339ti393yi")
+ .programId("program_i2v2os4mwza1oetokh9i")
.build();
```
diff --git a/build.gradle.kts b/build.gradle.kts
index db1776f38..811961cea 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.increase.api"
- version = "0.369.0" // x-release-please-version
+ version = "0.370.0" // x-release-please-version
}
subprojects {
diff --git a/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/IncreaseOkHttpClient.kt b/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/IncreaseOkHttpClient.kt
index 4f68fa3bd..8d8f55ae4 100644
--- a/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/IncreaseOkHttpClient.kt
+++ b/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/IncreaseOkHttpClient.kt
@@ -8,6 +8,7 @@ import com.increase.api.client.IncreaseClientImpl
import com.increase.api.core.ClientOptions
import com.increase.api.core.Sleeper
import com.increase.api.core.Timeout
+import com.increase.api.core.http.AsyncStreamResponse
import com.increase.api.core.http.Headers
import com.increase.api.core.http.HttpClient
import com.increase.api.core.http.QueryParams
@@ -16,6 +17,7 @@ import java.net.Proxy
import java.time.Clock
import java.time.Duration
import java.util.Optional
+import java.util.concurrent.Executor
import javax.net.ssl.HostnameVerifier
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.X509TrustManager
@@ -121,6 +123,17 @@ class IncreaseOkHttpClient private constructor() {
*/
fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) }
+ /**
+ * The executor to use for running [AsyncStreamResponse.Handler] callbacks.
+ *
+ * Defaults to a dedicated cached thread pool.
+ *
+ * This class takes ownership of the executor and shuts it down, if possible, when closed.
+ */
+ fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
+ clientOptions.streamHandlerExecutor(streamHandlerExecutor)
+ }
+
/**
* The interface to use for delaying execution, like during retries.
*
diff --git a/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/IncreaseOkHttpClientAsync.kt b/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/IncreaseOkHttpClientAsync.kt
index 963317a79..d80607c7e 100644
--- a/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/IncreaseOkHttpClientAsync.kt
+++ b/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/IncreaseOkHttpClientAsync.kt
@@ -8,6 +8,7 @@ import com.increase.api.client.IncreaseClientAsyncImpl
import com.increase.api.core.ClientOptions
import com.increase.api.core.Sleeper
import com.increase.api.core.Timeout
+import com.increase.api.core.http.AsyncStreamResponse
import com.increase.api.core.http.Headers
import com.increase.api.core.http.HttpClient
import com.increase.api.core.http.QueryParams
@@ -16,6 +17,7 @@ import java.net.Proxy
import java.time.Clock
import java.time.Duration
import java.util.Optional
+import java.util.concurrent.Executor
import javax.net.ssl.HostnameVerifier
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.X509TrustManager
@@ -121,6 +123,17 @@ class IncreaseOkHttpClientAsync private constructor() {
*/
fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) }
+ /**
+ * The executor to use for running [AsyncStreamResponse.Handler] callbacks.
+ *
+ * Defaults to a dedicated cached thread pool.
+ *
+ * This class takes ownership of the executor and shuts it down, if possible, when closed.
+ */
+ fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
+ clientOptions.streamHandlerExecutor(streamHandlerExecutor)
+ }
+
/**
* The interface to use for delaying execution, like during retries.
*
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/core/AutoPager.kt b/increase-java-core/src/main/kotlin/com/increase/api/core/AutoPager.kt
new file mode 100644
index 000000000..fc383e837
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/core/AutoPager.kt
@@ -0,0 +1,21 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.core
+
+import java.util.stream.Stream
+import java.util.stream.StreamSupport
+
+class AutoPager private constructor(private val firstPage: Page) : Iterable {
+
+ companion object {
+
+ fun from(firstPage: Page): AutoPager = AutoPager(firstPage)
+ }
+
+ override fun iterator(): Iterator =
+ generateSequence(firstPage) { if (it.hasNextPage()) it.nextPage() else null }
+ .flatMap { it.items() }
+ .iterator()
+
+ fun stream(): Stream = StreamSupport.stream(spliterator(), false)
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/core/AutoPagerAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/core/AutoPagerAsync.kt
new file mode 100644
index 000000000..15b811a06
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/core/AutoPagerAsync.kt
@@ -0,0 +1,88 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.core
+
+import com.increase.api.core.http.AsyncStreamResponse
+import java.util.Optional
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.CompletionException
+import java.util.concurrent.Executor
+import java.util.concurrent.atomic.AtomicReference
+
+class AutoPagerAsync
+private constructor(private val firstPage: PageAsync, private val defaultExecutor: Executor) :
+ AsyncStreamResponse {
+
+ companion object {
+
+ fun from(firstPage: PageAsync, defaultExecutor: Executor): AutoPagerAsync =
+ AutoPagerAsync(firstPage, defaultExecutor)
+ }
+
+ private val onCompleteFuture = CompletableFuture()
+ private val state = AtomicReference(State.NEW)
+
+ override fun subscribe(handler: AsyncStreamResponse.Handler): AsyncStreamResponse =
+ subscribe(handler, defaultExecutor)
+
+ override fun subscribe(
+ handler: AsyncStreamResponse.Handler,
+ executor: Executor,
+ ): AsyncStreamResponse = apply {
+ // TODO(JDK): Use `compareAndExchange` once targeting JDK 9.
+ check(state.compareAndSet(State.NEW, State.SUBSCRIBED)) {
+ if (state.get() == State.SUBSCRIBED) "Cannot subscribe more than once"
+ else "Cannot subscribe after the response is closed"
+ }
+
+ fun PageAsync.handle(): CompletableFuture {
+ if (state.get() == State.CLOSED) {
+ return CompletableFuture.completedFuture(null)
+ }
+
+ items().forEach { handler.onNext(it) }
+ return if (hasNextPage()) nextPage().thenCompose { it.handle() }
+ else CompletableFuture.completedFuture(null)
+ }
+
+ executor.execute {
+ firstPage.handle().whenComplete { _, error ->
+ val actualError =
+ if (error is CompletionException && error.cause != null) error.cause else error
+ try {
+ handler.onComplete(Optional.ofNullable(actualError))
+ } finally {
+ try {
+ if (actualError == null) {
+ onCompleteFuture.complete(null)
+ } else {
+ onCompleteFuture.completeExceptionally(actualError)
+ }
+ } finally {
+ close()
+ }
+ }
+ }
+ }
+ }
+
+ override fun onCompleteFuture(): CompletableFuture = onCompleteFuture
+
+ override fun close() {
+ val previousState = state.getAndSet(State.CLOSED)
+ if (previousState == State.CLOSED) {
+ return
+ }
+
+ // When the stream is closed, we should always consider it closed. If it closed due
+ // to an error, then we will have already completed the future earlier, and this
+ // will be a no-op.
+ onCompleteFuture.complete(null)
+ }
+}
+
+private enum class State {
+ NEW,
+ SUBSCRIBED,
+ CLOSED,
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/core/ClientOptions.kt b/increase-java-core/src/main/kotlin/com/increase/api/core/ClientOptions.kt
index 29167b2c3..0dff03ae7 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/core/ClientOptions.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/core/ClientOptions.kt
@@ -3,6 +3,7 @@
package com.increase.api.core
import com.fasterxml.jackson.databind.json.JsonMapper
+import com.increase.api.core.http.AsyncStreamResponse
import com.increase.api.core.http.Headers
import com.increase.api.core.http.HttpClient
import com.increase.api.core.http.PhantomReachableClosingHttpClient
@@ -11,6 +12,11 @@ import com.increase.api.core.http.RetryingHttpClient
import java.time.Clock
import java.time.Duration
import java.util.Optional
+import java.util.concurrent.Executor
+import java.util.concurrent.ExecutorService
+import java.util.concurrent.Executors
+import java.util.concurrent.ThreadFactory
+import java.util.concurrent.atomic.AtomicLong
import kotlin.jvm.optionals.getOrNull
/** A class representing the SDK client configuration. */
@@ -40,6 +46,14 @@ private constructor(
* needs to be overridden.
*/
@get:JvmName("jsonMapper") val jsonMapper: JsonMapper,
+ /**
+ * The executor to use for running [AsyncStreamResponse.Handler] callbacks.
+ *
+ * Defaults to a dedicated cached thread pool.
+ *
+ * This class takes ownership of the executor and shuts it down, if possible, when closed.
+ */
+ @get:JvmName("streamHandlerExecutor") val streamHandlerExecutor: Executor,
/**
* The interface to use for delaying execution, like during retries.
*
@@ -148,6 +162,7 @@ private constructor(
private var httpClient: HttpClient? = null
private var checkJacksonVersionCompatibility: Boolean = true
private var jsonMapper: JsonMapper = jsonMapper()
+ private var streamHandlerExecutor: Executor? = null
private var sleeper: Sleeper? = null
private var clock: Clock = Clock.systemUTC()
private var baseUrl: String? = null
@@ -164,6 +179,7 @@ private constructor(
httpClient = clientOptions.originalHttpClient
checkJacksonVersionCompatibility = clientOptions.checkJacksonVersionCompatibility
jsonMapper = clientOptions.jsonMapper
+ streamHandlerExecutor = clientOptions.streamHandlerExecutor
sleeper = clientOptions.sleeper
clock = clientOptions.clock
baseUrl = clientOptions.baseUrl
@@ -206,6 +222,20 @@ private constructor(
*/
fun jsonMapper(jsonMapper: JsonMapper) = apply { this.jsonMapper = jsonMapper }
+ /**
+ * The executor to use for running [AsyncStreamResponse.Handler] callbacks.
+ *
+ * Defaults to a dedicated cached thread pool.
+ *
+ * This class takes ownership of the executor and shuts it down, if possible, when closed.
+ */
+ fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
+ this.streamHandlerExecutor =
+ if (streamHandlerExecutor is ExecutorService)
+ PhantomReachableExecutorService(streamHandlerExecutor)
+ else streamHandlerExecutor
+ }
+
/**
* The interface to use for delaying execution, like during retries.
*
@@ -416,6 +446,24 @@ private constructor(
*/
fun build(): ClientOptions {
val httpClient = checkRequired("httpClient", httpClient)
+ val streamHandlerExecutor =
+ streamHandlerExecutor
+ ?: PhantomReachableExecutorService(
+ Executors.newCachedThreadPool(
+ object : ThreadFactory {
+
+ private val threadFactory: ThreadFactory =
+ Executors.defaultThreadFactory()
+ private val count = AtomicLong(0)
+
+ override fun newThread(runnable: Runnable): Thread =
+ threadFactory.newThread(runnable).also {
+ it.name =
+ "increase-stream-handler-thread-${count.getAndIncrement()}"
+ }
+ }
+ )
+ )
val sleeper = sleeper ?: PhantomReachableSleeper(DefaultSleeper())
val apiKey = checkRequired("apiKey", apiKey)
@@ -447,6 +495,7 @@ private constructor(
.build(),
checkJacksonVersionCompatibility,
jsonMapper,
+ streamHandlerExecutor,
sleeper,
clock,
baseUrl,
@@ -473,6 +522,7 @@ private constructor(
*/
fun close() {
httpClient.close()
+ (streamHandlerExecutor as? ExecutorService)?.shutdown()
sleeper.close()
}
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/core/Page.kt b/increase-java-core/src/main/kotlin/com/increase/api/core/Page.kt
new file mode 100644
index 000000000..6a28f88ef
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/core/Page.kt
@@ -0,0 +1,33 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.core
+
+/**
+ * An interface representing a single page, with items of type [T], from a paginated endpoint
+ * response.
+ *
+ * Implementations of this interface are expected to request additional pages synchronously. For
+ * asynchronous pagination, see the [PageAsync] interface.
+ */
+interface Page {
+
+ /**
+ * Returns whether there's another page after this one.
+ *
+ * The method generally doesn't make requests so the result depends entirely on the data in this
+ * page. If a significant amount of time has passed between requesting this page and calling
+ * this method, then the result could be stale.
+ */
+ fun hasNextPage(): Boolean
+
+ /**
+ * Returns the page after this one by making another request.
+ *
+ * @throws IllegalStateException if it's impossible to get the next page. This exception is
+ * avoidable by calling [hasNextPage] first.
+ */
+ fun nextPage(): Page
+
+ /** Returns the items in this page. */
+ fun items(): List
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/core/PageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/core/PageAsync.kt
new file mode 100644
index 000000000..8d5da0c9e
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/core/PageAsync.kt
@@ -0,0 +1,35 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.core
+
+import java.util.concurrent.CompletableFuture
+
+/**
+ * An interface representing a single page, with items of type [T], from a paginated endpoint
+ * response.
+ *
+ * Implementations of this interface are expected to request additional pages asynchronously. For
+ * synchronous pagination, see the [Page] interface.
+ */
+interface PageAsync {
+
+ /**
+ * Returns whether there's another page after this one.
+ *
+ * The method generally doesn't make requests so the result depends entirely on the data in this
+ * page. If a significant amount of time has passed between requesting this page and calling
+ * this method, then the result could be stale.
+ */
+ fun hasNextPage(): Boolean
+
+ /**
+ * Returns the page after this one by making another request.
+ *
+ * @throws IllegalStateException if it's impossible to get the next page. This exception is
+ * avoidable by calling [hasNextPage] first.
+ */
+ fun nextPage(): CompletableFuture>
+
+ /** Returns the items in this page. */
+ fun items(): List
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/accountnumbers/AccountNumberListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/accountnumbers/AccountNumberListPage.kt
new file mode 100644
index 000000000..06d541cd2
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/accountnumbers/AccountNumberListPage.kt
@@ -0,0 +1,133 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.accountnumbers
+
+import com.increase.api.core.AutoPager
+import com.increase.api.core.Page
+import com.increase.api.core.checkRequired
+import com.increase.api.services.blocking.AccountNumberService
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** @see AccountNumberService.list */
+class AccountNumberListPage
+private constructor(
+ private val service: AccountNumberService,
+ private val params: AccountNumberListParams,
+ private val response: AccountNumberListPageResponse,
+) : Page {
+
+ /**
+ * Delegates to [AccountNumberListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountNumberListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [AccountNumberListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountNumberListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): AccountNumberListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): AccountNumberListPage = service.list(nextPageParams())
+
+ fun autoPager(): AutoPager = AutoPager.from(this)
+
+ /** The parameters that were used to request this page. */
+ fun params(): AccountNumberListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): AccountNumberListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [AccountNumberListPage].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AccountNumberListPage]. */
+ class Builder internal constructor() {
+
+ private var service: AccountNumberService? = null
+ private var params: AccountNumberListParams? = null
+ private var response: AccountNumberListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(accountNumberListPage: AccountNumberListPage) = apply {
+ service = accountNumberListPage.service
+ params = accountNumberListPage.params
+ response = accountNumberListPage.response
+ }
+
+ fun service(service: AccountNumberService) = apply { this.service = service }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: AccountNumberListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: AccountNumberListPageResponse) = apply { this.response = response }
+
+ /**
+ * Returns an immutable instance of [AccountNumberListPage].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AccountNumberListPage =
+ AccountNumberListPage(
+ checkRequired("service", service),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AccountNumberListPage &&
+ service == other.service &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, params, response)
+
+ override fun toString() =
+ "AccountNumberListPage{service=$service, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/accountnumbers/AccountNumberListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/accountnumbers/AccountNumberListPageAsync.kt
new file mode 100644
index 000000000..a6af769cc
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/accountnumbers/AccountNumberListPageAsync.kt
@@ -0,0 +1,148 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.accountnumbers
+
+import com.increase.api.core.AutoPagerAsync
+import com.increase.api.core.PageAsync
+import com.increase.api.core.checkRequired
+import com.increase.api.services.async.AccountNumberServiceAsync
+import java.util.Objects
+import java.util.Optional
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.Executor
+import kotlin.jvm.optionals.getOrNull
+
+/** @see AccountNumberServiceAsync.list */
+class AccountNumberListPageAsync
+private constructor(
+ private val service: AccountNumberServiceAsync,
+ private val streamHandlerExecutor: Executor,
+ private val params: AccountNumberListParams,
+ private val response: AccountNumberListPageResponse,
+) : PageAsync {
+
+ /**
+ * Delegates to [AccountNumberListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountNumberListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [AccountNumberListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountNumberListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): AccountNumberListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CompletableFuture =
+ service.list(nextPageParams())
+
+ fun autoPager(): AutoPagerAsync =
+ AutoPagerAsync.from(this, streamHandlerExecutor)
+
+ /** The parameters that were used to request this page. */
+ fun params(): AccountNumberListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): AccountNumberListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [AccountNumberListPageAsync].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AccountNumberListPageAsync]. */
+ class Builder internal constructor() {
+
+ private var service: AccountNumberServiceAsync? = null
+ private var streamHandlerExecutor: Executor? = null
+ private var params: AccountNumberListParams? = null
+ private var response: AccountNumberListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(accountNumberListPageAsync: AccountNumberListPageAsync) = apply {
+ service = accountNumberListPageAsync.service
+ streamHandlerExecutor = accountNumberListPageAsync.streamHandlerExecutor
+ params = accountNumberListPageAsync.params
+ response = accountNumberListPageAsync.response
+ }
+
+ fun service(service: AccountNumberServiceAsync) = apply { this.service = service }
+
+ fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
+ this.streamHandlerExecutor = streamHandlerExecutor
+ }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: AccountNumberListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: AccountNumberListPageResponse) = apply { this.response = response }
+
+ /**
+ * Returns an immutable instance of [AccountNumberListPageAsync].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AccountNumberListPageAsync =
+ AccountNumberListPageAsync(
+ checkRequired("service", service),
+ checkRequired("streamHandlerExecutor", streamHandlerExecutor),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AccountNumberListPageAsync &&
+ service == other.service &&
+ streamHandlerExecutor == other.streamHandlerExecutor &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response)
+
+ override fun toString() =
+ "AccountNumberListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/accountnumbers/AccountNumberListResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/accountnumbers/AccountNumberListPageResponse.kt
similarity index 89%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/accountnumbers/AccountNumberListResponse.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/accountnumbers/AccountNumberListPageResponse.kt
index 9b48cc012..b7d9e2717 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/accountnumbers/AccountNumberListResponse.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/accountnumbers/AccountNumberListPageResponse.kt
@@ -20,7 +20,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/** A list of Account Number objects. */
-class AccountNumberListResponse
+class AccountNumberListPageResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val data: JsonField>,
@@ -83,7 +83,8 @@ private constructor(
companion object {
/**
- * Returns a mutable builder for constructing an instance of [AccountNumberListResponse].
+ * Returns a mutable builder for constructing an instance of
+ * [AccountNumberListPageResponse].
*
* The following fields are required:
* ```java
@@ -94,7 +95,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [AccountNumberListResponse]. */
+ /** A builder for [AccountNumberListPageResponse]. */
class Builder internal constructor() {
private var data: JsonField>? = null
@@ -102,10 +103,10 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(accountNumberListResponse: AccountNumberListResponse) = apply {
- data = accountNumberListResponse.data.map { it.toMutableList() }
- nextCursor = accountNumberListResponse.nextCursor
- additionalProperties = accountNumberListResponse.additionalProperties.toMutableMap()
+ internal fun from(accountNumberListPageResponse: AccountNumberListPageResponse) = apply {
+ data = accountNumberListPageResponse.data.map { it.toMutableList() }
+ nextCursor = accountNumberListPageResponse.nextCursor
+ additionalProperties = accountNumberListPageResponse.additionalProperties.toMutableMap()
}
/** The contents of the list. */
@@ -169,7 +170,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [AccountNumberListResponse].
+ * Returns an immutable instance of [AccountNumberListPageResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -181,8 +182,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): AccountNumberListResponse =
- AccountNumberListResponse(
+ fun build(): AccountNumberListPageResponse =
+ AccountNumberListPageResponse(
checkRequired("data", data).map { it.toImmutable() },
checkRequired("nextCursor", nextCursor),
additionalProperties.toMutableMap(),
@@ -191,7 +192,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): AccountNumberListResponse = apply {
+ fun validate(): AccountNumberListPageResponse = apply {
if (validated) {
return@apply
}
@@ -224,7 +225,7 @@ private constructor(
return true
}
- return other is AccountNumberListResponse &&
+ return other is AccountNumberListPageResponse &&
data == other.data &&
nextCursor == other.nextCursor &&
additionalProperties == other.additionalProperties
@@ -235,5 +236,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "AccountNumberListResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
+ "AccountNumberListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountListPage.kt
new file mode 100644
index 000000000..83d277337
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountListPage.kt
@@ -0,0 +1,132 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.accounts
+
+import com.increase.api.core.AutoPager
+import com.increase.api.core.Page
+import com.increase.api.core.checkRequired
+import com.increase.api.services.blocking.AccountService
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** @see AccountService.list */
+class AccountListPage
+private constructor(
+ private val service: AccountService,
+ private val params: AccountListParams,
+ private val response: AccountListPageResponse,
+) : Page {
+
+ /**
+ * Delegates to [AccountListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountListPageResponse.data
+ */
+ fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [AccountListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): AccountListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): AccountListPage = service.list(nextPageParams())
+
+ fun autoPager(): AutoPager = AutoPager.from(this)
+
+ /** The parameters that were used to request this page. */
+ fun params(): AccountListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): AccountListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [AccountListPage].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AccountListPage]. */
+ class Builder internal constructor() {
+
+ private var service: AccountService? = null
+ private var params: AccountListParams? = null
+ private var response: AccountListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(accountListPage: AccountListPage) = apply {
+ service = accountListPage.service
+ params = accountListPage.params
+ response = accountListPage.response
+ }
+
+ fun service(service: AccountService) = apply { this.service = service }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: AccountListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: AccountListPageResponse) = apply { this.response = response }
+
+ /**
+ * Returns an immutable instance of [AccountListPage].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AccountListPage =
+ AccountListPage(
+ checkRequired("service", service),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AccountListPage &&
+ service == other.service &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, params, response)
+
+ override fun toString() =
+ "AccountListPage{service=$service, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountListPageAsync.kt
new file mode 100644
index 000000000..d82c2d263
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountListPageAsync.kt
@@ -0,0 +1,146 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.accounts
+
+import com.increase.api.core.AutoPagerAsync
+import com.increase.api.core.PageAsync
+import com.increase.api.core.checkRequired
+import com.increase.api.services.async.AccountServiceAsync
+import java.util.Objects
+import java.util.Optional
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.Executor
+import kotlin.jvm.optionals.getOrNull
+
+/** @see AccountServiceAsync.list */
+class AccountListPageAsync
+private constructor(
+ private val service: AccountServiceAsync,
+ private val streamHandlerExecutor: Executor,
+ private val params: AccountListParams,
+ private val response: AccountListPageResponse,
+) : PageAsync {
+
+ /**
+ * Delegates to [AccountListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountListPageResponse.data
+ */
+ fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [AccountListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): AccountListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CompletableFuture =
+ service.list(nextPageParams())
+
+ fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor)
+
+ /** The parameters that were used to request this page. */
+ fun params(): AccountListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): AccountListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [AccountListPageAsync].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AccountListPageAsync]. */
+ class Builder internal constructor() {
+
+ private var service: AccountServiceAsync? = null
+ private var streamHandlerExecutor: Executor? = null
+ private var params: AccountListParams? = null
+ private var response: AccountListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(accountListPageAsync: AccountListPageAsync) = apply {
+ service = accountListPageAsync.service
+ streamHandlerExecutor = accountListPageAsync.streamHandlerExecutor
+ params = accountListPageAsync.params
+ response = accountListPageAsync.response
+ }
+
+ fun service(service: AccountServiceAsync) = apply { this.service = service }
+
+ fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
+ this.streamHandlerExecutor = streamHandlerExecutor
+ }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: AccountListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: AccountListPageResponse) = apply { this.response = response }
+
+ /**
+ * Returns an immutable instance of [AccountListPageAsync].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AccountListPageAsync =
+ AccountListPageAsync(
+ checkRequired("service", service),
+ checkRequired("streamHandlerExecutor", streamHandlerExecutor),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AccountListPageAsync &&
+ service == other.service &&
+ streamHandlerExecutor == other.streamHandlerExecutor &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response)
+
+ override fun toString() =
+ "AccountListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountListResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountListPageResponse.kt
similarity index 90%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountListResponse.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountListPageResponse.kt
index 4bb2ba9af..8867834b1 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountListResponse.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountListPageResponse.kt
@@ -20,7 +20,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/** A list of Account objects. */
-class AccountListResponse
+class AccountListPageResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val data: JsonField>,
@@ -81,7 +81,7 @@ private constructor(
companion object {
/**
- * Returns a mutable builder for constructing an instance of [AccountListResponse].
+ * Returns a mutable builder for constructing an instance of [AccountListPageResponse].
*
* The following fields are required:
* ```java
@@ -92,7 +92,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [AccountListResponse]. */
+ /** A builder for [AccountListPageResponse]. */
class Builder internal constructor() {
private var data: JsonField>? = null
@@ -100,10 +100,10 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(accountListResponse: AccountListResponse) = apply {
- data = accountListResponse.data.map { it.toMutableList() }
- nextCursor = accountListResponse.nextCursor
- additionalProperties = accountListResponse.additionalProperties.toMutableMap()
+ internal fun from(accountListPageResponse: AccountListPageResponse) = apply {
+ data = accountListPageResponse.data.map { it.toMutableList() }
+ nextCursor = accountListPageResponse.nextCursor
+ additionalProperties = accountListPageResponse.additionalProperties.toMutableMap()
}
/** The contents of the list. */
@@ -167,7 +167,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [AccountListResponse].
+ * Returns an immutable instance of [AccountListPageResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -179,8 +179,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): AccountListResponse =
- AccountListResponse(
+ fun build(): AccountListPageResponse =
+ AccountListPageResponse(
checkRequired("data", data).map { it.toImmutable() },
checkRequired("nextCursor", nextCursor),
additionalProperties.toMutableMap(),
@@ -189,7 +189,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): AccountListResponse = apply {
+ fun validate(): AccountListPageResponse = apply {
if (validated) {
return@apply
}
@@ -222,7 +222,7 @@ private constructor(
return true
}
- return other is AccountListResponse &&
+ return other is AccountListPageResponse &&
data == other.data &&
nextCursor == other.nextCursor &&
additionalProperties == other.additionalProperties
@@ -233,5 +233,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "AccountListResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
+ "AccountListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/accountstatements/AccountStatementListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/accountstatements/AccountStatementListPage.kt
new file mode 100644
index 000000000..aea9fbf46
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/accountstatements/AccountStatementListPage.kt
@@ -0,0 +1,135 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.accountstatements
+
+import com.increase.api.core.AutoPager
+import com.increase.api.core.Page
+import com.increase.api.core.checkRequired
+import com.increase.api.services.blocking.AccountStatementService
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** @see AccountStatementService.list */
+class AccountStatementListPage
+private constructor(
+ private val service: AccountStatementService,
+ private val params: AccountStatementListParams,
+ private val response: AccountStatementListPageResponse,
+) : Page {
+
+ /**
+ * Delegates to [AccountStatementListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountStatementListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [AccountStatementListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountStatementListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): AccountStatementListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): AccountStatementListPage = service.list(nextPageParams())
+
+ fun autoPager(): AutoPager = AutoPager.from(this)
+
+ /** The parameters that were used to request this page. */
+ fun params(): AccountStatementListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): AccountStatementListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [AccountStatementListPage].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AccountStatementListPage]. */
+ class Builder internal constructor() {
+
+ private var service: AccountStatementService? = null
+ private var params: AccountStatementListParams? = null
+ private var response: AccountStatementListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(accountStatementListPage: AccountStatementListPage) = apply {
+ service = accountStatementListPage.service
+ params = accountStatementListPage.params
+ response = accountStatementListPage.response
+ }
+
+ fun service(service: AccountStatementService) = apply { this.service = service }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: AccountStatementListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: AccountStatementListPageResponse) = apply {
+ this.response = response
+ }
+
+ /**
+ * Returns an immutable instance of [AccountStatementListPage].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AccountStatementListPage =
+ AccountStatementListPage(
+ checkRequired("service", service),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AccountStatementListPage &&
+ service == other.service &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, params, response)
+
+ override fun toString() =
+ "AccountStatementListPage{service=$service, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/accountstatements/AccountStatementListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/accountstatements/AccountStatementListPageAsync.kt
new file mode 100644
index 000000000..4f880a6e3
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/accountstatements/AccountStatementListPageAsync.kt
@@ -0,0 +1,151 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.accountstatements
+
+import com.increase.api.core.AutoPagerAsync
+import com.increase.api.core.PageAsync
+import com.increase.api.core.checkRequired
+import com.increase.api.services.async.AccountStatementServiceAsync
+import java.util.Objects
+import java.util.Optional
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.Executor
+import kotlin.jvm.optionals.getOrNull
+
+/** @see AccountStatementServiceAsync.list */
+class AccountStatementListPageAsync
+private constructor(
+ private val service: AccountStatementServiceAsync,
+ private val streamHandlerExecutor: Executor,
+ private val params: AccountStatementListParams,
+ private val response: AccountStatementListPageResponse,
+) : PageAsync {
+
+ /**
+ * Delegates to [AccountStatementListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountStatementListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [AccountStatementListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountStatementListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): AccountStatementListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CompletableFuture =
+ service.list(nextPageParams())
+
+ fun autoPager(): AutoPagerAsync =
+ AutoPagerAsync.from(this, streamHandlerExecutor)
+
+ /** The parameters that were used to request this page. */
+ fun params(): AccountStatementListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): AccountStatementListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [AccountStatementListPageAsync].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AccountStatementListPageAsync]. */
+ class Builder internal constructor() {
+
+ private var service: AccountStatementServiceAsync? = null
+ private var streamHandlerExecutor: Executor? = null
+ private var params: AccountStatementListParams? = null
+ private var response: AccountStatementListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(accountStatementListPageAsync: AccountStatementListPageAsync) = apply {
+ service = accountStatementListPageAsync.service
+ streamHandlerExecutor = accountStatementListPageAsync.streamHandlerExecutor
+ params = accountStatementListPageAsync.params
+ response = accountStatementListPageAsync.response
+ }
+
+ fun service(service: AccountStatementServiceAsync) = apply { this.service = service }
+
+ fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
+ this.streamHandlerExecutor = streamHandlerExecutor
+ }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: AccountStatementListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: AccountStatementListPageResponse) = apply {
+ this.response = response
+ }
+
+ /**
+ * Returns an immutable instance of [AccountStatementListPageAsync].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AccountStatementListPageAsync =
+ AccountStatementListPageAsync(
+ checkRequired("service", service),
+ checkRequired("streamHandlerExecutor", streamHandlerExecutor),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AccountStatementListPageAsync &&
+ service == other.service &&
+ streamHandlerExecutor == other.streamHandlerExecutor &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response)
+
+ override fun toString() =
+ "AccountStatementListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/accountstatements/AccountStatementListResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/accountstatements/AccountStatementListPageResponse.kt
similarity index 89%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/accountstatements/AccountStatementListResponse.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/accountstatements/AccountStatementListPageResponse.kt
index b17a4f7c6..1f40891bb 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/accountstatements/AccountStatementListResponse.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/accountstatements/AccountStatementListPageResponse.kt
@@ -20,7 +20,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/** A list of Account Statement objects. */
-class AccountStatementListResponse
+class AccountStatementListPageResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val data: JsonField>,
@@ -83,7 +83,8 @@ private constructor(
companion object {
/**
- * Returns a mutable builder for constructing an instance of [AccountStatementListResponse].
+ * Returns a mutable builder for constructing an instance of
+ * [AccountStatementListPageResponse].
*
* The following fields are required:
* ```java
@@ -94,7 +95,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [AccountStatementListResponse]. */
+ /** A builder for [AccountStatementListPageResponse]. */
class Builder internal constructor() {
private var data: JsonField>? = null
@@ -102,11 +103,13 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(accountStatementListResponse: AccountStatementListResponse) = apply {
- data = accountStatementListResponse.data.map { it.toMutableList() }
- nextCursor = accountStatementListResponse.nextCursor
- additionalProperties = accountStatementListResponse.additionalProperties.toMutableMap()
- }
+ internal fun from(accountStatementListPageResponse: AccountStatementListPageResponse) =
+ apply {
+ data = accountStatementListPageResponse.data.map { it.toMutableList() }
+ nextCursor = accountStatementListPageResponse.nextCursor
+ additionalProperties =
+ accountStatementListPageResponse.additionalProperties.toMutableMap()
+ }
/** The contents of the list. */
fun data(data: List) = data(JsonField.of(data))
@@ -169,7 +172,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [AccountStatementListResponse].
+ * Returns an immutable instance of [AccountStatementListPageResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -181,8 +184,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): AccountStatementListResponse =
- AccountStatementListResponse(
+ fun build(): AccountStatementListPageResponse =
+ AccountStatementListPageResponse(
checkRequired("data", data).map { it.toImmutable() },
checkRequired("nextCursor", nextCursor),
additionalProperties.toMutableMap(),
@@ -191,7 +194,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): AccountStatementListResponse = apply {
+ fun validate(): AccountStatementListPageResponse = apply {
if (validated) {
return@apply
}
@@ -224,7 +227,7 @@ private constructor(
return true
}
- return other is AccountStatementListResponse &&
+ return other is AccountStatementListPageResponse &&
data == other.data &&
nextCursor == other.nextCursor &&
additionalProperties == other.additionalProperties
@@ -235,5 +238,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "AccountStatementListResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
+ "AccountStatementListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/accounttransfers/AccountTransferListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/accounttransfers/AccountTransferListPage.kt
new file mode 100644
index 000000000..ee6c7e345
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/accounttransfers/AccountTransferListPage.kt
@@ -0,0 +1,133 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.accounttransfers
+
+import com.increase.api.core.AutoPager
+import com.increase.api.core.Page
+import com.increase.api.core.checkRequired
+import com.increase.api.services.blocking.AccountTransferService
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** @see AccountTransferService.list */
+class AccountTransferListPage
+private constructor(
+ private val service: AccountTransferService,
+ private val params: AccountTransferListParams,
+ private val response: AccountTransferListPageResponse,
+) : Page {
+
+ /**
+ * Delegates to [AccountTransferListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountTransferListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [AccountTransferListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountTransferListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): AccountTransferListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): AccountTransferListPage = service.list(nextPageParams())
+
+ fun autoPager(): AutoPager = AutoPager.from(this)
+
+ /** The parameters that were used to request this page. */
+ fun params(): AccountTransferListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): AccountTransferListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [AccountTransferListPage].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AccountTransferListPage]. */
+ class Builder internal constructor() {
+
+ private var service: AccountTransferService? = null
+ private var params: AccountTransferListParams? = null
+ private var response: AccountTransferListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(accountTransferListPage: AccountTransferListPage) = apply {
+ service = accountTransferListPage.service
+ params = accountTransferListPage.params
+ response = accountTransferListPage.response
+ }
+
+ fun service(service: AccountTransferService) = apply { this.service = service }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: AccountTransferListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: AccountTransferListPageResponse) = apply { this.response = response }
+
+ /**
+ * Returns an immutable instance of [AccountTransferListPage].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AccountTransferListPage =
+ AccountTransferListPage(
+ checkRequired("service", service),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AccountTransferListPage &&
+ service == other.service &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, params, response)
+
+ override fun toString() =
+ "AccountTransferListPage{service=$service, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/accounttransfers/AccountTransferListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/accounttransfers/AccountTransferListPageAsync.kt
new file mode 100644
index 000000000..dd88fd425
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/accounttransfers/AccountTransferListPageAsync.kt
@@ -0,0 +1,148 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.accounttransfers
+
+import com.increase.api.core.AutoPagerAsync
+import com.increase.api.core.PageAsync
+import com.increase.api.core.checkRequired
+import com.increase.api.services.async.AccountTransferServiceAsync
+import java.util.Objects
+import java.util.Optional
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.Executor
+import kotlin.jvm.optionals.getOrNull
+
+/** @see AccountTransferServiceAsync.list */
+class AccountTransferListPageAsync
+private constructor(
+ private val service: AccountTransferServiceAsync,
+ private val streamHandlerExecutor: Executor,
+ private val params: AccountTransferListParams,
+ private val response: AccountTransferListPageResponse,
+) : PageAsync {
+
+ /**
+ * Delegates to [AccountTransferListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountTransferListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [AccountTransferListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountTransferListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): AccountTransferListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CompletableFuture =
+ service.list(nextPageParams())
+
+ fun autoPager(): AutoPagerAsync =
+ AutoPagerAsync.from(this, streamHandlerExecutor)
+
+ /** The parameters that were used to request this page. */
+ fun params(): AccountTransferListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): AccountTransferListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [AccountTransferListPageAsync].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AccountTransferListPageAsync]. */
+ class Builder internal constructor() {
+
+ private var service: AccountTransferServiceAsync? = null
+ private var streamHandlerExecutor: Executor? = null
+ private var params: AccountTransferListParams? = null
+ private var response: AccountTransferListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(accountTransferListPageAsync: AccountTransferListPageAsync) = apply {
+ service = accountTransferListPageAsync.service
+ streamHandlerExecutor = accountTransferListPageAsync.streamHandlerExecutor
+ params = accountTransferListPageAsync.params
+ response = accountTransferListPageAsync.response
+ }
+
+ fun service(service: AccountTransferServiceAsync) = apply { this.service = service }
+
+ fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
+ this.streamHandlerExecutor = streamHandlerExecutor
+ }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: AccountTransferListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: AccountTransferListPageResponse) = apply { this.response = response }
+
+ /**
+ * Returns an immutable instance of [AccountTransferListPageAsync].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AccountTransferListPageAsync =
+ AccountTransferListPageAsync(
+ checkRequired("service", service),
+ checkRequired("streamHandlerExecutor", streamHandlerExecutor),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AccountTransferListPageAsync &&
+ service == other.service &&
+ streamHandlerExecutor == other.streamHandlerExecutor &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response)
+
+ override fun toString() =
+ "AccountTransferListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/accounttransfers/AccountTransferListResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/accounttransfers/AccountTransferListPageResponse.kt
similarity index 89%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/accounttransfers/AccountTransferListResponse.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/accounttransfers/AccountTransferListPageResponse.kt
index 25ddcde97..ee7169d0e 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/accounttransfers/AccountTransferListResponse.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/accounttransfers/AccountTransferListPageResponse.kt
@@ -20,7 +20,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/** A list of Account Transfer objects. */
-class AccountTransferListResponse
+class AccountTransferListPageResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val data: JsonField>,
@@ -83,7 +83,8 @@ private constructor(
companion object {
/**
- * Returns a mutable builder for constructing an instance of [AccountTransferListResponse].
+ * Returns a mutable builder for constructing an instance of
+ * [AccountTransferListPageResponse].
*
* The following fields are required:
* ```java
@@ -94,7 +95,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [AccountTransferListResponse]. */
+ /** A builder for [AccountTransferListPageResponse]. */
class Builder internal constructor() {
private var data: JsonField>? = null
@@ -102,11 +103,13 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(accountTransferListResponse: AccountTransferListResponse) = apply {
- data = accountTransferListResponse.data.map { it.toMutableList() }
- nextCursor = accountTransferListResponse.nextCursor
- additionalProperties = accountTransferListResponse.additionalProperties.toMutableMap()
- }
+ internal fun from(accountTransferListPageResponse: AccountTransferListPageResponse) =
+ apply {
+ data = accountTransferListPageResponse.data.map { it.toMutableList() }
+ nextCursor = accountTransferListPageResponse.nextCursor
+ additionalProperties =
+ accountTransferListPageResponse.additionalProperties.toMutableMap()
+ }
/** The contents of the list. */
fun data(data: List) = data(JsonField.of(data))
@@ -169,7 +172,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [AccountTransferListResponse].
+ * Returns an immutable instance of [AccountTransferListPageResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -181,8 +184,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): AccountTransferListResponse =
- AccountTransferListResponse(
+ fun build(): AccountTransferListPageResponse =
+ AccountTransferListPageResponse(
checkRequired("data", data).map { it.toImmutable() },
checkRequired("nextCursor", nextCursor),
additionalProperties.toMutableMap(),
@@ -191,7 +194,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): AccountTransferListResponse = apply {
+ fun validate(): AccountTransferListPageResponse = apply {
if (validated) {
return@apply
}
@@ -224,7 +227,7 @@ private constructor(
return true
}
- return other is AccountTransferListResponse &&
+ return other is AccountTransferListPageResponse &&
data == other.data &&
nextCursor == other.nextCursor &&
additionalProperties == other.additionalProperties
@@ -235,5 +238,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "AccountTransferListResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
+ "AccountTransferListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/achprenotifications/AchPrenotificationListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/achprenotifications/AchPrenotificationListPage.kt
new file mode 100644
index 000000000..525935209
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/achprenotifications/AchPrenotificationListPage.kt
@@ -0,0 +1,135 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.achprenotifications
+
+import com.increase.api.core.AutoPager
+import com.increase.api.core.Page
+import com.increase.api.core.checkRequired
+import com.increase.api.services.blocking.AchPrenotificationService
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** @see AchPrenotificationService.list */
+class AchPrenotificationListPage
+private constructor(
+ private val service: AchPrenotificationService,
+ private val params: AchPrenotificationListParams,
+ private val response: AchPrenotificationListPageResponse,
+) : Page {
+
+ /**
+ * Delegates to [AchPrenotificationListPageResponse], but gracefully handles missing data.
+ *
+ * @see AchPrenotificationListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [AchPrenotificationListPageResponse], but gracefully handles missing data.
+ *
+ * @see AchPrenotificationListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): AchPrenotificationListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): AchPrenotificationListPage = service.list(nextPageParams())
+
+ fun autoPager(): AutoPager = AutoPager.from(this)
+
+ /** The parameters that were used to request this page. */
+ fun params(): AchPrenotificationListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): AchPrenotificationListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [AchPrenotificationListPage].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AchPrenotificationListPage]. */
+ class Builder internal constructor() {
+
+ private var service: AchPrenotificationService? = null
+ private var params: AchPrenotificationListParams? = null
+ private var response: AchPrenotificationListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(achPrenotificationListPage: AchPrenotificationListPage) = apply {
+ service = achPrenotificationListPage.service
+ params = achPrenotificationListPage.params
+ response = achPrenotificationListPage.response
+ }
+
+ fun service(service: AchPrenotificationService) = apply { this.service = service }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: AchPrenotificationListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: AchPrenotificationListPageResponse) = apply {
+ this.response = response
+ }
+
+ /**
+ * Returns an immutable instance of [AchPrenotificationListPage].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AchPrenotificationListPage =
+ AchPrenotificationListPage(
+ checkRequired("service", service),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AchPrenotificationListPage &&
+ service == other.service &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, params, response)
+
+ override fun toString() =
+ "AchPrenotificationListPage{service=$service, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/achprenotifications/AchPrenotificationListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/achprenotifications/AchPrenotificationListPageAsync.kt
new file mode 100644
index 000000000..54ede4a4c
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/achprenotifications/AchPrenotificationListPageAsync.kt
@@ -0,0 +1,152 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.achprenotifications
+
+import com.increase.api.core.AutoPagerAsync
+import com.increase.api.core.PageAsync
+import com.increase.api.core.checkRequired
+import com.increase.api.services.async.AchPrenotificationServiceAsync
+import java.util.Objects
+import java.util.Optional
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.Executor
+import kotlin.jvm.optionals.getOrNull
+
+/** @see AchPrenotificationServiceAsync.list */
+class AchPrenotificationListPageAsync
+private constructor(
+ private val service: AchPrenotificationServiceAsync,
+ private val streamHandlerExecutor: Executor,
+ private val params: AchPrenotificationListParams,
+ private val response: AchPrenotificationListPageResponse,
+) : PageAsync {
+
+ /**
+ * Delegates to [AchPrenotificationListPageResponse], but gracefully handles missing data.
+ *
+ * @see AchPrenotificationListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [AchPrenotificationListPageResponse], but gracefully handles missing data.
+ *
+ * @see AchPrenotificationListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): AchPrenotificationListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CompletableFuture =
+ service.list(nextPageParams())
+
+ fun autoPager(): AutoPagerAsync =
+ AutoPagerAsync.from(this, streamHandlerExecutor)
+
+ /** The parameters that were used to request this page. */
+ fun params(): AchPrenotificationListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): AchPrenotificationListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [AchPrenotificationListPageAsync].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AchPrenotificationListPageAsync]. */
+ class Builder internal constructor() {
+
+ private var service: AchPrenotificationServiceAsync? = null
+ private var streamHandlerExecutor: Executor? = null
+ private var params: AchPrenotificationListParams? = null
+ private var response: AchPrenotificationListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(achPrenotificationListPageAsync: AchPrenotificationListPageAsync) =
+ apply {
+ service = achPrenotificationListPageAsync.service
+ streamHandlerExecutor = achPrenotificationListPageAsync.streamHandlerExecutor
+ params = achPrenotificationListPageAsync.params
+ response = achPrenotificationListPageAsync.response
+ }
+
+ fun service(service: AchPrenotificationServiceAsync) = apply { this.service = service }
+
+ fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
+ this.streamHandlerExecutor = streamHandlerExecutor
+ }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: AchPrenotificationListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: AchPrenotificationListPageResponse) = apply {
+ this.response = response
+ }
+
+ /**
+ * Returns an immutable instance of [AchPrenotificationListPageAsync].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AchPrenotificationListPageAsync =
+ AchPrenotificationListPageAsync(
+ checkRequired("service", service),
+ checkRequired("streamHandlerExecutor", streamHandlerExecutor),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AchPrenotificationListPageAsync &&
+ service == other.service &&
+ streamHandlerExecutor == other.streamHandlerExecutor &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response)
+
+ override fun toString() =
+ "AchPrenotificationListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/achprenotifications/AchPrenotificationListResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/achprenotifications/AchPrenotificationListPageResponse.kt
similarity index 88%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/achprenotifications/AchPrenotificationListResponse.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/achprenotifications/AchPrenotificationListPageResponse.kt
index 1824d27ea..683d38ca0 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/achprenotifications/AchPrenotificationListResponse.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/achprenotifications/AchPrenotificationListPageResponse.kt
@@ -20,7 +20,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/** A list of ACH Prenotification objects. */
-class AchPrenotificationListResponse
+class AchPrenotificationListPageResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val data: JsonField>,
@@ -84,7 +84,7 @@ private constructor(
/**
* Returns a mutable builder for constructing an instance of
- * [AchPrenotificationListResponse].
+ * [AchPrenotificationListPageResponse].
*
* The following fields are required:
* ```java
@@ -95,7 +95,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [AchPrenotificationListResponse]. */
+ /** A builder for [AchPrenotificationListPageResponse]. */
class Builder internal constructor() {
private var data: JsonField>? = null
@@ -103,12 +103,13 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(achPrenotificationListResponse: AchPrenotificationListResponse) = apply {
- data = achPrenotificationListResponse.data.map { it.toMutableList() }
- nextCursor = achPrenotificationListResponse.nextCursor
- additionalProperties =
- achPrenotificationListResponse.additionalProperties.toMutableMap()
- }
+ internal fun from(achPrenotificationListPageResponse: AchPrenotificationListPageResponse) =
+ apply {
+ data = achPrenotificationListPageResponse.data.map { it.toMutableList() }
+ nextCursor = achPrenotificationListPageResponse.nextCursor
+ additionalProperties =
+ achPrenotificationListPageResponse.additionalProperties.toMutableMap()
+ }
/** The contents of the list. */
fun data(data: List) = data(JsonField.of(data))
@@ -171,7 +172,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [AchPrenotificationListResponse].
+ * Returns an immutable instance of [AchPrenotificationListPageResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -183,8 +184,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): AchPrenotificationListResponse =
- AchPrenotificationListResponse(
+ fun build(): AchPrenotificationListPageResponse =
+ AchPrenotificationListPageResponse(
checkRequired("data", data).map { it.toImmutable() },
checkRequired("nextCursor", nextCursor),
additionalProperties.toMutableMap(),
@@ -193,7 +194,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): AchPrenotificationListResponse = apply {
+ fun validate(): AchPrenotificationListPageResponse = apply {
if (validated) {
return@apply
}
@@ -226,7 +227,7 @@ private constructor(
return true
}
- return other is AchPrenotificationListResponse &&
+ return other is AchPrenotificationListPageResponse &&
data == other.data &&
nextCursor == other.nextCursor &&
additionalProperties == other.additionalProperties
@@ -237,5 +238,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "AchPrenotificationListResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
+ "AchPrenotificationListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/achtransfers/AchTransferListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/achtransfers/AchTransferListPage.kt
new file mode 100644
index 000000000..53ba0c336
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/achtransfers/AchTransferListPage.kt
@@ -0,0 +1,132 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.achtransfers
+
+import com.increase.api.core.AutoPager
+import com.increase.api.core.Page
+import com.increase.api.core.checkRequired
+import com.increase.api.services.blocking.AchTransferService
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** @see AchTransferService.list */
+class AchTransferListPage
+private constructor(
+ private val service: AchTransferService,
+ private val params: AchTransferListParams,
+ private val response: AchTransferListPageResponse,
+) : Page {
+
+ /**
+ * Delegates to [AchTransferListPageResponse], but gracefully handles missing data.
+ *
+ * @see AchTransferListPageResponse.data
+ */
+ fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [AchTransferListPageResponse], but gracefully handles missing data.
+ *
+ * @see AchTransferListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): AchTransferListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): AchTransferListPage = service.list(nextPageParams())
+
+ fun autoPager(): AutoPager = AutoPager.from(this)
+
+ /** The parameters that were used to request this page. */
+ fun params(): AchTransferListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): AchTransferListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [AchTransferListPage].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AchTransferListPage]. */
+ class Builder internal constructor() {
+
+ private var service: AchTransferService? = null
+ private var params: AchTransferListParams? = null
+ private var response: AchTransferListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(achTransferListPage: AchTransferListPage) = apply {
+ service = achTransferListPage.service
+ params = achTransferListPage.params
+ response = achTransferListPage.response
+ }
+
+ fun service(service: AchTransferService) = apply { this.service = service }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: AchTransferListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: AchTransferListPageResponse) = apply { this.response = response }
+
+ /**
+ * Returns an immutable instance of [AchTransferListPage].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AchTransferListPage =
+ AchTransferListPage(
+ checkRequired("service", service),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AchTransferListPage &&
+ service == other.service &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, params, response)
+
+ override fun toString() =
+ "AchTransferListPage{service=$service, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/achtransfers/AchTransferListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/achtransfers/AchTransferListPageAsync.kt
new file mode 100644
index 000000000..ed0c92d58
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/achtransfers/AchTransferListPageAsync.kt
@@ -0,0 +1,146 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.achtransfers
+
+import com.increase.api.core.AutoPagerAsync
+import com.increase.api.core.PageAsync
+import com.increase.api.core.checkRequired
+import com.increase.api.services.async.AchTransferServiceAsync
+import java.util.Objects
+import java.util.Optional
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.Executor
+import kotlin.jvm.optionals.getOrNull
+
+/** @see AchTransferServiceAsync.list */
+class AchTransferListPageAsync
+private constructor(
+ private val service: AchTransferServiceAsync,
+ private val streamHandlerExecutor: Executor,
+ private val params: AchTransferListParams,
+ private val response: AchTransferListPageResponse,
+) : PageAsync {
+
+ /**
+ * Delegates to [AchTransferListPageResponse], but gracefully handles missing data.
+ *
+ * @see AchTransferListPageResponse.data
+ */
+ fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [AchTransferListPageResponse], but gracefully handles missing data.
+ *
+ * @see AchTransferListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): AchTransferListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CompletableFuture =
+ service.list(nextPageParams())
+
+ fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor)
+
+ /** The parameters that were used to request this page. */
+ fun params(): AchTransferListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): AchTransferListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [AchTransferListPageAsync].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AchTransferListPageAsync]. */
+ class Builder internal constructor() {
+
+ private var service: AchTransferServiceAsync? = null
+ private var streamHandlerExecutor: Executor? = null
+ private var params: AchTransferListParams? = null
+ private var response: AchTransferListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(achTransferListPageAsync: AchTransferListPageAsync) = apply {
+ service = achTransferListPageAsync.service
+ streamHandlerExecutor = achTransferListPageAsync.streamHandlerExecutor
+ params = achTransferListPageAsync.params
+ response = achTransferListPageAsync.response
+ }
+
+ fun service(service: AchTransferServiceAsync) = apply { this.service = service }
+
+ fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
+ this.streamHandlerExecutor = streamHandlerExecutor
+ }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: AchTransferListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: AchTransferListPageResponse) = apply { this.response = response }
+
+ /**
+ * Returns an immutable instance of [AchTransferListPageAsync].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AchTransferListPageAsync =
+ AchTransferListPageAsync(
+ checkRequired("service", service),
+ checkRequired("streamHandlerExecutor", streamHandlerExecutor),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AchTransferListPageAsync &&
+ service == other.service &&
+ streamHandlerExecutor == other.streamHandlerExecutor &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response)
+
+ override fun toString() =
+ "AchTransferListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/achtransfers/AchTransferListResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/achtransfers/AchTransferListPageResponse.kt
similarity index 89%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/achtransfers/AchTransferListResponse.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/achtransfers/AchTransferListPageResponse.kt
index de23515d3..ba224a5ea 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/achtransfers/AchTransferListResponse.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/achtransfers/AchTransferListPageResponse.kt
@@ -20,7 +20,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/** A list of ACH Transfer objects. */
-class AchTransferListResponse
+class AchTransferListPageResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val data: JsonField>,
@@ -81,7 +81,7 @@ private constructor(
companion object {
/**
- * Returns a mutable builder for constructing an instance of [AchTransferListResponse].
+ * Returns a mutable builder for constructing an instance of [AchTransferListPageResponse].
*
* The following fields are required:
* ```java
@@ -92,7 +92,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [AchTransferListResponse]. */
+ /** A builder for [AchTransferListPageResponse]. */
class Builder internal constructor() {
private var data: JsonField>? = null
@@ -100,10 +100,10 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(achTransferListResponse: AchTransferListResponse) = apply {
- data = achTransferListResponse.data.map { it.toMutableList() }
- nextCursor = achTransferListResponse.nextCursor
- additionalProperties = achTransferListResponse.additionalProperties.toMutableMap()
+ internal fun from(achTransferListPageResponse: AchTransferListPageResponse) = apply {
+ data = achTransferListPageResponse.data.map { it.toMutableList() }
+ nextCursor = achTransferListPageResponse.nextCursor
+ additionalProperties = achTransferListPageResponse.additionalProperties.toMutableMap()
}
/** The contents of the list. */
@@ -167,7 +167,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [AchTransferListResponse].
+ * Returns an immutable instance of [AchTransferListPageResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -179,8 +179,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): AchTransferListResponse =
- AchTransferListResponse(
+ fun build(): AchTransferListPageResponse =
+ AchTransferListPageResponse(
checkRequired("data", data).map { it.toImmutable() },
checkRequired("nextCursor", nextCursor),
additionalProperties.toMutableMap(),
@@ -189,7 +189,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): AchTransferListResponse = apply {
+ fun validate(): AchTransferListPageResponse = apply {
if (validated) {
return@apply
}
@@ -222,7 +222,7 @@ private constructor(
return true
}
- return other is AchTransferListResponse &&
+ return other is AchTransferListPageResponse &&
data == other.data &&
nextCursor == other.nextCursor &&
additionalProperties == other.additionalProperties
@@ -233,5 +233,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "AchTransferListResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
+ "AchTransferListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPage.kt
new file mode 100644
index 000000000..cd7b6b4e7
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPage.kt
@@ -0,0 +1,135 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.bookkeepingaccounts
+
+import com.increase.api.core.AutoPager
+import com.increase.api.core.Page
+import com.increase.api.core.checkRequired
+import com.increase.api.services.blocking.BookkeepingAccountService
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** @see BookkeepingAccountService.list */
+class BookkeepingAccountListPage
+private constructor(
+ private val service: BookkeepingAccountService,
+ private val params: BookkeepingAccountListParams,
+ private val response: BookkeepingAccountListPageResponse,
+) : Page {
+
+ /**
+ * Delegates to [BookkeepingAccountListPageResponse], but gracefully handles missing data.
+ *
+ * @see BookkeepingAccountListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [BookkeepingAccountListPageResponse], but gracefully handles missing data.
+ *
+ * @see BookkeepingAccountListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): BookkeepingAccountListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): BookkeepingAccountListPage = service.list(nextPageParams())
+
+ fun autoPager(): AutoPager = AutoPager.from(this)
+
+ /** The parameters that were used to request this page. */
+ fun params(): BookkeepingAccountListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): BookkeepingAccountListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [BookkeepingAccountListPage].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [BookkeepingAccountListPage]. */
+ class Builder internal constructor() {
+
+ private var service: BookkeepingAccountService? = null
+ private var params: BookkeepingAccountListParams? = null
+ private var response: BookkeepingAccountListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(bookkeepingAccountListPage: BookkeepingAccountListPage) = apply {
+ service = bookkeepingAccountListPage.service
+ params = bookkeepingAccountListPage.params
+ response = bookkeepingAccountListPage.response
+ }
+
+ fun service(service: BookkeepingAccountService) = apply { this.service = service }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: BookkeepingAccountListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: BookkeepingAccountListPageResponse) = apply {
+ this.response = response
+ }
+
+ /**
+ * Returns an immutable instance of [BookkeepingAccountListPage].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): BookkeepingAccountListPage =
+ BookkeepingAccountListPage(
+ checkRequired("service", service),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is BookkeepingAccountListPage &&
+ service == other.service &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, params, response)
+
+ override fun toString() =
+ "BookkeepingAccountListPage{service=$service, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPageAsync.kt
new file mode 100644
index 000000000..80eecd7c9
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPageAsync.kt
@@ -0,0 +1,152 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.bookkeepingaccounts
+
+import com.increase.api.core.AutoPagerAsync
+import com.increase.api.core.PageAsync
+import com.increase.api.core.checkRequired
+import com.increase.api.services.async.BookkeepingAccountServiceAsync
+import java.util.Objects
+import java.util.Optional
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.Executor
+import kotlin.jvm.optionals.getOrNull
+
+/** @see BookkeepingAccountServiceAsync.list */
+class BookkeepingAccountListPageAsync
+private constructor(
+ private val service: BookkeepingAccountServiceAsync,
+ private val streamHandlerExecutor: Executor,
+ private val params: BookkeepingAccountListParams,
+ private val response: BookkeepingAccountListPageResponse,
+) : PageAsync {
+
+ /**
+ * Delegates to [BookkeepingAccountListPageResponse], but gracefully handles missing data.
+ *
+ * @see BookkeepingAccountListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [BookkeepingAccountListPageResponse], but gracefully handles missing data.
+ *
+ * @see BookkeepingAccountListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): BookkeepingAccountListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CompletableFuture =
+ service.list(nextPageParams())
+
+ fun autoPager(): AutoPagerAsync =
+ AutoPagerAsync.from(this, streamHandlerExecutor)
+
+ /** The parameters that were used to request this page. */
+ fun params(): BookkeepingAccountListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): BookkeepingAccountListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [BookkeepingAccountListPageAsync].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [BookkeepingAccountListPageAsync]. */
+ class Builder internal constructor() {
+
+ private var service: BookkeepingAccountServiceAsync? = null
+ private var streamHandlerExecutor: Executor? = null
+ private var params: BookkeepingAccountListParams? = null
+ private var response: BookkeepingAccountListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(bookkeepingAccountListPageAsync: BookkeepingAccountListPageAsync) =
+ apply {
+ service = bookkeepingAccountListPageAsync.service
+ streamHandlerExecutor = bookkeepingAccountListPageAsync.streamHandlerExecutor
+ params = bookkeepingAccountListPageAsync.params
+ response = bookkeepingAccountListPageAsync.response
+ }
+
+ fun service(service: BookkeepingAccountServiceAsync) = apply { this.service = service }
+
+ fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
+ this.streamHandlerExecutor = streamHandlerExecutor
+ }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: BookkeepingAccountListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: BookkeepingAccountListPageResponse) = apply {
+ this.response = response
+ }
+
+ /**
+ * Returns an immutable instance of [BookkeepingAccountListPageAsync].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): BookkeepingAccountListPageAsync =
+ BookkeepingAccountListPageAsync(
+ checkRequired("service", service),
+ checkRequired("streamHandlerExecutor", streamHandlerExecutor),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is BookkeepingAccountListPageAsync &&
+ service == other.service &&
+ streamHandlerExecutor == other.streamHandlerExecutor &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response)
+
+ override fun toString() =
+ "BookkeepingAccountListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPageResponse.kt
similarity index 88%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListResponse.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPageResponse.kt
index e7b3edb98..ab8d56227 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListResponse.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPageResponse.kt
@@ -20,7 +20,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/** A list of Bookkeeping Account objects. */
-class BookkeepingAccountListResponse
+class BookkeepingAccountListPageResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val data: JsonField>,
@@ -84,7 +84,7 @@ private constructor(
/**
* Returns a mutable builder for constructing an instance of
- * [BookkeepingAccountListResponse].
+ * [BookkeepingAccountListPageResponse].
*
* The following fields are required:
* ```java
@@ -95,7 +95,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [BookkeepingAccountListResponse]. */
+ /** A builder for [BookkeepingAccountListPageResponse]. */
class Builder internal constructor() {
private var data: JsonField>? = null
@@ -103,12 +103,13 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(bookkeepingAccountListResponse: BookkeepingAccountListResponse) = apply {
- data = bookkeepingAccountListResponse.data.map { it.toMutableList() }
- nextCursor = bookkeepingAccountListResponse.nextCursor
- additionalProperties =
- bookkeepingAccountListResponse.additionalProperties.toMutableMap()
- }
+ internal fun from(bookkeepingAccountListPageResponse: BookkeepingAccountListPageResponse) =
+ apply {
+ data = bookkeepingAccountListPageResponse.data.map { it.toMutableList() }
+ nextCursor = bookkeepingAccountListPageResponse.nextCursor
+ additionalProperties =
+ bookkeepingAccountListPageResponse.additionalProperties.toMutableMap()
+ }
/** The contents of the list. */
fun data(data: List) = data(JsonField.of(data))
@@ -171,7 +172,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [BookkeepingAccountListResponse].
+ * Returns an immutable instance of [BookkeepingAccountListPageResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -183,8 +184,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): BookkeepingAccountListResponse =
- BookkeepingAccountListResponse(
+ fun build(): BookkeepingAccountListPageResponse =
+ BookkeepingAccountListPageResponse(
checkRequired("data", data).map { it.toImmutable() },
checkRequired("nextCursor", nextCursor),
additionalProperties.toMutableMap(),
@@ -193,7 +194,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): BookkeepingAccountListResponse = apply {
+ fun validate(): BookkeepingAccountListPageResponse = apply {
if (validated) {
return@apply
}
@@ -226,7 +227,7 @@ private constructor(
return true
}
- return other is BookkeepingAccountListResponse &&
+ return other is BookkeepingAccountListPageResponse &&
data == other.data &&
nextCursor == other.nextCursor &&
additionalProperties == other.additionalProperties
@@ -237,5 +238,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "BookkeepingAccountListResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
+ "BookkeepingAccountListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPage.kt
new file mode 100644
index 000000000..7a7224782
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPage.kt
@@ -0,0 +1,135 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.bookkeepingentries
+
+import com.increase.api.core.AutoPager
+import com.increase.api.core.Page
+import com.increase.api.core.checkRequired
+import com.increase.api.services.blocking.BookkeepingEntryService
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** @see BookkeepingEntryService.list */
+class BookkeepingEntryListPage
+private constructor(
+ private val service: BookkeepingEntryService,
+ private val params: BookkeepingEntryListParams,
+ private val response: BookkeepingEntryListPageResponse,
+) : Page {
+
+ /**
+ * Delegates to [BookkeepingEntryListPageResponse], but gracefully handles missing data.
+ *
+ * @see BookkeepingEntryListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [BookkeepingEntryListPageResponse], but gracefully handles missing data.
+ *
+ * @see BookkeepingEntryListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): BookkeepingEntryListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): BookkeepingEntryListPage = service.list(nextPageParams())
+
+ fun autoPager(): AutoPager = AutoPager.from(this)
+
+ /** The parameters that were used to request this page. */
+ fun params(): BookkeepingEntryListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): BookkeepingEntryListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [BookkeepingEntryListPage].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [BookkeepingEntryListPage]. */
+ class Builder internal constructor() {
+
+ private var service: BookkeepingEntryService? = null
+ private var params: BookkeepingEntryListParams? = null
+ private var response: BookkeepingEntryListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(bookkeepingEntryListPage: BookkeepingEntryListPage) = apply {
+ service = bookkeepingEntryListPage.service
+ params = bookkeepingEntryListPage.params
+ response = bookkeepingEntryListPage.response
+ }
+
+ fun service(service: BookkeepingEntryService) = apply { this.service = service }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: BookkeepingEntryListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: BookkeepingEntryListPageResponse) = apply {
+ this.response = response
+ }
+
+ /**
+ * Returns an immutable instance of [BookkeepingEntryListPage].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): BookkeepingEntryListPage =
+ BookkeepingEntryListPage(
+ checkRequired("service", service),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is BookkeepingEntryListPage &&
+ service == other.service &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, params, response)
+
+ override fun toString() =
+ "BookkeepingEntryListPage{service=$service, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPageAsync.kt
new file mode 100644
index 000000000..0b5495cb4
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPageAsync.kt
@@ -0,0 +1,151 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.bookkeepingentries
+
+import com.increase.api.core.AutoPagerAsync
+import com.increase.api.core.PageAsync
+import com.increase.api.core.checkRequired
+import com.increase.api.services.async.BookkeepingEntryServiceAsync
+import java.util.Objects
+import java.util.Optional
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.Executor
+import kotlin.jvm.optionals.getOrNull
+
+/** @see BookkeepingEntryServiceAsync.list */
+class BookkeepingEntryListPageAsync
+private constructor(
+ private val service: BookkeepingEntryServiceAsync,
+ private val streamHandlerExecutor: Executor,
+ private val params: BookkeepingEntryListParams,
+ private val response: BookkeepingEntryListPageResponse,
+) : PageAsync {
+
+ /**
+ * Delegates to [BookkeepingEntryListPageResponse], but gracefully handles missing data.
+ *
+ * @see BookkeepingEntryListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [BookkeepingEntryListPageResponse], but gracefully handles missing data.
+ *
+ * @see BookkeepingEntryListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): BookkeepingEntryListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CompletableFuture =
+ service.list(nextPageParams())
+
+ fun autoPager(): AutoPagerAsync =
+ AutoPagerAsync.from(this, streamHandlerExecutor)
+
+ /** The parameters that were used to request this page. */
+ fun params(): BookkeepingEntryListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): BookkeepingEntryListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [BookkeepingEntryListPageAsync].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [BookkeepingEntryListPageAsync]. */
+ class Builder internal constructor() {
+
+ private var service: BookkeepingEntryServiceAsync? = null
+ private var streamHandlerExecutor: Executor? = null
+ private var params: BookkeepingEntryListParams? = null
+ private var response: BookkeepingEntryListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(bookkeepingEntryListPageAsync: BookkeepingEntryListPageAsync) = apply {
+ service = bookkeepingEntryListPageAsync.service
+ streamHandlerExecutor = bookkeepingEntryListPageAsync.streamHandlerExecutor
+ params = bookkeepingEntryListPageAsync.params
+ response = bookkeepingEntryListPageAsync.response
+ }
+
+ fun service(service: BookkeepingEntryServiceAsync) = apply { this.service = service }
+
+ fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
+ this.streamHandlerExecutor = streamHandlerExecutor
+ }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: BookkeepingEntryListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: BookkeepingEntryListPageResponse) = apply {
+ this.response = response
+ }
+
+ /**
+ * Returns an immutable instance of [BookkeepingEntryListPageAsync].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): BookkeepingEntryListPageAsync =
+ BookkeepingEntryListPageAsync(
+ checkRequired("service", service),
+ checkRequired("streamHandlerExecutor", streamHandlerExecutor),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is BookkeepingEntryListPageAsync &&
+ service == other.service &&
+ streamHandlerExecutor == other.streamHandlerExecutor &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response)
+
+ override fun toString() =
+ "BookkeepingEntryListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPageResponse.kt
similarity index 89%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListResponse.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPageResponse.kt
index 9c83e2ac6..6364ab287 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListResponse.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPageResponse.kt
@@ -20,7 +20,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/** A list of Bookkeeping Entry objects. */
-class BookkeepingEntryListResponse
+class BookkeepingEntryListPageResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val data: JsonField>,
@@ -83,7 +83,8 @@ private constructor(
companion object {
/**
- * Returns a mutable builder for constructing an instance of [BookkeepingEntryListResponse].
+ * Returns a mutable builder for constructing an instance of
+ * [BookkeepingEntryListPageResponse].
*
* The following fields are required:
* ```java
@@ -94,7 +95,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [BookkeepingEntryListResponse]. */
+ /** A builder for [BookkeepingEntryListPageResponse]. */
class Builder internal constructor() {
private var data: JsonField>? = null
@@ -102,11 +103,13 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(bookkeepingEntryListResponse: BookkeepingEntryListResponse) = apply {
- data = bookkeepingEntryListResponse.data.map { it.toMutableList() }
- nextCursor = bookkeepingEntryListResponse.nextCursor
- additionalProperties = bookkeepingEntryListResponse.additionalProperties.toMutableMap()
- }
+ internal fun from(bookkeepingEntryListPageResponse: BookkeepingEntryListPageResponse) =
+ apply {
+ data = bookkeepingEntryListPageResponse.data.map { it.toMutableList() }
+ nextCursor = bookkeepingEntryListPageResponse.nextCursor
+ additionalProperties =
+ bookkeepingEntryListPageResponse.additionalProperties.toMutableMap()
+ }
/** The contents of the list. */
fun data(data: List) = data(JsonField.of(data))
@@ -169,7 +172,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [BookkeepingEntryListResponse].
+ * Returns an immutable instance of [BookkeepingEntryListPageResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -181,8 +184,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): BookkeepingEntryListResponse =
- BookkeepingEntryListResponse(
+ fun build(): BookkeepingEntryListPageResponse =
+ BookkeepingEntryListPageResponse(
checkRequired("data", data).map { it.toImmutable() },
checkRequired("nextCursor", nextCursor),
additionalProperties.toMutableMap(),
@@ -191,7 +194,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): BookkeepingEntryListResponse = apply {
+ fun validate(): BookkeepingEntryListPageResponse = apply {
if (validated) {
return@apply
}
@@ -224,7 +227,7 @@ private constructor(
return true
}
- return other is BookkeepingEntryListResponse &&
+ return other is BookkeepingEntryListPageResponse &&
data == other.data &&
nextCursor == other.nextCursor &&
additionalProperties == other.additionalProperties
@@ -235,5 +238,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "BookkeepingEntryListResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
+ "BookkeepingEntryListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPage.kt
new file mode 100644
index 000000000..daaa7cd7d
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPage.kt
@@ -0,0 +1,135 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.bookkeepingentrysets
+
+import com.increase.api.core.AutoPager
+import com.increase.api.core.Page
+import com.increase.api.core.checkRequired
+import com.increase.api.services.blocking.BookkeepingEntrySetService
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** @see BookkeepingEntrySetService.list */
+class BookkeepingEntrySetListPage
+private constructor(
+ private val service: BookkeepingEntrySetService,
+ private val params: BookkeepingEntrySetListParams,
+ private val response: BookkeepingEntrySetListPageResponse,
+) : Page {
+
+ /**
+ * Delegates to [BookkeepingEntrySetListPageResponse], but gracefully handles missing data.
+ *
+ * @see BookkeepingEntrySetListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [BookkeepingEntrySetListPageResponse], but gracefully handles missing data.
+ *
+ * @see BookkeepingEntrySetListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): BookkeepingEntrySetListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): BookkeepingEntrySetListPage = service.list(nextPageParams())
+
+ fun autoPager(): AutoPager = AutoPager.from(this)
+
+ /** The parameters that were used to request this page. */
+ fun params(): BookkeepingEntrySetListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): BookkeepingEntrySetListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [BookkeepingEntrySetListPage].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [BookkeepingEntrySetListPage]. */
+ class Builder internal constructor() {
+
+ private var service: BookkeepingEntrySetService? = null
+ private var params: BookkeepingEntrySetListParams? = null
+ private var response: BookkeepingEntrySetListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(bookkeepingEntrySetListPage: BookkeepingEntrySetListPage) = apply {
+ service = bookkeepingEntrySetListPage.service
+ params = bookkeepingEntrySetListPage.params
+ response = bookkeepingEntrySetListPage.response
+ }
+
+ fun service(service: BookkeepingEntrySetService) = apply { this.service = service }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: BookkeepingEntrySetListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: BookkeepingEntrySetListPageResponse) = apply {
+ this.response = response
+ }
+
+ /**
+ * Returns an immutable instance of [BookkeepingEntrySetListPage].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): BookkeepingEntrySetListPage =
+ BookkeepingEntrySetListPage(
+ checkRequired("service", service),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is BookkeepingEntrySetListPage &&
+ service == other.service &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, params, response)
+
+ override fun toString() =
+ "BookkeepingEntrySetListPage{service=$service, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPageAsync.kt
new file mode 100644
index 000000000..b7b003f0a
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPageAsync.kt
@@ -0,0 +1,152 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.bookkeepingentrysets
+
+import com.increase.api.core.AutoPagerAsync
+import com.increase.api.core.PageAsync
+import com.increase.api.core.checkRequired
+import com.increase.api.services.async.BookkeepingEntrySetServiceAsync
+import java.util.Objects
+import java.util.Optional
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.Executor
+import kotlin.jvm.optionals.getOrNull
+
+/** @see BookkeepingEntrySetServiceAsync.list */
+class BookkeepingEntrySetListPageAsync
+private constructor(
+ private val service: BookkeepingEntrySetServiceAsync,
+ private val streamHandlerExecutor: Executor,
+ private val params: BookkeepingEntrySetListParams,
+ private val response: BookkeepingEntrySetListPageResponse,
+) : PageAsync {
+
+ /**
+ * Delegates to [BookkeepingEntrySetListPageResponse], but gracefully handles missing data.
+ *
+ * @see BookkeepingEntrySetListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [BookkeepingEntrySetListPageResponse], but gracefully handles missing data.
+ *
+ * @see BookkeepingEntrySetListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): BookkeepingEntrySetListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CompletableFuture =
+ service.list(nextPageParams())
+
+ fun autoPager(): AutoPagerAsync =
+ AutoPagerAsync.from(this, streamHandlerExecutor)
+
+ /** The parameters that were used to request this page. */
+ fun params(): BookkeepingEntrySetListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): BookkeepingEntrySetListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [BookkeepingEntrySetListPageAsync].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [BookkeepingEntrySetListPageAsync]. */
+ class Builder internal constructor() {
+
+ private var service: BookkeepingEntrySetServiceAsync? = null
+ private var streamHandlerExecutor: Executor? = null
+ private var params: BookkeepingEntrySetListParams? = null
+ private var response: BookkeepingEntrySetListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(bookkeepingEntrySetListPageAsync: BookkeepingEntrySetListPageAsync) =
+ apply {
+ service = bookkeepingEntrySetListPageAsync.service
+ streamHandlerExecutor = bookkeepingEntrySetListPageAsync.streamHandlerExecutor
+ params = bookkeepingEntrySetListPageAsync.params
+ response = bookkeepingEntrySetListPageAsync.response
+ }
+
+ fun service(service: BookkeepingEntrySetServiceAsync) = apply { this.service = service }
+
+ fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
+ this.streamHandlerExecutor = streamHandlerExecutor
+ }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: BookkeepingEntrySetListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: BookkeepingEntrySetListPageResponse) = apply {
+ this.response = response
+ }
+
+ /**
+ * Returns an immutable instance of [BookkeepingEntrySetListPageAsync].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): BookkeepingEntrySetListPageAsync =
+ BookkeepingEntrySetListPageAsync(
+ checkRequired("service", service),
+ checkRequired("streamHandlerExecutor", streamHandlerExecutor),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is BookkeepingEntrySetListPageAsync &&
+ service == other.service &&
+ streamHandlerExecutor == other.streamHandlerExecutor &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response)
+
+ override fun toString() =
+ "BookkeepingEntrySetListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPageResponse.kt
similarity index 89%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListResponse.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPageResponse.kt
index 5889a7f04..62ea0aef2 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListResponse.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPageResponse.kt
@@ -20,7 +20,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/** A list of Bookkeeping Entry Set objects. */
-class BookkeepingEntrySetListResponse
+class BookkeepingEntrySetListPageResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val data: JsonField>,
@@ -84,7 +84,7 @@ private constructor(
/**
* Returns a mutable builder for constructing an instance of
- * [BookkeepingEntrySetListResponse].
+ * [BookkeepingEntrySetListPageResponse].
*
* The following fields are required:
* ```java
@@ -95,7 +95,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [BookkeepingEntrySetListResponse]. */
+ /** A builder for [BookkeepingEntrySetListPageResponse]. */
class Builder internal constructor() {
private var data: JsonField>? = null
@@ -103,13 +103,14 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(bookkeepingEntrySetListResponse: BookkeepingEntrySetListResponse) =
- apply {
- data = bookkeepingEntrySetListResponse.data.map { it.toMutableList() }
- nextCursor = bookkeepingEntrySetListResponse.nextCursor
- additionalProperties =
- bookkeepingEntrySetListResponse.additionalProperties.toMutableMap()
- }
+ internal fun from(
+ bookkeepingEntrySetListPageResponse: BookkeepingEntrySetListPageResponse
+ ) = apply {
+ data = bookkeepingEntrySetListPageResponse.data.map { it.toMutableList() }
+ nextCursor = bookkeepingEntrySetListPageResponse.nextCursor
+ additionalProperties =
+ bookkeepingEntrySetListPageResponse.additionalProperties.toMutableMap()
+ }
/** The contents of the list. */
fun data(data: List) = data(JsonField.of(data))
@@ -172,7 +173,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [BookkeepingEntrySetListResponse].
+ * Returns an immutable instance of [BookkeepingEntrySetListPageResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -184,8 +185,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): BookkeepingEntrySetListResponse =
- BookkeepingEntrySetListResponse(
+ fun build(): BookkeepingEntrySetListPageResponse =
+ BookkeepingEntrySetListPageResponse(
checkRequired("data", data).map { it.toImmutable() },
checkRequired("nextCursor", nextCursor),
additionalProperties.toMutableMap(),
@@ -194,7 +195,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): BookkeepingEntrySetListResponse = apply {
+ fun validate(): BookkeepingEntrySetListPageResponse = apply {
if (validated) {
return@apply
}
@@ -227,7 +228,7 @@ private constructor(
return true
}
- return other is BookkeepingEntrySetListResponse &&
+ return other is BookkeepingEntrySetListPageResponse &&
data == other.data &&
nextCursor == other.nextCursor &&
additionalProperties == other.additionalProperties
@@ -238,5 +239,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "BookkeepingEntrySetListResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
+ "BookkeepingEntrySetListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListPage.kt
new file mode 100644
index 000000000..abea17ee5
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListPage.kt
@@ -0,0 +1,132 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.carddisputes
+
+import com.increase.api.core.AutoPager
+import com.increase.api.core.Page
+import com.increase.api.core.checkRequired
+import com.increase.api.services.blocking.CardDisputeService
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** @see CardDisputeService.list */
+class CardDisputeListPage
+private constructor(
+ private val service: CardDisputeService,
+ private val params: CardDisputeListParams,
+ private val response: CardDisputeListPageResponse,
+) : Page {
+
+ /**
+ * Delegates to [CardDisputeListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardDisputeListPageResponse.data
+ */
+ fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [CardDisputeListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardDisputeListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): CardDisputeListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CardDisputeListPage = service.list(nextPageParams())
+
+ fun autoPager(): AutoPager = AutoPager.from(this)
+
+ /** The parameters that were used to request this page. */
+ fun params(): CardDisputeListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): CardDisputeListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [CardDisputeListPage].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [CardDisputeListPage]. */
+ class Builder internal constructor() {
+
+ private var service: CardDisputeService? = null
+ private var params: CardDisputeListParams? = null
+ private var response: CardDisputeListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(cardDisputeListPage: CardDisputeListPage) = apply {
+ service = cardDisputeListPage.service
+ params = cardDisputeListPage.params
+ response = cardDisputeListPage.response
+ }
+
+ fun service(service: CardDisputeService) = apply { this.service = service }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: CardDisputeListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: CardDisputeListPageResponse) = apply { this.response = response }
+
+ /**
+ * Returns an immutable instance of [CardDisputeListPage].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): CardDisputeListPage =
+ CardDisputeListPage(
+ checkRequired("service", service),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is CardDisputeListPage &&
+ service == other.service &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, params, response)
+
+ override fun toString() =
+ "CardDisputeListPage{service=$service, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListPageAsync.kt
new file mode 100644
index 000000000..a7c681639
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListPageAsync.kt
@@ -0,0 +1,146 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.carddisputes
+
+import com.increase.api.core.AutoPagerAsync
+import com.increase.api.core.PageAsync
+import com.increase.api.core.checkRequired
+import com.increase.api.services.async.CardDisputeServiceAsync
+import java.util.Objects
+import java.util.Optional
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.Executor
+import kotlin.jvm.optionals.getOrNull
+
+/** @see CardDisputeServiceAsync.list */
+class CardDisputeListPageAsync
+private constructor(
+ private val service: CardDisputeServiceAsync,
+ private val streamHandlerExecutor: Executor,
+ private val params: CardDisputeListParams,
+ private val response: CardDisputeListPageResponse,
+) : PageAsync {
+
+ /**
+ * Delegates to [CardDisputeListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardDisputeListPageResponse.data
+ */
+ fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [CardDisputeListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardDisputeListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): CardDisputeListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CompletableFuture =
+ service.list(nextPageParams())
+
+ fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor)
+
+ /** The parameters that were used to request this page. */
+ fun params(): CardDisputeListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): CardDisputeListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [CardDisputeListPageAsync].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [CardDisputeListPageAsync]. */
+ class Builder internal constructor() {
+
+ private var service: CardDisputeServiceAsync? = null
+ private var streamHandlerExecutor: Executor? = null
+ private var params: CardDisputeListParams? = null
+ private var response: CardDisputeListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(cardDisputeListPageAsync: CardDisputeListPageAsync) = apply {
+ service = cardDisputeListPageAsync.service
+ streamHandlerExecutor = cardDisputeListPageAsync.streamHandlerExecutor
+ params = cardDisputeListPageAsync.params
+ response = cardDisputeListPageAsync.response
+ }
+
+ fun service(service: CardDisputeServiceAsync) = apply { this.service = service }
+
+ fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
+ this.streamHandlerExecutor = streamHandlerExecutor
+ }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: CardDisputeListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: CardDisputeListPageResponse) = apply { this.response = response }
+
+ /**
+ * Returns an immutable instance of [CardDisputeListPageAsync].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): CardDisputeListPageAsync =
+ CardDisputeListPageAsync(
+ checkRequired("service", service),
+ checkRequired("streamHandlerExecutor", streamHandlerExecutor),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is CardDisputeListPageAsync &&
+ service == other.service &&
+ streamHandlerExecutor == other.streamHandlerExecutor &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response)
+
+ override fun toString() =
+ "CardDisputeListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListPageResponse.kt
similarity index 89%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListResponse.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListPageResponse.kt
index 979ebe1e6..8ca9d9a35 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListResponse.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListPageResponse.kt
@@ -20,7 +20,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/** A list of Card Dispute objects. */
-class CardDisputeListResponse
+class CardDisputeListPageResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val data: JsonField>,
@@ -81,7 +81,7 @@ private constructor(
companion object {
/**
- * Returns a mutable builder for constructing an instance of [CardDisputeListResponse].
+ * Returns a mutable builder for constructing an instance of [CardDisputeListPageResponse].
*
* The following fields are required:
* ```java
@@ -92,7 +92,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [CardDisputeListResponse]. */
+ /** A builder for [CardDisputeListPageResponse]. */
class Builder internal constructor() {
private var data: JsonField>? = null
@@ -100,10 +100,10 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(cardDisputeListResponse: CardDisputeListResponse) = apply {
- data = cardDisputeListResponse.data.map { it.toMutableList() }
- nextCursor = cardDisputeListResponse.nextCursor
- additionalProperties = cardDisputeListResponse.additionalProperties.toMutableMap()
+ internal fun from(cardDisputeListPageResponse: CardDisputeListPageResponse) = apply {
+ data = cardDisputeListPageResponse.data.map { it.toMutableList() }
+ nextCursor = cardDisputeListPageResponse.nextCursor
+ additionalProperties = cardDisputeListPageResponse.additionalProperties.toMutableMap()
}
/** The contents of the list. */
@@ -167,7 +167,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [CardDisputeListResponse].
+ * Returns an immutable instance of [CardDisputeListPageResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -179,8 +179,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): CardDisputeListResponse =
- CardDisputeListResponse(
+ fun build(): CardDisputeListPageResponse =
+ CardDisputeListPageResponse(
checkRequired("data", data).map { it.toImmutable() },
checkRequired("nextCursor", nextCursor),
additionalProperties.toMutableMap(),
@@ -189,7 +189,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): CardDisputeListResponse = apply {
+ fun validate(): CardDisputeListPageResponse = apply {
if (validated) {
return@apply
}
@@ -222,7 +222,7 @@ private constructor(
return true
}
- return other is CardDisputeListResponse &&
+ return other is CardDisputeListPageResponse &&
data == other.data &&
nextCursor == other.nextCursor &&
additionalProperties == other.additionalProperties
@@ -233,5 +233,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "CardDisputeListResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
+ "CardDisputeListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cardpayments/CardPaymentListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpayments/CardPaymentListPage.kt
new file mode 100644
index 000000000..ea3282ec6
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpayments/CardPaymentListPage.kt
@@ -0,0 +1,132 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.cardpayments
+
+import com.increase.api.core.AutoPager
+import com.increase.api.core.Page
+import com.increase.api.core.checkRequired
+import com.increase.api.services.blocking.CardPaymentService
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** @see CardPaymentService.list */
+class CardPaymentListPage
+private constructor(
+ private val service: CardPaymentService,
+ private val params: CardPaymentListParams,
+ private val response: CardPaymentListPageResponse,
+) : Page {
+
+ /**
+ * Delegates to [CardPaymentListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardPaymentListPageResponse.data
+ */
+ fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [CardPaymentListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardPaymentListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): CardPaymentListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CardPaymentListPage = service.list(nextPageParams())
+
+ fun autoPager(): AutoPager = AutoPager.from(this)
+
+ /** The parameters that were used to request this page. */
+ fun params(): CardPaymentListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): CardPaymentListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [CardPaymentListPage].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [CardPaymentListPage]. */
+ class Builder internal constructor() {
+
+ private var service: CardPaymentService? = null
+ private var params: CardPaymentListParams? = null
+ private var response: CardPaymentListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(cardPaymentListPage: CardPaymentListPage) = apply {
+ service = cardPaymentListPage.service
+ params = cardPaymentListPage.params
+ response = cardPaymentListPage.response
+ }
+
+ fun service(service: CardPaymentService) = apply { this.service = service }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: CardPaymentListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: CardPaymentListPageResponse) = apply { this.response = response }
+
+ /**
+ * Returns an immutable instance of [CardPaymentListPage].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): CardPaymentListPage =
+ CardPaymentListPage(
+ checkRequired("service", service),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is CardPaymentListPage &&
+ service == other.service &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, params, response)
+
+ override fun toString() =
+ "CardPaymentListPage{service=$service, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cardpayments/CardPaymentListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpayments/CardPaymentListPageAsync.kt
new file mode 100644
index 000000000..3660c86a5
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpayments/CardPaymentListPageAsync.kt
@@ -0,0 +1,146 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.cardpayments
+
+import com.increase.api.core.AutoPagerAsync
+import com.increase.api.core.PageAsync
+import com.increase.api.core.checkRequired
+import com.increase.api.services.async.CardPaymentServiceAsync
+import java.util.Objects
+import java.util.Optional
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.Executor
+import kotlin.jvm.optionals.getOrNull
+
+/** @see CardPaymentServiceAsync.list */
+class CardPaymentListPageAsync
+private constructor(
+ private val service: CardPaymentServiceAsync,
+ private val streamHandlerExecutor: Executor,
+ private val params: CardPaymentListParams,
+ private val response: CardPaymentListPageResponse,
+) : PageAsync {
+
+ /**
+ * Delegates to [CardPaymentListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardPaymentListPageResponse.data
+ */
+ fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [CardPaymentListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardPaymentListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): CardPaymentListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CompletableFuture =
+ service.list(nextPageParams())
+
+ fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor)
+
+ /** The parameters that were used to request this page. */
+ fun params(): CardPaymentListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): CardPaymentListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [CardPaymentListPageAsync].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [CardPaymentListPageAsync]. */
+ class Builder internal constructor() {
+
+ private var service: CardPaymentServiceAsync? = null
+ private var streamHandlerExecutor: Executor? = null
+ private var params: CardPaymentListParams? = null
+ private var response: CardPaymentListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(cardPaymentListPageAsync: CardPaymentListPageAsync) = apply {
+ service = cardPaymentListPageAsync.service
+ streamHandlerExecutor = cardPaymentListPageAsync.streamHandlerExecutor
+ params = cardPaymentListPageAsync.params
+ response = cardPaymentListPageAsync.response
+ }
+
+ fun service(service: CardPaymentServiceAsync) = apply { this.service = service }
+
+ fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
+ this.streamHandlerExecutor = streamHandlerExecutor
+ }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: CardPaymentListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: CardPaymentListPageResponse) = apply { this.response = response }
+
+ /**
+ * Returns an immutable instance of [CardPaymentListPageAsync].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): CardPaymentListPageAsync =
+ CardPaymentListPageAsync(
+ checkRequired("service", service),
+ checkRequired("streamHandlerExecutor", streamHandlerExecutor),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is CardPaymentListPageAsync &&
+ service == other.service &&
+ streamHandlerExecutor == other.streamHandlerExecutor &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response)
+
+ override fun toString() =
+ "CardPaymentListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cardpayments/CardPaymentListResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpayments/CardPaymentListPageResponse.kt
similarity index 89%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/cardpayments/CardPaymentListResponse.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/cardpayments/CardPaymentListPageResponse.kt
index 73f1bfdbc..ee43e398b 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/cardpayments/CardPaymentListResponse.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpayments/CardPaymentListPageResponse.kt
@@ -20,7 +20,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/** A list of Card Payment objects. */
-class CardPaymentListResponse
+class CardPaymentListPageResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val data: JsonField>,
@@ -81,7 +81,7 @@ private constructor(
companion object {
/**
- * Returns a mutable builder for constructing an instance of [CardPaymentListResponse].
+ * Returns a mutable builder for constructing an instance of [CardPaymentListPageResponse].
*
* The following fields are required:
* ```java
@@ -92,7 +92,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [CardPaymentListResponse]. */
+ /** A builder for [CardPaymentListPageResponse]. */
class Builder internal constructor() {
private var data: JsonField>? = null
@@ -100,10 +100,10 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(cardPaymentListResponse: CardPaymentListResponse) = apply {
- data = cardPaymentListResponse.data.map { it.toMutableList() }
- nextCursor = cardPaymentListResponse.nextCursor
- additionalProperties = cardPaymentListResponse.additionalProperties.toMutableMap()
+ internal fun from(cardPaymentListPageResponse: CardPaymentListPageResponse) = apply {
+ data = cardPaymentListPageResponse.data.map { it.toMutableList() }
+ nextCursor = cardPaymentListPageResponse.nextCursor
+ additionalProperties = cardPaymentListPageResponse.additionalProperties.toMutableMap()
}
/** The contents of the list. */
@@ -167,7 +167,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [CardPaymentListResponse].
+ * Returns an immutable instance of [CardPaymentListPageResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -179,8 +179,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): CardPaymentListResponse =
- CardPaymentListResponse(
+ fun build(): CardPaymentListPageResponse =
+ CardPaymentListPageResponse(
checkRequired("data", data).map { it.toImmutable() },
checkRequired("nextCursor", nextCursor),
additionalProperties.toMutableMap(),
@@ -189,7 +189,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): CardPaymentListResponse = apply {
+ fun validate(): CardPaymentListPageResponse = apply {
if (validated) {
return@apply
}
@@ -222,7 +222,7 @@ private constructor(
return true
}
- return other is CardPaymentListResponse &&
+ return other is CardPaymentListPageResponse &&
data == other.data &&
nextCursor == other.nextCursor &&
additionalProperties == other.additionalProperties
@@ -233,5 +233,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "CardPaymentListResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
+ "CardPaymentListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cardpurchasesupplements/CardPurchaseSupplementListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpurchasesupplements/CardPurchaseSupplementListPage.kt
new file mode 100644
index 000000000..9e36ee9ed
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpurchasesupplements/CardPurchaseSupplementListPage.kt
@@ -0,0 +1,136 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.cardpurchasesupplements
+
+import com.increase.api.core.AutoPager
+import com.increase.api.core.Page
+import com.increase.api.core.checkRequired
+import com.increase.api.services.blocking.CardPurchaseSupplementService
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** @see CardPurchaseSupplementService.list */
+class CardPurchaseSupplementListPage
+private constructor(
+ private val service: CardPurchaseSupplementService,
+ private val params: CardPurchaseSupplementListParams,
+ private val response: CardPurchaseSupplementListPageResponse,
+) : Page {
+
+ /**
+ * Delegates to [CardPurchaseSupplementListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardPurchaseSupplementListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [CardPurchaseSupplementListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardPurchaseSupplementListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): CardPurchaseSupplementListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CardPurchaseSupplementListPage = service.list(nextPageParams())
+
+ fun autoPager(): AutoPager = AutoPager.from(this)
+
+ /** The parameters that were used to request this page. */
+ fun params(): CardPurchaseSupplementListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): CardPurchaseSupplementListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [CardPurchaseSupplementListPage].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [CardPurchaseSupplementListPage]. */
+ class Builder internal constructor() {
+
+ private var service: CardPurchaseSupplementService? = null
+ private var params: CardPurchaseSupplementListParams? = null
+ private var response: CardPurchaseSupplementListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(cardPurchaseSupplementListPage: CardPurchaseSupplementListPage) = apply {
+ service = cardPurchaseSupplementListPage.service
+ params = cardPurchaseSupplementListPage.params
+ response = cardPurchaseSupplementListPage.response
+ }
+
+ fun service(service: CardPurchaseSupplementService) = apply { this.service = service }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: CardPurchaseSupplementListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: CardPurchaseSupplementListPageResponse) = apply {
+ this.response = response
+ }
+
+ /**
+ * Returns an immutable instance of [CardPurchaseSupplementListPage].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): CardPurchaseSupplementListPage =
+ CardPurchaseSupplementListPage(
+ checkRequired("service", service),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is CardPurchaseSupplementListPage &&
+ service == other.service &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, params, response)
+
+ override fun toString() =
+ "CardPurchaseSupplementListPage{service=$service, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cardpurchasesupplements/CardPurchaseSupplementListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpurchasesupplements/CardPurchaseSupplementListPageAsync.kt
new file mode 100644
index 000000000..14c46682e
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpurchasesupplements/CardPurchaseSupplementListPageAsync.kt
@@ -0,0 +1,153 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.cardpurchasesupplements
+
+import com.increase.api.core.AutoPagerAsync
+import com.increase.api.core.PageAsync
+import com.increase.api.core.checkRequired
+import com.increase.api.services.async.CardPurchaseSupplementServiceAsync
+import java.util.Objects
+import java.util.Optional
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.Executor
+import kotlin.jvm.optionals.getOrNull
+
+/** @see CardPurchaseSupplementServiceAsync.list */
+class CardPurchaseSupplementListPageAsync
+private constructor(
+ private val service: CardPurchaseSupplementServiceAsync,
+ private val streamHandlerExecutor: Executor,
+ private val params: CardPurchaseSupplementListParams,
+ private val response: CardPurchaseSupplementListPageResponse,
+) : PageAsync {
+
+ /**
+ * Delegates to [CardPurchaseSupplementListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardPurchaseSupplementListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [CardPurchaseSupplementListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardPurchaseSupplementListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): CardPurchaseSupplementListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CompletableFuture =
+ service.list(nextPageParams())
+
+ fun autoPager(): AutoPagerAsync =
+ AutoPagerAsync.from(this, streamHandlerExecutor)
+
+ /** The parameters that were used to request this page. */
+ fun params(): CardPurchaseSupplementListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): CardPurchaseSupplementListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [CardPurchaseSupplementListPageAsync].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [CardPurchaseSupplementListPageAsync]. */
+ class Builder internal constructor() {
+
+ private var service: CardPurchaseSupplementServiceAsync? = null
+ private var streamHandlerExecutor: Executor? = null
+ private var params: CardPurchaseSupplementListParams? = null
+ private var response: CardPurchaseSupplementListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(
+ cardPurchaseSupplementListPageAsync: CardPurchaseSupplementListPageAsync
+ ) = apply {
+ service = cardPurchaseSupplementListPageAsync.service
+ streamHandlerExecutor = cardPurchaseSupplementListPageAsync.streamHandlerExecutor
+ params = cardPurchaseSupplementListPageAsync.params
+ response = cardPurchaseSupplementListPageAsync.response
+ }
+
+ fun service(service: CardPurchaseSupplementServiceAsync) = apply { this.service = service }
+
+ fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
+ this.streamHandlerExecutor = streamHandlerExecutor
+ }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: CardPurchaseSupplementListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: CardPurchaseSupplementListPageResponse) = apply {
+ this.response = response
+ }
+
+ /**
+ * Returns an immutable instance of [CardPurchaseSupplementListPageAsync].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): CardPurchaseSupplementListPageAsync =
+ CardPurchaseSupplementListPageAsync(
+ checkRequired("service", service),
+ checkRequired("streamHandlerExecutor", streamHandlerExecutor),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is CardPurchaseSupplementListPageAsync &&
+ service == other.service &&
+ streamHandlerExecutor == other.streamHandlerExecutor &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response)
+
+ override fun toString() =
+ "CardPurchaseSupplementListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cardpurchasesupplements/CardPurchaseSupplementListResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpurchasesupplements/CardPurchaseSupplementListPageResponse.kt
similarity index 89%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/cardpurchasesupplements/CardPurchaseSupplementListResponse.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/cardpurchasesupplements/CardPurchaseSupplementListPageResponse.kt
index 4eb072bf7..fb8febe63 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/cardpurchasesupplements/CardPurchaseSupplementListResponse.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpurchasesupplements/CardPurchaseSupplementListPageResponse.kt
@@ -20,7 +20,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/** A list of Card Purchase Supplement objects. */
-class CardPurchaseSupplementListResponse
+class CardPurchaseSupplementListPageResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val data: JsonField>,
@@ -86,7 +86,7 @@ private constructor(
/**
* Returns a mutable builder for constructing an instance of
- * [CardPurchaseSupplementListResponse].
+ * [CardPurchaseSupplementListPageResponse].
*
* The following fields are required:
* ```java
@@ -97,7 +97,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [CardPurchaseSupplementListResponse]. */
+ /** A builder for [CardPurchaseSupplementListPageResponse]. */
class Builder internal constructor() {
private var data: JsonField>? = null
@@ -105,13 +105,14 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(cardPurchaseSupplementListResponse: CardPurchaseSupplementListResponse) =
- apply {
- data = cardPurchaseSupplementListResponse.data.map { it.toMutableList() }
- nextCursor = cardPurchaseSupplementListResponse.nextCursor
- additionalProperties =
- cardPurchaseSupplementListResponse.additionalProperties.toMutableMap()
- }
+ internal fun from(
+ cardPurchaseSupplementListPageResponse: CardPurchaseSupplementListPageResponse
+ ) = apply {
+ data = cardPurchaseSupplementListPageResponse.data.map { it.toMutableList() }
+ nextCursor = cardPurchaseSupplementListPageResponse.nextCursor
+ additionalProperties =
+ cardPurchaseSupplementListPageResponse.additionalProperties.toMutableMap()
+ }
/** The contents of the list. */
fun data(data: List) = data(JsonField.of(data))
@@ -174,7 +175,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [CardPurchaseSupplementListResponse].
+ * Returns an immutable instance of [CardPurchaseSupplementListPageResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -186,8 +187,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): CardPurchaseSupplementListResponse =
- CardPurchaseSupplementListResponse(
+ fun build(): CardPurchaseSupplementListPageResponse =
+ CardPurchaseSupplementListPageResponse(
checkRequired("data", data).map { it.toImmutable() },
checkRequired("nextCursor", nextCursor),
additionalProperties.toMutableMap(),
@@ -196,7 +197,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): CardPurchaseSupplementListResponse = apply {
+ fun validate(): CardPurchaseSupplementListPageResponse = apply {
if (validated) {
return@apply
}
@@ -229,7 +230,7 @@ private constructor(
return true
}
- return other is CardPurchaseSupplementListResponse &&
+ return other is CardPurchaseSupplementListPageResponse &&
data == other.data &&
nextCursor == other.nextCursor &&
additionalProperties == other.additionalProperties
@@ -240,5 +241,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "CardPurchaseSupplementListResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
+ "CardPurchaseSupplementListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cardpushtransfers/CardPushTransferListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpushtransfers/CardPushTransferListPage.kt
new file mode 100644
index 000000000..865cf24ad
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpushtransfers/CardPushTransferListPage.kt
@@ -0,0 +1,135 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.cardpushtransfers
+
+import com.increase.api.core.AutoPager
+import com.increase.api.core.Page
+import com.increase.api.core.checkRequired
+import com.increase.api.services.blocking.CardPushTransferService
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** @see CardPushTransferService.list */
+class CardPushTransferListPage
+private constructor(
+ private val service: CardPushTransferService,
+ private val params: CardPushTransferListParams,
+ private val response: CardPushTransferListPageResponse,
+) : Page {
+
+ /**
+ * Delegates to [CardPushTransferListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardPushTransferListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [CardPushTransferListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardPushTransferListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): CardPushTransferListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CardPushTransferListPage = service.list(nextPageParams())
+
+ fun autoPager(): AutoPager = AutoPager.from(this)
+
+ /** The parameters that were used to request this page. */
+ fun params(): CardPushTransferListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): CardPushTransferListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [CardPushTransferListPage].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [CardPushTransferListPage]. */
+ class Builder internal constructor() {
+
+ private var service: CardPushTransferService? = null
+ private var params: CardPushTransferListParams? = null
+ private var response: CardPushTransferListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(cardPushTransferListPage: CardPushTransferListPage) = apply {
+ service = cardPushTransferListPage.service
+ params = cardPushTransferListPage.params
+ response = cardPushTransferListPage.response
+ }
+
+ fun service(service: CardPushTransferService) = apply { this.service = service }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: CardPushTransferListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: CardPushTransferListPageResponse) = apply {
+ this.response = response
+ }
+
+ /**
+ * Returns an immutable instance of [CardPushTransferListPage].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): CardPushTransferListPage =
+ CardPushTransferListPage(
+ checkRequired("service", service),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is CardPushTransferListPage &&
+ service == other.service &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, params, response)
+
+ override fun toString() =
+ "CardPushTransferListPage{service=$service, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cardpushtransfers/CardPushTransferListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpushtransfers/CardPushTransferListPageAsync.kt
new file mode 100644
index 000000000..603a9c2d0
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpushtransfers/CardPushTransferListPageAsync.kt
@@ -0,0 +1,151 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.cardpushtransfers
+
+import com.increase.api.core.AutoPagerAsync
+import com.increase.api.core.PageAsync
+import com.increase.api.core.checkRequired
+import com.increase.api.services.async.CardPushTransferServiceAsync
+import java.util.Objects
+import java.util.Optional
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.Executor
+import kotlin.jvm.optionals.getOrNull
+
+/** @see CardPushTransferServiceAsync.list */
+class CardPushTransferListPageAsync
+private constructor(
+ private val service: CardPushTransferServiceAsync,
+ private val streamHandlerExecutor: Executor,
+ private val params: CardPushTransferListParams,
+ private val response: CardPushTransferListPageResponse,
+) : PageAsync {
+
+ /**
+ * Delegates to [CardPushTransferListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardPushTransferListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [CardPushTransferListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardPushTransferListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): CardPushTransferListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CompletableFuture =
+ service.list(nextPageParams())
+
+ fun autoPager(): AutoPagerAsync =
+ AutoPagerAsync.from(this, streamHandlerExecutor)
+
+ /** The parameters that were used to request this page. */
+ fun params(): CardPushTransferListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): CardPushTransferListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [CardPushTransferListPageAsync].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [CardPushTransferListPageAsync]. */
+ class Builder internal constructor() {
+
+ private var service: CardPushTransferServiceAsync? = null
+ private var streamHandlerExecutor: Executor? = null
+ private var params: CardPushTransferListParams? = null
+ private var response: CardPushTransferListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(cardPushTransferListPageAsync: CardPushTransferListPageAsync) = apply {
+ service = cardPushTransferListPageAsync.service
+ streamHandlerExecutor = cardPushTransferListPageAsync.streamHandlerExecutor
+ params = cardPushTransferListPageAsync.params
+ response = cardPushTransferListPageAsync.response
+ }
+
+ fun service(service: CardPushTransferServiceAsync) = apply { this.service = service }
+
+ fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
+ this.streamHandlerExecutor = streamHandlerExecutor
+ }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: CardPushTransferListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: CardPushTransferListPageResponse) = apply {
+ this.response = response
+ }
+
+ /**
+ * Returns an immutable instance of [CardPushTransferListPageAsync].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): CardPushTransferListPageAsync =
+ CardPushTransferListPageAsync(
+ checkRequired("service", service),
+ checkRequired("streamHandlerExecutor", streamHandlerExecutor),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is CardPushTransferListPageAsync &&
+ service == other.service &&
+ streamHandlerExecutor == other.streamHandlerExecutor &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response)
+
+ override fun toString() =
+ "CardPushTransferListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cardpushtransfers/CardPushTransferListResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpushtransfers/CardPushTransferListPageResponse.kt
similarity index 89%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/cardpushtransfers/CardPushTransferListResponse.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/cardpushtransfers/CardPushTransferListPageResponse.kt
index e1589efb1..7a8324456 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/cardpushtransfers/CardPushTransferListResponse.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpushtransfers/CardPushTransferListPageResponse.kt
@@ -20,7 +20,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/** A list of Card Push Transfer objects. */
-class CardPushTransferListResponse
+class CardPushTransferListPageResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val data: JsonField>,
@@ -83,7 +83,8 @@ private constructor(
companion object {
/**
- * Returns a mutable builder for constructing an instance of [CardPushTransferListResponse].
+ * Returns a mutable builder for constructing an instance of
+ * [CardPushTransferListPageResponse].
*
* The following fields are required:
* ```java
@@ -94,7 +95,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [CardPushTransferListResponse]. */
+ /** A builder for [CardPushTransferListPageResponse]. */
class Builder internal constructor() {
private var data: JsonField>? = null
@@ -102,11 +103,13 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(cardPushTransferListResponse: CardPushTransferListResponse) = apply {
- data = cardPushTransferListResponse.data.map { it.toMutableList() }
- nextCursor = cardPushTransferListResponse.nextCursor
- additionalProperties = cardPushTransferListResponse.additionalProperties.toMutableMap()
- }
+ internal fun from(cardPushTransferListPageResponse: CardPushTransferListPageResponse) =
+ apply {
+ data = cardPushTransferListPageResponse.data.map { it.toMutableList() }
+ nextCursor = cardPushTransferListPageResponse.nextCursor
+ additionalProperties =
+ cardPushTransferListPageResponse.additionalProperties.toMutableMap()
+ }
/** The contents of the list. */
fun data(data: List) = data(JsonField.of(data))
@@ -169,7 +172,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [CardPushTransferListResponse].
+ * Returns an immutable instance of [CardPushTransferListPageResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -181,8 +184,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): CardPushTransferListResponse =
- CardPushTransferListResponse(
+ fun build(): CardPushTransferListPageResponse =
+ CardPushTransferListPageResponse(
checkRequired("data", data).map { it.toImmutable() },
checkRequired("nextCursor", nextCursor),
additionalProperties.toMutableMap(),
@@ -191,7 +194,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): CardPushTransferListResponse = apply {
+ fun validate(): CardPushTransferListPageResponse = apply {
if (validated) {
return@apply
}
@@ -224,7 +227,7 @@ private constructor(
return true
}
- return other is CardPushTransferListResponse &&
+ return other is CardPushTransferListPageResponse &&
data == other.data &&
nextCursor == other.nextCursor &&
additionalProperties == other.additionalProperties
@@ -235,5 +238,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "CardPushTransferListResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
+ "CardPushTransferListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardListPage.kt
new file mode 100644
index 000000000..e9f8b8978
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardListPage.kt
@@ -0,0 +1,131 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.cards
+
+import com.increase.api.core.AutoPager
+import com.increase.api.core.Page
+import com.increase.api.core.checkRequired
+import com.increase.api.services.blocking.CardService
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** @see CardService.list */
+class CardListPage
+private constructor(
+ private val service: CardService,
+ private val params: CardListParams,
+ private val response: CardListPageResponse,
+) : Page {
+
+ /**
+ * Delegates to [CardListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardListPageResponse.data
+ */
+ fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [CardListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): CardListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CardListPage = service.list(nextPageParams())
+
+ fun autoPager(): AutoPager = AutoPager.from(this)
+
+ /** The parameters that were used to request this page. */
+ fun params(): CardListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): CardListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [CardListPage].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [CardListPage]. */
+ class Builder internal constructor() {
+
+ private var service: CardService? = null
+ private var params: CardListParams? = null
+ private var response: CardListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(cardListPage: CardListPage) = apply {
+ service = cardListPage.service
+ params = cardListPage.params
+ response = cardListPage.response
+ }
+
+ fun service(service: CardService) = apply { this.service = service }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: CardListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: CardListPageResponse) = apply { this.response = response }
+
+ /**
+ * Returns an immutable instance of [CardListPage].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): CardListPage =
+ CardListPage(
+ checkRequired("service", service),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is CardListPage &&
+ service == other.service &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, params, response)
+
+ override fun toString() = "CardListPage{service=$service, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardListPageAsync.kt
new file mode 100644
index 000000000..4b8f0975b
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardListPageAsync.kt
@@ -0,0 +1,145 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.cards
+
+import com.increase.api.core.AutoPagerAsync
+import com.increase.api.core.PageAsync
+import com.increase.api.core.checkRequired
+import com.increase.api.services.async.CardServiceAsync
+import java.util.Objects
+import java.util.Optional
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.Executor
+import kotlin.jvm.optionals.getOrNull
+
+/** @see CardServiceAsync.list */
+class CardListPageAsync
+private constructor(
+ private val service: CardServiceAsync,
+ private val streamHandlerExecutor: Executor,
+ private val params: CardListParams,
+ private val response: CardListPageResponse,
+) : PageAsync {
+
+ /**
+ * Delegates to [CardListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardListPageResponse.data
+ */
+ fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [CardListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): CardListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CompletableFuture = service.list(nextPageParams())
+
+ fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor)
+
+ /** The parameters that were used to request this page. */
+ fun params(): CardListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): CardListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [CardListPageAsync].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [CardListPageAsync]. */
+ class Builder internal constructor() {
+
+ private var service: CardServiceAsync? = null
+ private var streamHandlerExecutor: Executor? = null
+ private var params: CardListParams? = null
+ private var response: CardListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(cardListPageAsync: CardListPageAsync) = apply {
+ service = cardListPageAsync.service
+ streamHandlerExecutor = cardListPageAsync.streamHandlerExecutor
+ params = cardListPageAsync.params
+ response = cardListPageAsync.response
+ }
+
+ fun service(service: CardServiceAsync) = apply { this.service = service }
+
+ fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
+ this.streamHandlerExecutor = streamHandlerExecutor
+ }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: CardListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: CardListPageResponse) = apply { this.response = response }
+
+ /**
+ * Returns an immutable instance of [CardListPageAsync].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): CardListPageAsync =
+ CardListPageAsync(
+ checkRequired("service", service),
+ checkRequired("streamHandlerExecutor", streamHandlerExecutor),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is CardListPageAsync &&
+ service == other.service &&
+ streamHandlerExecutor == other.streamHandlerExecutor &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response)
+
+ override fun toString() =
+ "CardListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardListResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardListPageResponse.kt
similarity index 90%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardListResponse.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardListPageResponse.kt
index 5bbc28191..69c2b231a 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardListResponse.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardListPageResponse.kt
@@ -20,7 +20,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/** A list of Card objects. */
-class CardListResponse
+class CardListPageResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val data: JsonField>,
@@ -81,7 +81,7 @@ private constructor(
companion object {
/**
- * Returns a mutable builder for constructing an instance of [CardListResponse].
+ * Returns a mutable builder for constructing an instance of [CardListPageResponse].
*
* The following fields are required:
* ```java
@@ -92,7 +92,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [CardListResponse]. */
+ /** A builder for [CardListPageResponse]. */
class Builder internal constructor() {
private var data: JsonField>? = null
@@ -100,10 +100,10 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(cardListResponse: CardListResponse) = apply {
- data = cardListResponse.data.map { it.toMutableList() }
- nextCursor = cardListResponse.nextCursor
- additionalProperties = cardListResponse.additionalProperties.toMutableMap()
+ internal fun from(cardListPageResponse: CardListPageResponse) = apply {
+ data = cardListPageResponse.data.map { it.toMutableList() }
+ nextCursor = cardListPageResponse.nextCursor
+ additionalProperties = cardListPageResponse.additionalProperties.toMutableMap()
}
/** The contents of the list. */
@@ -166,7 +166,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [CardListResponse].
+ * Returns an immutable instance of [CardListPageResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -178,8 +178,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): CardListResponse =
- CardListResponse(
+ fun build(): CardListPageResponse =
+ CardListPageResponse(
checkRequired("data", data).map { it.toImmutable() },
checkRequired("nextCursor", nextCursor),
additionalProperties.toMutableMap(),
@@ -188,7 +188,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): CardListResponse = apply {
+ fun validate(): CardListPageResponse = apply {
if (validated) {
return@apply
}
@@ -221,7 +221,7 @@ private constructor(
return true
}
- return other is CardListResponse &&
+ return other is CardListPageResponse &&
data == other.data &&
nextCursor == other.nextCursor &&
additionalProperties == other.additionalProperties
@@ -232,5 +232,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "CardListResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
+ "CardListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cardtokens/CardTokenListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cardtokens/CardTokenListPage.kt
new file mode 100644
index 000000000..1c7dfc628
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cardtokens/CardTokenListPage.kt
@@ -0,0 +1,132 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.cardtokens
+
+import com.increase.api.core.AutoPager
+import com.increase.api.core.Page
+import com.increase.api.core.checkRequired
+import com.increase.api.services.blocking.CardTokenService
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** @see CardTokenService.list */
+class CardTokenListPage
+private constructor(
+ private val service: CardTokenService,
+ private val params: CardTokenListParams,
+ private val response: CardTokenListPageResponse,
+) : Page {
+
+ /**
+ * Delegates to [CardTokenListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardTokenListPageResponse.data
+ */
+ fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [CardTokenListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardTokenListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): CardTokenListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CardTokenListPage = service.list(nextPageParams())
+
+ fun autoPager(): AutoPager = AutoPager.from(this)
+
+ /** The parameters that were used to request this page. */
+ fun params(): CardTokenListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): CardTokenListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [CardTokenListPage].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [CardTokenListPage]. */
+ class Builder internal constructor() {
+
+ private var service: CardTokenService? = null
+ private var params: CardTokenListParams? = null
+ private var response: CardTokenListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(cardTokenListPage: CardTokenListPage) = apply {
+ service = cardTokenListPage.service
+ params = cardTokenListPage.params
+ response = cardTokenListPage.response
+ }
+
+ fun service(service: CardTokenService) = apply { this.service = service }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: CardTokenListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: CardTokenListPageResponse) = apply { this.response = response }
+
+ /**
+ * Returns an immutable instance of [CardTokenListPage].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): CardTokenListPage =
+ CardTokenListPage(
+ checkRequired("service", service),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is CardTokenListPage &&
+ service == other.service &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, params, response)
+
+ override fun toString() =
+ "CardTokenListPage{service=$service, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cardtokens/CardTokenListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cardtokens/CardTokenListPageAsync.kt
new file mode 100644
index 000000000..e1b562f8d
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cardtokens/CardTokenListPageAsync.kt
@@ -0,0 +1,146 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.cardtokens
+
+import com.increase.api.core.AutoPagerAsync
+import com.increase.api.core.PageAsync
+import com.increase.api.core.checkRequired
+import com.increase.api.services.async.CardTokenServiceAsync
+import java.util.Objects
+import java.util.Optional
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.Executor
+import kotlin.jvm.optionals.getOrNull
+
+/** @see CardTokenServiceAsync.list */
+class CardTokenListPageAsync
+private constructor(
+ private val service: CardTokenServiceAsync,
+ private val streamHandlerExecutor: Executor,
+ private val params: CardTokenListParams,
+ private val response: CardTokenListPageResponse,
+) : PageAsync {
+
+ /**
+ * Delegates to [CardTokenListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardTokenListPageResponse.data
+ */
+ fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [CardTokenListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardTokenListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent
+
+ fun nextPageParams(): CardTokenListParams {
+ val nextCursor =
+ nextCursor().getOrNull()
+ ?: throw IllegalStateException("Cannot construct next page params")
+ return params.toBuilder().cursor(nextCursor).build()
+ }
+
+ override fun nextPage(): CompletableFuture =
+ service.list(nextPageParams())
+
+ fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor)
+
+ /** The parameters that were used to request this page. */
+ fun params(): CardTokenListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): CardTokenListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [CardTokenListPageAsync].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [CardTokenListPageAsync]. */
+ class Builder internal constructor() {
+
+ private var service: CardTokenServiceAsync? = null
+ private var streamHandlerExecutor: Executor? = null
+ private var params: CardTokenListParams? = null
+ private var response: CardTokenListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(cardTokenListPageAsync: CardTokenListPageAsync) = apply {
+ service = cardTokenListPageAsync.service
+ streamHandlerExecutor = cardTokenListPageAsync.streamHandlerExecutor
+ params = cardTokenListPageAsync.params
+ response = cardTokenListPageAsync.response
+ }
+
+ fun service(service: CardTokenServiceAsync) = apply { this.service = service }
+
+ fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
+ this.streamHandlerExecutor = streamHandlerExecutor
+ }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: CardTokenListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: CardTokenListPageResponse) = apply { this.response = response }
+
+ /**
+ * Returns an immutable instance of [CardTokenListPageAsync].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): CardTokenListPageAsync =
+ CardTokenListPageAsync(
+ checkRequired("service", service),
+ checkRequired("streamHandlerExecutor", streamHandlerExecutor),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is CardTokenListPageAsync &&
+ service == other.service &&
+ streamHandlerExecutor == other.streamHandlerExecutor &&
+ params == other.params &&
+ response == other.response
+ }
+
+ override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response)
+
+ override fun toString() =
+ "CardTokenListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cardtokens/CardTokenListResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cardtokens/CardTokenListPageResponse.kt
similarity index 90%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/cardtokens/CardTokenListResponse.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/cardtokens/CardTokenListPageResponse.kt
index 2e89fc3da..efe5e9148 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/cardtokens/CardTokenListResponse.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cardtokens/CardTokenListPageResponse.kt
@@ -20,7 +20,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/** A list of Card Token objects. */
-class CardTokenListResponse
+class CardTokenListPageResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val data: JsonField>,
@@ -81,7 +81,7 @@ private constructor(
companion object {
/**
- * Returns a mutable builder for constructing an instance of [CardTokenListResponse].
+ * Returns a mutable builder for constructing an instance of [CardTokenListPageResponse].
*
* The following fields are required:
* ```java
@@ -92,7 +92,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [CardTokenListResponse]. */
+ /** A builder for [CardTokenListPageResponse]. */
class Builder internal constructor() {
private var data: JsonField>? = null
@@ -100,10 +100,10 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(cardTokenListResponse: CardTokenListResponse) = apply {
- data = cardTokenListResponse.data.map { it.toMutableList() }
- nextCursor = cardTokenListResponse.nextCursor
- additionalProperties = cardTokenListResponse.additionalProperties.toMutableMap()
+ internal fun from(cardTokenListPageResponse: CardTokenListPageResponse) = apply {
+ data = cardTokenListPageResponse.data.map { it.toMutableList() }
+ nextCursor = cardTokenListPageResponse.nextCursor
+ additionalProperties = cardTokenListPageResponse.additionalProperties.toMutableMap()
}
/** The contents of the list. */
@@ -167,7 +167,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [CardTokenListResponse].
+ * Returns an immutable instance of [CardTokenListPageResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -179,8 +179,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): CardTokenListResponse =
- CardTokenListResponse(
+ fun build(): CardTokenListPageResponse =
+ CardTokenListPageResponse(
checkRequired("data", data).map { it.toImmutable() },
checkRequired("nextCursor", nextCursor),
additionalProperties.toMutableMap(),
@@ -189,7 +189,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): CardTokenListResponse = apply {
+ fun validate(): CardTokenListPageResponse = apply {
if (validated) {
return@apply
}
@@ -222,7 +222,7 @@ private constructor(
return true
}
- return other is CardTokenListResponse &&
+ return other is CardTokenListPageResponse &&
data == other.data &&
nextCursor == other.nextCursor &&
additionalProperties == other.additionalProperties
@@ -233,5 +233,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "CardTokenListResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
+ "CardTokenListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cardvalidations/CardValidationListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cardvalidations/CardValidationListPage.kt
new file mode 100644
index 000000000..e1688cd1d
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cardvalidations/CardValidationListPage.kt
@@ -0,0 +1,133 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.cardvalidations
+
+import com.increase.api.core.AutoPager
+import com.increase.api.core.Page
+import com.increase.api.core.checkRequired
+import com.increase.api.services.blocking.CardValidationService
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** @see CardValidationService.list */
+class CardValidationListPage
+private constructor(
+ private val service: CardValidationService,
+ private val params: CardValidationListParams,
+ private val response: CardValidationListPageResponse,
+) : Page {
+
+ /**
+ * Delegates to [CardValidationListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardValidationListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [CardValidationListPageResponse], but gracefully handles missing data.
+ *
+ * @see CardValidationListPageResponse.nextCursor
+ */
+ fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor")
+
+ override fun items(): List