diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 01f6bba7..6e39864d 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "7.7.0"
+ ".": "7.8.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 0092e6cf..909df852 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 45
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch/finch-f17b0106d5004cf7339990dd9a9d60dc183ed38051a862db3855fb9d953fbbf8.yml
+configured_endpoints: 48
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch/finch-5092370ef89959c46138a85f9d6d3c919682a5492a0f9f85ac4421de702f35a8.yml
openapi_spec_hash: a4ca94b3405fc83934c949068943e16c
-config_hash: ae896fec93ebd7c3bc1a6c4d6d9880ff
+config_hash: a1c4b7d897cbf8ed42c5f474b3161d79
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7831410d..8358e393 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,14 @@
# Changelog
+## 7.8.0 (2026-05-12)
+
+Full Changelog: [v7.7.0...v7.8.0](https://github.com/Finch-API/finch-api-java/compare/v7.7.0...v7.8.0)
+
+### Features
+
+* **api:** add register benefits method ([6e858e5](https://github.com/Finch-API/finch-api-java/commit/6e858e5cf21cc0a006e19444192ac43a2948f781))
+* **api:** manual updates ([ad2d05d](https://github.com/Finch-API/finch-api-java/commit/ad2d05dfca49f26443d904e242b7eea45a79fcb9))
+
## 7.7.0 (2026-05-12)
Full Changelog: [v7.6.0...v7.7.0](https://github.com/Finch-API/finch-api-java/compare/v7.6.0...v7.7.0)
diff --git a/README.md b/README.md
index 12df0aa6..5bf309db 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.tryfinch.api/finch-java/7.7.0)
-[](https://javadoc.io/doc/com.tryfinch.api/finch-java/7.7.0)
+[](https://central.sonatype.com/artifact/com.tryfinch.api/finch-java/7.8.0)
+[](https://javadoc.io/doc/com.tryfinch.api/finch-java/7.8.0)
@@ -24,7 +24,7 @@ Use the Finch MCP Server to enable AI assistants to interact with this API, allo
-The REST API documentation can be found on [developer.tryfinch.com](https://developer.tryfinch.com/). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.tryfinch.api/finch-java/7.7.0).
+The REST API documentation can be found on [developer.tryfinch.com](https://developer.tryfinch.com/). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.tryfinch.api/finch-java/7.8.0).
@@ -35,7 +35,7 @@ The REST API documentation can be found on [developer.tryfinch.com](https://deve
### Gradle
```kotlin
-implementation("com.tryfinch.api:finch-java:7.7.0")
+implementation("com.tryfinch.api:finch-java:7.8.0")
```
### Maven
@@ -44,7 +44,7 @@ implementation("com.tryfinch.api:finch-java:7.7.0")
com.tryfinch.api
finch-java
- 7.7.0
+ 7.8.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 83fd3d1c..e67a9fe5 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.tryfinch.api"
- version = "7.7.0" // x-release-please-version
+ version = "7.8.0" // x-release-please-version
}
subprojects {
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectEntityParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectEntityParams.kt
new file mode 100644
index 00000000..d3a77e94
--- /dev/null
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectEntityParams.kt
@@ -0,0 +1,460 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.tryfinch.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.tryfinch.api.core.ExcludeMissing
+import com.tryfinch.api.core.JsonField
+import com.tryfinch.api.core.JsonMissing
+import com.tryfinch.api.core.JsonValue
+import com.tryfinch.api.core.Params
+import com.tryfinch.api.core.checkKnown
+import com.tryfinch.api.core.checkRequired
+import com.tryfinch.api.core.http.Headers
+import com.tryfinch.api.core.http.QueryParams
+import com.tryfinch.api.core.toImmutable
+import com.tryfinch.api.errors.FinchInvalidDataException
+import java.util.Collections
+import java.util.Objects
+import kotlin.jvm.optionals.getOrNull
+
+/**
+ * Disconnect entity(s) from a connection without affecting other entities associated with the same
+ * connection.
+ */
+class AccountDisconnectEntityParams
+private constructor(
+ private val body: DisconnectEntityRequest,
+ private val additionalHeaders: Headers,
+ private val additionalQueryParams: QueryParams,
+) : Params {
+
+ /**
+ * Array of entity UUIDs to disconnect. At least one entity ID must be provided.
+ *
+ * @throws FinchInvalidDataException 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 entityIds(): List = body.entityIds()
+
+ /**
+ * Returns the raw JSON value of [entityIds].
+ *
+ * Unlike [entityIds], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _entityIds(): JsonField> = body._entityIds()
+
+ 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
+ * [AccountDisconnectEntityParams].
+ *
+ * The following fields are required:
+ * ```java
+ * .entityIds()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AccountDisconnectEntityParams]. */
+ class Builder internal constructor() {
+
+ private var body: DisconnectEntityRequest.Builder = DisconnectEntityRequest.builder()
+ private var additionalHeaders: Headers.Builder = Headers.builder()
+ private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
+
+ @JvmSynthetic
+ internal fun from(accountDisconnectEntityParams: AccountDisconnectEntityParams) = apply {
+ body = accountDisconnectEntityParams.body.toBuilder()
+ additionalHeaders = accountDisconnectEntityParams.additionalHeaders.toBuilder()
+ additionalQueryParams = accountDisconnectEntityParams.additionalQueryParams.toBuilder()
+ }
+
+ /**
+ * 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:
+ * - [entityIds]
+ */
+ fun body(body: DisconnectEntityRequest) = apply { this.body = body.toBuilder() }
+
+ /** Array of entity UUIDs to disconnect. At least one entity ID must be provided. */
+ fun entityIds(entityIds: List) = apply { body.entityIds(entityIds) }
+
+ /**
+ * Sets [Builder.entityIds] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.entityIds] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun entityIds(entityIds: JsonField>) = apply { body.entityIds(entityIds) }
+
+ /**
+ * Adds a single [String] to [entityIds].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addEntityId(entityId: String) = apply { body.addEntityId(entityId) }
+
+ 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 [AccountDisconnectEntityParams].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .entityIds()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AccountDisconnectEntityParams =
+ AccountDisconnectEntityParams(
+ body.build(),
+ additionalHeaders.build(),
+ additionalQueryParams.build(),
+ )
+ }
+
+ fun _body(): DisconnectEntityRequest = body
+
+ override fun _headers(): Headers = additionalHeaders
+
+ override fun _queryParams(): QueryParams = additionalQueryParams
+
+ class DisconnectEntityRequest
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val entityIds: JsonField>,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("entity_ids")
+ @ExcludeMissing
+ entityIds: JsonField> = JsonMissing.of()
+ ) : this(entityIds, mutableMapOf())
+
+ /**
+ * Array of entity UUIDs to disconnect. At least one entity ID must be provided.
+ *
+ * @throws FinchInvalidDataException 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 entityIds(): List = entityIds.getRequired("entity_ids")
+
+ /**
+ * Returns the raw JSON value of [entityIds].
+ *
+ * Unlike [entityIds], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("entity_ids")
+ @ExcludeMissing
+ fun _entityIds(): JsonField> = entityIds
+
+ @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 [DisconnectEntityRequest].
+ *
+ * The following fields are required:
+ * ```java
+ * .entityIds()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [DisconnectEntityRequest]. */
+ class Builder internal constructor() {
+
+ private var entityIds: JsonField>? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(disconnectEntityRequest: DisconnectEntityRequest) = apply {
+ entityIds = disconnectEntityRequest.entityIds.map { it.toMutableList() }
+ additionalProperties = disconnectEntityRequest.additionalProperties.toMutableMap()
+ }
+
+ /** Array of entity UUIDs to disconnect. At least one entity ID must be provided. */
+ fun entityIds(entityIds: List) = entityIds(JsonField.of(entityIds))
+
+ /**
+ * Sets [Builder.entityIds] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.entityIds] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun entityIds(entityIds: JsonField>) = apply {
+ this.entityIds = entityIds.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [String] to [entityIds].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addEntityId(entityId: String) = apply {
+ entityIds =
+ (entityIds ?: JsonField.of(mutableListOf())).also {
+ checkKnown("entityIds", it).add(entityId)
+ }
+ }
+
+ 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 [DisconnectEntityRequest].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .entityIds()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): DisconnectEntityRequest =
+ DisconnectEntityRequest(
+ checkRequired("entityIds", entityIds).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws FinchInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): DisconnectEntityRequest = apply {
+ if (validated) {
+ return@apply
+ }
+
+ entityIds()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: FinchInvalidDataException) {
+ 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 = (entityIds.asKnown().getOrNull()?.size ?: 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is DisconnectEntityRequest &&
+ entityIds == other.entityIds &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(entityIds, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "DisconnectEntityRequest{entityIds=$entityIds, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AccountDisconnectEntityParams &&
+ body == other.body &&
+ additionalHeaders == other.additionalHeaders &&
+ additionalQueryParams == other.additionalQueryParams
+ }
+
+ override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams)
+
+ override fun toString() =
+ "AccountDisconnectEntityParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+}
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectEntityResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectEntityResponse.kt
new file mode 100644
index 00000000..426f6dba
--- /dev/null
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectEntityResponse.kt
@@ -0,0 +1,181 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.tryfinch.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.tryfinch.api.core.ExcludeMissing
+import com.tryfinch.api.core.JsonField
+import com.tryfinch.api.core.JsonMissing
+import com.tryfinch.api.core.JsonValue
+import com.tryfinch.api.core.checkRequired
+import com.tryfinch.api.errors.FinchInvalidDataException
+import java.util.Collections
+import java.util.Objects
+
+class DisconnectEntityResponse
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val status: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of()
+ ) : this(status, mutableMapOf())
+
+ /**
+ * If the request is successful, Finch will return "success" (HTTP 200 status).
+ *
+ * @throws FinchInvalidDataException 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(): String = status.getRequired("status")
+
+ /**
+ * 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
+
+ @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 [DisconnectEntityResponse].
+ *
+ * The following fields are required:
+ * ```java
+ * .status()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [DisconnectEntityResponse]. */
+ class Builder internal constructor() {
+
+ private var status: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(disconnectEntityResponse: DisconnectEntityResponse) = apply {
+ status = disconnectEntityResponse.status
+ additionalProperties = disconnectEntityResponse.additionalProperties.toMutableMap()
+ }
+
+ /** If the request is successful, Finch will return "success" (HTTP 200 status). */
+ fun status(status: String) = status(JsonField.of(status))
+
+ /**
+ * Sets [Builder.status] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.status] with a well-typed [String] 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 }
+
+ 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 [DisconnectEntityResponse].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .status()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): DisconnectEntityResponse =
+ DisconnectEntityResponse(
+ checkRequired("status", status),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws FinchInvalidDataException if any value type in this object doesn't match its expected
+ * type.
+ */
+ fun validate(): DisconnectEntityResponse = apply {
+ if (validated) {
+ return@apply
+ }
+
+ status()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: FinchInvalidDataException) {
+ 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 (status.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is DisconnectEntityResponse &&
+ status == other.status &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(status, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "DisconnectEntityResponse{status=$status, additionalProperties=$additionalProperties}"
+}
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrollManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrollManyParams.kt
new file mode 100644
index 00000000..ecbfe45c
--- /dev/null
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrollManyParams.kt
@@ -0,0 +1,2022 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.tryfinch.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.tryfinch.api.core.Enum
+import com.tryfinch.api.core.ExcludeMissing
+import com.tryfinch.api.core.JsonField
+import com.tryfinch.api.core.JsonMissing
+import com.tryfinch.api.core.JsonValue
+import com.tryfinch.api.core.Params
+import com.tryfinch.api.core.checkKnown
+import com.tryfinch.api.core.checkRequired
+import com.tryfinch.api.core.http.Headers
+import com.tryfinch.api.core.http.QueryParams
+import com.tryfinch.api.core.toImmutable
+import com.tryfinch.api.errors.FinchInvalidDataException
+import java.time.LocalDate
+import java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/**
+ * Enroll an individual into a deduction or contribution. This is an overwrite operation. If the
+ * employee is already enrolled, the enrollment amounts will be adjusted. Making the same request
+ * multiple times will not create new enrollments, but will continue to set the state of the
+ * existing enrollment.
+ */
+class HrisBenefitIndividualEnrollManyParams
+private constructor(
+ private val benefitId: String?,
+ private val entityIds: List?,
+ private val individuals: List?,
+ private val additionalHeaders: Headers,
+ private val additionalQueryParams: QueryParams,
+) : Params {
+
+ fun benefitId(): Optional = Optional.ofNullable(benefitId)
+
+ /** The entity IDs to specify which entities' data to access. */
+ fun entityIds(): Optional> = Optional.ofNullable(entityIds)
+
+ /** Array of the individual_id to enroll and a configuration object. */
+ fun individuals(): Optional> = Optional.ofNullable(individuals)
+
+ /** Additional headers to send with the request. */
+ fun _additionalHeaders(): Headers = additionalHeaders
+
+ /** Additional query param to send with the request. */
+ fun _additionalQueryParams(): QueryParams = additionalQueryParams
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ @JvmStatic fun none(): HrisBenefitIndividualEnrollManyParams = builder().build()
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [HrisBenefitIndividualEnrollManyParams].
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [HrisBenefitIndividualEnrollManyParams]. */
+ class Builder internal constructor() {
+
+ private var benefitId: String? = null
+ private var entityIds: MutableList? = null
+ private var individuals: MutableList? = null
+ private var additionalHeaders: Headers.Builder = Headers.builder()
+ private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
+
+ @JvmSynthetic
+ internal fun from(
+ hrisBenefitIndividualEnrollManyParams: HrisBenefitIndividualEnrollManyParams
+ ) = apply {
+ benefitId = hrisBenefitIndividualEnrollManyParams.benefitId
+ entityIds = hrisBenefitIndividualEnrollManyParams.entityIds?.toMutableList()
+ individuals = hrisBenefitIndividualEnrollManyParams.individuals?.toMutableList()
+ additionalHeaders = hrisBenefitIndividualEnrollManyParams.additionalHeaders.toBuilder()
+ additionalQueryParams =
+ hrisBenefitIndividualEnrollManyParams.additionalQueryParams.toBuilder()
+ }
+
+ fun benefitId(benefitId: String?) = apply { this.benefitId = benefitId }
+
+ /** Alias for calling [Builder.benefitId] with `benefitId.orElse(null)`. */
+ fun benefitId(benefitId: Optional) = benefitId(benefitId.getOrNull())
+
+ /** The entity IDs to specify which entities' data to access. */
+ fun entityIds(entityIds: List?) = apply {
+ this.entityIds = entityIds?.toMutableList()
+ }
+
+ /** Alias for calling [Builder.entityIds] with `entityIds.orElse(null)`. */
+ fun entityIds(entityIds: Optional>) = entityIds(entityIds.getOrNull())
+
+ /**
+ * Adds a single [String] to [entityIds].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addEntityId(entityId: String) = apply {
+ entityIds = (entityIds ?: mutableListOf()).apply { add(entityId) }
+ }
+
+ /** Array of the individual_id to enroll and a configuration object. */
+ fun individuals(individuals: List?) = apply {
+ this.individuals = individuals?.toMutableList()
+ }
+
+ /** Alias for calling [Builder.individuals] with `individuals.orElse(null)`. */
+ fun individuals(individuals: Optional>) =
+ individuals(individuals.getOrNull())
+
+ /**
+ * Adds a single [Individual] to [individuals].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addIndividual(individual: Individual) = apply {
+ individuals = (individuals ?: mutableListOf()).apply { add(individual) }
+ }
+
+ 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 [HrisBenefitIndividualEnrollManyParams].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): HrisBenefitIndividualEnrollManyParams =
+ HrisBenefitIndividualEnrollManyParams(
+ benefitId,
+ entityIds?.toImmutable(),
+ individuals?.toImmutable(),
+ additionalHeaders.build(),
+ additionalQueryParams.build(),
+ )
+ }
+
+ fun _body(): Optional> = Optional.ofNullable(individuals)
+
+ fun _pathParam(index: Int): String =
+ when (index) {
+ 0 -> benefitId ?: ""
+ else -> ""
+ }
+
+ override fun _headers(): Headers = additionalHeaders
+
+ override fun _queryParams(): QueryParams =
+ QueryParams.builder()
+ .apply {
+ entityIds?.forEach { put("entity_ids[]", it) }
+ putAll(additionalQueryParams)
+ }
+ .build()
+
+ class Individual
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val configuration: JsonField,
+ private val individualId: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("configuration")
+ @ExcludeMissing
+ configuration: JsonField = JsonMissing.of(),
+ @JsonProperty("individual_id")
+ @ExcludeMissing
+ individualId: JsonField = JsonMissing.of(),
+ ) : this(configuration, individualId, mutableMapOf())
+
+ /**
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun configuration(): Optional = configuration.getOptional("configuration")
+
+ /**
+ * Finch id (uuidv4) for the individual to enroll
+ *
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun individualId(): Optional = individualId.getOptional("individual_id")
+
+ /**
+ * Returns the raw JSON value of [configuration].
+ *
+ * Unlike [configuration], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("configuration")
+ @ExcludeMissing
+ fun _configuration(): JsonField = configuration
+
+ /**
+ * Returns the raw JSON value of [individualId].
+ *
+ * Unlike [individualId], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("individual_id")
+ @ExcludeMissing
+ fun _individualId(): JsonField = individualId
+
+ @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 [Individual]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Individual]. */
+ class Builder internal constructor() {
+
+ private var configuration: JsonField = JsonMissing.of()
+ private var individualId: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(individual: Individual) = apply {
+ configuration = individual.configuration
+ individualId = individual.individualId
+ additionalProperties = individual.additionalProperties.toMutableMap()
+ }
+
+ fun configuration(configuration: Configuration) =
+ configuration(JsonField.of(configuration))
+
+ /**
+ * Sets [Builder.configuration] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.configuration] with a well-typed [Configuration]
+ * value instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun configuration(configuration: JsonField) = apply {
+ this.configuration = configuration
+ }
+
+ /** Finch id (uuidv4) for the individual to enroll */
+ fun individualId(individualId: String) = individualId(JsonField.of(individualId))
+
+ /**
+ * Sets [Builder.individualId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.individualId] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun individualId(individualId: JsonField) = apply {
+ this.individualId = individualId
+ }
+
+ 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 [Individual].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): Individual =
+ Individual(configuration, individualId, additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws FinchInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): Individual = apply {
+ if (validated) {
+ return@apply
+ }
+
+ configuration().ifPresent { it.validate() }
+ individualId()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: FinchInvalidDataException) {
+ 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 =
+ (configuration.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (individualId.asKnown().isPresent) 1 else 0)
+
+ class Configuration
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val annualContributionLimit: JsonField,
+ private val annualMaximum: JsonField,
+ private val catchUp: JsonField,
+ private val companyContribution: JsonField,
+ private val effectiveDate: JsonField,
+ private val employeeDeduction: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("annual_contribution_limit")
+ @ExcludeMissing
+ annualContributionLimit: JsonField = JsonMissing.of(),
+ @JsonProperty("annual_maximum")
+ @ExcludeMissing
+ annualMaximum: JsonField = JsonMissing.of(),
+ @JsonProperty("catch_up")
+ @ExcludeMissing
+ catchUp: JsonField = JsonMissing.of(),
+ @JsonProperty("company_contribution")
+ @ExcludeMissing
+ companyContribution: JsonField = JsonMissing.of(),
+ @JsonProperty("effective_date")
+ @ExcludeMissing
+ effectiveDate: JsonField = JsonMissing.of(),
+ @JsonProperty("employee_deduction")
+ @ExcludeMissing
+ employeeDeduction: JsonField = JsonMissing.of(),
+ ) : this(
+ annualContributionLimit,
+ annualMaximum,
+ catchUp,
+ companyContribution,
+ effectiveDate,
+ employeeDeduction,
+ mutableMapOf(),
+ )
+
+ /**
+ * For HSA benefits only - whether the contribution limit is for an individual or family
+ *
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun annualContributionLimit(): Optional =
+ annualContributionLimit.getOptional("annual_contribution_limit")
+
+ /**
+ * Maximum annual amount in cents
+ *
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun annualMaximum(): Optional = annualMaximum.getOptional("annual_maximum")
+
+ /**
+ * For retirement benefits only - whether catch up contributions are enabled
+ *
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun catchUp(): Optional = catchUp.getOptional("catch_up")
+
+ /**
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun companyContribution(): Optional =
+ companyContribution.getOptional("company_contribution")
+
+ /**
+ * The date the enrollment will take effect
+ *
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun effectiveDate(): Optional = effectiveDate.getOptional("effective_date")
+
+ /**
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun employeeDeduction(): Optional =
+ employeeDeduction.getOptional("employee_deduction")
+
+ /**
+ * Returns the raw JSON value of [annualContributionLimit].
+ *
+ * Unlike [annualContributionLimit], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("annual_contribution_limit")
+ @ExcludeMissing
+ fun _annualContributionLimit(): JsonField =
+ annualContributionLimit
+
+ /**
+ * Returns the raw JSON value of [annualMaximum].
+ *
+ * Unlike [annualMaximum], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("annual_maximum")
+ @ExcludeMissing
+ fun _annualMaximum(): JsonField = annualMaximum
+
+ /**
+ * Returns the raw JSON value of [catchUp].
+ *
+ * Unlike [catchUp], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("catch_up") @ExcludeMissing fun _catchUp(): JsonField = catchUp
+
+ /**
+ * Returns the raw JSON value of [companyContribution].
+ *
+ * Unlike [companyContribution], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("company_contribution")
+ @ExcludeMissing
+ fun _companyContribution(): JsonField = companyContribution
+
+ /**
+ * Returns the raw JSON value of [effectiveDate].
+ *
+ * Unlike [effectiveDate], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("effective_date")
+ @ExcludeMissing
+ fun _effectiveDate(): JsonField = effectiveDate
+
+ /**
+ * Returns the raw JSON value of [employeeDeduction].
+ *
+ * Unlike [employeeDeduction], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("employee_deduction")
+ @ExcludeMissing
+ fun _employeeDeduction(): JsonField = employeeDeduction
+
+ @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 [Configuration]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Configuration]. */
+ class Builder internal constructor() {
+
+ private var annualContributionLimit: JsonField =
+ JsonMissing.of()
+ private var annualMaximum: JsonField = JsonMissing.of()
+ private var catchUp: JsonField = JsonMissing.of()
+ private var companyContribution: JsonField = JsonMissing.of()
+ private var effectiveDate: JsonField = JsonMissing.of()
+ private var employeeDeduction: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(configuration: Configuration) = apply {
+ annualContributionLimit = configuration.annualContributionLimit
+ annualMaximum = configuration.annualMaximum
+ catchUp = configuration.catchUp
+ companyContribution = configuration.companyContribution
+ effectiveDate = configuration.effectiveDate
+ employeeDeduction = configuration.employeeDeduction
+ additionalProperties = configuration.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * For HSA benefits only - whether the contribution limit is for an individual or
+ * family
+ */
+ fun annualContributionLimit(annualContributionLimit: AnnualContributionLimit) =
+ annualContributionLimit(JsonField.of(annualContributionLimit))
+
+ /**
+ * Sets [Builder.annualContributionLimit] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.annualContributionLimit] with a well-typed
+ * [AnnualContributionLimit] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun annualContributionLimit(
+ annualContributionLimit: JsonField
+ ) = apply { this.annualContributionLimit = annualContributionLimit }
+
+ /** Maximum annual amount in cents */
+ fun annualMaximum(annualMaximum: Long?) =
+ annualMaximum(JsonField.ofNullable(annualMaximum))
+
+ /**
+ * Alias for [Builder.annualMaximum].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun annualMaximum(annualMaximum: Long) = annualMaximum(annualMaximum as Long?)
+
+ /** Alias for calling [Builder.annualMaximum] with `annualMaximum.orElse(null)`. */
+ fun annualMaximum(annualMaximum: Optional) =
+ annualMaximum(annualMaximum.getOrNull())
+
+ /**
+ * Sets [Builder.annualMaximum] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.annualMaximum] with a well-typed [Long] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun annualMaximum(annualMaximum: JsonField) = apply {
+ this.annualMaximum = annualMaximum
+ }
+
+ /** For retirement benefits only - whether catch up contributions are enabled */
+ fun catchUp(catchUp: Boolean) = catchUp(JsonField.of(catchUp))
+
+ /**
+ * Sets [Builder.catchUp] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.catchUp] with a well-typed [Boolean] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun catchUp(catchUp: JsonField) = apply { this.catchUp = catchUp }
+
+ fun companyContribution(companyContribution: CompanyContribution) =
+ companyContribution(JsonField.of(companyContribution))
+
+ /**
+ * Sets [Builder.companyContribution] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.companyContribution] with a well-typed
+ * [CompanyContribution] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun companyContribution(companyContribution: JsonField) =
+ apply {
+ this.companyContribution = companyContribution
+ }
+
+ /** The date the enrollment will take effect */
+ fun effectiveDate(effectiveDate: LocalDate) =
+ effectiveDate(JsonField.of(effectiveDate))
+
+ /**
+ * Sets [Builder.effectiveDate] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.effectiveDate] with a well-typed [LocalDate]
+ * value instead. This method is primarily for setting the field to an undocumented
+ * or not yet supported value.
+ */
+ fun effectiveDate(effectiveDate: JsonField) = apply {
+ this.effectiveDate = effectiveDate
+ }
+
+ fun employeeDeduction(employeeDeduction: EmployeeDeduction) =
+ employeeDeduction(JsonField.of(employeeDeduction))
+
+ /**
+ * Sets [Builder.employeeDeduction] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.employeeDeduction] with a well-typed
+ * [EmployeeDeduction] value instead. This method is primarily for setting the field
+ * to an undocumented or not yet supported value.
+ */
+ fun employeeDeduction(employeeDeduction: JsonField) = apply {
+ this.employeeDeduction = employeeDeduction
+ }
+
+ 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 [Configuration].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): Configuration =
+ Configuration(
+ annualContributionLimit,
+ annualMaximum,
+ catchUp,
+ companyContribution,
+ effectiveDate,
+ employeeDeduction,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws FinchInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): Configuration = apply {
+ if (validated) {
+ return@apply
+ }
+
+ annualContributionLimit().ifPresent { it.validate() }
+ annualMaximum()
+ catchUp()
+ companyContribution().ifPresent { it.validate() }
+ effectiveDate()
+ employeeDeduction().ifPresent { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: FinchInvalidDataException) {
+ 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 =
+ (annualContributionLimit.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (annualMaximum.asKnown().isPresent) 1 else 0) +
+ (if (catchUp.asKnown().isPresent) 1 else 0) +
+ (companyContribution.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (effectiveDate.asKnown().isPresent) 1 else 0) +
+ (employeeDeduction.asKnown().getOrNull()?.validity() ?: 0)
+
+ /**
+ * For HSA benefits only - whether the contribution limit is for an individual or family
+ */
+ class AnnualContributionLimit
+ @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 INDIVIDUAL = of("individual")
+
+ @JvmField val FAMILY = of("family")
+
+ @JvmStatic fun of(value: String) = AnnualContributionLimit(JsonField.of(value))
+ }
+
+ /** An enum containing [AnnualContributionLimit]'s known values. */
+ enum class Known {
+ INDIVIDUAL,
+ FAMILY,
+ }
+
+ /**
+ * An enum containing [AnnualContributionLimit]'s known values, as well as an
+ * [_UNKNOWN] member.
+ *
+ * An instance of [AnnualContributionLimit] 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 {
+ INDIVIDUAL,
+ FAMILY,
+ /**
+ * An enum member indicating that [AnnualContributionLimit] 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) {
+ INDIVIDUAL -> Value.INDIVIDUAL
+ FAMILY -> Value.FAMILY
+ 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 FinchInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ INDIVIDUAL -> Known.INDIVIDUAL
+ FAMILY -> Known.FAMILY
+ else ->
+ throw FinchInvalidDataException(
+ "Unknown AnnualContributionLimit: $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 FinchInvalidDataException if this class instance's value does not have
+ * the expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ FinchInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws FinchInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
+ fun validate(): AnnualContributionLimit = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: FinchInvalidDataException) {
+ 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 AnnualContributionLimit && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ class CompanyContribution
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val amount: JsonField,
+ private val tiers: JsonField>,
+ private val type: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("amount")
+ @ExcludeMissing
+ amount: JsonField = JsonMissing.of(),
+ @JsonProperty("tiers")
+ @ExcludeMissing
+ tiers: JsonField> = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(),
+ ) : this(amount, tiers, type, mutableMapOf())
+
+ /**
+ * Amount in cents for fixed type or basis points (1/100th of a percent) for percent
+ * type
+ *
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun amount(): Optional = amount.getOptional("amount")
+
+ /**
+ * Array of tier objects for tiered contribution matching (required when type is
+ * tiered)
+ *
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun tiers(): Optional> = tiers.getOptional("tiers")
+
+ /**
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun type(): Optional = type.getOptional("type")
+
+ /**
+ * Returns the raw JSON value of [amount].
+ *
+ * Unlike [amount], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount
+
+ /**
+ * Returns the raw JSON value of [tiers].
+ *
+ * Unlike [tiers], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("tiers") @ExcludeMissing fun _tiers(): JsonField> = tiers
+
+ /**
+ * 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
+ * [CompanyContribution].
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [CompanyContribution]. */
+ class Builder internal constructor() {
+
+ private var amount: JsonField = JsonMissing.of()
+ private var tiers: JsonField>? = null
+ private var type: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(companyContribution: CompanyContribution) = apply {
+ amount = companyContribution.amount
+ tiers = companyContribution.tiers.map { it.toMutableList() }
+ type = companyContribution.type
+ additionalProperties =
+ companyContribution.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * Amount in cents for fixed type or basis points (1/100th of a percent) for
+ * percent type
+ */
+ fun amount(amount: Long) = amount(JsonField.of(amount))
+
+ /**
+ * Sets [Builder.amount] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.amount] with a well-typed [Long] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun amount(amount: JsonField) = apply { this.amount = amount }
+
+ /**
+ * Array of tier objects for tiered contribution matching (required when type is
+ * tiered)
+ */
+ fun tiers(tiers: List) = tiers(JsonField.of(tiers))
+
+ /**
+ * Sets [Builder.tiers] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.tiers] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun tiers(tiers: JsonField>) = apply {
+ this.tiers = tiers.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [Tier] to [tiers].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addTier(tier: Tier) = apply {
+ tiers =
+ (tiers ?: JsonField.of(mutableListOf())).also {
+ checkKnown("tiers", it).add(tier)
+ }
+ }
+
+ fun type(type: Type) = type(JsonField.of(type))
+
+ /**
+ * Sets [Builder.type] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.type] with a well-typed [Type] 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 [CompanyContribution].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): CompanyContribution =
+ CompanyContribution(
+ amount,
+ (tiers ?: JsonMissing.of()).map { it.toImmutable() },
+ type,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws FinchInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
+ fun validate(): CompanyContribution = apply {
+ if (validated) {
+ return@apply
+ }
+
+ amount()
+ tiers().ifPresent { it.forEach { it.validate() } }
+ type().ifPresent { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: FinchInvalidDataException) {
+ 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 (amount.asKnown().isPresent) 1 else 0) +
+ (tiers.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (type.asKnown().getOrNull()?.validity() ?: 0)
+
+ class Tier
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val match: JsonField,
+ private val threshold: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("match")
+ @ExcludeMissing
+ match: JsonField = JsonMissing.of(),
+ @JsonProperty("threshold")
+ @ExcludeMissing
+ threshold: JsonField = JsonMissing.of(),
+ ) : this(match, threshold, mutableMapOf())
+
+ /**
+ * The employer match percentage in basis points (0-10000 = 0-100%)
+ *
+ * @throws FinchInvalidDataException 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 match(): Long = match.getRequired("match")
+
+ /**
+ * The employee contribution threshold in basis points (0-10000 = 0-100%)
+ *
+ * @throws FinchInvalidDataException 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 threshold(): Long = threshold.getRequired("threshold")
+
+ /**
+ * Returns the raw JSON value of [match].
+ *
+ * Unlike [match], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("match") @ExcludeMissing fun _match(): JsonField = match
+
+ /**
+ * Returns the raw JSON value of [threshold].
+ *
+ * Unlike [threshold], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("threshold")
+ @ExcludeMissing
+ fun _threshold(): JsonField = threshold
+
+ @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 [Tier].
+ *
+ * The following fields are required:
+ * ```java
+ * .match()
+ * .threshold()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Tier]. */
+ class Builder internal constructor() {
+
+ private var match: JsonField? = null
+ private var threshold: JsonField? = null
+ private var additionalProperties: MutableMap =
+ mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(tier: Tier) = apply {
+ match = tier.match
+ threshold = tier.threshold
+ additionalProperties = tier.additionalProperties.toMutableMap()
+ }
+
+ /** The employer match percentage in basis points (0-10000 = 0-100%) */
+ fun match(match: Long) = match(JsonField.of(match))
+
+ /**
+ * Sets [Builder.match] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.match] with a well-typed [Long] value
+ * instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun match(match: JsonField) = apply { this.match = match }
+
+ /**
+ * The employee contribution threshold in basis points (0-10000 = 0-100%)
+ */
+ fun threshold(threshold: Long) = threshold(JsonField.of(threshold))
+
+ /**
+ * Sets [Builder.threshold] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.threshold] with a well-typed [Long]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun threshold(threshold: JsonField) = apply {
+ this.threshold = threshold
+ }
+
+ 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 [Tier].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .match()
+ * .threshold()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Tier =
+ Tier(
+ checkRequired("match", match),
+ checkRequired("threshold", threshold),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws FinchInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
+ fun validate(): Tier = apply {
+ if (validated) {
+ return@apply
+ }
+
+ match()
+ threshold()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: FinchInvalidDataException) {
+ 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 (match.asKnown().isPresent) 1 else 0) +
+ (if (threshold.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Tier &&
+ match == other.match &&
+ threshold == other.threshold &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(match, threshold, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Tier{match=$match, threshold=$threshold, additionalProperties=$additionalProperties}"
+ }
+
+ class Type @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 FIXED = of("fixed")
+
+ @JvmField val PERCENT = of("percent")
+
+ @JvmField val TIERED = of("tiered")
+
+ @JvmStatic fun of(value: String) = Type(JsonField.of(value))
+ }
+
+ /** An enum containing [Type]'s known values. */
+ enum class Known {
+ FIXED,
+ PERCENT,
+ TIERED,
+ }
+
+ /**
+ * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Type] 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 {
+ FIXED,
+ PERCENT,
+ TIERED,
+ /**
+ * An enum member indicating that [Type] 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) {
+ FIXED -> Value.FIXED
+ PERCENT -> Value.PERCENT
+ TIERED -> Value.TIERED
+ 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 FinchInvalidDataException if this class instance's value is a not a
+ * known member.
+ */
+ fun known(): Known =
+ when (this) {
+ FIXED -> Known.FIXED
+ PERCENT -> Known.PERCENT
+ TIERED -> Known.TIERED
+ else -> throw FinchInvalidDataException("Unknown Type: $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 FinchInvalidDataException if this class instance's value does not
+ * have the expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ FinchInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws FinchInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
+ fun validate(): Type = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: FinchInvalidDataException) {
+ 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 Type && 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 CompanyContribution &&
+ amount == other.amount &&
+ tiers == other.tiers &&
+ type == other.type &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(amount, tiers, type, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "CompanyContribution{amount=$amount, tiers=$tiers, type=$type, additionalProperties=$additionalProperties}"
+ }
+
+ class EmployeeDeduction
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val amount: JsonField,
+ private val type: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("amount")
+ @ExcludeMissing
+ amount: JsonField = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(),
+ ) : this(amount, type, mutableMapOf())
+
+ /**
+ * Amount in cents for fixed type or basis points (1/100th of a percent) for percent
+ * type
+ *
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun amount(): Optional = amount.getOptional("amount")
+
+ /**
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun type(): Optional = type.getOptional("type")
+
+ /**
+ * Returns the raw JSON value of [amount].
+ *
+ * Unlike [amount], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount
+
+ /**
+ * 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
+ * [EmployeeDeduction].
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [EmployeeDeduction]. */
+ class Builder internal constructor() {
+
+ private var amount: JsonField = JsonMissing.of()
+ private var type: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(employeeDeduction: EmployeeDeduction) = apply {
+ amount = employeeDeduction.amount
+ type = employeeDeduction.type
+ additionalProperties = employeeDeduction.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * Amount in cents for fixed type or basis points (1/100th of a percent) for
+ * percent type
+ */
+ fun amount(amount: Long) = amount(JsonField.of(amount))
+
+ /**
+ * Sets [Builder.amount] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.amount] with a well-typed [Long] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun amount(amount: JsonField) = apply { this.amount = amount }
+
+ fun type(type: Type) = type(JsonField.of(type))
+
+ /**
+ * Sets [Builder.type] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.type] with a well-typed [Type] 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 [EmployeeDeduction].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): EmployeeDeduction =
+ EmployeeDeduction(amount, type, additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws FinchInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
+ fun validate(): EmployeeDeduction = apply {
+ if (validated) {
+ return@apply
+ }
+
+ amount()
+ type().ifPresent { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: FinchInvalidDataException) {
+ 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 (amount.asKnown().isPresent) 1 else 0) +
+ (type.asKnown().getOrNull()?.validity() ?: 0)
+
+ class Type @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 FIXED = of("fixed")
+
+ @JvmField val PERCENT = of("percent")
+
+ @JvmStatic fun of(value: String) = Type(JsonField.of(value))
+ }
+
+ /** An enum containing [Type]'s known values. */
+ enum class Known {
+ FIXED,
+ PERCENT,
+ }
+
+ /**
+ * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Type] 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 {
+ FIXED,
+ PERCENT,
+ /**
+ * An enum member indicating that [Type] 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) {
+ FIXED -> Value.FIXED
+ PERCENT -> Value.PERCENT
+ 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 FinchInvalidDataException if this class instance's value is a not a
+ * known member.
+ */
+ fun known(): Known =
+ when (this) {
+ FIXED -> Known.FIXED
+ PERCENT -> Known.PERCENT
+ else -> throw FinchInvalidDataException("Unknown Type: $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 FinchInvalidDataException if this class instance's value does not
+ * have the expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ FinchInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws FinchInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
+ fun validate(): Type = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: FinchInvalidDataException) {
+ 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 Type && 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 EmployeeDeduction &&
+ amount == other.amount &&
+ type == other.type &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(amount, type, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "EmployeeDeduction{amount=$amount, type=$type, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Configuration &&
+ annualContributionLimit == other.annualContributionLimit &&
+ annualMaximum == other.annualMaximum &&
+ catchUp == other.catchUp &&
+ companyContribution == other.companyContribution &&
+ effectiveDate == other.effectiveDate &&
+ employeeDeduction == other.employeeDeduction &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(
+ annualContributionLimit,
+ annualMaximum,
+ catchUp,
+ companyContribution,
+ effectiveDate,
+ employeeDeduction,
+ additionalProperties,
+ )
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Configuration{annualContributionLimit=$annualContributionLimit, annualMaximum=$annualMaximum, catchUp=$catchUp, companyContribution=$companyContribution, effectiveDate=$effectiveDate, employeeDeduction=$employeeDeduction, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Individual &&
+ configuration == other.configuration &&
+ individualId == other.individualId &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(configuration, individualId, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Individual{configuration=$configuration, individualId=$individualId, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is HrisBenefitIndividualEnrollManyParams &&
+ benefitId == other.benefitId &&
+ entityIds == other.entityIds &&
+ individuals == other.individuals &&
+ additionalHeaders == other.additionalHeaders &&
+ additionalQueryParams == other.additionalQueryParams
+ }
+
+ override fun hashCode(): Int =
+ Objects.hash(benefitId, entityIds, individuals, additionalHeaders, additionalQueryParams)
+
+ override fun toString() =
+ "HrisBenefitIndividualEnrollManyParams{benefitId=$benefitId, entityIds=$entityIds, individuals=$individuals, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+}
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRegisterParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRegisterParams.kt
new file mode 100644
index 00000000..05501115
--- /dev/null
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRegisterParams.kt
@@ -0,0 +1,584 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.tryfinch.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.tryfinch.api.core.ExcludeMissing
+import com.tryfinch.api.core.JsonField
+import com.tryfinch.api.core.JsonMissing
+import com.tryfinch.api.core.JsonValue
+import com.tryfinch.api.core.Params
+import com.tryfinch.api.core.http.Headers
+import com.tryfinch.api.core.http.QueryParams
+import com.tryfinch.api.core.toImmutable
+import com.tryfinch.api.errors.FinchInvalidDataException
+import java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/**
+ * Register existing benefits from the customer on the provider, on Finch's end. Please use the
+ * `/provider` endpoint to view available types for each provider.
+ */
+class HrisBenefitRegisterParams
+private constructor(
+ private val entityIds: List?,
+ private val body: Body,
+ private val additionalHeaders: Headers,
+ private val additionalQueryParams: QueryParams,
+) : Params {
+
+ /** The entity IDs to specify which entities' data to access. */
+ fun entityIds(): Optional> = Optional.ofNullable(entityIds)
+
+ /**
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun description(): Optional = body.description()
+
+ /**
+ * The frequency of the benefit deduction/contribution.
+ *
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun frequency(): Optional = body.frequency()
+
+ /**
+ * Type of benefit.
+ *
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun type(): Optional = body.type()
+
+ /**
+ * Returns the raw JSON value of [description].
+ *
+ * Unlike [description], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _description(): JsonField = body._description()
+
+ /**
+ * Returns the raw JSON value of [frequency].
+ *
+ * Unlike [frequency], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _frequency(): JsonField = body._frequency()
+
+ /**
+ * 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 {
+
+ @JvmStatic fun none(): HrisBenefitRegisterParams = builder().build()
+
+ /**
+ * Returns a mutable builder for constructing an instance of [HrisBenefitRegisterParams].
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [HrisBenefitRegisterParams]. */
+ class Builder internal constructor() {
+
+ private var entityIds: MutableList? = null
+ private var body: Body.Builder = Body.builder()
+ private var additionalHeaders: Headers.Builder = Headers.builder()
+ private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
+
+ @JvmSynthetic
+ internal fun from(hrisBenefitRegisterParams: HrisBenefitRegisterParams) = apply {
+ entityIds = hrisBenefitRegisterParams.entityIds?.toMutableList()
+ body = hrisBenefitRegisterParams.body.toBuilder()
+ additionalHeaders = hrisBenefitRegisterParams.additionalHeaders.toBuilder()
+ additionalQueryParams = hrisBenefitRegisterParams.additionalQueryParams.toBuilder()
+ }
+
+ /** The entity IDs to specify which entities' data to access. */
+ fun entityIds(entityIds: List?) = apply {
+ this.entityIds = entityIds?.toMutableList()
+ }
+
+ /** Alias for calling [Builder.entityIds] with `entityIds.orElse(null)`. */
+ fun entityIds(entityIds: Optional>) = entityIds(entityIds.getOrNull())
+
+ /**
+ * Adds a single [String] to [entityIds].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addEntityId(entityId: String) = apply {
+ entityIds = (entityIds ?: mutableListOf()).apply { add(entityId) }
+ }
+
+ /**
+ * 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:
+ * - [description]
+ * - [frequency]
+ * - [type]
+ */
+ fun body(body: Body) = apply { this.body = body.toBuilder() }
+
+ fun description(description: String) = apply { body.description(description) }
+
+ /**
+ * Sets [Builder.description] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.description] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun description(description: JsonField) = apply { body.description(description) }
+
+ /** The frequency of the benefit deduction/contribution. */
+ fun frequency(frequency: BenefitFrequency?) = apply { body.frequency(frequency) }
+
+ /** Alias for calling [Builder.frequency] with `frequency.orElse(null)`. */
+ fun frequency(frequency: Optional) = frequency(frequency.getOrNull())
+
+ /**
+ * Sets [Builder.frequency] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.frequency] with a well-typed [BenefitFrequency] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun frequency(frequency: JsonField) = apply { body.frequency(frequency) }
+
+ /** Type of benefit. */
+ fun type(type: BenefitType?) = apply { body.type(type) }
+
+ /** Alias for calling [Builder.type] with `type.orElse(null)`. */
+ fun type(type: Optional) = type(type.getOrNull())
+
+ /**
+ * Sets [Builder.type] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.type] with a well-typed [BenefitType] 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 [HrisBenefitRegisterParams].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): HrisBenefitRegisterParams =
+ HrisBenefitRegisterParams(
+ entityIds?.toImmutable(),
+ body.build(),
+ additionalHeaders.build(),
+ additionalQueryParams.build(),
+ )
+ }
+
+ fun _body(): Body = body
+
+ override fun _headers(): Headers = additionalHeaders
+
+ override fun _queryParams(): QueryParams =
+ QueryParams.builder()
+ .apply {
+ entityIds?.forEach { put("entity_ids[]", it) }
+ putAll(additionalQueryParams)
+ }
+ .build()
+
+ class Body
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val description: JsonField,
+ private val frequency: JsonField,
+ private val type: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("description")
+ @ExcludeMissing
+ description: JsonField = JsonMissing.of(),
+ @JsonProperty("frequency")
+ @ExcludeMissing
+ frequency: JsonField = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(),
+ ) : this(description, frequency, type, mutableMapOf())
+
+ /**
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun description(): Optional = description.getOptional("description")
+
+ /**
+ * The frequency of the benefit deduction/contribution.
+ *
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun frequency(): Optional = frequency.getOptional("frequency")
+
+ /**
+ * Type of benefit.
+ *
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun type(): Optional = type.getOptional("type")
+
+ /**
+ * Returns the raw JSON value of [description].
+ *
+ * Unlike [description], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("description")
+ @ExcludeMissing
+ fun _description(): JsonField = description
+
+ /**
+ * Returns the raw JSON value of [frequency].
+ *
+ * Unlike [frequency], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("frequency")
+ @ExcludeMissing
+ fun _frequency(): JsonField = frequency
+
+ /**
+ * 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 [Body]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Body]. */
+ class Builder internal constructor() {
+
+ private var description: JsonField = JsonMissing.of()
+ private var frequency: JsonField = JsonMissing.of()
+ private var type: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(body: Body) = apply {
+ description = body.description
+ frequency = body.frequency
+ type = body.type
+ additionalProperties = body.additionalProperties.toMutableMap()
+ }
+
+ fun description(description: String) = description(JsonField.of(description))
+
+ /**
+ * Sets [Builder.description] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.description] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun description(description: JsonField) = apply {
+ this.description = description
+ }
+
+ /** The frequency of the benefit deduction/contribution. */
+ fun frequency(frequency: BenefitFrequency?) = frequency(JsonField.ofNullable(frequency))
+
+ /** Alias for calling [Builder.frequency] with `frequency.orElse(null)`. */
+ fun frequency(frequency: Optional) = frequency(frequency.getOrNull())
+
+ /**
+ * Sets [Builder.frequency] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.frequency] with a well-typed [BenefitFrequency]
+ * value instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun frequency(frequency: JsonField) = apply {
+ this.frequency = frequency
+ }
+
+ /** Type of benefit. */
+ fun type(type: BenefitType?) = type(JsonField.ofNullable(type))
+
+ /** Alias for calling [Builder.type] with `type.orElse(null)`. */
+ fun type(type: Optional) = type(type.getOrNull())
+
+ /**
+ * Sets [Builder.type] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.type] with a well-typed [BenefitType] 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