diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index b6700282..617f7502 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.117.0"
+ ".": "0.118.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 5a93d129..c06c60ed 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 177
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-c24eebe942f400bff8922a6fbef1ce551ad14f61eb4da21b50d823a62ca42586.yml
-openapi_spec_hash: b79ed927e625dedff69cea29131a34d9
-config_hash: 693dddc4721eef512d75ab6c60897794
+configured_endpoints: 185
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-c1dbf87770ddffb9d6d1ada33d1c43739d43498ff687c1d58e403ffc08f6f863.yml
+openapi_spec_hash: f488e595de02180bb904da283b7a1c39
+config_hash: 925e84bc73b1b9b5eb0ffd230fc9800f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3bc58031..214d3bc7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,30 @@
# Changelog
+## 0.118.0 (2026-02-26)
+
+Full Changelog: [v0.117.0...v0.118.0](https://github.com/lithic-com/lithic-java/compare/v0.117.0...v0.118.0)
+
+### Features
+
+* **api:** Add account holder entity endpoints ([04b301b](https://github.com/lithic-com/lithic-java/commit/04b301b3bfc4669821fb0555bdcea4b5f8484310))
+* **api:** Add INTEREST_AND_FEES_PAUSED substatus to financial account ([b533580](https://github.com/lithic-com/lithic-java/commit/b5335809bcdb615e5f8b22f5b7f2b5ea81581219))
+* **api:** Expose MIL interest schedules and loan tape configuration endpoints ([54ea41f](https://github.com/lithic-com/lithic-java/commit/54ea41f7aa89aae69fc1120ae232b110fc64b15d))
+
+
+### Bug Fixes
+
+* set Accept header in more places ([13de846](https://github.com/lithic-com/lithic-java/commit/13de84622f05d951233a64bf00528f9aa80dc8e1))
+
+
+### Chores
+
+* drop apache dependency ([6f437cc](https://github.com/lithic-com/lithic-java/commit/6f437cc3dd1cac56e147714a789d1c767284bea6))
+* fix card embed endpoints after removing apache dependency ([3d05137](https://github.com/lithic-com/lithic-java/commit/3d051375f098f6c0efc2b24e1cfd08c5f237129b))
+* fix card embed endpoints after removing apache dependency ([c64c472](https://github.com/lithic-com/lithic-java/commit/c64c4722e902a963f62ad90526717aa38360dd6b))
+* fix card embed endpoints after removing apache dependency [#1567](https://github.com/lithic-com/lithic-java/issues/1567) ([3d05137](https://github.com/lithic-com/lithic-java/commit/3d051375f098f6c0efc2b24e1cfd08c5f237129b))
+* **internal:** expand imports ([c03db70](https://github.com/lithic-com/lithic-java/commit/c03db70d19686cd85e06e89b4b134a53ca7fb965))
+* make `Properties` more resilient to `null` ([40426af](https://github.com/lithic-com/lithic-java/commit/40426afe752ec8a8bc77e3791deb1376a2efea9b))
+
## 0.117.0 (2026-02-18)
Full Changelog: [v0.116.0...v0.117.0](https://github.com/lithic-com/lithic-java/compare/v0.116.0...v0.117.0)
diff --git a/README.md b/README.md
index 5b40c425..dfe23ed4 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.117.0)
-[](https://javadoc.io/doc/com.lithic.api/lithic-java/0.117.0)
+[](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.118.0)
+[](https://javadoc.io/doc/com.lithic.api/lithic-java/0.118.0)
@@ -22,7 +22,7 @@ Use the Lithic MCP Server to enable AI assistants to interact with this API, all
-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.117.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.118.0).
@@ -33,7 +33,7 @@ The REST API documentation can be found on [docs.lithic.com](https://docs.lithic
### Gradle
```kotlin
-implementation("com.lithic.api:lithic-java:0.117.0")
+implementation("com.lithic.api:lithic-java:0.118.0")
```
### Maven
@@ -42,7 +42,7 @@ implementation("com.lithic.api:lithic-java:0.117.0")
com.lithic.api
lithic-java
- 0.117.0
+ 0.118.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 3371f3d6..433e6f12 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.lithic.api"
- version = "0.117.0" // x-release-please-version
+ version = "0.118.0" // x-release-please-version
}
subprojects {
diff --git a/lithic-java-core/build.gradle.kts b/lithic-java-core/build.gradle.kts
index dc2ea195..76861612 100644
--- a/lithic-java-core/build.gradle.kts
+++ b/lithic-java-core/build.gradle.kts
@@ -28,8 +28,6 @@ dependencies {
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.2")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.2")
- implementation("org.apache.httpcomponents.core5:httpcore5:5.2.4")
- implementation("org.apache.httpcomponents.client5:httpclient5:5.3.1")
testImplementation(kotlin("test"))
testImplementation(project(":lithic-java-client-okhttp"))
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/core/Properties.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/core/Properties.kt
index 6de9f807..3f0593b3 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/core/Properties.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/core/Properties.kt
@@ -34,9 +34,9 @@ fun getOsName(): String {
}
}
-fun getOsVersion(): String = System.getProperty("os.version", "unknown")
+fun getOsVersion(): String = System.getProperty("os.version", "unknown") ?: "unknown"
fun getPackageVersion(): String =
- LithicClient::class.java.`package`.implementationVersion ?: "unknown"
+ LithicClient::class.java.`package`?.implementationVersion ?: "unknown"
-fun getJavaVersion(): String = System.getProperty("java.version", "unknown")
+fun getJavaVersion(): String = System.getProperty("java.version", "unknown") ?: "unknown"
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/core/http/HttpRequestBodies.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/core/http/HttpRequestBodies.kt
index 5e05f2a0..fc5c5539 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/core/http/HttpRequestBodies.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/core/http/HttpRequestBodies.kt
@@ -8,13 +8,13 @@ import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.json.JsonMapper
import com.fasterxml.jackson.databind.node.JsonNodeType
import com.lithic.api.core.MultipartField
+import com.lithic.api.core.toImmutable
import com.lithic.api.errors.LithicInvalidDataException
+import java.io.ByteArrayInputStream
import java.io.InputStream
import java.io.OutputStream
+import java.util.UUID
import kotlin.jvm.optionals.getOrNull
-import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder
-import org.apache.hc.core5.http.ContentType
-import org.apache.hc.core5.http.HttpEntity
@JvmSynthetic
internal inline fun json(jsonMapper: JsonMapper, value: T): HttpRequestBody =
@@ -37,92 +37,231 @@ internal fun multipartFormData(
jsonMapper: JsonMapper,
fields: Map>,
): HttpRequestBody =
- object : HttpRequestBody {
- private val entity: HttpEntity by lazy {
- MultipartEntityBuilder.create()
- .apply {
- fields.forEach { (name, field) ->
- val knownValue = field.value.asKnown().getOrNull()
- val parts =
- if (knownValue is InputStream) {
- // Read directly from the `InputStream` instead of reading it all
- // into memory due to the `jsonMapper` serialization below.
- sequenceOf(name to knownValue)
- } else {
- val node = jsonMapper.valueToTree(field.value)
- serializePart(name, node)
+ MultipartBody.Builder()
+ .apply {
+ fields.forEach { (name, field) ->
+ val knownValue = field.value.asKnown().getOrNull()
+ val parts =
+ if (knownValue is InputStream) {
+ // Read directly from the `InputStream` instead of reading it all
+ // into memory due to the `jsonMapper` serialization below.
+ sequenceOf(name to knownValue)
+ } else {
+ val node = jsonMapper.valueToTree(field.value)
+ serializePart(name, node)
+ }
+
+ parts.forEach { (name, bytes) ->
+ val partBody =
+ if (bytes is ByteArrayInputStream) {
+ val byteArray = bytes.readBytes()
+
+ object : HttpRequestBody {
+
+ override fun writeTo(outputStream: OutputStream) {
+ outputStream.write(byteArray)
+ }
+
+ override fun contentType(): String = field.contentType
+
+ override fun contentLength(): Long = byteArray.size.toLong()
+
+ override fun repeatable(): Boolean = true
+
+ override fun close() {}
}
+ } else {
+ object : HttpRequestBody {
+
+ override fun writeTo(outputStream: OutputStream) {
+ bytes.copyTo(outputStream)
+ }
+
+ override fun contentType(): String = field.contentType
+
+ override fun contentLength(): Long = -1L
- parts.forEach { (name, bytes) ->
- addBinaryBody(
- name,
- bytes,
- ContentType.parseLenient(field.contentType),
- field.filename().getOrNull(),
- )
+ override fun repeatable(): Boolean = false
+
+ override fun close() = bytes.close()
+ }
}
- }
+
+ addPart(
+ MultipartBody.Part.create(
+ name,
+ field.filename().getOrNull(),
+ field.contentType,
+ partBody,
+ )
+ )
}
- .build()
+ }
}
+ .build()
- private fun serializePart(
- name: String,
- node: JsonNode,
- ): Sequence> =
- when (node.nodeType) {
- JsonNodeType.MISSING,
- JsonNodeType.NULL -> emptySequence()
- JsonNodeType.BINARY -> sequenceOf(name to node.binaryValue().inputStream())
- JsonNodeType.STRING -> sequenceOf(name to node.textValue().inputStream())
- JsonNodeType.BOOLEAN ->
- sequenceOf(name to node.booleanValue().toString().inputStream())
- JsonNodeType.NUMBER ->
- sequenceOf(name to node.numberValue().toString().inputStream())
- JsonNodeType.ARRAY ->
- sequenceOf(
- name to
- node
- .elements()
- .asSequence()
- .mapNotNull { element ->
- when (element.nodeType) {
- JsonNodeType.MISSING,
- JsonNodeType.NULL -> null
- JsonNodeType.STRING -> node.textValue()
- JsonNodeType.BOOLEAN -> node.booleanValue().toString()
- JsonNodeType.NUMBER -> node.numberValue().toString()
- null,
- JsonNodeType.BINARY,
- JsonNodeType.ARRAY,
- JsonNodeType.OBJECT,
- JsonNodeType.POJO ->
- throw LithicInvalidDataException(
- "Unexpected JsonNode type in array: ${node.nodeType}"
- )
- }
- }
- .joinToString(",")
- .inputStream()
- )
- JsonNodeType.OBJECT ->
- node.fields().asSequence().flatMap { (key, value) ->
- serializePart("$name[$key]", value)
- }
- JsonNodeType.POJO,
- null ->
- throw LithicInvalidDataException("Unexpected JsonNode type: ${node.nodeType}")
+private fun serializePart(name: String, node: JsonNode): Sequence> =
+ when (node.nodeType) {
+ JsonNodeType.MISSING,
+ JsonNodeType.NULL -> emptySequence()
+ JsonNodeType.BINARY -> sequenceOf(name to node.binaryValue().inputStream())
+ JsonNodeType.STRING -> sequenceOf(name to node.textValue().byteInputStream())
+ JsonNodeType.BOOLEAN -> sequenceOf(name to node.booleanValue().toString().byteInputStream())
+ JsonNodeType.NUMBER -> sequenceOf(name to node.numberValue().toString().byteInputStream())
+ JsonNodeType.ARRAY ->
+ sequenceOf(
+ name to
+ node
+ .elements()
+ .asSequence()
+ .mapNotNull { element ->
+ when (element.nodeType) {
+ JsonNodeType.MISSING,
+ JsonNodeType.NULL -> null
+ JsonNodeType.STRING -> element.textValue()
+ JsonNodeType.BOOLEAN -> element.booleanValue().toString()
+ JsonNodeType.NUMBER -> element.numberValue().toString()
+ null,
+ JsonNodeType.BINARY,
+ JsonNodeType.ARRAY,
+ JsonNodeType.OBJECT,
+ JsonNodeType.POJO ->
+ throw LithicInvalidDataException(
+ "Unexpected JsonNode type in array: ${element.nodeType}"
+ )
+ }
+ }
+ .joinToString(",")
+ .byteInputStream()
+ )
+ JsonNodeType.OBJECT ->
+ node.fields().asSequence().flatMap { (key, value) ->
+ serializePart("$name[$key]", value)
+ }
+ JsonNodeType.POJO,
+ null -> throw LithicInvalidDataException("Unexpected JsonNode type: ${node.nodeType}")
+ }
+
+private class MultipartBody
+private constructor(private val boundary: String, private val parts: List) : HttpRequestBody {
+ private val boundaryBytes: ByteArray = boundary.toByteArray()
+ private val contentType = "multipart/form-data; boundary=$boundary"
+
+ // This must remain in sync with `contentLength`.
+ override fun writeTo(outputStream: OutputStream) {
+ parts.forEach { part ->
+ outputStream.write(DASHDASH)
+ outputStream.write(boundaryBytes)
+ outputStream.write(CRLF)
+
+ outputStream.write(CONTENT_DISPOSITION)
+ outputStream.write(part.contentDisposition.toByteArray())
+ outputStream.write(CRLF)
+
+ outputStream.write(CONTENT_TYPE)
+ outputStream.write(part.contentType.toByteArray())
+ outputStream.write(CRLF)
+
+ outputStream.write(CRLF)
+ part.body.writeTo(outputStream)
+ outputStream.write(CRLF)
+ }
+
+ outputStream.write(DASHDASH)
+ outputStream.write(boundaryBytes)
+ outputStream.write(DASHDASH)
+ outputStream.write(CRLF)
+ }
+
+ override fun contentType(): String = contentType
+
+ // This must remain in sync with `writeTo`.
+ override fun contentLength(): Long {
+ var byteCount = 0L
+
+ parts.forEach { part ->
+ val contentLength = part.body.contentLength()
+ if (contentLength == -1L) {
+ return -1L
}
- private fun String.inputStream(): InputStream = toByteArray().inputStream()
+ byteCount +=
+ DASHDASH.size +
+ boundaryBytes.size +
+ CRLF.size +
+ CONTENT_DISPOSITION.size +
+ part.contentDisposition.toByteArray().size +
+ CRLF.size +
+ CONTENT_TYPE.size +
+ part.contentType.toByteArray().size +
+ CRLF.size +
+ CRLF.size +
+ contentLength +
+ CRLF.size
+ }
- override fun writeTo(outputStream: OutputStream) = entity.writeTo(outputStream)
+ byteCount += DASHDASH.size + boundaryBytes.size + DASHDASH.size + CRLF.size
+ return byteCount
+ }
- override fun contentType(): String = entity.contentType
+ override fun repeatable(): Boolean = parts.all { it.body.repeatable() }
- override fun contentLength(): Long = entity.contentLength
+ override fun close() {
+ parts.forEach { it.body.close() }
+ }
- override fun repeatable(): Boolean = entity.isRepeatable
+ class Builder {
+ private val boundary = UUID.randomUUID().toString()
+ private val parts: MutableList = mutableListOf()
- override fun close() = entity.close()
+ fun addPart(part: Part) = apply { parts.add(part) }
+
+ fun build() = MultipartBody(boundary, parts.toImmutable())
+ }
+
+ class Part
+ private constructor(
+ val contentDisposition: String,
+ val contentType: String,
+ val body: HttpRequestBody,
+ ) {
+ companion object {
+ fun create(
+ name: String,
+ filename: String?,
+ contentType: String,
+ body: HttpRequestBody,
+ ): Part {
+ val disposition = buildString {
+ append("form-data; name=")
+ appendQuotedString(name)
+ if (filename != null) {
+ append("; filename=")
+ appendQuotedString(filename)
+ }
+ }
+ return Part(disposition, contentType, body)
+ }
+ }
+ }
+
+ companion object {
+ private val CRLF = byteArrayOf('\r'.code.toByte(), '\n'.code.toByte())
+ private val DASHDASH = byteArrayOf('-'.code.toByte(), '-'.code.toByte())
+ private val CONTENT_DISPOSITION = "Content-Disposition: ".toByteArray()
+ private val CONTENT_TYPE = "Content-Type: ".toByteArray()
+
+ private fun StringBuilder.appendQuotedString(key: String) {
+ append('"')
+ for (ch in key) {
+ when (ch) {
+ '\n' -> append("%0A")
+ '\r' -> append("%0D")
+ '"' -> append("%22")
+ else -> append(ch)
+ }
+ }
+ append('"')
+ }
}
+}
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/core/http/RetryingHttpClient.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/core/http/RetryingHttpClient.kt
index 5d2ac94f..a70bc12c 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/core/http/RetryingHttpClient.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/core/http/RetryingHttpClient.kt
@@ -1,3 +1,5 @@
+// File generated from our OpenAPI spec by Stainless.
+
package com.lithic.api.core.http
import com.lithic.api.core.DefaultSleeper
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderEntity.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderEntity.kt
new file mode 100644
index 00000000..47572e3d
--- /dev/null
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderEntity.kt
@@ -0,0 +1,1194 @@
+// 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.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.checkRequired
+import com.lithic.api.errors.LithicInvalidDataException
+import java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** Information about an entity associated with an account holder */
+class AccountHolderEntity
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val token: JsonField,
+ private val accountHolderToken: JsonField,
+ private val address: JsonField,
+ private val dob: JsonField,
+ private val email: JsonField,
+ private val firstName: JsonField,
+ private val lastName: JsonField,
+ private val phoneNumber: JsonField,
+ private val status: JsonField,
+ private val type: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(),
+ @JsonProperty("account_holder_token")
+ @ExcludeMissing
+ accountHolderToken: JsonField = JsonMissing.of(),
+ @JsonProperty("address") @ExcludeMissing address: JsonField = JsonMissing.of(),
+ @JsonProperty("dob") @ExcludeMissing dob: JsonField = JsonMissing.of(),
+ @JsonProperty("email") @ExcludeMissing email: JsonField = JsonMissing.of(),
+ @JsonProperty("first_name") @ExcludeMissing firstName: JsonField = JsonMissing.of(),
+ @JsonProperty("last_name") @ExcludeMissing lastName: JsonField = JsonMissing.of(),
+ @JsonProperty("phone_number")
+ @ExcludeMissing
+ phoneNumber: JsonField = JsonMissing.of(),
+ @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(),
+ ) : this(
+ token,
+ accountHolderToken,
+ address,
+ dob,
+ email,
+ firstName,
+ lastName,
+ phoneNumber,
+ status,
+ type,
+ mutableMapOf(),
+ )
+
+ /**
+ * Globally unique identifier for the entity
+ *
+ * @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")
+
+ /**
+ * Globally unique identifier for the account holder
+ *
+ * @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 accountHolderToken(): String = accountHolderToken.getRequired("account_holder_token")
+
+ /**
+ * Individual's current address
+ *
+ * @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 address(): Address = address.getRequired("address")
+
+ /**
+ * Individual's date of birth, as an RFC 3339 date
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun dob(): Optional = dob.getOptional("dob")
+
+ /**
+ * Individual's email address
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun email(): Optional = email.getOptional("email")
+
+ /**
+ * Individual's first name, as it appears on government-issued identity documents
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun firstName(): Optional = firstName.getOptional("first_name")
+
+ /**
+ * Individual's last name, as it appears on government-issued identity documents
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun lastName(): Optional = lastName.getOptional("last_name")
+
+ /**
+ * Individual's phone number, entered in E.164 format
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun phoneNumber(): Optional = phoneNumber.getOptional("phone_number")
+
+ /**
+ * The status of the entity
+ *
+ * @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(): EntityStatus = status.getRequired("status")
+
+ /**
+ * The type of entity
+ *
+ * @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 type(): EntityType = type.getRequired("type")
+
+ /**
+ * 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 [accountHolderToken].
+ *
+ * Unlike [accountHolderToken], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("account_holder_token")
+ @ExcludeMissing
+ fun _accountHolderToken(): JsonField = accountHolderToken
+
+ /**
+ * Returns the raw JSON value of [address].
+ *
+ * Unlike [address], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("address") @ExcludeMissing fun _address(): JsonField = address
+
+ /**
+ * Returns the raw JSON value of [dob].
+ *
+ * Unlike [dob], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("dob") @ExcludeMissing fun _dob(): JsonField = dob
+
+ /**
+ * Returns the raw JSON value of [email].
+ *
+ * Unlike [email], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("email") @ExcludeMissing fun _email(): JsonField = email
+
+ /**
+ * Returns the raw JSON value of [firstName].
+ *
+ * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName
+
+ /**
+ * Returns the raw JSON value of [lastName].
+ *
+ * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName
+
+ /**
+ * Returns the raw JSON value of [phoneNumber].
+ *
+ * Unlike [phoneNumber], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("phone_number")
+ @ExcludeMissing
+ fun _phoneNumber(): JsonField = phoneNumber
+
+ /**
+ * 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 [type].
+ *
+ * Unlike [type], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type
+
+ @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 [AccountHolderEntity].
+ *
+ * The following fields are required:
+ * ```java
+ * .token()
+ * .accountHolderToken()
+ * .address()
+ * .dob()
+ * .email()
+ * .firstName()
+ * .lastName()
+ * .phoneNumber()
+ * .status()
+ * .type()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AccountHolderEntity]. */
+ class Builder internal constructor() {
+
+ private var token: JsonField? = null
+ private var accountHolderToken: JsonField? = null
+ private var address: JsonField? = null
+ private var dob: JsonField? = null
+ private var email: JsonField? = null
+ private var firstName: JsonField? = null
+ private var lastName: JsonField? = null
+ private var phoneNumber: JsonField? = null
+ private var status: JsonField? = null
+ private var type: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(accountHolderEntity: AccountHolderEntity) = apply {
+ token = accountHolderEntity.token
+ accountHolderToken = accountHolderEntity.accountHolderToken
+ address = accountHolderEntity.address
+ dob = accountHolderEntity.dob
+ email = accountHolderEntity.email
+ firstName = accountHolderEntity.firstName
+ lastName = accountHolderEntity.lastName
+ phoneNumber = accountHolderEntity.phoneNumber
+ status = accountHolderEntity.status
+ type = accountHolderEntity.type
+ additionalProperties = accountHolderEntity.additionalProperties.toMutableMap()
+ }
+
+ /** Globally unique identifier for the entity */
+ 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 }
+
+ /** Globally unique identifier for the account holder */
+ fun accountHolderToken(accountHolderToken: String) =
+ accountHolderToken(JsonField.of(accountHolderToken))
+
+ /**
+ * Sets [Builder.accountHolderToken] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.accountHolderToken] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun accountHolderToken(accountHolderToken: JsonField) = apply {
+ this.accountHolderToken = accountHolderToken
+ }
+
+ /** Individual's current address */
+ fun address(address: Address) = address(JsonField.of(address))
+
+ /**
+ * Sets [Builder.address] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.address] with a well-typed [Address] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun address(address: JsonField) = apply { this.address = address }
+
+ /** Individual's date of birth, as an RFC 3339 date */
+ fun dob(dob: String?) = dob(JsonField.ofNullable(dob))
+
+ /** Alias for calling [Builder.dob] with `dob.orElse(null)`. */
+ fun dob(dob: Optional) = dob(dob.getOrNull())
+
+ /**
+ * Sets [Builder.dob] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.dob] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun dob(dob: JsonField) = apply { this.dob = dob }
+
+ /** Individual's email address */
+ fun email(email: String?) = email(JsonField.ofNullable(email))
+
+ /** Alias for calling [Builder.email] with `email.orElse(null)`. */
+ fun email(email: Optional) = email(email.getOrNull())
+
+ /**
+ * Sets [Builder.email] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.email] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun email(email: JsonField) = apply { this.email = email }
+
+ /** Individual's first name, as it appears on government-issued identity documents */
+ fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName))
+
+ /** Alias for calling [Builder.firstName] with `firstName.orElse(null)`. */
+ fun firstName(firstName: Optional) = firstName(firstName.getOrNull())
+
+ /**
+ * Sets [Builder.firstName] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.firstName] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun firstName(firstName: JsonField) = apply { this.firstName = firstName }
+
+ /** Individual's last name, as it appears on government-issued identity documents */
+ fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName))
+
+ /** Alias for calling [Builder.lastName] with `lastName.orElse(null)`. */
+ fun lastName(lastName: Optional) = lastName(lastName.getOrNull())
+
+ /**
+ * Sets [Builder.lastName] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.lastName] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun lastName(lastName: JsonField) = apply { this.lastName = lastName }
+
+ /** Individual's phone number, entered in E.164 format */
+ fun phoneNumber(phoneNumber: String?) = phoneNumber(JsonField.ofNullable(phoneNumber))
+
+ /** Alias for calling [Builder.phoneNumber] with `phoneNumber.orElse(null)`. */
+ fun phoneNumber(phoneNumber: Optional) = phoneNumber(phoneNumber.getOrNull())
+
+ /**
+ * Sets [Builder.phoneNumber] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.phoneNumber] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun phoneNumber(phoneNumber: JsonField) = apply { this.phoneNumber = phoneNumber }
+
+ /** The status of the entity */
+ fun status(status: EntityStatus) = status(JsonField.of(status))
+
+ /**
+ * Sets [Builder.status] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.status] with a well-typed [EntityStatus] 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 }
+
+ /** The type of entity */
+ fun type(type: EntityType) = type(JsonField.of(type))
+
+ /**
+ * Sets [Builder.type] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.type] with a well-typed [EntityType] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun type(type: JsonField) = apply { this.type = type }
+
+ 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 [AccountHolderEntity].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .token()
+ * .accountHolderToken()
+ * .address()
+ * .dob()
+ * .email()
+ * .firstName()
+ * .lastName()
+ * .phoneNumber()
+ * .status()
+ * .type()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AccountHolderEntity =
+ AccountHolderEntity(
+ checkRequired("token", token),
+ checkRequired("accountHolderToken", accountHolderToken),
+ checkRequired("address", address),
+ checkRequired("dob", dob),
+ checkRequired("email", email),
+ checkRequired("firstName", firstName),
+ checkRequired("lastName", lastName),
+ checkRequired("phoneNumber", phoneNumber),
+ checkRequired("status", status),
+ checkRequired("type", type),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): AccountHolderEntity = apply {
+ if (validated) {
+ return@apply
+ }
+
+ token()
+ accountHolderToken()
+ address().validate()
+ dob()
+ email()
+ firstName()
+ lastName()
+ phoneNumber()
+ status().validate()
+ type().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 =
+ (if (token.asKnown().isPresent) 1 else 0) +
+ (if (accountHolderToken.asKnown().isPresent) 1 else 0) +
+ (address.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (dob.asKnown().isPresent) 1 else 0) +
+ (if (email.asKnown().isPresent) 1 else 0) +
+ (if (firstName.asKnown().isPresent) 1 else 0) +
+ (if (lastName.asKnown().isPresent) 1 else 0) +
+ (if (phoneNumber.asKnown().isPresent) 1 else 0) +
+ (status.asKnown().getOrNull()?.validity() ?: 0) +
+ (type.asKnown().getOrNull()?.validity() ?: 0)
+
+ /** Individual's current address */
+ class Address
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val address1: JsonField,
+ private val city: JsonField,
+ private val country: JsonField,
+ private val postalCode: JsonField,
+ private val state: JsonField,
+ private val address2: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("address1")
+ @ExcludeMissing
+ address1: JsonField = JsonMissing.of(),
+ @JsonProperty("city") @ExcludeMissing city: JsonField = JsonMissing.of(),
+ @JsonProperty("country") @ExcludeMissing country: JsonField = JsonMissing.of(),
+ @JsonProperty("postal_code")
+ @ExcludeMissing
+ postalCode: JsonField = JsonMissing.of(),
+ @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(),
+ @JsonProperty("address2") @ExcludeMissing address2: JsonField = JsonMissing.of(),
+ ) : this(address1, city, country, postalCode, state, address2, mutableMapOf())
+
+ /**
+ * Valid deliverable address (no PO boxes).
+ *
+ * @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 address1(): String = address1.getRequired("address1")
+
+ /**
+ * Name of city.
+ *
+ * @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 city(): String = city.getRequired("city")
+
+ /**
+ * Valid country code. Only USA is currently supported, entered in uppercase ISO 3166-1
+ * alpha-3 three-character 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 country(): String = country.getRequired("country")
+
+ /**
+ * Valid postal code. Only USA ZIP codes are currently supported, entered as a five-digit
+ * ZIP or nine-digit ZIP+4.
+ *
+ * @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 postalCode(): String = postalCode.getRequired("postal_code")
+
+ /**
+ * Valid state code. Only USA state codes are currently supported, entered in uppercase ISO
+ * 3166-2 two-character 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 state(): String = state.getRequired("state")
+
+ /**
+ * Unit or apartment number (if applicable).
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun address2(): Optional = address2.getOptional("address2")
+
+ /**
+ * Returns the raw JSON value of [address1].
+ *
+ * Unlike [address1], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("address1") @ExcludeMissing fun _address1(): JsonField = address1
+
+ /**
+ * Returns the raw JSON value of [city].
+ *
+ * Unlike [city], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city
+
+ /**
+ * Returns the raw JSON value of [country].
+ *
+ * Unlike [country], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country
+
+ /**
+ * Returns the raw JSON value of [postalCode].
+ *
+ * Unlike [postalCode], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("postal_code")
+ @ExcludeMissing
+ fun _postalCode(): JsonField = postalCode
+
+ /**
+ * Returns the raw JSON value of [state].
+ *
+ * Unlike [state], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state
+
+ /**
+ * Returns the raw JSON value of [address2].
+ *
+ * Unlike [address2], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("address2") @ExcludeMissing fun _address2(): JsonField = address2
+
+ @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 [Address].
+ *
+ * The following fields are required:
+ * ```java
+ * .address1()
+ * .city()
+ * .country()
+ * .postalCode()
+ * .state()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Address]. */
+ class Builder internal constructor() {
+
+ private var address1: JsonField? = null
+ private var city: JsonField? = null
+ private var country: JsonField? = null
+ private var postalCode: JsonField? = null
+ private var state: JsonField? = null
+ private var address2: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(address: Address) = apply {
+ address1 = address.address1
+ city = address.city
+ country = address.country
+ postalCode = address.postalCode
+ state = address.state
+ address2 = address.address2
+ additionalProperties = address.additionalProperties.toMutableMap()
+ }
+
+ /** Valid deliverable address (no PO boxes). */
+ fun address1(address1: String) = address1(JsonField.of(address1))
+
+ /**
+ * Sets [Builder.address1] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.address1] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun address1(address1: JsonField) = apply { this.address1 = address1 }
+
+ /** Name of city. */
+ fun city(city: String) = city(JsonField.of(city))
+
+ /**
+ * Sets [Builder.city] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.city] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun city(city: JsonField) = apply { this.city = city }
+
+ /**
+ * Valid country code. Only USA is currently supported, entered in uppercase ISO 3166-1
+ * alpha-3 three-character format.
+ */
+ fun country(country: String) = country(JsonField.of(country))
+
+ /**
+ * Sets [Builder.country] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.country] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun country(country: JsonField) = apply { this.country = country }
+
+ /**
+ * Valid postal code. Only USA ZIP codes are currently supported, entered as a
+ * five-digit ZIP or nine-digit ZIP+4.
+ */
+ fun postalCode(postalCode: String) = postalCode(JsonField.of(postalCode))
+
+ /**
+ * Sets [Builder.postalCode] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.postalCode] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode }
+
+ /**
+ * Valid state code. Only USA state codes are currently supported, entered in uppercase
+ * ISO 3166-2 two-character format.
+ */
+ fun state(state: String) = state(JsonField.of(state))
+
+ /**
+ * Sets [Builder.state] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.state] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun state(state: JsonField) = apply { this.state = state }
+
+ /** Unit or apartment number (if applicable). */
+ fun address2(address2: String) = address2(JsonField.of(address2))
+
+ /**
+ * Sets [Builder.address2] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.address2] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun address2(address2: JsonField) = apply { this.address2 = address2 }
+
+ 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 [Address].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .address1()
+ * .city()
+ * .country()
+ * .postalCode()
+ * .state()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Address =
+ Address(
+ checkRequired("address1", address1),
+ checkRequired("city", city),
+ checkRequired("country", country),
+ checkRequired("postalCode", postalCode),
+ checkRequired("state", state),
+ address2,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Address = apply {
+ if (validated) {
+ return@apply
+ }
+
+ address1()
+ city()
+ country()
+ postalCode()
+ state()
+ address2()
+ 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 (address1.asKnown().isPresent) 1 else 0) +
+ (if (city.asKnown().isPresent) 1 else 0) +
+ (if (country.asKnown().isPresent) 1 else 0) +
+ (if (postalCode.asKnown().isPresent) 1 else 0) +
+ (if (state.asKnown().isPresent) 1 else 0) +
+ (if (address2.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Address &&
+ address1 == other.address1 &&
+ city == other.city &&
+ country == other.country &&
+ postalCode == other.postalCode &&
+ state == other.state &&
+ address2 == other.address2 &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(address1, city, country, postalCode, state, address2, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Address{address1=$address1, city=$city, country=$country, postalCode=$postalCode, state=$state, address2=$address2, additionalProperties=$additionalProperties}"
+ }
+
+ /** The status of the entity */
+ class EntityStatus @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 ACCEPTED = of("ACCEPTED")
+
+ @JvmField val INACTIVE = of("INACTIVE")
+
+ @JvmField val PENDING_REVIEW = of("PENDING_REVIEW")
+
+ @JvmField val REJECTED = of("REJECTED")
+
+ @JvmStatic fun of(value: String) = EntityStatus(JsonField.of(value))
+ }
+
+ /** An enum containing [EntityStatus]'s known values. */
+ enum class Known {
+ ACCEPTED,
+ INACTIVE,
+ PENDING_REVIEW,
+ REJECTED,
+ }
+
+ /**
+ * An enum containing [EntityStatus]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [EntityStatus] 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 {
+ ACCEPTED,
+ INACTIVE,
+ PENDING_REVIEW,
+ REJECTED,
+ /**
+ * An enum member indicating that [EntityStatus] 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) {
+ ACCEPTED -> Value.ACCEPTED
+ INACTIVE -> Value.INACTIVE
+ PENDING_REVIEW -> Value.PENDING_REVIEW
+ REJECTED -> Value.REJECTED
+ 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) {
+ ACCEPTED -> Known.ACCEPTED
+ INACTIVE -> Known.INACTIVE
+ PENDING_REVIEW -> Known.PENDING_REVIEW
+ REJECTED -> Known.REJECTED
+ else -> throw LithicInvalidDataException("Unknown EntityStatus: $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(): EntityStatus = 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 other is EntityStatus && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ /** The type of entity */
+ class EntityType @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 BENEFICIAL_OWNER_INDIVIDUAL = of("BENEFICIAL_OWNER_INDIVIDUAL")
+
+ @JvmField val CONTROL_PERSON = of("CONTROL_PERSON")
+
+ @JvmStatic fun of(value: String) = EntityType(JsonField.of(value))
+ }
+
+ /** An enum containing [EntityType]'s known values. */
+ enum class Known {
+ BENEFICIAL_OWNER_INDIVIDUAL,
+ CONTROL_PERSON,
+ }
+
+ /**
+ * An enum containing [EntityType]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [EntityType] 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 {
+ BENEFICIAL_OWNER_INDIVIDUAL,
+ CONTROL_PERSON,
+ /**
+ * An enum member indicating that [EntityType] 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) {
+ BENEFICIAL_OWNER_INDIVIDUAL -> Value.BENEFICIAL_OWNER_INDIVIDUAL
+ CONTROL_PERSON -> Value.CONTROL_PERSON
+ 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) {
+ BENEFICIAL_OWNER_INDIVIDUAL -> Known.BENEFICIAL_OWNER_INDIVIDUAL
+ CONTROL_PERSON -> Known.CONTROL_PERSON
+ else -> throw LithicInvalidDataException("Unknown EntityType: $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(): EntityType = 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 other is EntityType && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AccountHolderEntity &&
+ token == other.token &&
+ accountHolderToken == other.accountHolderToken &&
+ address == other.address &&
+ dob == other.dob &&
+ email == other.email &&
+ firstName == other.firstName &&
+ lastName == other.lastName &&
+ phoneNumber == other.phoneNumber &&
+ status == other.status &&
+ type == other.type &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(
+ token,
+ accountHolderToken,
+ address,
+ dob,
+ email,
+ firstName,
+ lastName,
+ phoneNumber,
+ status,
+ type,
+ additionalProperties,
+ )
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "AccountHolderEntity{token=$token, accountHolderToken=$accountHolderToken, address=$address, dob=$dob, email=$email, firstName=$firstName, lastName=$lastName, phoneNumber=$phoneNumber, status=$status, type=$type, additionalProperties=$additionalProperties}"
+}
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderEntityCreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderEntityCreateParams.kt
new file mode 100644
index 00000000..c3bd16e4
--- /dev/null
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderEntityCreateParams.kt
@@ -0,0 +1,1491 @@
+// 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.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.Params
+import com.lithic.api.core.checkRequired
+import com.lithic.api.core.http.Headers
+import com.lithic.api.core.http.QueryParams
+import com.lithic.api.errors.LithicInvalidDataException
+import java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/**
+ * Create a new beneficial owner or replace the control person entity on an existing KYB account
+ * holder. This endpoint is only applicable for account holders enrolled through a KYB workflow with
+ * the Persona KYB provider. A new control person can only replace the existing one. A maximum of 4
+ * beneficial owners can be associated with an account holder.
+ */
+class AccountHolderEntityCreateParams
+private constructor(
+ private val accountHolderToken: String?,
+ private val body: CreateEntityRequest,
+ private val additionalHeaders: Headers,
+ private val additionalQueryParams: QueryParams,
+) : Params {
+
+ fun accountHolderToken(): Optional = Optional.ofNullable(accountHolderToken)
+
+ /**
+ * Individual's current address - PO boxes, UPS drops, and FedEx drops are not acceptable;
+ * APO/FPO are acceptable. Only USA addresses are currently supported.
+ *
+ * @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 address(): Address = body.address()
+
+ /**
+ * Individual's date of birth, as an RFC 3339 date.
+ *
+ * @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 dob(): String = body.dob()
+
+ /**
+ * Individual's email address. If utilizing Lithic for chargeback processing, this customer
+ * email address may be used to communicate dispute status and resolution.
+ *
+ * @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 email(): String = body.email()
+
+ /**
+ * Individual's first name, as it appears on government-issued identity documents.
+ *
+ * @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 firstName(): String = body.firstName()
+
+ /**
+ * Government-issued identification number (required for identity verification and compliance
+ * with banking regulations). Social Security Numbers (SSN) and Individual Taxpayer
+ * Identification Numbers (ITIN) are currently supported, entered as full nine-digits, with or
+ * without hyphens
+ *
+ * @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 governmentId(): String = body.governmentId()
+
+ /**
+ * Individual's last name, as it appears on government-issued identity documents.
+ *
+ * @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 lastName(): String = body.lastName()
+
+ /**
+ * Individual's phone number, entered in E.164 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 phoneNumber(): String = body.phoneNumber()
+
+ /**
+ * The type of entity to create on the account holder
+ *
+ * @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 type(): EntityType = body.type()
+
+ /**
+ * Returns the raw JSON value of [address].
+ *
+ * Unlike [address], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _address(): JsonField = body._address()
+
+ /**
+ * Returns the raw JSON value of [dob].
+ *
+ * Unlike [dob], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _dob(): JsonField = body._dob()
+
+ /**
+ * Returns the raw JSON value of [email].
+ *
+ * Unlike [email], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _email(): JsonField = body._email()
+
+ /**
+ * Returns the raw JSON value of [firstName].
+ *
+ * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _firstName(): JsonField = body._firstName()
+
+ /**
+ * Returns the raw JSON value of [governmentId].
+ *
+ * Unlike [governmentId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _governmentId(): JsonField = body._governmentId()
+
+ /**
+ * Returns the raw JSON value of [lastName].
+ *
+ * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _lastName(): JsonField = body._lastName()
+
+ /**
+ * Returns the raw JSON value of [phoneNumber].
+ *
+ * Unlike [phoneNumber], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _phoneNumber(): JsonField = body._phoneNumber()
+
+ /**
+ * Returns the raw JSON value of [type].
+ *
+ * Unlike [type], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _type(): JsonField = body._type()
+
+ fun _additionalBodyProperties(): Map = body._additionalProperties()
+
+ /** 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 {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [AccountHolderEntityCreateParams].
+ *
+ * The following fields are required:
+ * ```java
+ * .address()
+ * .dob()
+ * .email()
+ * .firstName()
+ * .governmentId()
+ * .lastName()
+ * .phoneNumber()
+ * .type()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AccountHolderEntityCreateParams]. */
+ class Builder internal constructor() {
+
+ private var accountHolderToken: String? = null
+ private var body: CreateEntityRequest.Builder = CreateEntityRequest.builder()
+ private var additionalHeaders: Headers.Builder = Headers.builder()
+ private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
+
+ @JvmSynthetic
+ internal fun from(accountHolderEntityCreateParams: AccountHolderEntityCreateParams) =
+ apply {
+ accountHolderToken = accountHolderEntityCreateParams.accountHolderToken
+ body = accountHolderEntityCreateParams.body.toBuilder()
+ additionalHeaders = accountHolderEntityCreateParams.additionalHeaders.toBuilder()
+ additionalQueryParams =
+ accountHolderEntityCreateParams.additionalQueryParams.toBuilder()
+ }
+
+ fun accountHolderToken(accountHolderToken: String?) = apply {
+ this.accountHolderToken = accountHolderToken
+ }
+
+ /**
+ * Alias for calling [Builder.accountHolderToken] with `accountHolderToken.orElse(null)`.
+ */
+ fun accountHolderToken(accountHolderToken: Optional) =
+ accountHolderToken(accountHolderToken.getOrNull())
+
+ /**
+ * Sets the entire request body.
+ *
+ * This is generally only useful if you are already constructing the body separately.
+ * Otherwise, it's more convenient to use the top-level setters instead:
+ * - [address]
+ * - [dob]
+ * - [email]
+ * - [firstName]
+ * - [governmentId]
+ * - etc.
+ */
+ fun body(body: CreateEntityRequest) = apply { this.body = body.toBuilder() }
+
+ /**
+ * Individual's current address - PO boxes, UPS drops, and FedEx drops are not acceptable;
+ * APO/FPO are acceptable. Only USA addresses are currently supported.
+ */
+ fun address(address: Address) = apply { body.address(address) }
+
+ /**
+ * Sets [Builder.address] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.address] with a well-typed [Address] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun address(address: JsonField) = apply { body.address(address) }
+
+ /** Individual's date of birth, as an RFC 3339 date. */
+ fun dob(dob: String) = apply { body.dob(dob) }
+
+ /**
+ * Sets [Builder.dob] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.dob] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun dob(dob: JsonField) = apply { body.dob(dob) }
+
+ /**
+ * Individual's email address. If utilizing Lithic for chargeback processing, this customer
+ * email address may be used to communicate dispute status and resolution.
+ */
+ fun email(email: String) = apply { body.email(email) }
+
+ /**
+ * Sets [Builder.email] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.email] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun email(email: JsonField) = apply { body.email(email) }
+
+ /** Individual's first name, as it appears on government-issued identity documents. */
+ fun firstName(firstName: String) = apply { body.firstName(firstName) }
+
+ /**
+ * Sets [Builder.firstName] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.firstName] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun firstName(firstName: JsonField) = apply { body.firstName(firstName) }
+
+ /**
+ * Government-issued identification number (required for identity verification and
+ * compliance with banking regulations). Social Security Numbers (SSN) and Individual
+ * Taxpayer Identification Numbers (ITIN) are currently supported, entered as full
+ * nine-digits, with or without hyphens
+ */
+ fun governmentId(governmentId: String) = apply { body.governmentId(governmentId) }
+
+ /**
+ * Sets [Builder.governmentId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.governmentId] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun governmentId(governmentId: JsonField) = apply {
+ body.governmentId(governmentId)
+ }
+
+ /** Individual's last name, as it appears on government-issued identity documents. */
+ fun lastName(lastName: String) = apply { body.lastName(lastName) }
+
+ /**
+ * Sets [Builder.lastName] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.lastName] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun lastName(lastName: JsonField) = apply { body.lastName(lastName) }
+
+ /** Individual's phone number, entered in E.164 format. */
+ fun phoneNumber(phoneNumber: String) = apply { body.phoneNumber(phoneNumber) }
+
+ /**
+ * Sets [Builder.phoneNumber] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.phoneNumber] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun phoneNumber(phoneNumber: JsonField) = apply { body.phoneNumber(phoneNumber) }
+
+ /** The type of entity to create on the account holder */
+ fun type(type: EntityType) = apply { body.type(type) }
+
+ /**
+ * Sets [Builder.type] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.type] with a well-typed [EntityType] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun type(type: JsonField) = apply { body.type(type) }
+
+ fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
+ body.additionalProperties(additionalBodyProperties)
+ }
+
+ fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
+ body.putAdditionalProperty(key, value)
+ }
+
+ fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) =
+ apply {
+ body.putAllAdditionalProperties(additionalBodyProperties)
+ }
+
+ fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) }
+
+ fun removeAllAdditionalBodyProperties(keys: Set) = apply {
+ body.removeAllAdditionalProperties(keys)
+ }
+
+ 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 [AccountHolderEntityCreateParams].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .address()
+ * .dob()
+ * .email()
+ * .firstName()
+ * .governmentId()
+ * .lastName()
+ * .phoneNumber()
+ * .type()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AccountHolderEntityCreateParams =
+ AccountHolderEntityCreateParams(
+ accountHolderToken,
+ body.build(),
+ additionalHeaders.build(),
+ additionalQueryParams.build(),
+ )
+ }
+
+ fun _body(): CreateEntityRequest = body
+
+ fun _pathParam(index: Int): String =
+ when (index) {
+ 0 -> accountHolderToken ?: ""
+ else -> ""
+ }
+
+ override fun _headers(): Headers = additionalHeaders
+
+ override fun _queryParams(): QueryParams = additionalQueryParams
+
+ /**
+ * Request body for creating a new beneficial owner or replacing the control person entity on an
+ * existing KYB account holder.
+ */
+ class CreateEntityRequest
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val address: JsonField,
+ private val dob: JsonField,
+ private val email: JsonField,
+ private val firstName: JsonField,
+ private val governmentId: JsonField,
+ private val lastName: JsonField,
+ private val phoneNumber: JsonField,
+ private val type: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("address") @ExcludeMissing address: JsonField = JsonMissing.of(),
+ @JsonProperty("dob") @ExcludeMissing dob: JsonField = JsonMissing.of(),
+ @JsonProperty("email") @ExcludeMissing email: JsonField = JsonMissing.of(),
+ @JsonProperty("first_name")
+ @ExcludeMissing
+ firstName: JsonField = JsonMissing.of(),
+ @JsonProperty("government_id")
+ @ExcludeMissing
+ governmentId: JsonField = JsonMissing.of(),
+ @JsonProperty("last_name")
+ @ExcludeMissing
+ lastName: JsonField = JsonMissing.of(),
+ @JsonProperty("phone_number")
+ @ExcludeMissing
+ phoneNumber: JsonField = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(),
+ ) : this(
+ address,
+ dob,
+ email,
+ firstName,
+ governmentId,
+ lastName,
+ phoneNumber,
+ type,
+ mutableMapOf(),
+ )
+
+ /**
+ * Individual's current address - PO boxes, UPS drops, and FedEx drops are not acceptable;
+ * APO/FPO are acceptable. Only USA addresses are currently supported.
+ *
+ * @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 address(): Address = address.getRequired("address")
+
+ /**
+ * Individual's date of birth, as an RFC 3339 date.
+ *
+ * @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 dob(): String = dob.getRequired("dob")
+
+ /**
+ * Individual's email address. If utilizing Lithic for chargeback processing, this customer
+ * email address may be used to communicate dispute status and resolution.
+ *
+ * @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 email(): String = email.getRequired("email")
+
+ /**
+ * Individual's first name, as it appears on government-issued identity documents.
+ *
+ * @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 firstName(): String = firstName.getRequired("first_name")
+
+ /**
+ * Government-issued identification number (required for identity verification and
+ * compliance with banking regulations). Social Security Numbers (SSN) and Individual
+ * Taxpayer Identification Numbers (ITIN) are currently supported, entered as full
+ * nine-digits, with or without hyphens
+ *
+ * @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 governmentId(): String = governmentId.getRequired("government_id")
+
+ /**
+ * Individual's last name, as it appears on government-issued identity documents.
+ *
+ * @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 lastName(): String = lastName.getRequired("last_name")
+
+ /**
+ * Individual's phone number, entered in E.164 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 phoneNumber(): String = phoneNumber.getRequired("phone_number")
+
+ /**
+ * The type of entity to create on the account holder
+ *
+ * @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 type(): EntityType = type.getRequired("type")
+
+ /**
+ * Returns the raw JSON value of [address].
+ *
+ * Unlike [address], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("address") @ExcludeMissing fun _address(): JsonField = address
+
+ /**
+ * Returns the raw JSON value of [dob].
+ *
+ * Unlike [dob], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("dob") @ExcludeMissing fun _dob(): JsonField = dob
+
+ /**
+ * Returns the raw JSON value of [email].
+ *
+ * Unlike [email], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("email") @ExcludeMissing fun _email(): JsonField = email
+
+ /**
+ * Returns the raw JSON value of [firstName].
+ *
+ * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName
+
+ /**
+ * Returns the raw JSON value of [governmentId].
+ *
+ * Unlike [governmentId], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("government_id")
+ @ExcludeMissing
+ fun _governmentId(): JsonField = governmentId
+
+ /**
+ * Returns the raw JSON value of [lastName].
+ *
+ * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName
+
+ /**
+ * Returns the raw JSON value of [phoneNumber].
+ *
+ * Unlike [phoneNumber], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("phone_number")
+ @ExcludeMissing
+ fun _phoneNumber(): JsonField = phoneNumber
+
+ /**
+ * Returns the raw JSON value of [type].
+ *
+ * Unlike [type], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type
+
+ @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 [CreateEntityRequest].
+ *
+ * The following fields are required:
+ * ```java
+ * .address()
+ * .dob()
+ * .email()
+ * .firstName()
+ * .governmentId()
+ * .lastName()
+ * .phoneNumber()
+ * .type()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [CreateEntityRequest]. */
+ class Builder internal constructor() {
+
+ private var address: JsonField? = null
+ private var dob: JsonField? = null
+ private var email: JsonField? = null
+ private var firstName: JsonField? = null
+ private var governmentId: JsonField? = null
+ private var lastName: JsonField? = null
+ private var phoneNumber: JsonField? = null
+ private var type: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(createEntityRequest: CreateEntityRequest) = apply {
+ address = createEntityRequest.address
+ dob = createEntityRequest.dob
+ email = createEntityRequest.email
+ firstName = createEntityRequest.firstName
+ governmentId = createEntityRequest.governmentId
+ lastName = createEntityRequest.lastName
+ phoneNumber = createEntityRequest.phoneNumber
+ type = createEntityRequest.type
+ additionalProperties = createEntityRequest.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * Individual's current address - PO boxes, UPS drops, and FedEx drops are not
+ * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported.
+ */
+ fun address(address: Address) = address(JsonField.of(address))
+
+ /**
+ * Sets [Builder.address] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.address] with a well-typed [Address] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun address(address: JsonField) = apply { this.address = address }
+
+ /** Individual's date of birth, as an RFC 3339 date. */
+ fun dob(dob: String) = dob(JsonField.of(dob))
+
+ /**
+ * Sets [Builder.dob] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.dob] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun dob(dob: JsonField) = apply { this.dob = dob }
+
+ /**
+ * Individual's email address. If utilizing Lithic for chargeback processing, this
+ * customer email address may be used to communicate dispute status and resolution.
+ */
+ fun email(email: String) = email(JsonField.of(email))
+
+ /**
+ * Sets [Builder.email] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.email] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun email(email: JsonField) = apply { this.email = email }
+
+ /** Individual's first name, as it appears on government-issued identity documents. */
+ fun firstName(firstName: String) = firstName(JsonField.of(firstName))
+
+ /**
+ * Sets [Builder.firstName] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.firstName] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun firstName(firstName: JsonField) = apply { this.firstName = firstName }
+
+ /**
+ * Government-issued identification number (required for identity verification and
+ * compliance with banking regulations). Social Security Numbers (SSN) and Individual
+ * Taxpayer Identification Numbers (ITIN) are currently supported, entered as full
+ * nine-digits, with or without hyphens
+ */
+ fun governmentId(governmentId: String) = governmentId(JsonField.of(governmentId))
+
+ /**
+ * Sets [Builder.governmentId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.governmentId] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun governmentId(governmentId: JsonField) = apply {
+ this.governmentId = governmentId
+ }
+
+ /** Individual's last name, as it appears on government-issued identity documents. */
+ fun lastName(lastName: String) = lastName(JsonField.of(lastName))
+
+ /**
+ * Sets [Builder.lastName] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.lastName] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun lastName(lastName: JsonField) = apply { this.lastName = lastName }
+
+ /** Individual's phone number, entered in E.164 format. */
+ fun phoneNumber(phoneNumber: String) = phoneNumber(JsonField.of(phoneNumber))
+
+ /**
+ * Sets [Builder.phoneNumber] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.phoneNumber] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun phoneNumber(phoneNumber: JsonField) = apply {
+ this.phoneNumber = phoneNumber
+ }
+
+ /** The type of entity to create on the account holder */
+ fun type(type: EntityType) = type(JsonField.of(type))
+
+ /**
+ * Sets [Builder.type] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.type] with a well-typed [EntityType] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun type(type: JsonField) = apply { this.type = type }
+
+ 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 [CreateEntityRequest].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .address()
+ * .dob()
+ * .email()
+ * .firstName()
+ * .governmentId()
+ * .lastName()
+ * .phoneNumber()
+ * .type()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): CreateEntityRequest =
+ CreateEntityRequest(
+ checkRequired("address", address),
+ checkRequired("dob", dob),
+ checkRequired("email", email),
+ checkRequired("firstName", firstName),
+ checkRequired("governmentId", governmentId),
+ checkRequired("lastName", lastName),
+ checkRequired("phoneNumber", phoneNumber),
+ checkRequired("type", type),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): CreateEntityRequest = apply {
+ if (validated) {
+ return@apply
+ }
+
+ address().validate()
+ dob()
+ email()
+ firstName()
+ governmentId()
+ lastName()
+ phoneNumber()
+ type().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 =
+ (address.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (dob.asKnown().isPresent) 1 else 0) +
+ (if (email.asKnown().isPresent) 1 else 0) +
+ (if (firstName.asKnown().isPresent) 1 else 0) +
+ (if (governmentId.asKnown().isPresent) 1 else 0) +
+ (if (lastName.asKnown().isPresent) 1 else 0) +
+ (if (phoneNumber.asKnown().isPresent) 1 else 0) +
+ (type.asKnown().getOrNull()?.validity() ?: 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is CreateEntityRequest &&
+ address == other.address &&
+ dob == other.dob &&
+ email == other.email &&
+ firstName == other.firstName &&
+ governmentId == other.governmentId &&
+ lastName == other.lastName &&
+ phoneNumber == other.phoneNumber &&
+ type == other.type &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(
+ address,
+ dob,
+ email,
+ firstName,
+ governmentId,
+ lastName,
+ phoneNumber,
+ type,
+ additionalProperties,
+ )
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "CreateEntityRequest{address=$address, dob=$dob, email=$email, firstName=$firstName, governmentId=$governmentId, lastName=$lastName, phoneNumber=$phoneNumber, type=$type, additionalProperties=$additionalProperties}"
+ }
+
+ /**
+ * Individual's current address - PO boxes, UPS drops, and FedEx drops are not acceptable;
+ * APO/FPO are acceptable. Only USA addresses are currently supported.
+ */
+ class Address
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val address1: JsonField,
+ private val city: JsonField,
+ private val country: JsonField,
+ private val postalCode: JsonField,
+ private val state: JsonField,
+ private val address2: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("address1")
+ @ExcludeMissing
+ address1: JsonField = JsonMissing.of(),
+ @JsonProperty("city") @ExcludeMissing city: JsonField = JsonMissing.of(),
+ @JsonProperty("country") @ExcludeMissing country: JsonField = JsonMissing.of(),
+ @JsonProperty("postal_code")
+ @ExcludeMissing
+ postalCode: JsonField = JsonMissing.of(),
+ @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(),
+ @JsonProperty("address2") @ExcludeMissing address2: JsonField = JsonMissing.of(),
+ ) : this(address1, city, country, postalCode, state, address2, mutableMapOf())
+
+ /**
+ * Valid deliverable address (no PO boxes).
+ *
+ * @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 address1(): String = address1.getRequired("address1")
+
+ /**
+ * Name of city.
+ *
+ * @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 city(): String = city.getRequired("city")
+
+ /**
+ * Valid country code. Only USA is currently supported, entered in uppercase ISO 3166-1
+ * alpha-3 three-character 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 country(): String = country.getRequired("country")
+
+ /**
+ * Valid postal code. Only USA ZIP codes are currently supported, entered as a five-digit
+ * ZIP or nine-digit ZIP+4.
+ *
+ * @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 postalCode(): String = postalCode.getRequired("postal_code")
+
+ /**
+ * Valid state code. Only USA state codes are currently supported, entered in uppercase ISO
+ * 3166-2 two-character 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 state(): String = state.getRequired("state")
+
+ /**
+ * Unit or apartment number (if applicable).
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun address2(): Optional = address2.getOptional("address2")
+
+ /**
+ * Returns the raw JSON value of [address1].
+ *
+ * Unlike [address1], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("address1") @ExcludeMissing fun _address1(): JsonField = address1
+
+ /**
+ * Returns the raw JSON value of [city].
+ *
+ * Unlike [city], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city
+
+ /**
+ * Returns the raw JSON value of [country].
+ *
+ * Unlike [country], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country
+
+ /**
+ * Returns the raw JSON value of [postalCode].
+ *
+ * Unlike [postalCode], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("postal_code")
+ @ExcludeMissing
+ fun _postalCode(): JsonField = postalCode
+
+ /**
+ * Returns the raw JSON value of [state].
+ *
+ * Unlike [state], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state
+
+ /**
+ * Returns the raw JSON value of [address2].
+ *
+ * Unlike [address2], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("address2") @ExcludeMissing fun _address2(): JsonField = address2
+
+ @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 [Address].
+ *
+ * The following fields are required:
+ * ```java
+ * .address1()
+ * .city()
+ * .country()
+ * .postalCode()
+ * .state()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Address]. */
+ class Builder internal constructor() {
+
+ private var address1: JsonField? = null
+ private var city: JsonField? = null
+ private var country: JsonField? = null
+ private var postalCode: JsonField? = null
+ private var state: JsonField? = null
+ private var address2: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(address: Address) = apply {
+ address1 = address.address1
+ city = address.city
+ country = address.country
+ postalCode = address.postalCode
+ state = address.state
+ address2 = address.address2
+ additionalProperties = address.additionalProperties.toMutableMap()
+ }
+
+ /** Valid deliverable address (no PO boxes). */
+ fun address1(address1: String) = address1(JsonField.of(address1))
+
+ /**
+ * Sets [Builder.address1] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.address1] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun address1(address1: JsonField) = apply { this.address1 = address1 }
+
+ /** Name of city. */
+ fun city(city: String) = city(JsonField.of(city))
+
+ /**
+ * Sets [Builder.city] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.city] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun city(city: JsonField) = apply { this.city = city }
+
+ /**
+ * Valid country code. Only USA is currently supported, entered in uppercase ISO 3166-1
+ * alpha-3 three-character format.
+ */
+ fun country(country: String) = country(JsonField.of(country))
+
+ /**
+ * Sets [Builder.country] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.country] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun country(country: JsonField) = apply { this.country = country }
+
+ /**
+ * Valid postal code. Only USA ZIP codes are currently supported, entered as a
+ * five-digit ZIP or nine-digit ZIP+4.
+ */
+ fun postalCode(postalCode: String) = postalCode(JsonField.of(postalCode))
+
+ /**
+ * Sets [Builder.postalCode] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.postalCode] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode }
+
+ /**
+ * Valid state code. Only USA state codes are currently supported, entered in uppercase
+ * ISO 3166-2 two-character format.
+ */
+ fun state(state: String) = state(JsonField.of(state))
+
+ /**
+ * Sets [Builder.state] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.state] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun state(state: JsonField) = apply { this.state = state }
+
+ /** Unit or apartment number (if applicable). */
+ fun address2(address2: String) = address2(JsonField.of(address2))
+
+ /**
+ * Sets [Builder.address2] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.address2] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun address2(address2: JsonField) = apply { this.address2 = address2 }
+
+ 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 [Address].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .address1()
+ * .city()
+ * .country()
+ * .postalCode()
+ * .state()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Address =
+ Address(
+ checkRequired("address1", address1),
+ checkRequired("city", city),
+ checkRequired("country", country),
+ checkRequired("postalCode", postalCode),
+ checkRequired("state", state),
+ address2,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Address = apply {
+ if (validated) {
+ return@apply
+ }
+
+ address1()
+ city()
+ country()
+ postalCode()
+ state()
+ address2()
+ 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 (address1.asKnown().isPresent) 1 else 0) +
+ (if (city.asKnown().isPresent) 1 else 0) +
+ (if (country.asKnown().isPresent) 1 else 0) +
+ (if (postalCode.asKnown().isPresent) 1 else 0) +
+ (if (state.asKnown().isPresent) 1 else 0) +
+ (if (address2.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Address &&
+ address1 == other.address1 &&
+ city == other.city &&
+ country == other.country &&
+ postalCode == other.postalCode &&
+ state == other.state &&
+ address2 == other.address2 &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(address1, city, country, postalCode, state, address2, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Address{address1=$address1, city=$city, country=$country, postalCode=$postalCode, state=$state, address2=$address2, additionalProperties=$additionalProperties}"
+ }
+
+ /** The type of entity to create on the account holder */
+ class EntityType @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 BENEFICIAL_OWNER_INDIVIDUAL = of("BENEFICIAL_OWNER_INDIVIDUAL")
+
+ @JvmField val CONTROL_PERSON = of("CONTROL_PERSON")
+
+ @JvmStatic fun of(value: String) = EntityType(JsonField.of(value))
+ }
+
+ /** An enum containing [EntityType]'s known values. */
+ enum class Known {
+ BENEFICIAL_OWNER_INDIVIDUAL,
+ CONTROL_PERSON,
+ }
+
+ /**
+ * An enum containing [EntityType]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [EntityType] 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 {
+ BENEFICIAL_OWNER_INDIVIDUAL,
+ CONTROL_PERSON,
+ /**
+ * An enum member indicating that [EntityType] 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) {
+ BENEFICIAL_OWNER_INDIVIDUAL -> Value.BENEFICIAL_OWNER_INDIVIDUAL
+ CONTROL_PERSON -> Value.CONTROL_PERSON
+ 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) {
+ BENEFICIAL_OWNER_INDIVIDUAL -> Known.BENEFICIAL_OWNER_INDIVIDUAL
+ CONTROL_PERSON -> Known.CONTROL_PERSON
+ else -> throw LithicInvalidDataException("Unknown EntityType: $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(): EntityType = 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 other is EntityType && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AccountHolderEntityCreateParams &&
+ accountHolderToken == other.accountHolderToken &&
+ body == other.body &&
+ additionalHeaders == other.additionalHeaders &&
+ additionalQueryParams == other.additionalQueryParams
+ }
+
+ override fun hashCode(): Int =
+ Objects.hash(accountHolderToken, body, additionalHeaders, additionalQueryParams)
+
+ override fun toString() =
+ "AccountHolderEntityCreateParams{accountHolderToken=$accountHolderToken, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+}
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderEntityDeleteParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderEntityDeleteParams.kt
new file mode 100644
index 00000000..4b2486ca
--- /dev/null
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderEntityDeleteParams.kt
@@ -0,0 +1,267 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.lithic.api.models
+
+import com.lithic.api.core.JsonValue
+import com.lithic.api.core.Params
+import com.lithic.api.core.checkRequired
+import com.lithic.api.core.http.Headers
+import com.lithic.api.core.http.QueryParams
+import com.lithic.api.core.toImmutable
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/**
+ * Deactivate a beneficial owner entity on an existing KYB account holder. Only beneficial owner
+ * entities can be deactivated.
+ */
+class AccountHolderEntityDeleteParams
+private constructor(
+ private val accountHolderToken: String,
+ private val entityToken: String?,
+ private val additionalHeaders: Headers,
+ private val additionalQueryParams: QueryParams,
+ private val additionalBodyProperties: Map,
+) : Params {
+
+ fun accountHolderToken(): String = accountHolderToken
+
+ fun entityToken(): Optional = Optional.ofNullable(entityToken)
+
+ /** Additional body properties to send with the request. */
+ fun _additionalBodyProperties(): Map = additionalBodyProperties
+
+ /** 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 {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [AccountHolderEntityDeleteParams].
+ *
+ * The following fields are required:
+ * ```java
+ * .accountHolderToken()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AccountHolderEntityDeleteParams]. */
+ class Builder internal constructor() {
+
+ private var accountHolderToken: String? = null
+ private var entityToken: String? = null
+ private var additionalHeaders: Headers.Builder = Headers.builder()
+ private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
+ private var additionalBodyProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(accountHolderEntityDeleteParams: AccountHolderEntityDeleteParams) =
+ apply {
+ accountHolderToken = accountHolderEntityDeleteParams.accountHolderToken
+ entityToken = accountHolderEntityDeleteParams.entityToken
+ additionalHeaders = accountHolderEntityDeleteParams.additionalHeaders.toBuilder()
+ additionalQueryParams =
+ accountHolderEntityDeleteParams.additionalQueryParams.toBuilder()
+ additionalBodyProperties =
+ accountHolderEntityDeleteParams.additionalBodyProperties.toMutableMap()
+ }
+
+ fun accountHolderToken(accountHolderToken: String) = apply {
+ this.accountHolderToken = accountHolderToken
+ }
+
+ fun entityToken(entityToken: String?) = apply { this.entityToken = entityToken }
+
+ /** Alias for calling [Builder.entityToken] with `entityToken.orElse(null)`. */
+ fun entityToken(entityToken: Optional) = entityToken(entityToken.getOrNull())
+
+ 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)
+ }
+
+ fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
+ this.additionalBodyProperties.clear()
+ putAllAdditionalBodyProperties(additionalBodyProperties)
+ }
+
+ fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
+ additionalBodyProperties.put(key, value)
+ }
+
+ fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) =
+ apply {
+ this.additionalBodyProperties.putAll(additionalBodyProperties)
+ }
+
+ fun removeAdditionalBodyProperty(key: String) = apply {
+ additionalBodyProperties.remove(key)
+ }
+
+ fun removeAllAdditionalBodyProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalBodyProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [AccountHolderEntityDeleteParams].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .accountHolderToken()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AccountHolderEntityDeleteParams =
+ AccountHolderEntityDeleteParams(
+ checkRequired("accountHolderToken", accountHolderToken),
+ entityToken,
+ additionalHeaders.build(),
+ additionalQueryParams.build(),
+ additionalBodyProperties.toImmutable(),
+ )
+ }
+
+ fun _body(): Optional