diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index a579a4349..97d8dbba5 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.99.0"
+ ".": "0.100.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 0ae331cd6..c01750cd7 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 167
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-aa089e65735b8884f8cb391b39b9a0b295819e438bf976c98cc6150628ca5488.yml
-openapi_spec_hash: 719876533d1496e9192c7a734a78c736
-config_hash: e9a46eb8acb9dc2c236f3e1958a1c4dd
+configured_endpoints: 169
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-529662462c00af160f74568fe26dbe576cf1fdc9f427e11bb1939bd8acdcb43f.yml
+openapi_spec_hash: a98631dfc66716d41ada4ddb199f7028
+config_hash: 2d501901f343d00775037fcec4121983
diff --git a/CHANGELOG.md b/CHANGELOG.md
index df54f798b..dc96703a0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 0.100.0 (2025-08-04)
+
+Full Changelog: [v0.99.0...v0.100.0](https://github.com/lithic-com/lithic-java/compare/v0.99.0...v0.100.0)
+
+### Features
+
+* **api:** adds new Account Activity API ([8c85abd](https://github.com/lithic-com/lithic-java/commit/8c85abda56d34fb424cb6343c3c7f96d0cd32b9a))
+
## 0.99.0 (2025-07-31)
Full Changelog: [v0.98.0...v0.99.0](https://github.com/lithic-com/lithic-java/compare/v0.98.0...v0.99.0)
diff --git a/README.md b/README.md
index 247ce2123..ea643c48b 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.99.0)
-[](https://javadoc.io/doc/com.lithic.api/lithic-java/0.99.0)
+[](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.100.0)
+[](https://javadoc.io/doc/com.lithic.api/lithic-java/0.100.0)
@@ -13,7 +13,7 @@ The Lithic Java SDK is similar to the Lithic Kotlin SDK but with minor differenc
-The REST API documentation can be found on [docs.lithic.com](https://docs.lithic.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.lithic.api/lithic-java/0.99.0).
+The REST API documentation can be found on [docs.lithic.com](https://docs.lithic.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.lithic.api/lithic-java/0.100.0).
@@ -24,7 +24,7 @@ The REST API documentation can be found on [docs.lithic.com](https://docs.lithic
### Gradle
```kotlin
-implementation("com.lithic.api:lithic-java:0.99.0")
+implementation("com.lithic.api:lithic-java:0.100.0")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.lithic.api:lithic-java:0.99.0")
com.lithic.api
lithic-java
- 0.99.0
+ 0.100.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 5439db507..38798d539 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.lithic.api"
- version = "0.99.0" // x-release-please-version
+ version = "0.100.0" // x-release-please-version
}
subprojects {
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClient.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClient.kt
index ababd62f1..19d433991 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClient.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClient.kt
@@ -8,6 +8,7 @@ import com.lithic.api.core.RequestOptions
import com.lithic.api.core.http.HttpResponseFor
import com.lithic.api.models.ApiStatus
import com.lithic.api.models.ClientApiStatusParams
+import com.lithic.api.services.blocking.AccountActivityService
import com.lithic.api.services.blocking.AccountHolderService
import com.lithic.api.services.blocking.AccountService
import com.lithic.api.services.blocking.AggregateBalanceService
@@ -133,6 +134,8 @@ interface LithicClient {
fun networkPrograms(): NetworkProgramService
+ fun accountActivity(): AccountActivityService
+
/** Status of api */
fun apiStatus(): ApiStatus = apiStatus(ClientApiStatusParams.none())
@@ -229,6 +232,8 @@ interface LithicClient {
fun networkPrograms(): NetworkProgramService.WithRawResponse
+ fun accountActivity(): AccountActivityService.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /v1/status`, but is otherwise the same as
* [LithicClient.apiStatus].
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsync.kt
index 20cbe7005..63aa8975b 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsync.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsync.kt
@@ -7,6 +7,7 @@ import com.lithic.api.core.RequestOptions
import com.lithic.api.core.http.HttpResponseFor
import com.lithic.api.models.ApiStatus
import com.lithic.api.models.ClientApiStatusParams
+import com.lithic.api.services.async.AccountActivityServiceAsync
import com.lithic.api.services.async.AccountHolderServiceAsync
import com.lithic.api.services.async.AccountServiceAsync
import com.lithic.api.services.async.AggregateBalanceServiceAsync
@@ -133,6 +134,8 @@ interface LithicClientAsync {
fun networkPrograms(): NetworkProgramServiceAsync
+ fun accountActivity(): AccountActivityServiceAsync
+
/** Status of api */
fun apiStatus(): CompletableFuture = apiStatus(ClientApiStatusParams.none())
@@ -232,6 +235,8 @@ interface LithicClientAsync {
fun networkPrograms(): NetworkProgramServiceAsync.WithRawResponse
+ fun accountActivity(): AccountActivityServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /v1/status`, but is otherwise the same as
* [LithicClientAsync.apiStatus].
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsyncImpl.kt
index fa05a6755..173776d11 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsyncImpl.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsyncImpl.kt
@@ -17,6 +17,8 @@ import com.lithic.api.core.http.parseable
import com.lithic.api.core.prepareAsync
import com.lithic.api.models.ApiStatus
import com.lithic.api.models.ClientApiStatusParams
+import com.lithic.api.services.async.AccountActivityServiceAsync
+import com.lithic.api.services.async.AccountActivityServiceAsyncImpl
import com.lithic.api.services.async.AccountHolderServiceAsync
import com.lithic.api.services.async.AccountHolderServiceAsyncImpl
import com.lithic.api.services.async.AccountServiceAsync
@@ -207,6 +209,10 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl
NetworkProgramServiceAsyncImpl(clientOptionsWithUserAgent)
}
+ private val accountActivity: AccountActivityServiceAsync by lazy {
+ AccountActivityServiceAsyncImpl(clientOptionsWithUserAgent)
+ }
+
override fun sync(): LithicClient = sync
override fun withRawResponse(): LithicClientAsync.WithRawResponse = withRawResponse
@@ -273,6 +279,8 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl
override fun networkPrograms(): NetworkProgramServiceAsync = networkPrograms
+ override fun accountActivity(): AccountActivityServiceAsync = accountActivity
+
override fun apiStatus(
params: ClientApiStatusParams,
requestOptions: RequestOptions,
@@ -401,6 +409,10 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl
NetworkProgramServiceAsyncImpl.WithRawResponseImpl(clientOptions)
}
+ private val accountActivity: AccountActivityServiceAsync.WithRawResponse by lazy {
+ AccountActivityServiceAsyncImpl.WithRawResponseImpl(clientOptions)
+ }
+
override fun withOptions(
modifier: Consumer
): LithicClientAsync.WithRawResponse =
@@ -472,6 +484,9 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl
override fun networkPrograms(): NetworkProgramServiceAsync.WithRawResponse = networkPrograms
+ override fun accountActivity(): AccountActivityServiceAsync.WithRawResponse =
+ accountActivity
+
private val apiStatusHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientImpl.kt
index 28a889f85..3be6e93bf 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientImpl.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientImpl.kt
@@ -17,6 +17,8 @@ import com.lithic.api.core.http.parseable
import com.lithic.api.core.prepare
import com.lithic.api.models.ApiStatus
import com.lithic.api.models.ClientApiStatusParams
+import com.lithic.api.services.blocking.AccountActivityService
+import com.lithic.api.services.blocking.AccountActivityServiceImpl
import com.lithic.api.services.blocking.AccountHolderService
import com.lithic.api.services.blocking.AccountHolderServiceImpl
import com.lithic.api.services.blocking.AccountService
@@ -190,6 +192,10 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient
NetworkProgramServiceImpl(clientOptionsWithUserAgent)
}
+ private val accountActivity: AccountActivityService by lazy {
+ AccountActivityServiceImpl(clientOptionsWithUserAgent)
+ }
+
override fun async(): LithicClientAsync = async
override fun withRawResponse(): LithicClient.WithRawResponse = withRawResponse
@@ -255,6 +261,8 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient
override fun networkPrograms(): NetworkProgramService = networkPrograms
+ override fun accountActivity(): AccountActivityService = accountActivity
+
override fun apiStatus(
params: ClientApiStatusParams,
requestOptions: RequestOptions,
@@ -383,6 +391,10 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient
NetworkProgramServiceImpl.WithRawResponseImpl(clientOptions)
}
+ private val accountActivity: AccountActivityService.WithRawResponse by lazy {
+ AccountActivityServiceImpl.WithRawResponseImpl(clientOptions)
+ }
+
override fun withOptions(
modifier: Consumer
): LithicClient.WithRawResponse =
@@ -453,6 +465,8 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient
override fun networkPrograms(): NetworkProgramService.WithRawResponse = networkPrograms
+ override fun accountActivity(): AccountActivityService.WithRawResponse = accountActivity
+
private val apiStatusHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPage.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPage.kt
new file mode 100644
index 000000000..3f32e1ddd
--- /dev/null
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPage.kt
@@ -0,0 +1,210 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.lithic.api.models
+
+import com.lithic.api.core.AutoPager
+import com.lithic.api.core.Page
+import com.lithic.api.core.checkRequired
+import com.lithic.api.services.blocking.AccountActivityService
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** @see AccountActivityService.list */
+class AccountActivityListPage
+private constructor(
+ private val service: AccountActivityService,
+ private val params: AccountActivityListParams,
+ private val response: AccountActivityListPageResponse,
+) : Page {
+
+ /**
+ * Delegates to [AccountActivityListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountActivityListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [AccountActivityListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountActivityListPageResponse.hasMore
+ */
+ fun hasMore(): Optional = response._hasMore().getOptional("has_more")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty()
+
+ fun nextPageParams(): AccountActivityListParams =
+ if (params.endingBefore().isPresent) {
+ params
+ .toBuilder()
+ .endingBefore(
+ items()
+ .first()
+ .accept(
+ object : AccountActivityListResponse.Visitor> {
+ override fun visitFinancialTransaction(
+ financialTransaction:
+ AccountActivityListResponse.FinancialTransaction
+ ): Optional =
+ financialTransaction._token().getOptional("token")
+
+ override fun visitBookTransferTransaction(
+ bookTransferTransaction:
+ AccountActivityListResponse.BookTransferTransaction
+ ): Optional =
+ bookTransferTransaction._token().getOptional("token")
+
+ override fun visitCardTransaction(
+ cardTransaction: AccountActivityListResponse.CardTransaction
+ ): Optional = cardTransaction._token().getOptional("token")
+
+ override fun visitPaymentTransaction(
+ paymentTransaction:
+ AccountActivityListResponse.PaymentTransaction
+ ): Optional =
+ paymentTransaction._token().getOptional("token")
+
+ override fun visitExternalPayment(
+ externalPayment: ExternalPayment
+ ): Optional = externalPayment._token().getOptional("token")
+
+ override fun visitManagementOperationTransaction(
+ managementOperationTransaction: ManagementOperationTransaction
+ ): Optional =
+ managementOperationTransaction._token().getOptional("token")
+ }
+ )
+ )
+ .build()
+ } else {
+ params
+ .toBuilder()
+ .startingAfter(
+ items()
+ .last()
+ .accept(
+ object : AccountActivityListResponse.Visitor> {
+ override fun visitFinancialTransaction(
+ financialTransaction:
+ AccountActivityListResponse.FinancialTransaction
+ ): Optional =
+ financialTransaction._token().getOptional("token")
+
+ override fun visitBookTransferTransaction(
+ bookTransferTransaction:
+ AccountActivityListResponse.BookTransferTransaction
+ ): Optional =
+ bookTransferTransaction._token().getOptional("token")
+
+ override fun visitCardTransaction(
+ cardTransaction: AccountActivityListResponse.CardTransaction
+ ): Optional = cardTransaction._token().getOptional("token")
+
+ override fun visitPaymentTransaction(
+ paymentTransaction:
+ AccountActivityListResponse.PaymentTransaction
+ ): Optional =
+ paymentTransaction._token().getOptional("token")
+
+ override fun visitExternalPayment(
+ externalPayment: ExternalPayment
+ ): Optional = externalPayment._token().getOptional("token")
+
+ override fun visitManagementOperationTransaction(
+ managementOperationTransaction: ManagementOperationTransaction
+ ): Optional =
+ managementOperationTransaction._token().getOptional("token")
+ }
+ )
+ )
+ .build()
+ }
+
+ override fun nextPage(): AccountActivityListPage = service.list(nextPageParams())
+
+ fun autoPager(): AutoPager = AutoPager.from(this)
+
+ /** The parameters that were used to request this page. */
+ fun params(): AccountActivityListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): AccountActivityListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [AccountActivityListPage].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AccountActivityListPage]. */
+ class Builder internal constructor() {
+
+ private var service: AccountActivityService? = null
+ private var params: AccountActivityListParams? = null
+ private var response: AccountActivityListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(accountActivityListPage: AccountActivityListPage) = apply {
+ service = accountActivityListPage.service
+ params = accountActivityListPage.params
+ response = accountActivityListPage.response
+ }
+
+ fun service(service: AccountActivityService) = apply { this.service = service }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: AccountActivityListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: AccountActivityListPageResponse) = apply { this.response = response }
+
+ /**
+ * Returns an immutable instance of [AccountActivityListPage].
+ *
+ * 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(): AccountActivityListPage =
+ AccountActivityListPage(
+ checkRequired("service", service),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is AccountActivityListPage && service == other.service && params == other.params && response == other.response /* spotless:on */
+ }
+
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */
+
+ override fun toString() =
+ "AccountActivityListPage{service=$service, params=$params, response=$response}"
+}
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPageAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPageAsync.kt
new file mode 100644
index 000000000..e80c694b0
--- /dev/null
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPageAsync.kt
@@ -0,0 +1,224 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.lithic.api.models
+
+import com.lithic.api.core.AutoPagerAsync
+import com.lithic.api.core.PageAsync
+import com.lithic.api.core.checkRequired
+import com.lithic.api.services.async.AccountActivityServiceAsync
+import java.util.Objects
+import java.util.Optional
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.Executor
+import kotlin.jvm.optionals.getOrNull
+
+/** @see AccountActivityServiceAsync.list */
+class AccountActivityListPageAsync
+private constructor(
+ private val service: AccountActivityServiceAsync,
+ private val streamHandlerExecutor: Executor,
+ private val params: AccountActivityListParams,
+ private val response: AccountActivityListPageResponse,
+) : PageAsync {
+
+ /**
+ * Delegates to [AccountActivityListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountActivityListPageResponse.data
+ */
+ fun data(): List =
+ response._data().getOptional("data").getOrNull() ?: emptyList()
+
+ /**
+ * Delegates to [AccountActivityListPageResponse], but gracefully handles missing data.
+ *
+ * @see AccountActivityListPageResponse.hasMore
+ */
+ fun hasMore(): Optional = response._hasMore().getOptional("has_more")
+
+ override fun items(): List = data()
+
+ override fun hasNextPage(): Boolean = items().isNotEmpty()
+
+ fun nextPageParams(): AccountActivityListParams =
+ if (params.endingBefore().isPresent) {
+ params
+ .toBuilder()
+ .endingBefore(
+ items()
+ .first()
+ .accept(
+ object : AccountActivityListResponse.Visitor> {
+ override fun visitFinancialTransaction(
+ financialTransaction:
+ AccountActivityListResponse.FinancialTransaction
+ ): Optional =
+ financialTransaction._token().getOptional("token")
+
+ override fun visitBookTransferTransaction(
+ bookTransferTransaction:
+ AccountActivityListResponse.BookTransferTransaction
+ ): Optional =
+ bookTransferTransaction._token().getOptional("token")
+
+ override fun visitCardTransaction(
+ cardTransaction: AccountActivityListResponse.CardTransaction
+ ): Optional = cardTransaction._token().getOptional("token")
+
+ override fun visitPaymentTransaction(
+ paymentTransaction:
+ AccountActivityListResponse.PaymentTransaction
+ ): Optional =
+ paymentTransaction._token().getOptional("token")
+
+ override fun visitExternalPayment(
+ externalPayment: ExternalPayment
+ ): Optional = externalPayment._token().getOptional("token")
+
+ override fun visitManagementOperationTransaction(
+ managementOperationTransaction: ManagementOperationTransaction
+ ): Optional =
+ managementOperationTransaction._token().getOptional("token")
+ }
+ )
+ )
+ .build()
+ } else {
+ params
+ .toBuilder()
+ .startingAfter(
+ items()
+ .last()
+ .accept(
+ object : AccountActivityListResponse.Visitor> {
+ override fun visitFinancialTransaction(
+ financialTransaction:
+ AccountActivityListResponse.FinancialTransaction
+ ): Optional =
+ financialTransaction._token().getOptional("token")
+
+ override fun visitBookTransferTransaction(
+ bookTransferTransaction:
+ AccountActivityListResponse.BookTransferTransaction
+ ): Optional =
+ bookTransferTransaction._token().getOptional("token")
+
+ override fun visitCardTransaction(
+ cardTransaction: AccountActivityListResponse.CardTransaction
+ ): Optional = cardTransaction._token().getOptional("token")
+
+ override fun visitPaymentTransaction(
+ paymentTransaction:
+ AccountActivityListResponse.PaymentTransaction
+ ): Optional =
+ paymentTransaction._token().getOptional("token")
+
+ override fun visitExternalPayment(
+ externalPayment: ExternalPayment
+ ): Optional = externalPayment._token().getOptional("token")
+
+ override fun visitManagementOperationTransaction(
+ managementOperationTransaction: ManagementOperationTransaction
+ ): Optional =
+ managementOperationTransaction._token().getOptional("token")
+ }
+ )
+ )
+ .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(): AccountActivityListParams = params
+
+ /** The response that this page was parsed from. */
+ fun response(): AccountActivityListPageResponse = response
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [AccountActivityListPageAsync].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .streamHandlerExecutor()
+ * .params()
+ * .response()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AccountActivityListPageAsync]. */
+ class Builder internal constructor() {
+
+ private var service: AccountActivityServiceAsync? = null
+ private var streamHandlerExecutor: Executor? = null
+ private var params: AccountActivityListParams? = null
+ private var response: AccountActivityListPageResponse? = null
+
+ @JvmSynthetic
+ internal fun from(accountActivityListPageAsync: AccountActivityListPageAsync) = apply {
+ service = accountActivityListPageAsync.service
+ streamHandlerExecutor = accountActivityListPageAsync.streamHandlerExecutor
+ params = accountActivityListPageAsync.params
+ response = accountActivityListPageAsync.response
+ }
+
+ fun service(service: AccountActivityServiceAsync) = apply { this.service = service }
+
+ fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
+ this.streamHandlerExecutor = streamHandlerExecutor
+ }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: AccountActivityListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun response(response: AccountActivityListPageResponse) = apply { this.response = response }
+
+ /**
+ * Returns an immutable instance of [AccountActivityListPageAsync].
+ *
+ * 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(): AccountActivityListPageAsync =
+ AccountActivityListPageAsync(
+ checkRequired("service", service),
+ checkRequired("streamHandlerExecutor", streamHandlerExecutor),
+ checkRequired("params", params),
+ checkRequired("response", response),
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is AccountActivityListPageAsync && service == other.service && streamHandlerExecutor == other.streamHandlerExecutor && params == other.params && response == other.response /* spotless:on */
+ }
+
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, streamHandlerExecutor, params, response) /* spotless:on */
+
+ override fun toString() =
+ "AccountActivityListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}"
+}
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPageResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPageResponse.kt
new file mode 100644
index 000000000..0f72a8019
--- /dev/null
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPageResponse.kt
@@ -0,0 +1,264 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.lithic.api.models
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter
+import com.fasterxml.jackson.annotation.JsonAnySetter
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.annotation.JsonProperty
+import com.lithic.api.core.ExcludeMissing
+import com.lithic.api.core.JsonField
+import com.lithic.api.core.JsonMissing
+import com.lithic.api.core.JsonValue
+import com.lithic.api.core.checkKnown
+import com.lithic.api.core.toImmutable
+import com.lithic.api.errors.LithicInvalidDataException
+import java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** A response containing a list of transactions */
+class AccountActivityListPageResponse
+private constructor(
+ private val data: JsonField>,
+ private val hasMore: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("data")
+ @ExcludeMissing
+ data: JsonField> = JsonMissing.of(),
+ @JsonProperty("has_more") @ExcludeMissing hasMore: JsonField = JsonMissing.of(),
+ ) : this(data, hasMore, mutableMapOf())
+
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun data(): Optional> = data.getOptional("data")
+
+ /**
+ * Indicates if there are more transactions available for pagination
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun hasMore(): Optional = hasMore.getOptional("has_more")
+
+ /**
+ * Returns the raw JSON value of [data].
+ *
+ * Unlike [data], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("data")
+ @ExcludeMissing
+ fun _data(): JsonField> = data
+
+ /**
+ * Returns the raw JSON value of [hasMore].
+ *
+ * Unlike [hasMore], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("has_more") @ExcludeMissing fun _hasMore(): JsonField = hasMore
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [AccountActivityListPageResponse].
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AccountActivityListPageResponse]. */
+ class Builder internal constructor() {
+
+ private var data: JsonField>? = null
+ private var hasMore: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(accountActivityListPageResponse: AccountActivityListPageResponse) =
+ apply {
+ data = accountActivityListPageResponse.data.map { it.toMutableList() }
+ hasMore = accountActivityListPageResponse.hasMore
+ additionalProperties =
+ accountActivityListPageResponse.additionalProperties.toMutableMap()
+ }
+
+ fun data(data: List) = data(JsonField.of(data))
+
+ /**
+ * Sets [Builder.data] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.data] with a well-typed
+ * `List` value instead. This method is primarily for setting
+ * the field to an undocumented or not yet supported value.
+ */
+ fun data(data: JsonField>) = apply {
+ this.data = data.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [AccountActivityListResponse] to [Builder.data].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addData(data: AccountActivityListResponse) = apply {
+ this.data =
+ (this.data ?: JsonField.of(mutableListOf())).also {
+ checkKnown("data", it).add(data)
+ }
+ }
+
+ /**
+ * Alias for calling [addData] with
+ * `AccountActivityListResponse.ofFinancialTransaction(financialTransaction)`.
+ */
+ fun addData(financialTransaction: AccountActivityListResponse.FinancialTransaction) =
+ addData(AccountActivityListResponse.ofFinancialTransaction(financialTransaction))
+
+ /**
+ * Alias for calling [addData] with
+ * `AccountActivityListResponse.ofBookTransferTransaction(bookTransferTransaction)`.
+ */
+ fun addData(bookTransferTransaction: AccountActivityListResponse.BookTransferTransaction) =
+ addData(AccountActivityListResponse.ofBookTransferTransaction(bookTransferTransaction))
+
+ /**
+ * Alias for calling [addData] with
+ * `AccountActivityListResponse.ofCardTransaction(cardTransaction)`.
+ */
+ fun addData(cardTransaction: AccountActivityListResponse.CardTransaction) =
+ addData(AccountActivityListResponse.ofCardTransaction(cardTransaction))
+
+ /**
+ * Alias for calling [addData] with
+ * `AccountActivityListResponse.ofPaymentTransaction(paymentTransaction)`.
+ */
+ fun addData(paymentTransaction: AccountActivityListResponse.PaymentTransaction) =
+ addData(AccountActivityListResponse.ofPaymentTransaction(paymentTransaction))
+
+ /**
+ * Alias for calling [addData] with
+ * `AccountActivityListResponse.ofExternalPayment(externalPayment)`.
+ */
+ fun addData(externalPayment: ExternalPayment) =
+ addData(AccountActivityListResponse.ofExternalPayment(externalPayment))
+
+ /**
+ * Alias for calling [addData] with
+ * `AccountActivityListResponse.ofManagementOperationTransaction(managementOperationTransaction)`.
+ */
+ fun addData(managementOperationTransaction: ManagementOperationTransaction) =
+ addData(
+ AccountActivityListResponse.ofManagementOperationTransaction(
+ managementOperationTransaction
+ )
+ )
+
+ /** Indicates if there are more transactions available for pagination */
+ fun hasMore(hasMore: Boolean) = hasMore(JsonField.of(hasMore))
+
+ /**
+ * Sets [Builder.hasMore] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.hasMore] with a well-typed [Boolean] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun hasMore(hasMore: JsonField) = apply { this.hasMore = hasMore }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [AccountActivityListPageResponse].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): AccountActivityListPageResponse =
+ AccountActivityListPageResponse(
+ (data ?: JsonMissing.of()).map { it.toImmutable() },
+ hasMore,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): AccountActivityListPageResponse = apply {
+ if (validated) {
+ return@apply
+ }
+
+ data().ifPresent { it.forEach { it.validate() } }
+ hasMore()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (data.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (if (hasMore.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is AccountActivityListPageResponse && data == other.data && hasMore == other.hasMore && additionalProperties == other.additionalProperties /* spotless:on */
+ }
+
+ /* spotless:off */
+ private val hashCode: Int by lazy { Objects.hash(data, hasMore, additionalProperties) }
+ /* spotless:on */
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "AccountActivityListPageResponse{data=$data, hasMore=$hasMore, additionalProperties=$additionalProperties}"
+}
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt
new file mode 100644
index 000000000..0cf2ccc86
--- /dev/null
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt
@@ -0,0 +1,866 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.lithic.api.models
+
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.lithic.api.core.Enum
+import com.lithic.api.core.JsonField
+import com.lithic.api.core.Params
+import com.lithic.api.core.http.Headers
+import com.lithic.api.core.http.QueryParams
+import com.lithic.api.core.toImmutable
+import com.lithic.api.errors.LithicInvalidDataException
+import java.time.OffsetDateTime
+import java.time.format.DateTimeFormatter
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** Retrieve a list of transactions across all public accounts. */
+class AccountActivityListParams
+private constructor(
+ private val begin: OffsetDateTime?,
+ private val businessAccountToken: String?,
+ private val category: TransactionCategory?,
+ private val end: OffsetDateTime?,
+ private val endingBefore: String?,
+ private val financialAccountToken: String?,
+ private val pageSize: Long?,
+ private val result: List?,
+ private val startingAfter: String?,
+ private val status: List?,
+ private val additionalHeaders: Headers,
+ private val additionalQueryParams: QueryParams,
+) : Params {
+
+ /**
+ * Date string in RFC 3339 format. Only entries created after the specified time will be
+ * included. UTC time zone.
+ */
+ fun begin(): Optional = Optional.ofNullable(begin)
+
+ /** Filter by business account token */
+ fun businessAccountToken(): Optional = Optional.ofNullable(businessAccountToken)
+
+ /** Filter by transaction category */
+ fun category(): Optional = Optional.ofNullable(category)
+
+ /**
+ * Date string in RFC 3339 format. Only entries created before the specified time will be
+ * included. UTC time zone.
+ */
+ fun end(): Optional = Optional.ofNullable(end)
+
+ /**
+ * A cursor representing an item's token before which a page of results should end. Used to
+ * retrieve the previous page of results before this item.
+ */
+ fun endingBefore(): Optional = Optional.ofNullable(endingBefore)
+
+ /** Filter by financial account token */
+ fun financialAccountToken(): Optional = Optional.ofNullable(financialAccountToken)
+
+ /** Page size (for pagination). */
+ fun pageSize(): Optional = Optional.ofNullable(pageSize)
+
+ /** Filter by transaction result */
+ fun result(): Optional> = Optional.ofNullable(result)
+
+ /**
+ * A cursor representing an item's token after which a page of results should begin. Used to
+ * retrieve the next page of results after this item.
+ */
+ fun startingAfter(): Optional = Optional.ofNullable(startingAfter)
+
+ /** Filter by transaction status */
+ fun status(): Optional> = Optional.ofNullable(status)
+
+ /** Additional headers to send with the request. */
+ fun _additionalHeaders(): Headers = additionalHeaders
+
+ /** Additional query param to send with the request. */
+ fun _additionalQueryParams(): QueryParams = additionalQueryParams
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ @JvmStatic fun none(): AccountActivityListParams = builder().build()
+
+ /**
+ * Returns a mutable builder for constructing an instance of [AccountActivityListParams].
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AccountActivityListParams]. */
+ class Builder internal constructor() {
+
+ private var begin: OffsetDateTime? = null
+ private var businessAccountToken: String? = null
+ private var category: TransactionCategory? = null
+ private var end: OffsetDateTime? = null
+ private var endingBefore: String? = null
+ private var financialAccountToken: String? = null
+ private var pageSize: Long? = null
+ private var result: MutableList? = null
+ private var startingAfter: String? = null
+ private var status: MutableList? = null
+ private var additionalHeaders: Headers.Builder = Headers.builder()
+ private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
+
+ @JvmSynthetic
+ internal fun from(accountActivityListParams: AccountActivityListParams) = apply {
+ begin = accountActivityListParams.begin
+ businessAccountToken = accountActivityListParams.businessAccountToken
+ category = accountActivityListParams.category
+ end = accountActivityListParams.end
+ endingBefore = accountActivityListParams.endingBefore
+ financialAccountToken = accountActivityListParams.financialAccountToken
+ pageSize = accountActivityListParams.pageSize
+ result = accountActivityListParams.result?.toMutableList()
+ startingAfter = accountActivityListParams.startingAfter
+ status = accountActivityListParams.status?.toMutableList()
+ additionalHeaders = accountActivityListParams.additionalHeaders.toBuilder()
+ additionalQueryParams = accountActivityListParams.additionalQueryParams.toBuilder()
+ }
+
+ /**
+ * Date string in RFC 3339 format. Only entries created after the specified time will be
+ * included. UTC time zone.
+ */
+ fun begin(begin: OffsetDateTime?) = apply { this.begin = begin }
+
+ /** Alias for calling [Builder.begin] with `begin.orElse(null)`. */
+ fun begin(begin: Optional) = begin(begin.getOrNull())
+
+ /** Filter by business account token */
+ fun businessAccountToken(businessAccountToken: String?) = apply {
+ this.businessAccountToken = businessAccountToken
+ }
+
+ /**
+ * Alias for calling [Builder.businessAccountToken] with
+ * `businessAccountToken.orElse(null)`.
+ */
+ fun businessAccountToken(businessAccountToken: Optional) =
+ businessAccountToken(businessAccountToken.getOrNull())
+
+ /** Filter by transaction category */
+ fun category(category: TransactionCategory?) = apply { this.category = category }
+
+ /** Alias for calling [Builder.category] with `category.orElse(null)`. */
+ fun category(category: Optional) = category(category.getOrNull())
+
+ /**
+ * Date string in RFC 3339 format. Only entries created before the specified time will be
+ * included. UTC time zone.
+ */
+ fun end(end: OffsetDateTime?) = apply { this.end = end }
+
+ /** Alias for calling [Builder.end] with `end.orElse(null)`. */
+ fun end(end: Optional) = end(end.getOrNull())
+
+ /**
+ * A cursor representing an item's token before which a page of results should end. Used to
+ * retrieve the previous page of results before this item.
+ */
+ fun endingBefore(endingBefore: String?) = apply { this.endingBefore = endingBefore }
+
+ /** Alias for calling [Builder.endingBefore] with `endingBefore.orElse(null)`. */
+ fun endingBefore(endingBefore: Optional) = endingBefore(endingBefore.getOrNull())
+
+ /** Filter by financial account token */
+ fun financialAccountToken(financialAccountToken: String?) = apply {
+ this.financialAccountToken = financialAccountToken
+ }
+
+ /**
+ * Alias for calling [Builder.financialAccountToken] with
+ * `financialAccountToken.orElse(null)`.
+ */
+ fun financialAccountToken(financialAccountToken: Optional) =
+ financialAccountToken(financialAccountToken.getOrNull())
+
+ /** Page size (for pagination). */
+ fun pageSize(pageSize: Long?) = apply { this.pageSize = pageSize }
+
+ /**
+ * Alias for [Builder.pageSize].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun pageSize(pageSize: Long) = pageSize(pageSize as Long?)
+
+ /** Alias for calling [Builder.pageSize] with `pageSize.orElse(null)`. */
+ fun pageSize(pageSize: Optional) = pageSize(pageSize.getOrNull())
+
+ /** Filter by transaction result */
+ fun result(result: List?) = apply { this.result = result?.toMutableList() }
+
+ /** Alias for calling [Builder.result] with `result.orElse(null)`. */
+ fun result(result: Optional>) = result(result.getOrNull())
+
+ /**
+ * Adds a single [Result] to [Builder.result].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addResult(result: Result) = apply {
+ this.result = (this.result ?: mutableListOf()).apply { add(result) }
+ }
+
+ /**
+ * A cursor representing an item's token after which a page of results should begin. Used to
+ * retrieve the next page of results after this item.
+ */
+ fun startingAfter(startingAfter: String?) = apply { this.startingAfter = startingAfter }
+
+ /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */
+ fun startingAfter(startingAfter: Optional) =
+ startingAfter(startingAfter.getOrNull())
+
+ /** Filter by transaction status */
+ fun status(status: List?) = apply { this.status = status?.toMutableList() }
+
+ /** Alias for calling [Builder.status] with `status.orElse(null)`. */
+ fun status(status: Optional>) = status(status.getOrNull())
+
+ /**
+ * Adds a single [Status] to [Builder.status].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addStatus(status: Status) = apply {
+ this.status = (this.status ?: mutableListOf()).apply { add(status) }
+ }
+
+ fun additionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.clear()
+ putAllAdditionalHeaders(additionalHeaders)
+ }
+
+ fun additionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.clear()
+ putAllAdditionalHeaders(additionalHeaders)
+ }
+
+ fun putAdditionalHeader(name: String, value: String) = apply {
+ additionalHeaders.put(name, value)
+ }
+
+ fun putAdditionalHeaders(name: String, values: Iterable) = apply {
+ additionalHeaders.put(name, values)
+ }
+
+ fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.putAll(additionalHeaders)
+ }
+
+ fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.putAll(additionalHeaders)
+ }
+
+ fun replaceAdditionalHeaders(name: String, value: String) = apply {
+ additionalHeaders.replace(name, value)
+ }
+
+ fun replaceAdditionalHeaders(name: String, values: Iterable) = apply {
+ additionalHeaders.replace(name, values)
+ }
+
+ fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.replaceAll(additionalHeaders)
+ }
+
+ fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.replaceAll(additionalHeaders)
+ }
+
+ fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
+
+ fun removeAllAdditionalHeaders(names: Set) = apply {
+ additionalHeaders.removeAll(names)
+ }
+
+ fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.clear()
+ putAllAdditionalQueryParams(additionalQueryParams)
+ }
+
+ fun additionalQueryParams(additionalQueryParams: Map>) = apply {
+ this.additionalQueryParams.clear()
+ putAllAdditionalQueryParams(additionalQueryParams)
+ }
+
+ fun putAdditionalQueryParam(key: String, value: String) = apply {
+ additionalQueryParams.put(key, value)
+ }
+
+ fun putAdditionalQueryParams(key: String, values: Iterable) = apply {
+ additionalQueryParams.put(key, values)
+ }
+
+ fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.putAll(additionalQueryParams)
+ }
+
+ fun putAllAdditionalQueryParams(additionalQueryParams: Map>) =
+ apply {
+ this.additionalQueryParams.putAll(additionalQueryParams)
+ }
+
+ fun replaceAdditionalQueryParams(key: String, value: String) = apply {
+ additionalQueryParams.replace(key, value)
+ }
+
+ fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply {
+ additionalQueryParams.replace(key, values)
+ }
+
+ fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.replaceAll(additionalQueryParams)
+ }
+
+ fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) =
+ apply {
+ this.additionalQueryParams.replaceAll(additionalQueryParams)
+ }
+
+ fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }
+
+ fun removeAllAdditionalQueryParams(keys: Set) = apply {
+ additionalQueryParams.removeAll(keys)
+ }
+
+ /**
+ * Returns an immutable instance of [AccountActivityListParams].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): AccountActivityListParams =
+ AccountActivityListParams(
+ begin,
+ businessAccountToken,
+ category,
+ end,
+ endingBefore,
+ financialAccountToken,
+ pageSize,
+ result?.toImmutable(),
+ startingAfter,
+ status?.toImmutable(),
+ additionalHeaders.build(),
+ additionalQueryParams.build(),
+ )
+ }
+
+ override fun _headers(): Headers = additionalHeaders
+
+ override fun _queryParams(): QueryParams =
+ QueryParams.builder()
+ .apply {
+ begin?.let { put("begin", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) }
+ businessAccountToken?.let { put("business_account_token", it) }
+ category?.let { put("category", it.toString()) }
+ end?.let { put("end", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) }
+ endingBefore?.let { put("ending_before", it) }
+ financialAccountToken?.let { put("financial_account_token", it) }
+ pageSize?.let { put("page_size", it.toString()) }
+ result?.let { put("result", it.joinToString(",") { it.toString() }) }
+ startingAfter?.let { put("starting_after", it) }
+ status?.let { put("status", it.joinToString(",") { it.toString() }) }
+ putAll(additionalQueryParams)
+ }
+ .build()
+
+ /** Filter by transaction category */
+ class TransactionCategory
+ @JsonCreator
+ private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ @JvmField val ACH = of("ACH")
+
+ @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING")
+
+ @JvmField val CARD = of("CARD")
+
+ @JvmField val EXTERNAL_ACH = of("EXTERNAL_ACH")
+
+ @JvmField val EXTERNAL_CHECK = of("EXTERNAL_CHECK")
+
+ @JvmField val EXTERNAL_TRANSFER = of("EXTERNAL_TRANSFER")
+
+ @JvmField val EXTERNAL_WIRE = of("EXTERNAL_WIRE")
+
+ @JvmField val MANAGEMENT_ADJUSTMENT = of("MANAGEMENT_ADJUSTMENT")
+
+ @JvmField val MANAGEMENT_DISPUTE = of("MANAGEMENT_DISPUTE")
+
+ @JvmField val MANAGEMENT_FEE = of("MANAGEMENT_FEE")
+
+ @JvmField val MANAGEMENT_REWARD = of("MANAGEMENT_REWARD")
+
+ @JvmField val MANAGEMENT_DISBURSEMENT = of("MANAGEMENT_DISBURSEMENT")
+
+ @JvmField val PROGRAM_FUNDING = of("PROGRAM_FUNDING")
+
+ @JvmStatic fun of(value: String) = TransactionCategory(JsonField.of(value))
+ }
+
+ /** An enum containing [TransactionCategory]'s known values. */
+ enum class Known {
+ ACH,
+ BALANCE_OR_FUNDING,
+ CARD,
+ EXTERNAL_ACH,
+ EXTERNAL_CHECK,
+ EXTERNAL_TRANSFER,
+ EXTERNAL_WIRE,
+ MANAGEMENT_ADJUSTMENT,
+ MANAGEMENT_DISPUTE,
+ MANAGEMENT_FEE,
+ MANAGEMENT_REWARD,
+ MANAGEMENT_DISBURSEMENT,
+ PROGRAM_FUNDING,
+ }
+
+ /**
+ * An enum containing [TransactionCategory]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [TransactionCategory] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ ACH,
+ BALANCE_OR_FUNDING,
+ CARD,
+ EXTERNAL_ACH,
+ EXTERNAL_CHECK,
+ EXTERNAL_TRANSFER,
+ EXTERNAL_WIRE,
+ MANAGEMENT_ADJUSTMENT,
+ MANAGEMENT_DISPUTE,
+ MANAGEMENT_FEE,
+ MANAGEMENT_REWARD,
+ MANAGEMENT_DISBURSEMENT,
+ PROGRAM_FUNDING,
+ /**
+ * An enum member indicating that [TransactionCategory] was instantiated with an unknown
+ * value.
+ */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ ACH -> Value.ACH
+ BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING
+ CARD -> Value.CARD
+ EXTERNAL_ACH -> Value.EXTERNAL_ACH
+ EXTERNAL_CHECK -> Value.EXTERNAL_CHECK
+ EXTERNAL_TRANSFER -> Value.EXTERNAL_TRANSFER
+ EXTERNAL_WIRE -> Value.EXTERNAL_WIRE
+ MANAGEMENT_ADJUSTMENT -> Value.MANAGEMENT_ADJUSTMENT
+ MANAGEMENT_DISPUTE -> Value.MANAGEMENT_DISPUTE
+ MANAGEMENT_FEE -> Value.MANAGEMENT_FEE
+ MANAGEMENT_REWARD -> Value.MANAGEMENT_REWARD
+ MANAGEMENT_DISBURSEMENT -> Value.MANAGEMENT_DISBURSEMENT
+ PROGRAM_FUNDING -> Value.PROGRAM_FUNDING
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws LithicInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ ACH -> Known.ACH
+ BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING
+ CARD -> Known.CARD
+ EXTERNAL_ACH -> Known.EXTERNAL_ACH
+ EXTERNAL_CHECK -> Known.EXTERNAL_CHECK
+ EXTERNAL_TRANSFER -> Known.EXTERNAL_TRANSFER
+ EXTERNAL_WIRE -> Known.EXTERNAL_WIRE
+ MANAGEMENT_ADJUSTMENT -> Known.MANAGEMENT_ADJUSTMENT
+ MANAGEMENT_DISPUTE -> Known.MANAGEMENT_DISPUTE
+ MANAGEMENT_FEE -> Known.MANAGEMENT_FEE
+ MANAGEMENT_REWARD -> Known.MANAGEMENT_REWARD
+ MANAGEMENT_DISBURSEMENT -> Known.MANAGEMENT_DISBURSEMENT
+ PROGRAM_FUNDING -> Known.PROGRAM_FUNDING
+ else -> throw LithicInvalidDataException("Unknown TransactionCategory: $value")
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for debugging
+ * and generally doesn't throw.
+ *
+ * @throws LithicInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") }
+
+ private var validated: Boolean = false
+
+ fun validate(): TransactionCategory = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is TransactionCategory && value == other.value /* spotless:on */
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ class Result @JsonCreator private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ @JvmField val APPROVED = of("APPROVED")
+
+ @JvmField val DECLINED = of("DECLINED")
+
+ @JvmStatic fun of(value: String) = Result(JsonField.of(value))
+ }
+
+ /** An enum containing [Result]'s known values. */
+ enum class Known {
+ APPROVED,
+ DECLINED,
+ }
+
+ /**
+ * An enum containing [Result]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Result] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ APPROVED,
+ DECLINED,
+ /** An enum member indicating that [Result] was instantiated with an unknown value. */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ APPROVED -> Value.APPROVED
+ DECLINED -> Value.DECLINED
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws LithicInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ APPROVED -> Known.APPROVED
+ DECLINED -> Known.DECLINED
+ else -> throw LithicInvalidDataException("Unknown Result: $value")
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for debugging
+ * and generally doesn't throw.
+ *
+ * @throws LithicInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") }
+
+ private var validated: Boolean = false
+
+ fun validate(): Result = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is Result && value == other.value /* spotless:on */
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ class Status @JsonCreator private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ @JvmField val DECLINED = of("DECLINED")
+
+ @JvmField val EXPIRED = of("EXPIRED")
+
+ @JvmField val PENDING = of("PENDING")
+
+ @JvmField val SETTLED = of("SETTLED")
+
+ @JvmField val VOIDED = of("VOIDED")
+
+ @JvmField val RETURNED = of("RETURNED")
+
+ @JvmField val REVERSED = of("REVERSED")
+
+ @JvmStatic fun of(value: String) = Status(JsonField.of(value))
+ }
+
+ /** An enum containing [Status]'s known values. */
+ enum class Known {
+ DECLINED,
+ EXPIRED,
+ PENDING,
+ SETTLED,
+ VOIDED,
+ RETURNED,
+ REVERSED,
+ }
+
+ /**
+ * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Status] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ DECLINED,
+ EXPIRED,
+ PENDING,
+ SETTLED,
+ VOIDED,
+ RETURNED,
+ REVERSED,
+ /** An enum member indicating that [Status] was instantiated with an unknown value. */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ DECLINED -> Value.DECLINED
+ EXPIRED -> Value.EXPIRED
+ PENDING -> Value.PENDING
+ SETTLED -> Value.SETTLED
+ VOIDED -> Value.VOIDED
+ RETURNED -> Value.RETURNED
+ REVERSED -> Value.REVERSED
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws LithicInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ DECLINED -> Known.DECLINED
+ EXPIRED -> Known.EXPIRED
+ PENDING -> Known.PENDING
+ SETTLED -> Known.SETTLED
+ VOIDED -> Known.VOIDED
+ RETURNED -> Known.RETURNED
+ REVERSED -> Known.REVERSED
+ else -> throw LithicInvalidDataException("Unknown Status: $value")
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for debugging
+ * and generally doesn't throw.
+ *
+ * @throws LithicInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") }
+
+ private var validated: Boolean = false
+
+ fun validate(): Status = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is Status && value == other.value /* spotless:on */
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is AccountActivityListParams && begin == other.begin && businessAccountToken == other.businessAccountToken && category == other.category && end == other.end && endingBefore == other.endingBefore && financialAccountToken == other.financialAccountToken && pageSize == other.pageSize && result == other.result && startingAfter == other.startingAfter && status == other.status && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */
+ }
+
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(begin, businessAccountToken, category, end, endingBefore, financialAccountToken, pageSize, result, startingAfter, status, additionalHeaders, additionalQueryParams) /* spotless:on */
+
+ override fun toString() =
+ "AccountActivityListParams{begin=$begin, businessAccountToken=$businessAccountToken, category=$category, end=$end, endingBefore=$endingBefore, financialAccountToken=$financialAccountToken, pageSize=$pageSize, result=$result, startingAfter=$startingAfter, status=$status, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+}
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListResponse.kt
new file mode 100644
index 000000000..2f768d2ad
--- /dev/null
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListResponse.kt
@@ -0,0 +1,8893 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.lithic.api.models
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter
+import com.fasterxml.jackson.annotation.JsonAnySetter
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.annotation.JsonProperty
+import com.fasterxml.jackson.core.JsonGenerator
+import com.fasterxml.jackson.core.ObjectCodec
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.SerializerProvider
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize
+import com.fasterxml.jackson.databind.annotation.JsonSerialize
+import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
+import com.lithic.api.core.BaseDeserializer
+import com.lithic.api.core.BaseSerializer
+import com.lithic.api.core.Enum
+import com.lithic.api.core.ExcludeMissing
+import com.lithic.api.core.JsonField
+import com.lithic.api.core.JsonMissing
+import com.lithic.api.core.JsonValue
+import com.lithic.api.core.allMaxBy
+import com.lithic.api.core.checkKnown
+import com.lithic.api.core.checkRequired
+import com.lithic.api.core.getOrThrow
+import com.lithic.api.core.toImmutable
+import com.lithic.api.errors.LithicInvalidDataException
+import java.time.LocalDate
+import java.time.OffsetDateTime
+import java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** Response containing multiple transaction types */
+@JsonDeserialize(using = AccountActivityListResponse.Deserializer::class)
+@JsonSerialize(using = AccountActivityListResponse.Serializer::class)
+class AccountActivityListResponse
+private constructor(
+ private val financialTransaction: FinancialTransaction? = null,
+ private val bookTransferTransaction: BookTransferTransaction? = null,
+ private val cardTransaction: CardTransaction? = null,
+ private val paymentTransaction: PaymentTransaction? = null,
+ private val externalPayment: ExternalPayment? = null,
+ private val managementOperationTransaction: ManagementOperationTransaction? = null,
+ private val _json: JsonValue? = null,
+) {
+
+ /** Financial transaction with inheritance from unified base transaction */
+ fun financialTransaction(): Optional =
+ Optional.ofNullable(financialTransaction)
+
+ /** Book transfer transaction */
+ fun bookTransferTransaction(): Optional =
+ Optional.ofNullable(bookTransferTransaction)
+
+ /** Base class for all transaction types in the ledger service */
+ fun cardTransaction(): Optional = Optional.ofNullable(cardTransaction)
+
+ /** Payment transaction */
+ fun paymentTransaction(): Optional = Optional.ofNullable(paymentTransaction)
+
+ fun externalPayment(): Optional = Optional.ofNullable(externalPayment)
+
+ fun managementOperationTransaction(): Optional =
+ Optional.ofNullable(managementOperationTransaction)
+
+ fun isFinancialTransaction(): Boolean = financialTransaction != null
+
+ fun isBookTransferTransaction(): Boolean = bookTransferTransaction != null
+
+ fun isCardTransaction(): Boolean = cardTransaction != null
+
+ fun isPaymentTransaction(): Boolean = paymentTransaction != null
+
+ fun isExternalPayment(): Boolean = externalPayment != null
+
+ fun isManagementOperationTransaction(): Boolean = managementOperationTransaction != null
+
+ /** Financial transaction with inheritance from unified base transaction */
+ fun asFinancialTransaction(): FinancialTransaction =
+ financialTransaction.getOrThrow("financialTransaction")
+
+ /** Book transfer transaction */
+ fun asBookTransferTransaction(): BookTransferTransaction =
+ bookTransferTransaction.getOrThrow("bookTransferTransaction")
+
+ /** Base class for all transaction types in the ledger service */
+ fun asCardTransaction(): CardTransaction = cardTransaction.getOrThrow("cardTransaction")
+
+ /** Payment transaction */
+ fun asPaymentTransaction(): PaymentTransaction =
+ paymentTransaction.getOrThrow("paymentTransaction")
+
+ fun asExternalPayment(): ExternalPayment = externalPayment.getOrThrow("externalPayment")
+
+ fun asManagementOperationTransaction(): ManagementOperationTransaction =
+ managementOperationTransaction.getOrThrow("managementOperationTransaction")
+
+ fun _json(): Optional = Optional.ofNullable(_json)
+
+ fun accept(visitor: Visitor): T =
+ when {
+ financialTransaction != null -> visitor.visitFinancialTransaction(financialTransaction)
+ bookTransferTransaction != null ->
+ visitor.visitBookTransferTransaction(bookTransferTransaction)
+ cardTransaction != null -> visitor.visitCardTransaction(cardTransaction)
+ paymentTransaction != null -> visitor.visitPaymentTransaction(paymentTransaction)
+ externalPayment != null -> visitor.visitExternalPayment(externalPayment)
+ managementOperationTransaction != null ->
+ visitor.visitManagementOperationTransaction(managementOperationTransaction)
+ else -> visitor.unknown(_json)
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): AccountActivityListResponse = apply {
+ if (validated) {
+ return@apply
+ }
+
+ accept(
+ object : Visitor {
+ override fun visitFinancialTransaction(financialTransaction: FinancialTransaction) {
+ financialTransaction.validate()
+ }
+
+ override fun visitBookTransferTransaction(
+ bookTransferTransaction: BookTransferTransaction
+ ) {
+ bookTransferTransaction.validate()
+ }
+
+ override fun visitCardTransaction(cardTransaction: CardTransaction) {
+ cardTransaction.validate()
+ }
+
+ override fun visitPaymentTransaction(paymentTransaction: PaymentTransaction) {
+ paymentTransaction.validate()
+ }
+
+ override fun visitExternalPayment(externalPayment: ExternalPayment) {
+ externalPayment.validate()
+ }
+
+ override fun visitManagementOperationTransaction(
+ managementOperationTransaction: ManagementOperationTransaction
+ ) {
+ managementOperationTransaction.validate()
+ }
+ }
+ )
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ accept(
+ object : Visitor {
+ override fun visitFinancialTransaction(financialTransaction: FinancialTransaction) =
+ financialTransaction.validity()
+
+ override fun visitBookTransferTransaction(
+ bookTransferTransaction: BookTransferTransaction
+ ) = bookTransferTransaction.validity()
+
+ override fun visitCardTransaction(cardTransaction: CardTransaction) =
+ cardTransaction.validity()
+
+ override fun visitPaymentTransaction(paymentTransaction: PaymentTransaction) =
+ paymentTransaction.validity()
+
+ override fun visitExternalPayment(externalPayment: ExternalPayment) =
+ externalPayment.validity()
+
+ override fun visitManagementOperationTransaction(
+ managementOperationTransaction: ManagementOperationTransaction
+ ) = managementOperationTransaction.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is AccountActivityListResponse && financialTransaction == other.financialTransaction && bookTransferTransaction == other.bookTransferTransaction && cardTransaction == other.cardTransaction && paymentTransaction == other.paymentTransaction && externalPayment == other.externalPayment && managementOperationTransaction == other.managementOperationTransaction /* spotless:on */
+ }
+
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(financialTransaction, bookTransferTransaction, cardTransaction, paymentTransaction, externalPayment, managementOperationTransaction) /* spotless:on */
+
+ override fun toString(): String =
+ when {
+ financialTransaction != null ->
+ "AccountActivityListResponse{financialTransaction=$financialTransaction}"
+ bookTransferTransaction != null ->
+ "AccountActivityListResponse{bookTransferTransaction=$bookTransferTransaction}"
+ cardTransaction != null ->
+ "AccountActivityListResponse{cardTransaction=$cardTransaction}"
+ paymentTransaction != null ->
+ "AccountActivityListResponse{paymentTransaction=$paymentTransaction}"
+ externalPayment != null ->
+ "AccountActivityListResponse{externalPayment=$externalPayment}"
+ managementOperationTransaction != null ->
+ "AccountActivityListResponse{managementOperationTransaction=$managementOperationTransaction}"
+ _json != null -> "AccountActivityListResponse{_unknown=$_json}"
+ else -> throw IllegalStateException("Invalid AccountActivityListResponse")
+ }
+
+ companion object {
+
+ /** Financial transaction with inheritance from unified base transaction */
+ @JvmStatic
+ fun ofFinancialTransaction(financialTransaction: FinancialTransaction) =
+ AccountActivityListResponse(financialTransaction = financialTransaction)
+
+ /** Book transfer transaction */
+ @JvmStatic
+ fun ofBookTransferTransaction(bookTransferTransaction: BookTransferTransaction) =
+ AccountActivityListResponse(bookTransferTransaction = bookTransferTransaction)
+
+ /** Base class for all transaction types in the ledger service */
+ @JvmStatic
+ fun ofCardTransaction(cardTransaction: CardTransaction) =
+ AccountActivityListResponse(cardTransaction = cardTransaction)
+
+ /** Payment transaction */
+ @JvmStatic
+ fun ofPaymentTransaction(paymentTransaction: PaymentTransaction) =
+ AccountActivityListResponse(paymentTransaction = paymentTransaction)
+
+ @JvmStatic
+ fun ofExternalPayment(externalPayment: ExternalPayment) =
+ AccountActivityListResponse(externalPayment = externalPayment)
+
+ @JvmStatic
+ fun ofManagementOperationTransaction(
+ managementOperationTransaction: ManagementOperationTransaction
+ ) =
+ AccountActivityListResponse(
+ managementOperationTransaction = managementOperationTransaction
+ )
+ }
+
+ /**
+ * An interface that defines how to map each variant of [AccountActivityListResponse] to a value
+ * of type [T].
+ */
+ interface Visitor {
+
+ /** Financial transaction with inheritance from unified base transaction */
+ fun visitFinancialTransaction(financialTransaction: FinancialTransaction): T
+
+ /** Book transfer transaction */
+ fun visitBookTransferTransaction(bookTransferTransaction: BookTransferTransaction): T
+
+ /** Base class for all transaction types in the ledger service */
+ fun visitCardTransaction(cardTransaction: CardTransaction): T
+
+ /** Payment transaction */
+ fun visitPaymentTransaction(paymentTransaction: PaymentTransaction): T
+
+ fun visitExternalPayment(externalPayment: ExternalPayment): T
+
+ fun visitManagementOperationTransaction(
+ managementOperationTransaction: ManagementOperationTransaction
+ ): T
+
+ /**
+ * Maps an unknown variant of [AccountActivityListResponse] to a value of type [T].
+ *
+ * An instance of [AccountActivityListResponse] can contain an unknown variant if it was
+ * deserialized from data that doesn't match any known variant. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new variants that the SDK
+ * is unaware of.
+ *
+ * @throws LithicInvalidDataException in the default implementation.
+ */
+ fun unknown(json: JsonValue?): T {
+ throw LithicInvalidDataException("Unknown AccountActivityListResponse: $json")
+ }
+ }
+
+ internal class Deserializer :
+ BaseDeserializer(AccountActivityListResponse::class) {
+
+ override fun ObjectCodec.deserialize(node: JsonNode): AccountActivityListResponse {
+ val json = JsonValue.fromJsonNode(node)
+
+ val bestMatches =
+ sequenceOf(
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ AccountActivityListResponse(financialTransaction = it, _json = json)
+ },
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ AccountActivityListResponse(bookTransferTransaction = it, _json = json)
+ },
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ AccountActivityListResponse(cardTransaction = it, _json = json)
+ },
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ AccountActivityListResponse(paymentTransaction = it, _json = json)
+ },
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ AccountActivityListResponse(externalPayment = it, _json = json)
+ },
+ tryDeserialize(node, jacksonTypeRef())
+ ?.let {
+ AccountActivityListResponse(
+ managementOperationTransaction = it,
+ _json = json,
+ )
+ },
+ )
+ .filterNotNull()
+ .allMaxBy { it.validity() }
+ .toList()
+ return when (bestMatches.size) {
+ // This can happen if what we're deserializing is completely incompatible with all
+ // the possible variants (e.g. deserializing from boolean).
+ 0 -> AccountActivityListResponse(_json = json)
+ 1 -> bestMatches.single()
+ // If there's more than one match with the highest validity, then use the first
+ // completely valid match, or simply the first match if none are completely valid.
+ else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first()
+ }
+ }
+ }
+
+ internal class Serializer :
+ BaseSerializer(AccountActivityListResponse::class) {
+
+ override fun serialize(
+ value: AccountActivityListResponse,
+ generator: JsonGenerator,
+ provider: SerializerProvider,
+ ) {
+ when {
+ value.financialTransaction != null ->
+ generator.writeObject(value.financialTransaction)
+ value.bookTransferTransaction != null ->
+ generator.writeObject(value.bookTransferTransaction)
+ value.cardTransaction != null -> generator.writeObject(value.cardTransaction)
+ value.paymentTransaction != null -> generator.writeObject(value.paymentTransaction)
+ value.externalPayment != null -> generator.writeObject(value.externalPayment)
+ value.managementOperationTransaction != null ->
+ generator.writeObject(value.managementOperationTransaction)
+ value._json != null -> generator.writeObject(value._json)
+ else -> throw IllegalStateException("Invalid AccountActivityListResponse")
+ }
+ }
+ }
+
+ /** Financial transaction with inheritance from unified base transaction */
+ class FinancialTransaction
+ private constructor(
+ private val token: JsonField,
+ private val category: JsonField,
+ private val created: JsonField,
+ private val currency: JsonField,
+ private val descriptor: JsonField,
+ private val events: JsonField>,
+ private val family: JsonField,
+ private val financialAccountToken: JsonField,
+ private val pendingAmount: JsonField,
+ private val result: JsonField,
+ private val settledAmount: JsonField,
+ private val status: JsonField,
+ private val updated: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(),
+ @JsonProperty("category")
+ @ExcludeMissing
+ category: JsonField = JsonMissing.of(),
+ @JsonProperty("created")
+ @ExcludeMissing
+ created: JsonField = JsonMissing.of(),
+ @JsonProperty("currency")
+ @ExcludeMissing
+ currency: JsonField = JsonMissing.of(),
+ @JsonProperty("descriptor")
+ @ExcludeMissing
+ descriptor: JsonField = JsonMissing.of(),
+ @JsonProperty("events")
+ @ExcludeMissing
+ events: JsonField> = JsonMissing.of(),
+ @JsonProperty("family")
+ @ExcludeMissing
+ family: JsonField = JsonMissing.of(),
+ @JsonProperty("financial_account_token")
+ @ExcludeMissing
+ financialAccountToken: JsonField = JsonMissing.of(),
+ @JsonProperty("pending_amount")
+ @ExcludeMissing
+ pendingAmount: JsonField = JsonMissing.of(),
+ @JsonProperty("result")
+ @ExcludeMissing
+ result: JsonField = JsonMissing.of(),
+ @JsonProperty("settled_amount")
+ @ExcludeMissing
+ settledAmount: JsonField = JsonMissing.of(),
+ @JsonProperty("status")
+ @ExcludeMissing
+ status: JsonField = JsonMissing.of(),
+ @JsonProperty("updated")
+ @ExcludeMissing
+ updated: JsonField = JsonMissing.of(),
+ ) : this(
+ token,
+ category,
+ created,
+ currency,
+ descriptor,
+ events,
+ family,
+ financialAccountToken,
+ pendingAmount,
+ result,
+ settledAmount,
+ status,
+ updated,
+ mutableMapOf(),
+ )
+
+ /**
+ * Unique identifier for the transaction
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun token(): String = token.getRequired("token")
+
+ /**
+ * Transaction category
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun category(): TransactionCategory = category.getRequired("category")
+
+ /**
+ * ISO 8601 timestamp of when the transaction was created
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun created(): OffsetDateTime = created.getRequired("created")
+
+ /**
+ * Currency of the transaction, represented in ISO 4217 format
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun currency(): String = currency.getRequired("currency")
+
+ /**
+ * Transaction descriptor
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun descriptor(): String = descriptor.getRequired("descriptor")
+
+ /**
+ * List of transaction events
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun events(): List = events.getRequired("events")
+
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun family(): TransactionFamilyTypes = family.getRequired("family")
+
+ /**
+ * Financial account token associated with the transaction
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun financialAccountToken(): String =
+ financialAccountToken.getRequired("financial_account_token")
+
+ /**
+ * Pending amount in cents
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun pendingAmount(): Long = pendingAmount.getRequired("pending_amount")
+
+ /**
+ * Transaction result
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun result(): TransactionResult = result.getRequired("result")
+
+ /**
+ * Settled amount in cents
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun settledAmount(): Long = settledAmount.getRequired("settled_amount")
+
+ /**
+ * The status of the transaction
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun status(): TransactionStatus = status.getRequired("status")
+
+ /**
+ * ISO 8601 timestamp of when the transaction was last updated
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun updated(): OffsetDateTime = updated.getRequired("updated")
+
+ /**
+ * Returns the raw JSON value of [token].
+ *
+ * Unlike [token], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token
+
+ /**
+ * Returns the raw JSON value of [category].
+ *
+ * Unlike [category], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("category")
+ @ExcludeMissing
+ fun _category(): JsonField = category
+
+ /**
+ * Returns the raw JSON value of [created].
+ *
+ * Unlike [created], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created
+
+ /**
+ * Returns the raw JSON value of [currency].
+ *
+ * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency
+
+ /**
+ * Returns the raw JSON value of [descriptor].
+ *
+ * Unlike [descriptor], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("descriptor")
+ @ExcludeMissing
+ fun _descriptor(): JsonField = descriptor
+
+ /**
+ * Returns the raw JSON value of [events].
+ *
+ * Unlike [events], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("events") @ExcludeMissing fun _events(): JsonField> = events
+
+ /**
+ * Returns the raw JSON value of [family].
+ *
+ * Unlike [family], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("family")
+ @ExcludeMissing
+ fun _family(): JsonField = family
+
+ /**
+ * Returns the raw JSON value of [financialAccountToken].
+ *
+ * Unlike [financialAccountToken], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("financial_account_token")
+ @ExcludeMissing
+ fun _financialAccountToken(): JsonField = financialAccountToken
+
+ /**
+ * Returns the raw JSON value of [pendingAmount].
+ *
+ * Unlike [pendingAmount], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("pending_amount")
+ @ExcludeMissing
+ fun _pendingAmount(): JsonField = pendingAmount
+
+ /**
+ * Returns the raw JSON value of [result].
+ *
+ * Unlike [result], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("result") @ExcludeMissing fun _result(): JsonField = result
+
+ /**
+ * Returns the raw JSON value of [settledAmount].
+ *
+ * Unlike [settledAmount], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("settled_amount")
+ @ExcludeMissing
+ fun _settledAmount(): JsonField = settledAmount
+
+ /**
+ * Returns the raw JSON value of [status].
+ *
+ * Unlike [status], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status
+
+ /**
+ * Returns the raw JSON value of [updated].
+ *
+ * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [FinancialTransaction].
+ *
+ * The following fields are required:
+ * ```java
+ * .token()
+ * .category()
+ * .created()
+ * .currency()
+ * .descriptor()
+ * .events()
+ * .family()
+ * .financialAccountToken()
+ * .pendingAmount()
+ * .result()
+ * .settledAmount()
+ * .status()
+ * .updated()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [FinancialTransaction]. */
+ class Builder internal constructor() {
+
+ private var token: JsonField? = null
+ private var category: JsonField? = null
+ private var created: JsonField? = null
+ private var currency: JsonField? = null
+ private var descriptor: JsonField? = null
+ private var events: JsonField>? = null
+ private var family: JsonField? = null
+ private var financialAccountToken: JsonField? = null
+ private var pendingAmount: JsonField? = null
+ private var result: JsonField? = null
+ private var settledAmount: JsonField? = null
+ private var status: JsonField? = null
+ private var updated: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(financialTransaction: FinancialTransaction) = apply {
+ token = financialTransaction.token
+ category = financialTransaction.category
+ created = financialTransaction.created
+ currency = financialTransaction.currency
+ descriptor = financialTransaction.descriptor
+ events = financialTransaction.events.map { it.toMutableList() }
+ family = financialTransaction.family
+ financialAccountToken = financialTransaction.financialAccountToken
+ pendingAmount = financialTransaction.pendingAmount
+ result = financialTransaction.result
+ settledAmount = financialTransaction.settledAmount
+ status = financialTransaction.status
+ updated = financialTransaction.updated
+ additionalProperties = financialTransaction.additionalProperties.toMutableMap()
+ }
+
+ /** Unique identifier for the transaction */
+ fun token(token: String) = token(JsonField.of(token))
+
+ /**
+ * Sets [Builder.token] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.token] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun token(token: JsonField) = apply { this.token = token }
+
+ /** Transaction category */
+ fun category(category: TransactionCategory) = category(JsonField.of(category))
+
+ /**
+ * Sets [Builder.category] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.category] with a well-typed [TransactionCategory]
+ * value instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun category(category: JsonField) = apply {
+ this.category = category
+ }
+
+ /** ISO 8601 timestamp of when the transaction was created */
+ fun created(created: OffsetDateTime) = created(JsonField.of(created))
+
+ /**
+ * Sets [Builder.created] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun created(created: JsonField) = apply { this.created = created }
+
+ /** Currency of the transaction, represented in ISO 4217 format */
+ fun currency(currency: String) = currency(JsonField.of(currency))
+
+ /**
+ * Sets [Builder.currency] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.currency] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun currency(currency: JsonField) = apply { this.currency = currency }
+
+ /** Transaction descriptor */
+ fun descriptor(descriptor: String) = descriptor(JsonField.of(descriptor))
+
+ /**
+ * Sets [Builder.descriptor] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.descriptor] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun descriptor(descriptor: JsonField) = apply { this.descriptor = descriptor }
+
+ /** List of transaction events */
+ fun events(events: List) = events(JsonField.of(events))
+
+ /**
+ * Sets [Builder.events] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.events] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun events(events: JsonField>) = apply {
+ this.events = events.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [JsonValue] to [events].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addEvent(event: JsonValue) = apply {
+ events =
+ (events ?: JsonField.of(mutableListOf())).also {
+ checkKnown("events", it).add(event)
+ }
+ }
+
+ fun family(family: TransactionFamilyTypes) = family(JsonField.of(family))
+
+ /**
+ * Sets [Builder.family] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.family] with a well-typed [TransactionFamilyTypes]
+ * value instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun family(family: JsonField) = apply { this.family = family }
+
+ /** Financial account token associated with the transaction */
+ fun financialAccountToken(financialAccountToken: String) =
+ financialAccountToken(JsonField.of(financialAccountToken))
+
+ /**
+ * Sets [Builder.financialAccountToken] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.financialAccountToken] with a well-typed [String]
+ * value instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun financialAccountToken(financialAccountToken: JsonField) = apply {
+ this.financialAccountToken = financialAccountToken
+ }
+
+ /** Pending amount in cents */
+ fun pendingAmount(pendingAmount: Long) = pendingAmount(JsonField.of(pendingAmount))
+
+ /**
+ * Sets [Builder.pendingAmount] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.pendingAmount] with a well-typed [Long] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun pendingAmount(pendingAmount: JsonField) = apply {
+ this.pendingAmount = pendingAmount
+ }
+
+ /** Transaction result */
+ fun result(result: TransactionResult) = result(JsonField.of(result))
+
+ /**
+ * Sets [Builder.result] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.result] with a well-typed [TransactionResult] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun result(result: JsonField) = apply { this.result = result }
+
+ /** Settled amount in cents */
+ fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount))
+
+ /**
+ * Sets [Builder.settledAmount] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.settledAmount] with a well-typed [Long] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun settledAmount(settledAmount: JsonField) = apply {
+ this.settledAmount = settledAmount
+ }
+
+ /** The status of the transaction */
+ fun status(status: TransactionStatus) = status(JsonField.of(status))
+
+ /**
+ * Sets [Builder.status] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.status] with a well-typed [TransactionStatus] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun status(status: JsonField) = apply { this.status = status }
+
+ /** ISO 8601 timestamp of when the transaction was last updated */
+ fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated))
+
+ /**
+ * Sets [Builder.updated] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.updated] with a well-typed [OffsetDateTime] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun updated(updated: JsonField) = apply { this.updated = updated }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [FinancialTransaction].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .token()
+ * .category()
+ * .created()
+ * .currency()
+ * .descriptor()
+ * .events()
+ * .family()
+ * .financialAccountToken()
+ * .pendingAmount()
+ * .result()
+ * .settledAmount()
+ * .status()
+ * .updated()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): FinancialTransaction =
+ FinancialTransaction(
+ checkRequired("token", token),
+ checkRequired("category", category),
+ checkRequired("created", created),
+ checkRequired("currency", currency),
+ checkRequired("descriptor", descriptor),
+ checkRequired("events", events).map { it.toImmutable() },
+ checkRequired("family", family),
+ checkRequired("financialAccountToken", financialAccountToken),
+ checkRequired("pendingAmount", pendingAmount),
+ checkRequired("result", result),
+ checkRequired("settledAmount", settledAmount),
+ checkRequired("status", status),
+ checkRequired("updated", updated),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): FinancialTransaction = apply {
+ if (validated) {
+ return@apply
+ }
+
+ token()
+ category().validate()
+ created()
+ currency()
+ descriptor()
+ events()
+ family().validate()
+ financialAccountToken()
+ pendingAmount()
+ result().validate()
+ settledAmount()
+ status().validate()
+ updated()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (token.asKnown().isPresent) 1 else 0) +
+ (category.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (created.asKnown().isPresent) 1 else 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (if (descriptor.asKnown().isPresent) 1 else 0) +
+ (events.asKnown().getOrNull()?.size ?: 0) +
+ (family.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (financialAccountToken.asKnown().isPresent) 1 else 0) +
+ (if (pendingAmount.asKnown().isPresent) 1 else 0) +
+ (result.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (settledAmount.asKnown().isPresent) 1 else 0) +
+ (status.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (updated.asKnown().isPresent) 1 else 0)
+
+ /** Transaction category */
+ class TransactionCategory
+ @JsonCreator
+ private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new members that the
+ * SDK is unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ @JvmField val ACH = of("ACH")
+
+ @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING")
+
+ @JvmField val CARD = of("CARD")
+
+ @JvmField val EXTERNAL_ACH = of("EXTERNAL_ACH")
+
+ @JvmField val EXTERNAL_CHECK = of("EXTERNAL_CHECK")
+
+ @JvmField val EXTERNAL_TRANSFER = of("EXTERNAL_TRANSFER")
+
+ @JvmField val EXTERNAL_WIRE = of("EXTERNAL_WIRE")
+
+ @JvmField val MANAGEMENT_ADJUSTMENT = of("MANAGEMENT_ADJUSTMENT")
+
+ @JvmField val MANAGEMENT_DISPUTE = of("MANAGEMENT_DISPUTE")
+
+ @JvmField val MANAGEMENT_FEE = of("MANAGEMENT_FEE")
+
+ @JvmField val MANAGEMENT_REWARD = of("MANAGEMENT_REWARD")
+
+ @JvmField val MANAGEMENT_DISBURSEMENT = of("MANAGEMENT_DISBURSEMENT")
+
+ @JvmField val PROGRAM_FUNDING = of("PROGRAM_FUNDING")
+
+ @JvmStatic fun of(value: String) = TransactionCategory(JsonField.of(value))
+ }
+
+ /** An enum containing [TransactionCategory]'s known values. */
+ enum class Known {
+ ACH,
+ BALANCE_OR_FUNDING,
+ CARD,
+ EXTERNAL_ACH,
+ EXTERNAL_CHECK,
+ EXTERNAL_TRANSFER,
+ EXTERNAL_WIRE,
+ MANAGEMENT_ADJUSTMENT,
+ MANAGEMENT_DISPUTE,
+ MANAGEMENT_FEE,
+ MANAGEMENT_REWARD,
+ MANAGEMENT_DISBURSEMENT,
+ PROGRAM_FUNDING,
+ }
+
+ /**
+ * An enum containing [TransactionCategory]'s known values, as well as an [_UNKNOWN]
+ * member.
+ *
+ * An instance of [TransactionCategory] can contain an unknown value in a couple of
+ * cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ ACH,
+ BALANCE_OR_FUNDING,
+ CARD,
+ EXTERNAL_ACH,
+ EXTERNAL_CHECK,
+ EXTERNAL_TRANSFER,
+ EXTERNAL_WIRE,
+ MANAGEMENT_ADJUSTMENT,
+ MANAGEMENT_DISPUTE,
+ MANAGEMENT_FEE,
+ MANAGEMENT_REWARD,
+ MANAGEMENT_DISBURSEMENT,
+ PROGRAM_FUNDING,
+ /**
+ * An enum member indicating that [TransactionCategory] was instantiated with an
+ * unknown value.
+ */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you
+ * want to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ ACH -> Value.ACH
+ BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING
+ CARD -> Value.CARD
+ EXTERNAL_ACH -> Value.EXTERNAL_ACH
+ EXTERNAL_CHECK -> Value.EXTERNAL_CHECK
+ EXTERNAL_TRANSFER -> Value.EXTERNAL_TRANSFER
+ EXTERNAL_WIRE -> Value.EXTERNAL_WIRE
+ MANAGEMENT_ADJUSTMENT -> Value.MANAGEMENT_ADJUSTMENT
+ MANAGEMENT_DISPUTE -> Value.MANAGEMENT_DISPUTE
+ MANAGEMENT_FEE -> Value.MANAGEMENT_FEE
+ MANAGEMENT_REWARD -> Value.MANAGEMENT_REWARD
+ MANAGEMENT_DISBURSEMENT -> Value.MANAGEMENT_DISBURSEMENT
+ PROGRAM_FUNDING -> Value.PROGRAM_FUNDING
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws LithicInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ ACH -> Known.ACH
+ BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING
+ CARD -> Known.CARD
+ EXTERNAL_ACH -> Known.EXTERNAL_ACH
+ EXTERNAL_CHECK -> Known.EXTERNAL_CHECK
+ EXTERNAL_TRANSFER -> Known.EXTERNAL_TRANSFER
+ EXTERNAL_WIRE -> Known.EXTERNAL_WIRE
+ MANAGEMENT_ADJUSTMENT -> Known.MANAGEMENT_ADJUSTMENT
+ MANAGEMENT_DISPUTE -> Known.MANAGEMENT_DISPUTE
+ MANAGEMENT_FEE -> Known.MANAGEMENT_FEE
+ MANAGEMENT_REWARD -> Known.MANAGEMENT_REWARD
+ MANAGEMENT_DISBURSEMENT -> Known.MANAGEMENT_DISBURSEMENT
+ PROGRAM_FUNDING -> Known.PROGRAM_FUNDING
+ else -> throw LithicInvalidDataException("Unknown TransactionCategory: $value")
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for
+ * debugging and generally doesn't throw.
+ *
+ * @throws LithicInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ LithicInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): TransactionCategory = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is TransactionCategory && value == other.value /* spotless:on */
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ class TransactionFamilyTypes
+ @JsonCreator
+ private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new members that the
+ * SDK is unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ @JvmField val CARD = of("CARD")
+
+ @JvmField val PAYMENT = of("PAYMENT")
+
+ @JvmField val TRANSFER = of("TRANSFER")
+
+ @JvmField val INTERNAL = of("INTERNAL")
+
+ @JvmField val EXTERNAL_PAYMENT = of("EXTERNAL_PAYMENT")
+
+ @JvmField val MANAGEMENT_OPERATION = of("MANAGEMENT_OPERATION")
+
+ @JvmStatic fun of(value: String) = TransactionFamilyTypes(JsonField.of(value))
+ }
+
+ /** An enum containing [TransactionFamilyTypes]'s known values. */
+ enum class Known {
+ CARD,
+ PAYMENT,
+ TRANSFER,
+ INTERNAL,
+ EXTERNAL_PAYMENT,
+ MANAGEMENT_OPERATION,
+ }
+
+ /**
+ * An enum containing [TransactionFamilyTypes]'s known values, as well as an [_UNKNOWN]
+ * member.
+ *
+ * An instance of [TransactionFamilyTypes] can contain an unknown value in a couple of
+ * cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ CARD,
+ PAYMENT,
+ TRANSFER,
+ INTERNAL,
+ EXTERNAL_PAYMENT,
+ MANAGEMENT_OPERATION,
+ /**
+ * An enum member indicating that [TransactionFamilyTypes] was instantiated with an
+ * unknown value.
+ */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you
+ * want to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ CARD -> Value.CARD
+ PAYMENT -> Value.PAYMENT
+ TRANSFER -> Value.TRANSFER
+ INTERNAL -> Value.INTERNAL
+ EXTERNAL_PAYMENT -> Value.EXTERNAL_PAYMENT
+ MANAGEMENT_OPERATION -> Value.MANAGEMENT_OPERATION
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws LithicInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ CARD -> Known.CARD
+ PAYMENT -> Known.PAYMENT
+ TRANSFER -> Known.TRANSFER
+ INTERNAL -> Known.INTERNAL
+ EXTERNAL_PAYMENT -> Known.EXTERNAL_PAYMENT
+ MANAGEMENT_OPERATION -> Known.MANAGEMENT_OPERATION
+ else ->
+ throw LithicInvalidDataException("Unknown TransactionFamilyTypes: $value")
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for
+ * debugging and generally doesn't throw.
+ *
+ * @throws LithicInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ LithicInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): TransactionFamilyTypes = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is TransactionFamilyTypes && value == other.value /* spotless:on */
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ /** Transaction result */
+ class TransactionResult
+ @JsonCreator
+ private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new members that the
+ * SDK is unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ @JvmField val APPROVED = of("APPROVED")
+
+ @JvmField val DECLINED = of("DECLINED")
+
+ @JvmStatic fun of(value: String) = TransactionResult(JsonField.of(value))
+ }
+
+ /** An enum containing [TransactionResult]'s known values. */
+ enum class Known {
+ APPROVED,
+ DECLINED,
+ }
+
+ /**
+ * An enum containing [TransactionResult]'s known values, as well as an [_UNKNOWN]
+ * member.
+ *
+ * An instance of [TransactionResult] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ APPROVED,
+ DECLINED,
+ /**
+ * An enum member indicating that [TransactionResult] was instantiated with an
+ * unknown value.
+ */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you
+ * want to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ APPROVED -> Value.APPROVED
+ DECLINED -> Value.DECLINED
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws LithicInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ APPROVED -> Known.APPROVED
+ DECLINED -> Known.DECLINED
+ else -> throw LithicInvalidDataException("Unknown TransactionResult: $value")
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for
+ * debugging and generally doesn't throw.
+ *
+ * @throws LithicInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ LithicInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): TransactionResult = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is TransactionResult && value == other.value /* spotless:on */
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ /** The status of the transaction */
+ class TransactionStatus
+ @JsonCreator
+ private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new members that the
+ * SDK is unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ @JvmField val PENDING = of("PENDING")
+
+ @JvmField val SETTLED = of("SETTLED")
+
+ @JvmField val DECLINED = of("DECLINED")
+
+ @JvmField val REVERSED = of("REVERSED")
+
+ @JvmField val CANCELED = of("CANCELED")
+
+ @JvmStatic fun of(value: String) = TransactionStatus(JsonField.of(value))
+ }
+
+ /** An enum containing [TransactionStatus]'s known values. */
+ enum class Known {
+ PENDING,
+ SETTLED,
+ DECLINED,
+ REVERSED,
+ CANCELED,
+ }
+
+ /**
+ * An enum containing [TransactionStatus]'s known values, as well as an [_UNKNOWN]
+ * member.
+ *
+ * An instance of [TransactionStatus] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ PENDING,
+ SETTLED,
+ DECLINED,
+ REVERSED,
+ CANCELED,
+ /**
+ * An enum member indicating that [TransactionStatus] was instantiated with an
+ * unknown value.
+ */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you
+ * want to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ PENDING -> Value.PENDING
+ SETTLED -> Value.SETTLED
+ DECLINED -> Value.DECLINED
+ REVERSED -> Value.REVERSED
+ CANCELED -> Value.CANCELED
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws LithicInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ PENDING -> Known.PENDING
+ SETTLED -> Known.SETTLED
+ DECLINED -> Known.DECLINED
+ REVERSED -> Known.REVERSED
+ CANCELED -> Known.CANCELED
+ else -> throw LithicInvalidDataException("Unknown TransactionStatus: $value")
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for
+ * debugging and generally doesn't throw.
+ *
+ * @throws LithicInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ LithicInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): TransactionStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is TransactionStatus && value == other.value /* spotless:on */
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is FinancialTransaction && token == other.token && category == other.category && created == other.created && currency == other.currency && descriptor == other.descriptor && events == other.events && family == other.family && financialAccountToken == other.financialAccountToken && pendingAmount == other.pendingAmount && result == other.result && settledAmount == other.settledAmount && status == other.status && updated == other.updated && additionalProperties == other.additionalProperties /* spotless:on */
+ }
+
+ /* spotless:off */
+ private val hashCode: Int by lazy { Objects.hash(token, category, created, currency, descriptor, events, family, financialAccountToken, pendingAmount, result, settledAmount, status, updated, additionalProperties) }
+ /* spotless:on */
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "FinancialTransaction{token=$token, category=$category, created=$created, currency=$currency, descriptor=$descriptor, events=$events, family=$family, financialAccountToken=$financialAccountToken, pendingAmount=$pendingAmount, result=$result, settledAmount=$settledAmount, status=$status, updated=$updated, additionalProperties=$additionalProperties}"
+ }
+
+ /** Book transfer transaction */
+ class BookTransferTransaction
+ private constructor(
+ private val token: JsonField,
+ private val category: JsonField,
+ private val created: JsonField,
+ private val currency: JsonField,
+ private val events: JsonField>,
+ private val family: JsonField,
+ private val fromFinancialAccountToken: JsonField,
+ private val pendingAmount: JsonField,
+ private val result: JsonField,
+ private val settledAmount: JsonField,
+ private val status: JsonField,
+ private val toFinancialAccountToken: JsonField,
+ private val updated: JsonField,
+ private val externalId: JsonField,
+ private val externalResource: JsonField,
+ private val transactionSeries: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(),
+ @JsonProperty("category")
+ @ExcludeMissing
+ category: JsonField = JsonMissing.of(),
+ @JsonProperty("created")
+ @ExcludeMissing
+ created: JsonField = JsonMissing.of(),
+ @JsonProperty("currency")
+ @ExcludeMissing
+ currency: JsonField = JsonMissing.of(),
+ @JsonProperty("events")
+ @ExcludeMissing
+ events: JsonField> = JsonMissing.of(),
+ @JsonProperty("family")
+ @ExcludeMissing
+ family: JsonField = JsonMissing.of(),
+ @JsonProperty("from_financial_account_token")
+ @ExcludeMissing
+ fromFinancialAccountToken: JsonField = JsonMissing.of(),
+ @JsonProperty("pending_amount")
+ @ExcludeMissing
+ pendingAmount: JsonField = JsonMissing.of(),
+ @JsonProperty("result")
+ @ExcludeMissing
+ result: JsonField = JsonMissing.of(),
+ @JsonProperty("settled_amount")
+ @ExcludeMissing
+ settledAmount: JsonField = JsonMissing.of(),
+ @JsonProperty("status")
+ @ExcludeMissing
+ status: JsonField = JsonMissing.of(),
+ @JsonProperty("to_financial_account_token")
+ @ExcludeMissing
+ toFinancialAccountToken: JsonField = JsonMissing.of(),
+ @JsonProperty("updated")
+ @ExcludeMissing
+ updated: JsonField = JsonMissing.of(),
+ @JsonProperty("external_id")
+ @ExcludeMissing
+ externalId: JsonField = JsonMissing.of(),
+ @JsonProperty("external_resource")
+ @ExcludeMissing
+ externalResource: JsonField = JsonMissing.of(),
+ @JsonProperty("transaction_series")
+ @ExcludeMissing
+ transactionSeries: JsonField = JsonMissing.of(),
+ ) : this(
+ token,
+ category,
+ created,
+ currency,
+ events,
+ family,
+ fromFinancialAccountToken,
+ pendingAmount,
+ result,
+ settledAmount,
+ status,
+ toFinancialAccountToken,
+ updated,
+ externalId,
+ externalResource,
+ transactionSeries,
+ mutableMapOf(),
+ )
+
+ /**
+ * Unique identifier for the transaction
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun token(): String = token.getRequired("token")
+
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun category(): TransactionCategory = category.getRequired("category")
+
+ /**
+ * ISO 8601 timestamp of when the transaction was created
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun created(): OffsetDateTime = created.getRequired("created")
+
+ /**
+ * Currency of the transaction in ISO 4217 format
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun currency(): String = currency.getRequired("currency")
+
+ /**
+ * List of events associated with this book transfer
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun events(): List = events.getRequired("events")
+
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun family(): TransactionFamilyTypes = family.getRequired("family")
+
+ /**
+ * Source account token
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun fromFinancialAccountToken(): String =
+ fromFinancialAccountToken.getRequired("from_financial_account_token")
+
+ /**
+ * The pending amount of the transaction in cents
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun pendingAmount(): Long = pendingAmount.getRequired("pending_amount")
+
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun result(): TransactionResult = result.getRequired("result")
+
+ /**
+ * The settled amount of the transaction in cents
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun settledAmount(): Long = settledAmount.getRequired("settled_amount")
+
+ /**
+ * The status of the transaction
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun status(): TransactionStatus = status.getRequired("status")
+
+ /**
+ * Destination account token
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun toFinancialAccountToken(): String =
+ toFinancialAccountToken.getRequired("to_financial_account_token")
+
+ /**
+ * ISO 8601 timestamp of when the transaction was last updated
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun updated(): OffsetDateTime = updated.getRequired("updated")
+
+ /**
+ * External identifier for the transaction
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun externalId(): Optional = externalId.getOptional("external_id")
+
+ /**
+ * External resource associated with the management operation
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun externalResource(): Optional =
+ externalResource.getOptional("external_resource")
+
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun transactionSeries(): Optional =
+ transactionSeries.getOptional("transaction_series")
+
+ /**
+ * Returns the raw JSON value of [token].
+ *
+ * Unlike [token], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token
+
+ /**
+ * Returns the raw JSON value of [category].
+ *
+ * Unlike [category], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("category")
+ @ExcludeMissing
+ fun _category(): JsonField = category
+
+ /**
+ * Returns the raw JSON value of [created].
+ *
+ * Unlike [created], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created
+
+ /**
+ * Returns the raw JSON value of [currency].
+ *
+ * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency
+
+ /**
+ * Returns the raw JSON value of [events].
+ *
+ * Unlike [events], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("events") @ExcludeMissing fun _events(): JsonField> = events
+
+ /**
+ * Returns the raw JSON value of [family].
+ *
+ * Unlike [family], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("family")
+ @ExcludeMissing
+ fun _family(): JsonField