diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 94046873..ebbaa260 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -12,8 +12,6 @@ jobs:
lint:
name: lint
runs-on: ubuntu-latest
-
-
steps:
- uses: actions/checkout@v4
@@ -34,7 +32,6 @@ jobs:
test:
name: test
runs-on: ubuntu-latest
-
steps:
- uses: actions/checkout@v4
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 8e76abb5..4808d97d 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "5.0.0"
+ ".": "5.1.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index e3e52833..c28b601a 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%2Ffinch-14d375aab89e6b212fe459805a42d6ea7d7da8eae2037ae710a187d06911be1d.yml
-openapi_spec_hash: 08b86ecbec3323717d48e4aaee48ed54
-config_hash: ce10384813f68ba3fed61c7b601b396b
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-bf858f37d7ab420841ddc6329dad8c46377308b6a5c8e935908011d0f9845e22.yml
+openapi_spec_hash: 2523952a32436e3c7fd3b55508c2e7ee
+config_hash: 53778a0b839c4f6ad34fbba051f5e8a6
diff --git a/CHANGELOG.md b/CHANGELOG.md
index be5fb27e..1ab14aa2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,42 @@
# Changelog
+## 5.1.0 (2025-04-11)
+
+Full Changelog: [v5.0.0...v5.1.0](https://github.com/Finch-API/finch-api-java/compare/v5.0.0...v5.1.0)
+
+### Features
+
+* **api:** add models for hrs benefits individuals async responses ([511b7fb](https://github.com/Finch-API/finch-api-java/commit/511b7fb4b6969bfded3c4f021753c1823b10baf1))
+* **api:** api update ([#533](https://github.com/Finch-API/finch-api-java/issues/533)) ([a7c802c](https://github.com/Finch-API/finch-api-java/commit/a7c802c84dff751a252c17ea3d4b19624792cba1))
+* **api:** benefits mutation API endpoints (create benefit, update benefit, enroll individual, unenroll individual) now properly return async response types ([#539](https://github.com/Finch-API/finch-api-java/issues/539)) ([4d1722f](https://github.com/Finch-API/finch-api-java/commit/4d1722feebfff70b762a41c6ea7c7a72299de8a8))
+* **client:** make pagination robust to missing data ([c054662](https://github.com/Finch-API/finch-api-java/commit/c054662ddf6e98fb805574d6851f8f81933bc07a))
+* **client:** support setting base URL via env var ([#535](https://github.com/Finch-API/finch-api-java/issues/535)) ([2a19f7e](https://github.com/Finch-API/finch-api-java/commit/2a19f7ec2159e69798afdb92f6f220254276a5fe))
+
+
+### Bug Fixes
+
+* **client:** bump to better jackson version ([#537](https://github.com/Finch-API/finch-api-java/issues/537)) ([4b3bc8d](https://github.com/Finch-API/finch-api-java/commit/4b3bc8d9e5a06356889f49afd96b19085c0aedfe))
+* **client:** page compilation error ([4da1190](https://github.com/Finch-API/finch-api-java/commit/4da1190d2b90298fb4d24ac48f2b9009fb39534f))
+
+
+### Chores
+
+* fix typo ([94a98e8](https://github.com/Finch-API/finch-api-java/commit/94a98e8ccff95f19fb8faf965525dd063745a3cb))
+* fix typo ([#540](https://github.com/Finch-API/finch-api-java/issues/540)) ([c56d73d](https://github.com/Finch-API/finch-api-java/commit/c56d73d2d29464841ec771edfa791fda80fb073f))
+* **internal:** expand CI branch coverage ([#536](https://github.com/Finch-API/finch-api-java/issues/536)) ([ed70465](https://github.com/Finch-API/finch-api-java/commit/ed704657d81ca00bc2e0baf40291d754b343d2aa))
+* **internal:** reduce CI branch coverage ([72adfa6](https://github.com/Finch-API/finch-api-java/commit/72adfa647da7ce56023200595f04f46379245ff8))
+
+
+### Documentation
+
+* add comments for page methods ([c054662](https://github.com/Finch-API/finch-api-java/commit/c054662ddf6e98fb805574d6851f8f81933bc07a))
+
+
+### Refactors
+
+* **client:** deduplicate page response classes ([#538](https://github.com/Finch-API/finch-api-java/issues/538)) ([c054662](https://github.com/Finch-API/finch-api-java/commit/c054662ddf6e98fb805574d6851f8f81933bc07a))
+* **client:** migrate pages to builder pattern ([#541](https://github.com/Finch-API/finch-api-java/issues/541)) ([5463e75](https://github.com/Finch-API/finch-api-java/commit/5463e75521312f9b219be62a6c7b4d090bec0754))
+
## 5.0.0 (2025-04-08)
Full Changelog: [v4.2.0...v5.0.0](https://github.com/Finch-API/finch-api-java/compare/v4.2.0...v5.0.0)
diff --git a/README.md b/README.md
index e0b9c13b..687c0836 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.tryfinch.api/finch-java/5.0.0)
-[](https://javadoc.io/doc/com.tryfinch.api/finch-java/5.0.0)
+[](https://central.sonatype.com/artifact/com.tryfinch.api/finch-java/5.1.0)
+[](https://javadoc.io/doc/com.tryfinch.api/finch-java/5.1.0)
@@ -15,7 +15,7 @@ It is generated with [Stainless](https://www.stainless.com/).
-The REST API documentation can be found on [developer.tryfinch.com](https://developer.tryfinch.com/). Javadocs are also available on [javadoc.io](https://javadoc.io/doc/com.tryfinch.api/finch-java/5.0.0).
+The REST API documentation can be found on [developer.tryfinch.com](https://developer.tryfinch.com/). Javadocs are also available on [javadoc.io](https://javadoc.io/doc/com.tryfinch.api/finch-java/5.1.0).
@@ -26,7 +26,7 @@ The REST API documentation can be found on [developer.tryfinch.com](https://deve
### Gradle
```kotlin
-implementation("com.tryfinch.api:finch-java:5.0.0")
+implementation("com.tryfinch.api:finch-java:5.1.0")
```
### Maven
@@ -35,7 +35,7 @@ implementation("com.tryfinch.api:finch-java:5.0.0")
com.tryfinch.api
finch-java
- 5.0.0
+ 5.1.0
```
@@ -54,7 +54,7 @@ import com.tryfinch.api.models.HrisDirectoryListPage;
import com.tryfinch.api.models.HrisDirectoryListParams;
FinchClient client = FinchOkHttpClient.builder()
- // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET` and `FINCH_WEBHOOK_SECRET` environment variables
+ // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET`, `FINCH_WEBHOOK_SECRET` and `FINCH_BASE_URL` environment variables
.fromEnv()
.accessToken("My Access Token")
.build();
@@ -71,7 +71,7 @@ import com.tryfinch.api.client.FinchClient;
import com.tryfinch.api.client.okhttp.FinchOkHttpClient;
FinchClient client = FinchOkHttpClient.builder()
- // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET` and `FINCH_WEBHOOK_SECRET` environment variables
+ // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET`, `FINCH_WEBHOOK_SECRET` and `FINCH_BASE_URL` environment variables
.fromEnv()
.accessToken("My Access Token")
.build();
@@ -95,7 +95,7 @@ import com.tryfinch.api.client.FinchClient;
import com.tryfinch.api.client.okhttp.FinchOkHttpClient;
FinchClient client = FinchOkHttpClient.builder()
- // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET` and `FINCH_WEBHOOK_SECRET` environment variables
+ // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET`, `FINCH_WEBHOOK_SECRET` and `FINCH_BASE_URL` environment variables
.fromEnv()
.accessToken("My Access Token")
.build();
@@ -103,11 +103,12 @@ FinchClient client = FinchOkHttpClient.builder()
See this table for the available options:
-| Setter | Environment variable | Required | Default value |
-| --------------- | ---------------------- | -------- | ------------- |
-| `clientId` | `FINCH_CLIENT_ID` | false | - |
-| `clientSecret` | `FINCH_CLIENT_SECRET` | false | - |
-| `webhookSecret` | `FINCH_WEBHOOK_SECRET` | false | - |
+| Setter | Environment variable | Required | Default value |
+| --------------- | ---------------------- | -------- | ---------------------------- |
+| `clientId` | `FINCH_CLIENT_ID` | false | - |
+| `clientSecret` | `FINCH_CLIENT_SECRET` | false | - |
+| `webhookSecret` | `FINCH_WEBHOOK_SECRET` | false | - |
+| `baseUrl` | `FINCH_BASE_URL` | true | `"https://api.tryfinch.com"` |
> [!TIP]
> Don't create more than one client in the same application. Each client has a connection pool and
@@ -139,7 +140,7 @@ import com.tryfinch.api.models.HrisDirectoryListParams;
import java.util.concurrent.CompletableFuture;
FinchClient client = FinchOkHttpClient.builder()
- // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET` and `FINCH_WEBHOOK_SECRET` environment variables
+ // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET`, `FINCH_WEBHOOK_SECRET` and `FINCH_BASE_URL` environment variables
.fromEnv()
.accessToken("My Access Token")
.build();
@@ -157,7 +158,7 @@ import com.tryfinch.api.models.HrisDirectoryListParams;
import java.util.concurrent.CompletableFuture;
FinchClientAsync client = FinchOkHttpClientAsync.builder()
- // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET` and `FINCH_WEBHOOK_SECRET` environment variables
+ // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET`, `FINCH_WEBHOOK_SECRET` and `FINCH_BASE_URL` environment variables
.fromEnv()
.accessToken("My Access Token")
.build();
diff --git a/build.gradle.kts b/build.gradle.kts
index 371fde06..a52f35b7 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.tryfinch.api"
- version = "5.0.0" // x-release-please-version
+ version = "5.1.0" // x-release-please-version
}
subprojects {
diff --git a/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/FinchOkHttpClient.kt b/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/FinchOkHttpClient.kt
index 3e365dbe..625e6cac 100644
--- a/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/FinchOkHttpClient.kt
+++ b/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/FinchOkHttpClient.kt
@@ -29,14 +29,10 @@ class FinchOkHttpClient private constructor() {
class Builder internal constructor() {
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
- private var baseUrl: String = ClientOptions.PRODUCTION_URL
private var timeout: Timeout = Timeout.default()
private var proxy: Proxy? = null
- fun baseUrl(baseUrl: String) = apply {
- clientOptions.baseUrl(baseUrl)
- this.baseUrl = baseUrl
- }
+ fun baseUrl(baseUrl: String) = apply { clientOptions.baseUrl(baseUrl) }
/**
* Whether to throw an exception if any of the Jackson versions detected at runtime are
@@ -190,7 +186,7 @@ class FinchOkHttpClient private constructor() {
clientOptions
.httpClient(
OkHttpClient.builder()
- .baseUrl(baseUrl)
+ .baseUrl(clientOptions.baseUrl())
.timeout(timeout)
.proxy(proxy)
.build()
diff --git a/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/FinchOkHttpClientAsync.kt b/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/FinchOkHttpClientAsync.kt
index 0a25d955..b8aac548 100644
--- a/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/FinchOkHttpClientAsync.kt
+++ b/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/FinchOkHttpClientAsync.kt
@@ -29,14 +29,10 @@ class FinchOkHttpClientAsync private constructor() {
class Builder internal constructor() {
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
- private var baseUrl: String = ClientOptions.PRODUCTION_URL
private var timeout: Timeout = Timeout.default()
private var proxy: Proxy? = null
- fun baseUrl(baseUrl: String) = apply {
- clientOptions.baseUrl(baseUrl)
- this.baseUrl = baseUrl
- }
+ fun baseUrl(baseUrl: String) = apply { clientOptions.baseUrl(baseUrl) }
/**
* Whether to throw an exception if any of the Jackson versions detected at runtime are
@@ -190,7 +186,7 @@ class FinchOkHttpClientAsync private constructor() {
clientOptions
.httpClient(
OkHttpClient.builder()
- .baseUrl(baseUrl)
+ .baseUrl(clientOptions.baseUrl())
.timeout(timeout)
.proxy(proxy)
.build()
diff --git a/finch-java-core/build.gradle.kts b/finch-java-core/build.gradle.kts
index cc2d57aa..b3da0288 100644
--- a/finch-java-core/build.gradle.kts
+++ b/finch-java-core/build.gradle.kts
@@ -17,14 +17,14 @@ configurations.all {
}
dependencies {
- api("com.fasterxml.jackson.core:jackson-core:2.18.1")
- api("com.fasterxml.jackson.core:jackson-databind:2.18.1")
+ api("com.fasterxml.jackson.core:jackson-core:2.18.2")
+ api("com.fasterxml.jackson.core:jackson-databind:2.18.2")
api("com.google.errorprone:error_prone_annotations:2.33.0")
- implementation("com.fasterxml.jackson.core:jackson-annotations:2.18.1")
- implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.1")
- implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.1")
- implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.1")
+ implementation("com.fasterxml.jackson.core:jackson-annotations:2.18.2")
+ implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.2")
+ implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2")
+ implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.2")
implementation("org.apache.httpcomponents.core5:httpcore5:5.2.4")
implementation("org.apache.httpcomponents.client5:httpclient5:5.3.1")
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Check.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Check.kt
index 5918fb36..7ac22c66 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Check.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Check.kt
@@ -47,6 +47,7 @@ internal fun checkMaxLength(name: String, value: String, maxLength: Int): String
internal fun checkJacksonVersionCompatibility() {
val incompatibleJacksonVersions =
RUNTIME_JACKSON_VERSIONS.mapNotNull {
+ val badVersionReason = BAD_JACKSON_VERSIONS[it.toString()]
when {
it.majorVersion != MINIMUM_JACKSON_VERSION.majorVersion ->
it to "incompatible major version"
@@ -55,6 +56,7 @@ internal fun checkJacksonVersionCompatibility() {
it.minorVersion == MINIMUM_JACKSON_VERSION.minorVersion &&
it.patchLevel < MINIMUM_JACKSON_VERSION.patchLevel ->
it to "patch version too low"
+ badVersionReason != null -> it to badVersionReason
else -> null
}
}
@@ -77,6 +79,8 @@ Double-check that you are depending on compatible Jackson versions.
}
private val MINIMUM_JACKSON_VERSION: Version = VersionUtil.parseVersion("2.13.4", null, null)
+private val BAD_JACKSON_VERSIONS: Map =
+ mapOf("2.18.1" to "due to https://github.com/FasterXML/jackson-databind/issues/4639")
private val RUNTIME_JACKSON_VERSIONS: List =
listOf(
com.fasterxml.jackson.core.json.PackageVersion.VERSION,
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ClientOptions.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ClientOptions.kt
index ee2132fe..8a9abd9c 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ClientOptions.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ClientOptions.kt
@@ -222,7 +222,10 @@ private constructor(
fun removeAllQueryParams(keys: Set) = apply { queryParams.removeAll(keys) }
+ fun baseUrl(): String = baseUrl
+
fun fromEnv() = apply {
+ System.getenv("FINCH_BASE_URL")?.let { baseUrl(it) }
System.getenv("FINCH_CLIENT_ID")?.let { clientId(it) }
System.getenv("FINCH_CLIENT_SECRET")?.let { clientSecret(it) }
System.getenv("FINCH_WEBHOOK_SECRET")?.let { webhookSecret(it) }
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitListSupportedBenefitsResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitListSupportedBenefitsResponse.kt
new file mode 100644
index 00000000..be8e05eb
--- /dev/null
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitListSupportedBenefitsResponse.kt
@@ -0,0 +1,918 @@
+// 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.checkKnown
+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
+
+class BenefitListSupportedBenefitsResponse
+private constructor(
+ private val annualMaximum: JsonField,
+ private val catchUp: JsonField,
+ private val companyContribution: JsonField>,
+ private val description: JsonField,
+ private val employeeDeduction: JsonField>,
+ private val frequencies: JsonField>,
+ private val hsaContributionLimit: JsonField>,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @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("description")
+ @ExcludeMissing
+ description: JsonField = JsonMissing.of(),
+ @JsonProperty("employee_deduction")
+ @ExcludeMissing
+ employeeDeduction: JsonField> = JsonMissing.of(),
+ @JsonProperty("frequencies")
+ @ExcludeMissing
+ frequencies: JsonField> = JsonMissing.of(),
+ @JsonProperty("hsa_contribution_limit")
+ @ExcludeMissing
+ hsaContributionLimit: JsonField> = JsonMissing.of(),
+ ) : this(
+ annualMaximum,
+ catchUp,
+ companyContribution,
+ description,
+ employeeDeduction,
+ frequencies,
+ hsaContributionLimit,
+ mutableMapOf(),
+ )
+
+ /**
+ * Whether the provider supports an annual maximum for this benefit.
+ *
+ * @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")
+
+ /**
+ * Whether the provider supports catch up for this benefit. This field will only be true for
+ * retirement benefits.
+ *
+ * @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")
+
+ /**
+ * Supported contribution types. An empty array indicates contributions are not supported.
+ *
+ * @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")
+
+ /**
+ * @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")
+
+ /**
+ * Supported deduction types. An empty array indicates deductions are not supported.
+ *
+ * @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")
+
+ /**
+ * The list of frequencies supported by the provider for this benefit
+ *
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun frequencies(): Optional> = frequencies.getOptional("frequencies")
+
+ /**
+ * Whether the provider supports HSA contribution limits. Empty if this feature is not supported
+ * for the benefit. This array only has values for HSA benefits.
+ *
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun hsaContributionLimit(): Optional> =
+ hsaContributionLimit.getOptional("hsa_contribution_limit")
+
+ /**
+ * 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 [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 [employeeDeduction].
+ *
+ * Unlike [employeeDeduction], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("employee_deduction")
+ @ExcludeMissing
+ fun _employeeDeduction(): JsonField> = employeeDeduction
+
+ /**
+ * Returns the raw JSON value of [frequencies].
+ *
+ * Unlike [frequencies], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("frequencies")
+ @ExcludeMissing
+ fun _frequencies(): JsonField> = frequencies
+
+ /**
+ * Returns the raw JSON value of [hsaContributionLimit].
+ *
+ * Unlike [hsaContributionLimit], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("hsa_contribution_limit")
+ @ExcludeMissing
+ fun _hsaContributionLimit(): JsonField> = hsaContributionLimit
+
+ @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
+ * [BenefitListSupportedBenefitsResponse].
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [BenefitListSupportedBenefitsResponse]. */
+ class Builder internal constructor() {
+
+ private var annualMaximum: JsonField = JsonMissing.of()
+ private var catchUp: JsonField = JsonMissing.of()
+ private var companyContribution: JsonField>? = null
+ private var description: JsonField = JsonMissing.of()
+ private var employeeDeduction: JsonField>? = null
+ private var frequencies: JsonField>? = null
+ private var hsaContributionLimit: JsonField>? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(
+ benefitListSupportedBenefitsResponse: BenefitListSupportedBenefitsResponse
+ ) = apply {
+ annualMaximum = benefitListSupportedBenefitsResponse.annualMaximum
+ catchUp = benefitListSupportedBenefitsResponse.catchUp
+ companyContribution =
+ benefitListSupportedBenefitsResponse.companyContribution.map { it.toMutableList() }
+ description = benefitListSupportedBenefitsResponse.description
+ employeeDeduction =
+ benefitListSupportedBenefitsResponse.employeeDeduction.map { it.toMutableList() }
+ frequencies =
+ benefitListSupportedBenefitsResponse.frequencies.map { it.toMutableList() }
+ hsaContributionLimit =
+ benefitListSupportedBenefitsResponse.hsaContributionLimit.map { it.toMutableList() }
+ additionalProperties =
+ benefitListSupportedBenefitsResponse.additionalProperties.toMutableMap()
+ }
+
+ /** Whether the provider supports an annual maximum for this benefit. */
+ fun annualMaximum(annualMaximum: Boolean?) =
+ annualMaximum(JsonField.ofNullable(annualMaximum))
+
+ /**
+ * Alias for [Builder.annualMaximum].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun annualMaximum(annualMaximum: Boolean) = annualMaximum(annualMaximum as Boolean?)
+
+ /** 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 [Boolean] 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
+ }
+
+ /**
+ * Whether the provider supports catch up for this benefit. This field will only be true for
+ * retirement benefits.
+ */
+ fun catchUp(catchUp: Boolean?) = catchUp(JsonField.ofNullable(catchUp))
+
+ /**
+ * Alias for [Builder.catchUp].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun catchUp(catchUp: Boolean) = catchUp(catchUp as Boolean?)
+
+ /** Alias for calling [Builder.catchUp] with `catchUp.orElse(null)`. */
+ fun catchUp(catchUp: Optional) = catchUp(catchUp.getOrNull())
+
+ /**
+ * 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 }
+
+ /**
+ * Supported contribution types. An empty array indicates contributions are not supported.
+ */
+ fun companyContribution(companyContribution: List?) =
+ companyContribution(JsonField.ofNullable(companyContribution))
+
+ /**
+ * Alias for calling [Builder.companyContribution] with `companyContribution.orElse(null)`.
+ */
+ fun companyContribution(companyContribution: Optional>) =
+ companyContribution(companyContribution.getOrNull())
+
+ /**
+ * Sets [Builder.companyContribution] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.companyContribution] with a well-typed
+ * `List` 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.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [CompanyContribution] to [Builder.companyContribution].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addCompanyContribution(companyContribution: CompanyContribution) = apply {
+ this.companyContribution =
+ (this.companyContribution ?: JsonField.of(mutableListOf())).also {
+ checkKnown("companyContribution", it).add(companyContribution)
+ }
+ }
+
+ fun description(description: String?) = description(JsonField.ofNullable(description))
+
+ /** Alias for calling [Builder.description] with `description.orElse(null)`. */
+ fun description(description: Optional) = description(description.getOrNull())
+
+ /**
+ * 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 }
+
+ /** Supported deduction types. An empty array indicates deductions are not supported. */
+ fun employeeDeduction(employeeDeduction: List?) =
+ employeeDeduction(JsonField.ofNullable(employeeDeduction))
+
+ /** Alias for calling [Builder.employeeDeduction] with `employeeDeduction.orElse(null)`. */
+ fun employeeDeduction(employeeDeduction: Optional>) =
+ employeeDeduction(employeeDeduction.getOrNull())
+
+ /**
+ * Sets [Builder.employeeDeduction] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.employeeDeduction] with a well-typed
+ * `List` 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.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [EmployeeDeduction] to [Builder.employeeDeduction].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addEmployeeDeduction(employeeDeduction: EmployeeDeduction) = apply {
+ this.employeeDeduction =
+ (this.employeeDeduction ?: JsonField.of(mutableListOf())).also {
+ checkKnown("employeeDeduction", it).add(employeeDeduction)
+ }
+ }
+
+ /** The list of frequencies supported by the provider for this benefit */
+ fun frequencies(frequencies: List) =
+ frequencies(JsonField.of(frequencies))
+
+ /**
+ * Sets [Builder.frequencies] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.frequencies] with a well-typed `List`
+ * value instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun frequencies(frequencies: JsonField>) = apply {
+ this.frequencies = frequencies.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [BenefitFrequency] to [frequencies].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addFrequency(frequency: BenefitFrequency) = apply {
+ frequencies =
+ (frequencies ?: JsonField.of(mutableListOf())).also {
+ checkKnown("frequencies", it).add(frequency)
+ }
+ }
+
+ /**
+ * Whether the provider supports HSA contribution limits. Empty if this feature is not
+ * supported for the benefit. This array only has values for HSA benefits.
+ */
+ fun hsaContributionLimit(hsaContributionLimit: List?) =
+ hsaContributionLimit(JsonField.ofNullable(hsaContributionLimit))
+
+ /**
+ * Alias for calling [Builder.hsaContributionLimit] with
+ * `hsaContributionLimit.orElse(null)`.
+ */
+ fun hsaContributionLimit(hsaContributionLimit: Optional>) =
+ hsaContributionLimit(hsaContributionLimit.getOrNull())
+
+ /**
+ * Sets [Builder.hsaContributionLimit] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.hsaContributionLimit] with a well-typed
+ * `List` value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun hsaContributionLimit(hsaContributionLimit: JsonField>) =
+ apply {
+ this.hsaContributionLimit = hsaContributionLimit.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [HsaContributionLimit] to [Builder.hsaContributionLimit].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addHsaContributionLimit(hsaContributionLimit: HsaContributionLimit) = apply {
+ this.hsaContributionLimit =
+ (this.hsaContributionLimit ?: JsonField.of(mutableListOf())).also {
+ checkKnown("hsaContributionLimit", it).add(hsaContributionLimit)
+ }
+ }
+
+ 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 [BenefitListSupportedBenefitsResponse].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): BenefitListSupportedBenefitsResponse =
+ BenefitListSupportedBenefitsResponse(
+ annualMaximum,
+ catchUp,
+ (companyContribution ?: JsonMissing.of()).map { it.toImmutable() },
+ description,
+ (employeeDeduction ?: JsonMissing.of()).map { it.toImmutable() },
+ (frequencies ?: JsonMissing.of()).map { it.toImmutable() },
+ (hsaContributionLimit ?: JsonMissing.of()).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): BenefitListSupportedBenefitsResponse = apply {
+ if (validated) {
+ return@apply
+ }
+
+ annualMaximum()
+ catchUp()
+ companyContribution().ifPresent { it.forEach { it?.validate() } }
+ description()
+ employeeDeduction().ifPresent { it.forEach { it?.validate() } }
+ frequencies().ifPresent { it.forEach { it?.validate() } }
+ hsaContributionLimit().ifPresent { it.forEach { 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 (annualMaximum.asKnown().isPresent) 1 else 0) +
+ (if (catchUp.asKnown().isPresent) 1 else 0) +
+ (companyContribution.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() }
+ ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (employeeDeduction.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() }
+ ?: 0) +
+ (frequencies.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } ?: 0) +
+ (hsaContributionLimit.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() }
+ ?: 0)
+
+ class CompanyContribution
+ @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) = CompanyContribution(JsonField.of(value))
+ }
+
+ /** An enum containing [CompanyContribution]'s known values. */
+ enum class Known {
+ FIXED,
+ PERCENT,
+ }
+
+ /**
+ * An enum containing [CompanyContribution]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [CompanyContribution] 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 [CompanyContribution] 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 CompanyContribution: $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
+
+ fun validate(): CompanyContribution = 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 /* spotless:off */ other is CompanyContribution && value == other.value /* spotless:on */
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ class EmployeeDeduction @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) = EmployeeDeduction(JsonField.of(value))
+ }
+
+ /** An enum containing [EmployeeDeduction]'s known values. */
+ enum class Known {
+ FIXED,
+ PERCENT,
+ }
+
+ /**
+ * An enum containing [EmployeeDeduction]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [EmployeeDeduction] 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 [EmployeeDeduction] 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 EmployeeDeduction: $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
+
+ fun validate(): EmployeeDeduction = 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 /* spotless:off */ other is EmployeeDeduction && value == other.value /* spotless:on */
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ class HsaContributionLimit
+ @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) = HsaContributionLimit(JsonField.of(value))
+ }
+
+ /** An enum containing [HsaContributionLimit]'s known values. */
+ enum class Known {
+ INDIVIDUAL,
+ FAMILY,
+ }
+
+ /**
+ * An enum containing [HsaContributionLimit]'s known values, as well as an [_UNKNOWN]
+ * member.
+ *
+ * An instance of [HsaContributionLimit] 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 [HsaContributionLimit] 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 HsaContributionLimit: $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
+
+ fun validate(): HsaContributionLimit = 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 /* spotless:off */ other is HsaContributionLimit && value == other.value /* spotless:on */
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is BenefitListSupportedBenefitsResponse && annualMaximum == other.annualMaximum && catchUp == other.catchUp && companyContribution == other.companyContribution && description == other.description && employeeDeduction == other.employeeDeduction && frequencies == other.frequencies && hsaContributionLimit == other.hsaContributionLimit && additionalProperties == other.additionalProperties /* spotless:on */
+ }
+
+ /* spotless:off */
+ private val hashCode: Int by lazy { Objects.hash(annualMaximum, catchUp, companyContribution, description, employeeDeduction, frequencies, hsaContributionLimit, additionalProperties) }
+ /* spotless:on */
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "BenefitListSupportedBenefitsResponse{annualMaximum=$annualMaximum, catchUp=$catchUp, companyContribution=$companyContribution, description=$description, employeeDeduction=$employeeDeduction, frequencies=$frequencies, hsaContributionLimit=$hsaContributionLimit, additionalProperties=$additionalProperties}"
+}
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponse.kt
index 16e0501e..a65b38d4 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponse.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponse.kt
@@ -18,13 +18,15 @@ import java.util.Objects
class CreateCompanyBenefitsResponse
private constructor(
private val benefitId: JsonField,
+ private val jobId: JsonField,
private val additionalProperties: MutableMap,
) {
@JsonCreator
private constructor(
- @JsonProperty("benefit_id") @ExcludeMissing benefitId: JsonField = JsonMissing.of()
- ) : this(benefitId, mutableMapOf())
+ @JsonProperty("benefit_id") @ExcludeMissing benefitId: JsonField = JsonMissing.of(),
+ @JsonProperty("job_id") @ExcludeMissing jobId: JsonField = JsonMissing.of(),
+ ) : this(benefitId, jobId, mutableMapOf())
/**
* The id of the benefit.
@@ -34,6 +36,12 @@ private constructor(
*/
fun benefitId(): String = benefitId.getRequired("benefit_id")
+ /**
+ * @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 jobId(): String = jobId.getRequired("job_id")
+
/**
* Returns the raw JSON value of [benefitId].
*
@@ -41,6 +49,13 @@ private constructor(
*/
@JsonProperty("benefit_id") @ExcludeMissing fun _benefitId(): JsonField = benefitId
+ /**
+ * Returns the raw JSON value of [jobId].
+ *
+ * Unlike [jobId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("job_id") @ExcludeMissing fun _jobId(): JsonField = jobId
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -62,6 +77,7 @@ private constructor(
* The following fields are required:
* ```java
* .benefitId()
+ * .jobId()
* ```
*/
@JvmStatic fun builder() = Builder()
@@ -71,11 +87,13 @@ private constructor(
class Builder internal constructor() {
private var benefitId: JsonField? = null
+ private var jobId: JsonField? = null
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(createCompanyBenefitsResponse: CreateCompanyBenefitsResponse) = apply {
benefitId = createCompanyBenefitsResponse.benefitId
+ jobId = createCompanyBenefitsResponse.jobId
additionalProperties = createCompanyBenefitsResponse.additionalProperties.toMutableMap()
}
@@ -91,6 +109,16 @@ private constructor(
*/
fun benefitId(benefitId: JsonField) = apply { this.benefitId = benefitId }
+ fun jobId(jobId: String) = jobId(JsonField.of(jobId))
+
+ /**
+ * Sets [Builder.jobId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.jobId] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun jobId(jobId: JsonField) = apply { this.jobId = jobId }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -118,6 +146,7 @@ private constructor(
* The following fields are required:
* ```java
* .benefitId()
+ * .jobId()
* ```
*
* @throws IllegalStateException if any required field is unset.
@@ -125,6 +154,7 @@ private constructor(
fun build(): CreateCompanyBenefitsResponse =
CreateCompanyBenefitsResponse(
checkRequired("benefitId", benefitId),
+ checkRequired("jobId", jobId),
additionalProperties.toMutableMap(),
)
}
@@ -137,6 +167,7 @@ private constructor(
}
benefitId()
+ jobId()
validated = true
}
@@ -153,22 +184,24 @@ private constructor(
*
* Used for best match union deserialization.
*/
- @JvmSynthetic internal fun validity(): Int = (if (benefitId.asKnown().isPresent) 1 else 0)
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (benefitId.asKnown().isPresent) 1 else 0) + (if (jobId.asKnown().isPresent) 1 else 0)
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
- return /* spotless:off */ other is CreateCompanyBenefitsResponse && benefitId == other.benefitId && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is CreateCompanyBenefitsResponse && benefitId == other.benefitId && jobId == other.jobId && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(benefitId, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(benefitId, jobId, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "CreateCompanyBenefitsResponse{benefitId=$benefitId, additionalProperties=$additionalProperties}"
+ "CreateCompanyBenefitsResponse{benefitId=$benefitId, jobId=$jobId, additionalProperties=$additionalProperties}"
}
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EnrolledIndividual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EnrolledIndividual.kt
deleted file mode 100644
index f2a7666c..00000000
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EnrolledIndividual.kt
+++ /dev/null
@@ -1,579 +0,0 @@
-// 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.errors.FinchInvalidDataException
-import java.util.Collections
-import java.util.Objects
-import java.util.Optional
-import kotlin.jvm.optionals.getOrNull
-
-class EnrolledIndividual
-private constructor(
- private val body: JsonField,
- private val code: JsonField,
- private val individualId: JsonField,
- private val additionalProperties: MutableMap,
-) {
-
- @JsonCreator
- private constructor(
- @JsonProperty("body") @ExcludeMissing body: JsonField = JsonMissing.of(),
- @JsonProperty("code") @ExcludeMissing code: JsonField = JsonMissing.of(),
- @JsonProperty("individual_id")
- @ExcludeMissing
- individualId: JsonField = JsonMissing.of(),
- ) : this(body, code, individualId, mutableMapOf())
-
- /**
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun body(): Optional = body.getOptional("body")
-
- /**
- * HTTP status code. Either 201 or 200
- *
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun code(): Optional = code.getOptional("code")
-
- /**
- * @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 [body].
- *
- * Unlike [body], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("body") @ExcludeMissing fun _body(): JsonField = body
-
- /**
- * Returns the raw JSON value of [code].
- *
- * Unlike [code], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code
-
- /**
- * 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 [EnrolledIndividual]. */
- @JvmStatic fun builder() = Builder()
- }
-
- /** A builder for [EnrolledIndividual]. */
- class Builder internal constructor() {
-
- private var body: JsonField = JsonMissing.of()
- private var code: JsonField = JsonMissing.of()
- private var individualId: JsonField = JsonMissing.of()
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(enrolledIndividual: EnrolledIndividual) = apply {
- body = enrolledIndividual.body
- code = enrolledIndividual.code
- individualId = enrolledIndividual.individualId
- additionalProperties = enrolledIndividual.additionalProperties.toMutableMap()
- }
-
- fun body(body: Body) = body(JsonField.of(body))
-
- /**
- * Sets [Builder.body] to an arbitrary JSON value.
- *
- * You should usually call [Builder.body] with a well-typed [Body] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun body(body: JsonField) = apply { this.body = body }
-
- /** HTTP status code. Either 201 or 200 */
- fun code(code: Code) = code(JsonField.of(code))
-
- /**
- * Sets [Builder.code] to an arbitrary JSON value.
- *
- * You should usually call [Builder.code] with a well-typed [Code] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun code(code: JsonField) = apply { this.code = code }
-
- 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 [EnrolledIndividual].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- */
- fun build(): EnrolledIndividual =
- EnrolledIndividual(body, code, individualId, additionalProperties.toMutableMap())
- }
-
- private var validated: Boolean = false
-
- fun validate(): EnrolledIndividual = apply {
- if (validated) {
- return@apply
- }
-
- body().ifPresent { it.validate() }
- code().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 =
- (body.asKnown().getOrNull()?.validity() ?: 0) +
- (code.asKnown().getOrNull()?.validity() ?: 0) +
- (if (individualId.asKnown().isPresent) 1 else 0)
-
- class Body
- private constructor(
- private val finchCode: JsonField,
- private val message: JsonField,
- private val name: JsonField,
- private val additionalProperties: MutableMap,
- ) {
-
- @JsonCreator
- private constructor(
- @JsonProperty("finch_code")
- @ExcludeMissing
- finchCode: JsonField = JsonMissing.of(),
- @JsonProperty("message") @ExcludeMissing message: JsonField = JsonMissing.of(),
- @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
- ) : this(finchCode, message, name, mutableMapOf())
-
- /**
- * A descriptive identifier for the response.
- *
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun finchCode(): Optional = finchCode.getOptional("finch_code")
-
- /**
- * Short description in English that provides more information about the response.
- *
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun message(): Optional = message.getOptional("message")
-
- /**
- * Identifier indicating whether the benefit was newly enrolled or updated.
- *
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun name(): Optional = name.getOptional("name")
-
- /**
- * Returns the raw JSON value of [finchCode].
- *
- * Unlike [finchCode], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("finch_code") @ExcludeMissing fun _finchCode(): JsonField = finchCode
-
- /**
- * Returns the raw JSON value of [message].
- *
- * Unlike [message], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("message") @ExcludeMissing fun _message(): JsonField = message
-
- /**
- * Returns the raw JSON value of [name].
- *
- * Unlike [name], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name
-
- @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 finchCode: JsonField = JsonMissing.of()
- private var message: JsonField = JsonMissing.of()
- private var name: JsonField = JsonMissing.of()
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(body: Body) = apply {
- finchCode = body.finchCode
- message = body.message
- name = body.name
- additionalProperties = body.additionalProperties.toMutableMap()
- }
-
- /** A descriptive identifier for the response. */
- fun finchCode(finchCode: String?) = finchCode(JsonField.ofNullable(finchCode))
-
- /** Alias for calling [Builder.finchCode] with `finchCode.orElse(null)`. */
- fun finchCode(finchCode: Optional) = finchCode(finchCode.getOrNull())
-
- /**
- * Sets [Builder.finchCode] to an arbitrary JSON value.
- *
- * You should usually call [Builder.finchCode] with a well-typed [String] value instead.
- * This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun finchCode(finchCode: JsonField) = apply { this.finchCode = finchCode }
-
- /** Short description in English that provides more information about the response. */
- fun message(message: String?) = message(JsonField.ofNullable(message))
-
- /** Alias for calling [Builder.message] with `message.orElse(null)`. */
- fun message(message: Optional) = message(message.getOrNull())
-
- /**
- * Sets [Builder.message] to an arbitrary JSON value.
- *
- * You should usually call [Builder.message] with a well-typed [String] value instead.
- * This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun message(message: JsonField) = apply { this.message = message }
-
- /** Identifier indicating whether the benefit was newly enrolled or updated. */
- fun name(name: String?) = name(JsonField.ofNullable(name))
-
- /** Alias for calling [Builder.name] with `name.orElse(null)`. */
- fun name(name: Optional) = name(name.getOrNull())
-
- /**
- * Sets [Builder.name] to an arbitrary JSON value.
- *
- * You should usually call [Builder.name] with a well-typed [String] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported
- * value.
- */
- fun name(name: JsonField) = apply { this.name = name }
-
- 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 [Body].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- */
- fun build(): Body = Body(finchCode, message, name, additionalProperties.toMutableMap())
- }
-
- private var validated: Boolean = false
-
- fun validate(): Body = apply {
- if (validated) {
- return@apply
- }
-
- finchCode()
- message()
- name()
- 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 (finchCode.asKnown().isPresent) 1 else 0) +
- (if (message.asKnown().isPresent) 1 else 0) +
- (if (name.asKnown().isPresent) 1 else 0)
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return /* spotless:off */ other is Body && finchCode == other.finchCode && message == other.message && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */
- }
-
- /* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(finchCode, message, name, additionalProperties) }
- /* spotless:on */
-
- override fun hashCode(): Int = hashCode
-
- override fun toString() =
- "Body{finchCode=$finchCode, message=$message, name=$name, additionalProperties=$additionalProperties}"
- }
-
- /** HTTP status code. Either 201 or 200 */
- class Code @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 OK = of(200)
-
- @JvmField val CREATED = of(201)
-
- @JvmField val NOT_FOUND = of(404)
-
- @JvmField val FORBIDDEN = of(403)
-
- @JvmStatic fun of(value: Long) = Code(JsonField.of(value))
- }
-
- /** An enum containing [Code]'s known values. */
- enum class Known {
- OK,
- CREATED,
- NOT_FOUND,
- FORBIDDEN,
- }
-
- /**
- * An enum containing [Code]'s known values, as well as an [_UNKNOWN] member.
- *
- * An instance of [Code] 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 {
- OK,
- CREATED,
- NOT_FOUND,
- FORBIDDEN,
- /** An enum member indicating that [Code] 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) {
- OK -> Value.OK
- CREATED -> Value.CREATED
- NOT_FOUND -> Value.NOT_FOUND
- FORBIDDEN -> Value.FORBIDDEN
- 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) {
- OK -> Known.OK
- CREATED -> Known.CREATED
- NOT_FOUND -> Known.NOT_FOUND
- FORBIDDEN -> Known.FORBIDDEN
- else -> throw FinchInvalidDataException("Unknown Code: $value")
- }
-
- /**
- * Returns this class instance's primitive wire representation.
- *
- * @throws FinchInvalidDataException if this class instance's value does not have the
- * expected primitive type.
- */
- fun asLong(): Long =
- _value().asNumber().getOrNull()?.let {
- if (it.toDouble() % 1 == 0.0) it.toLong() else null
- } ?: throw FinchInvalidDataException("Value is not a Long")
-
- private var validated: Boolean = false
-
- fun validate(): Code = 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 /* spotless:off */ other is Code && value == other.value /* spotless:on */
- }
-
- override fun hashCode() = value.hashCode()
-
- override fun toString() = value.toString()
- }
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return /* spotless:off */ other is EnrolledIndividual && body == other.body && code == other.code && individualId == other.individualId && additionalProperties == other.additionalProperties /* spotless:on */
- }
-
- /* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(body, code, individualId, additionalProperties) }
- /* spotless:on */
-
- override fun hashCode(): Int = hashCode
-
- override fun toString() =
- "EnrolledIndividual{body=$body, code=$code, individualId=$individualId, additionalProperties=$additionalProperties}"
-}
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EnrolledIndividualBenefitResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EnrolledIndividualBenefitResponse.kt
new file mode 100644
index 00000000..b3cabc1d
--- /dev/null
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EnrolledIndividualBenefitResponse.kt
@@ -0,0 +1,172 @@
+// 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 EnrolledIndividualBenefitResponse
+private constructor(
+ private val jobId: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("job_id") @ExcludeMissing jobId: JsonField = JsonMissing.of()
+ ) : this(jobId, mutableMapOf())
+
+ /**
+ * @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 jobId(): String = jobId.getRequired("job_id")
+
+ /**
+ * Returns the raw JSON value of [jobId].
+ *
+ * Unlike [jobId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("job_id") @ExcludeMissing fun _jobId(): JsonField = jobId
+
+ @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
+ * [EnrolledIndividualBenefitResponse].
+ *
+ * The following fields are required:
+ * ```java
+ * .jobId()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [EnrolledIndividualBenefitResponse]. */
+ class Builder internal constructor() {
+
+ private var jobId: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(enrolledIndividualBenefitResponse: EnrolledIndividualBenefitResponse) =
+ apply {
+ jobId = enrolledIndividualBenefitResponse.jobId
+ additionalProperties =
+ enrolledIndividualBenefitResponse.additionalProperties.toMutableMap()
+ }
+
+ fun jobId(jobId: String) = jobId(JsonField.of(jobId))
+
+ /**
+ * Sets [Builder.jobId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.jobId] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun jobId(jobId: JsonField) = apply { this.jobId = jobId }
+
+ 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 [EnrolledIndividualBenefitResponse].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .jobId()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): EnrolledIndividualBenefitResponse =
+ EnrolledIndividualBenefitResponse(
+ checkRequired("jobId", jobId),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): EnrolledIndividualBenefitResponse = apply {
+ if (validated) {
+ return@apply
+ }
+
+ jobId()
+ 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 (jobId.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is EnrolledIndividualBenefitResponse && jobId == other.jobId && additionalProperties == other.additionalProperties /* spotless:on */
+ }
+
+ /* spotless:off */
+ private val hashCode: Int by lazy { Objects.hash(jobId, additionalProperties) }
+ /* spotless:on */
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "EnrolledIndividualBenefitResponse{jobId=$jobId, additionalProperties=$additionalProperties}"
+}
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPage.kt
index 6ca15012..b5773d4e 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPage.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPage.kt
@@ -2,166 +2,103 @@
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.errors.FinchInvalidDataException
+import com.tryfinch.api.core.checkRequired
import com.tryfinch.api.services.blocking.hris.benefits.IndividualService
-import java.util.Collections
import java.util.Objects
import java.util.Optional
import java.util.stream.Stream
import java.util.stream.StreamSupport
import kotlin.jvm.optionals.getOrNull
-/** Get enrollment information for the given individuals. */
+/** @see [IndividualService.retrieveManyBenefits] */
class HrisBenefitIndividualRetrieveManyBenefitsPage
private constructor(
- private val individualsService: IndividualService,
+ private val service: IndividualService,
private val params: HrisBenefitIndividualRetrieveManyBenefitsParams,
- private val response: Response,
+ private val items: List,
) {
- fun response(): Response = response
+ fun hasNextPage(): Boolean = items.isNotEmpty()
- fun items(): List = response().items()
+ fun getNextPageParams(): Optional =
+ Optional.empty()
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return /* spotless:off */ other is HrisBenefitIndividualRetrieveManyBenefitsPage && individualsService == other.individualsService && params == other.params && response == other.response /* spotless:on */
- }
-
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(individualsService, params, response) /* spotless:on */
+ fun getNextPage(): Optional =
+ getNextPageParams().map { service.retrieveManyBenefits(it) }
- override fun toString() =
- "HrisBenefitIndividualRetrieveManyBenefitsPage{individualsService=$individualsService, params=$params, response=$response}"
-
- fun hasNextPage(): Boolean {
- return !items().isEmpty()
- }
+ fun autoPager(): AutoPager = AutoPager(this)
- fun getNextPageParams(): Optional {
- return Optional.empty()
- }
+ /** The parameters that were used to request this page. */
+ fun params(): HrisBenefitIndividualRetrieveManyBenefitsParams = params
- fun getNextPage(): Optional {
- return getNextPageParams().map { individualsService.retrieveManyBenefits(it) }
- }
+ /** The response that this page was parsed from. */
+ fun items(): List = items
- fun autoPager(): AutoPager = AutoPager(this)
+ fun toBuilder() = Builder().from(this)
companion object {
- @JvmStatic
- fun of(
- individualsService: IndividualService,
- params: HrisBenefitIndividualRetrieveManyBenefitsParams,
- response: Response,
- ) = HrisBenefitIndividualRetrieveManyBenefitsPage(individualsService, params, response)
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [HrisBenefitIndividualRetrieveManyBenefitsPage].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .items()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
}
- class Response(
- private val items: JsonField>,
- private val additionalProperties: MutableMap,
- ) {
-
- @JsonCreator
- private constructor(
- @JsonProperty("items") items: JsonField> = JsonMissing.of()
- ) : this(items, mutableMapOf())
-
- fun items(): List = items.getOptional("items").getOrNull() ?: listOf()
-
- @JsonProperty("items")
- fun _items(): Optional>> = Optional.ofNullable(items)
-
- @JsonAnySetter
- private fun putAdditionalProperty(key: String, value: JsonValue) {
- additionalProperties.put(key, value)
- }
-
- @JsonAnyGetter
- @ExcludeMissing
- fun _additionalProperties(): Map =
- Collections.unmodifiableMap(additionalProperties)
-
- private var validated: Boolean = false
-
- fun validate(): Response = apply {
- if (validated) {
- return@apply
- }
-
- items().map { it.validate() }
- validated = true
- }
-
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: FinchInvalidDataException) {
- false
- }
-
- fun toBuilder() = Builder().from(this)
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return /* spotless:off */ other is Response && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */
+ /** A builder for [HrisBenefitIndividualRetrieveManyBenefitsPage]. */
+ class Builder internal constructor() {
+
+ private var service: IndividualService? = null
+ private var params: HrisBenefitIndividualRetrieveManyBenefitsParams? = null
+ private var items: List? = null
+
+ @JvmSynthetic
+ internal fun from(
+ hrisBenefitIndividualRetrieveManyBenefitsPage:
+ HrisBenefitIndividualRetrieveManyBenefitsPage
+ ) = apply {
+ service = hrisBenefitIndividualRetrieveManyBenefitsPage.service
+ params = hrisBenefitIndividualRetrieveManyBenefitsPage.params
+ items = hrisBenefitIndividualRetrieveManyBenefitsPage.items
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(items, additionalProperties) /* spotless:on */
-
- override fun toString() =
- "Response{items=$items, additionalProperties=$additionalProperties}"
-
- companion object {
+ fun service(service: IndividualService) = apply { this.service = service }
- /**
- * Returns a mutable builder for constructing an instance of
- * [HrisBenefitIndividualRetrieveManyBenefitsPage].
- */
- @JvmStatic fun builder() = Builder()
+ /** The parameters that were used to request this page. */
+ fun params(params: HrisBenefitIndividualRetrieveManyBenefitsParams) = apply {
+ this.params = params
}
- class Builder {
-
- private var items: JsonField> = JsonMissing.of()
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(page: Response) = apply {
- this.items = page.items
- this.additionalProperties.putAll(page.additionalProperties)
- }
-
- fun items(items: List) = items(JsonField.of(items))
-
- fun items(items: JsonField>) = apply { this.items = items }
-
- fun putAdditionalProperty(key: String, value: JsonValue) = apply {
- this.additionalProperties.put(key, value)
- }
-
- /**
- * Returns an immutable instance of [Response].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- */
- fun build(): Response = Response(items, additionalProperties.toMutableMap())
- }
+ /** The response that this page was parsed from. */
+ fun items(items: List) = apply { this.items = items }
+
+ /**
+ * Returns an immutable instance of [HrisBenefitIndividualRetrieveManyBenefitsPage].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .items()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): HrisBenefitIndividualRetrieveManyBenefitsPage =
+ HrisBenefitIndividualRetrieveManyBenefitsPage(
+ checkRequired("service", service),
+ checkRequired("params", params),
+ checkRequired("items", items),
+ )
}
class AutoPager(private val firstPage: HrisBenefitIndividualRetrieveManyBenefitsPage) :
@@ -183,4 +120,17 @@ private constructor(
return StreamSupport.stream(spliterator(), false)
}
}
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is HrisBenefitIndividualRetrieveManyBenefitsPage && service == other.service && params == other.params && items == other.items /* spotless:on */
+ }
+
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, items) /* spotless:on */
+
+ override fun toString() =
+ "HrisBenefitIndividualRetrieveManyBenefitsPage{service=$service, params=$params, items=$items}"
}
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPageAsync.kt
index 1ff8bb43..1d164078 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPageAsync.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPageAsync.kt
@@ -2,170 +2,106 @@
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.errors.FinchInvalidDataException
+import com.tryfinch.api.core.checkRequired
import com.tryfinch.api.services.async.hris.benefits.IndividualServiceAsync
-import java.util.Collections
import java.util.Objects
import java.util.Optional
import java.util.concurrent.CompletableFuture
import java.util.concurrent.Executor
import java.util.function.Predicate
-import kotlin.jvm.optionals.getOrNull
-/** Get enrollment information for the given individuals. */
+/** @see [IndividualServiceAsync.retrieveManyBenefits] */
class HrisBenefitIndividualRetrieveManyBenefitsPageAsync
private constructor(
- private val individualsService: IndividualServiceAsync,
+ private val service: IndividualServiceAsync,
private val params: HrisBenefitIndividualRetrieveManyBenefitsParams,
- private val response: Response,
+ private val items: List,
) {
- fun response(): Response = response
+ fun hasNextPage(): Boolean = items.isNotEmpty()
- fun items(): List = response().items()
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return /* spotless:off */ other is HrisBenefitIndividualRetrieveManyBenefitsPageAsync && individualsService == other.individualsService && params == other.params && response == other.response /* spotless:on */
- }
-
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(individualsService, params, response) /* spotless:on */
-
- override fun toString() =
- "HrisBenefitIndividualRetrieveManyBenefitsPageAsync{individualsService=$individualsService, params=$params, response=$response}"
-
- fun hasNextPage(): Boolean {
- return !items().isEmpty()
- }
-
- fun getNextPageParams(): Optional {
- return Optional.empty()
- }
+ fun getNextPageParams(): Optional =
+ Optional.empty()
fun getNextPage():
- CompletableFuture> {
- return getNextPageParams()
- .map { individualsService.retrieveManyBenefits(it).thenApply { Optional.of(it) } }
+ CompletableFuture> =
+ getNextPageParams()
+ .map { service.retrieveManyBenefits(it).thenApply { Optional.of(it) } }
.orElseGet { CompletableFuture.completedFuture(Optional.empty()) }
- }
fun autoPager(): AutoPager = AutoPager(this)
- companion object {
-
- @JvmStatic
- fun of(
- individualsService: IndividualServiceAsync,
- params: HrisBenefitIndividualRetrieveManyBenefitsParams,
- response: Response,
- ) = HrisBenefitIndividualRetrieveManyBenefitsPageAsync(individualsService, params, response)
- }
-
- class Response(
- private val items: JsonField>,
- private val additionalProperties: MutableMap,
- ) {
-
- @JsonCreator
- private constructor(
- @JsonProperty("items") items: JsonField> = JsonMissing.of()
- ) : this(items, mutableMapOf())
-
- fun items(): List = items.getOptional("items").getOrNull() ?: listOf()
-
- @JsonProperty("items")
- fun _items(): Optional>> = Optional.ofNullable(items)
-
- @JsonAnySetter
- private fun putAdditionalProperty(key: String, value: JsonValue) {
- additionalProperties.put(key, value)
- }
-
- @JsonAnyGetter
- @ExcludeMissing
- fun _additionalProperties(): Map =
- Collections.unmodifiableMap(additionalProperties)
+ /** The parameters that were used to request this page. */
+ fun params(): HrisBenefitIndividualRetrieveManyBenefitsParams = params
- private var validated: Boolean = false
+ /** The response that this page was parsed from. */
+ fun items(): List = items
- fun validate(): Response = apply {
- if (validated) {
- return@apply
- }
+ fun toBuilder() = Builder().from(this)
- items().map { it.validate() }
- validated = true
- }
-
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: FinchInvalidDataException) {
- false
- }
-
- fun toBuilder() = Builder().from(this)
+ companion object {
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [HrisBenefitIndividualRetrieveManyBenefitsPageAsync].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .items()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
- return /* spotless:off */ other is Response && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */
+ /** A builder for [HrisBenefitIndividualRetrieveManyBenefitsPageAsync]. */
+ class Builder internal constructor() {
+
+ private var service: IndividualServiceAsync? = null
+ private var params: HrisBenefitIndividualRetrieveManyBenefitsParams? = null
+ private var items: List? = null
+
+ @JvmSynthetic
+ internal fun from(
+ hrisBenefitIndividualRetrieveManyBenefitsPageAsync:
+ HrisBenefitIndividualRetrieveManyBenefitsPageAsync
+ ) = apply {
+ service = hrisBenefitIndividualRetrieveManyBenefitsPageAsync.service
+ params = hrisBenefitIndividualRetrieveManyBenefitsPageAsync.params
+ items = hrisBenefitIndividualRetrieveManyBenefitsPageAsync.items
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(items, additionalProperties) /* spotless:on */
-
- override fun toString() =
- "Response{items=$items, additionalProperties=$additionalProperties}"
+ fun service(service: IndividualServiceAsync) = apply { this.service = service }
- companion object {
-
- /**
- * Returns a mutable builder for constructing an instance of
- * [HrisBenefitIndividualRetrieveManyBenefitsPageAsync].
- */
- @JvmStatic fun builder() = Builder()
+ /** The parameters that were used to request this page. */
+ fun params(params: HrisBenefitIndividualRetrieveManyBenefitsParams) = apply {
+ this.params = params
}
- class Builder {
-
- private var items: JsonField> = JsonMissing.of()
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(page: Response) = apply {
- this.items = page.items
- this.additionalProperties.putAll(page.additionalProperties)
- }
-
- fun items(items: List) = items(JsonField.of(items))
-
- fun items(items: JsonField>) = apply { this.items = items }
-
- fun putAdditionalProperty(key: String, value: JsonValue) = apply {
- this.additionalProperties.put(key, value)
- }
-
- /**
- * Returns an immutable instance of [Response].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- */
- fun build(): Response = Response(items, additionalProperties.toMutableMap())
- }
+ /** The response that this page was parsed from. */
+ fun items(items: List) = apply { this.items = items }
+
+ /**
+ * Returns an immutable instance of [HrisBenefitIndividualRetrieveManyBenefitsPageAsync].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .items()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): HrisBenefitIndividualRetrieveManyBenefitsPageAsync =
+ HrisBenefitIndividualRetrieveManyBenefitsPageAsync(
+ checkRequired("service", service),
+ checkRequired("params", params),
+ checkRequired("items", items),
+ )
}
class AutoPager(private val firstPage: HrisBenefitIndividualRetrieveManyBenefitsPageAsync) {
@@ -197,4 +133,17 @@ private constructor(
return forEach(values::add, executor).thenApply { values }
}
}
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is HrisBenefitIndividualRetrieveManyBenefitsPageAsync && service == other.service && params == other.params && items == other.items /* spotless:on */
+ }
+
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, items) /* spotless:on */
+
+ override fun toString() =
+ "HrisBenefitIndividualRetrieveManyBenefitsPageAsync{service=$service, params=$params, items=$items}"
}
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPage.kt
deleted file mode 100644
index 2b7b92b4..00000000
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPage.kt
+++ /dev/null
@@ -1,186 +0,0 @@
-// 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.errors.FinchInvalidDataException
-import com.tryfinch.api.services.blocking.hris.benefits.IndividualService
-import java.util.Collections
-import java.util.Objects
-import java.util.Optional
-import java.util.stream.Stream
-import java.util.stream.StreamSupport
-import kotlin.jvm.optionals.getOrNull
-
-/** Unenroll individuals from a deduction or contribution */
-class HrisBenefitIndividualUnenrollManyPage
-private constructor(
- private val individualsService: IndividualService,
- private val params: HrisBenefitIndividualUnenrollManyParams,
- private val response: Response,
-) {
-
- fun response(): Response = response
-
- fun items(): List = response().items()
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return /* spotless:off */ other is HrisBenefitIndividualUnenrollManyPage && individualsService == other.individualsService && params == other.params && response == other.response /* spotless:on */
- }
-
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(individualsService, params, response) /* spotless:on */
-
- override fun toString() =
- "HrisBenefitIndividualUnenrollManyPage{individualsService=$individualsService, params=$params, response=$response}"
-
- fun hasNextPage(): Boolean {
- return !items().isEmpty()
- }
-
- fun getNextPageParams(): Optional {
- return Optional.empty()
- }
-
- fun getNextPage(): Optional {
- return getNextPageParams().map { individualsService.unenrollMany(it) }
- }
-
- fun autoPager(): AutoPager = AutoPager(this)
-
- companion object {
-
- @JvmStatic
- fun of(
- individualsService: IndividualService,
- params: HrisBenefitIndividualUnenrollManyParams,
- response: Response,
- ) = HrisBenefitIndividualUnenrollManyPage(individualsService, params, response)
- }
-
- class Response(
- private val items: JsonField>,
- private val additionalProperties: MutableMap,
- ) {
-
- @JsonCreator
- private constructor(
- @JsonProperty("items") items: JsonField> = JsonMissing.of()
- ) : this(items, mutableMapOf())
-
- fun items(): List = items.getOptional("items").getOrNull() ?: listOf()
-
- @JsonProperty("items")
- fun _items(): Optional>> = Optional.ofNullable(items)
-
- @JsonAnySetter
- private fun putAdditionalProperty(key: String, value: JsonValue) {
- additionalProperties.put(key, value)
- }
-
- @JsonAnyGetter
- @ExcludeMissing
- fun _additionalProperties(): Map =
- Collections.unmodifiableMap(additionalProperties)
-
- private var validated: Boolean = false
-
- fun validate(): Response = apply {
- if (validated) {
- return@apply
- }
-
- items().map { it.validate() }
- validated = true
- }
-
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: FinchInvalidDataException) {
- false
- }
-
- fun toBuilder() = Builder().from(this)
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return /* spotless:off */ other is Response && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */
- }
-
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(items, additionalProperties) /* spotless:on */
-
- override fun toString() =
- "Response{items=$items, additionalProperties=$additionalProperties}"
-
- companion object {
-
- /**
- * Returns a mutable builder for constructing an instance of
- * [HrisBenefitIndividualUnenrollManyPage].
- */
- @JvmStatic fun builder() = Builder()
- }
-
- class Builder {
-
- private var items: JsonField> = JsonMissing.of()
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(page: Response) = apply {
- this.items = page.items
- this.additionalProperties.putAll(page.additionalProperties)
- }
-
- fun items(items: List) = items(JsonField.of(items))
-
- fun items(items: JsonField>) = apply { this.items = items }
-
- fun putAdditionalProperty(key: String, value: JsonValue) = apply {
- this.additionalProperties.put(key, value)
- }
-
- /**
- * Returns an immutable instance of [Response].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- */
- fun build(): Response = Response(items, additionalProperties.toMutableMap())
- }
- }
-
- class AutoPager(private val firstPage: HrisBenefitIndividualUnenrollManyPage) :
- Iterable {
-
- override fun iterator(): Iterator = iterator {
- var page = firstPage
- var index = 0
- while (true) {
- while (index < page.items().size) {
- yield(page.items()[index++])
- }
- page = page.getNextPage().getOrNull() ?: break
- index = 0
- }
- }
-
- fun stream(): Stream {
- return StreamSupport.stream(spliterator(), false)
- }
- }
-}
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPageAsync.kt
deleted file mode 100644
index e569d5ee..00000000
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPageAsync.kt
+++ /dev/null
@@ -1,198 +0,0 @@
-// 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.errors.FinchInvalidDataException
-import com.tryfinch.api.services.async.hris.benefits.IndividualServiceAsync
-import java.util.Collections
-import java.util.Objects
-import java.util.Optional
-import java.util.concurrent.CompletableFuture
-import java.util.concurrent.Executor
-import java.util.function.Predicate
-import kotlin.jvm.optionals.getOrNull
-
-/** Unenroll individuals from a deduction or contribution */
-class HrisBenefitIndividualUnenrollManyPageAsync
-private constructor(
- private val individualsService: IndividualServiceAsync,
- private val params: HrisBenefitIndividualUnenrollManyParams,
- private val response: Response,
-) {
-
- fun response(): Response = response
-
- fun items(): List = response().items()
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return /* spotless:off */ other is HrisBenefitIndividualUnenrollManyPageAsync && individualsService == other.individualsService && params == other.params && response == other.response /* spotless:on */
- }
-
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(individualsService, params, response) /* spotless:on */
-
- override fun toString() =
- "HrisBenefitIndividualUnenrollManyPageAsync{individualsService=$individualsService, params=$params, response=$response}"
-
- fun hasNextPage(): Boolean {
- return !items().isEmpty()
- }
-
- fun getNextPageParams(): Optional {
- return Optional.empty()
- }
-
- fun getNextPage(): CompletableFuture> {
- return getNextPageParams()
- .map { individualsService.unenrollMany(it).thenApply { Optional.of(it) } }
- .orElseGet { CompletableFuture.completedFuture(Optional.empty()) }
- }
-
- fun autoPager(): AutoPager = AutoPager(this)
-
- companion object {
-
- @JvmStatic
- fun of(
- individualsService: IndividualServiceAsync,
- params: HrisBenefitIndividualUnenrollManyParams,
- response: Response,
- ) = HrisBenefitIndividualUnenrollManyPageAsync(individualsService, params, response)
- }
-
- class Response(
- private val items: JsonField>,
- private val additionalProperties: MutableMap,
- ) {
-
- @JsonCreator
- private constructor(
- @JsonProperty("items") items: JsonField> = JsonMissing.of()
- ) : this(items, mutableMapOf())
-
- fun items(): List = items.getOptional("items").getOrNull() ?: listOf()
-
- @JsonProperty("items")
- fun _items(): Optional>> = Optional.ofNullable(items)
-
- @JsonAnySetter
- private fun putAdditionalProperty(key: String, value: JsonValue) {
- additionalProperties.put(key, value)
- }
-
- @JsonAnyGetter
- @ExcludeMissing
- fun _additionalProperties(): Map =
- Collections.unmodifiableMap(additionalProperties)
-
- private var validated: Boolean = false
-
- fun validate(): Response = apply {
- if (validated) {
- return@apply
- }
-
- items().map { it.validate() }
- validated = true
- }
-
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: FinchInvalidDataException) {
- false
- }
-
- fun toBuilder() = Builder().from(this)
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return /* spotless:off */ other is Response && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */
- }
-
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(items, additionalProperties) /* spotless:on */
-
- override fun toString() =
- "Response{items=$items, additionalProperties=$additionalProperties}"
-
- companion object {
-
- /**
- * Returns a mutable builder for constructing an instance of
- * [HrisBenefitIndividualUnenrollManyPageAsync].
- */
- @JvmStatic fun builder() = Builder()
- }
-
- class Builder {
-
- private var items: JsonField> = JsonMissing.of()
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(page: Response) = apply {
- this.items = page.items
- this.additionalProperties.putAll(page.additionalProperties)
- }
-
- fun items(items: List) = items(JsonField.of(items))
-
- fun items(items: JsonField>) = apply { this.items = items }
-
- fun putAdditionalProperty(key: String, value: JsonValue) = apply {
- this.additionalProperties.put(key, value)
- }
-
- /**
- * Returns an immutable instance of [Response].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- */
- fun build(): Response = Response(items, additionalProperties.toMutableMap())
- }
- }
-
- class AutoPager(private val firstPage: HrisBenefitIndividualUnenrollManyPageAsync) {
-
- fun forEach(
- action: Predicate,
- executor: Executor,
- ): CompletableFuture {
- fun CompletableFuture>.forEach(
- action: (UnenrolledIndividual) -> Boolean,
- executor: Executor,
- ): CompletableFuture =
- thenComposeAsync(
- { page ->
- page
- .filter { it.items().all(action) }
- .map { it.getNextPage().forEach(action, executor) }
- .orElseGet { CompletableFuture.completedFuture(null) }
- },
- executor,
- )
- return CompletableFuture.completedFuture(Optional.of(firstPage))
- .forEach(action::test, executor)
- }
-
- fun toList(executor: Executor): CompletableFuture> {
- val values = mutableListOf()
- return forEach(values::add, executor).thenApply { values }
- }
- }
-}
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPage.kt
index 55732adf..7b00ce90 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPage.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPage.kt
@@ -2,160 +2,95 @@
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.errors.FinchInvalidDataException
+import com.tryfinch.api.core.checkRequired
import com.tryfinch.api.services.blocking.hris.BenefitService
-import java.util.Collections
import java.util.Objects
import java.util.Optional
import java.util.stream.Stream
import java.util.stream.StreamSupport
import kotlin.jvm.optionals.getOrNull
-/** List all company-wide deductions and contributions. */
+/** @see [BenefitService.list] */
class HrisBenefitListPage
private constructor(
- private val benefitsService: BenefitService,
+ private val service: BenefitService,
private val params: HrisBenefitListParams,
- private val response: Response,
+ private val items: List,
) {
- fun response(): Response = response
+ fun hasNextPage(): Boolean = items.isNotEmpty()
- fun items(): List = response().items()
+ fun getNextPageParams(): Optional = Optional.empty()
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return /* spotless:off */ other is HrisBenefitListPage && benefitsService == other.benefitsService && params == other.params && response == other.response /* spotless:on */
- }
-
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(benefitsService, params, response) /* spotless:on */
+ fun getNextPage(): Optional = getNextPageParams().map { service.list(it) }
- override fun toString() =
- "HrisBenefitListPage{benefitsService=$benefitsService, params=$params, response=$response}"
-
- fun hasNextPage(): Boolean {
- return !items().isEmpty()
- }
+ fun autoPager(): AutoPager = AutoPager(this)
- fun getNextPageParams(): Optional {
- return Optional.empty()
- }
+ /** The parameters that were used to request this page. */
+ fun params(): HrisBenefitListParams = params
- fun getNextPage(): Optional {
- return getNextPageParams().map { benefitsService.list(it) }
- }
+ /** The response that this page was parsed from. */
+ fun items(): List = items
- fun autoPager(): AutoPager = AutoPager(this)
+ fun toBuilder() = Builder().from(this)
companion object {
- @JvmStatic
- fun of(benefitsService: BenefitService, params: HrisBenefitListParams, response: Response) =
- HrisBenefitListPage(benefitsService, params, response)
+ /**
+ * Returns a mutable builder for constructing an instance of [HrisBenefitListPage].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .items()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
}
- class Response(
- private val items: JsonField>,
- private val additionalProperties: MutableMap,
- ) {
+ /** A builder for [HrisBenefitListPage]. */
+ class Builder internal constructor() {
- @JsonCreator
- private constructor(
- @JsonProperty("items") items: JsonField> = JsonMissing.of()
- ) : this(items, mutableMapOf())
+ private var service: BenefitService? = null
+ private var params: HrisBenefitListParams? = null
+ private var items: List? = null
- fun items(): List = items.getOptional("items").getOrNull() ?: listOf()
-
- @JsonProperty("items")
- fun _items(): Optional>> = Optional.ofNullable(items)
-
- @JsonAnySetter
- private fun putAdditionalProperty(key: String, value: JsonValue) {
- additionalProperties.put(key, value)
+ @JvmSynthetic
+ internal fun from(hrisBenefitListPage: HrisBenefitListPage) = apply {
+ service = hrisBenefitListPage.service
+ params = hrisBenefitListPage.params
+ items = hrisBenefitListPage.items
}
- @JsonAnyGetter
- @ExcludeMissing
- fun _additionalProperties(): Map =
- Collections.unmodifiableMap(additionalProperties)
-
- private var validated: Boolean = false
-
- fun validate(): Response = apply {
- if (validated) {
- return@apply
- }
-
- items().map { it.validate() }
- validated = true
- }
-
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: FinchInvalidDataException) {
- false
- }
-
- fun toBuilder() = Builder().from(this)
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return /* spotless:off */ other is Response && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */
- }
-
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(items, additionalProperties) /* spotless:on */
-
- override fun toString() =
- "Response{items=$items, additionalProperties=$additionalProperties}"
-
- companion object {
-
- /** Returns a mutable builder for constructing an instance of [HrisBenefitListPage]. */
- @JvmStatic fun builder() = Builder()
- }
-
- class Builder {
-
- private var items: JsonField> = JsonMissing.of()
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(page: Response) = apply {
- this.items = page.items
- this.additionalProperties.putAll(page.additionalProperties)
- }
-
- fun items(items: List) = items(JsonField.of(items))
-
- fun items(items: JsonField>) = apply { this.items = items }
-
- fun putAdditionalProperty(key: String, value: JsonValue) = apply {
- this.additionalProperties.put(key, value)
- }
-
- /**
- * Returns an immutable instance of [Response].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- */
- fun build(): Response = Response(items, additionalProperties.toMutableMap())
- }
+ fun service(service: BenefitService) = apply { this.service = service }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: HrisBenefitListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun items(items: List) = apply { this.items = items }
+
+ /**
+ * Returns an immutable instance of [HrisBenefitListPage].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .items()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): HrisBenefitListPage =
+ HrisBenefitListPage(
+ checkRequired("service", service),
+ checkRequired("params", params),
+ checkRequired("items", items),
+ )
}
class AutoPager(private val firstPage: HrisBenefitListPage) : Iterable {
@@ -176,4 +111,16 @@ private constructor(
return StreamSupport.stream(spliterator(), false)
}
}
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is HrisBenefitListPage && service == other.service && params == other.params && items == other.items /* spotless:on */
+ }
+
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, items) /* spotless:on */
+
+ override fun toString() = "HrisBenefitListPage{service=$service, params=$params, items=$items}"
}
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPageAsync.kt
index 1dd66c6b..f49f49a4 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPageAsync.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPageAsync.kt
@@ -2,168 +2,98 @@
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.errors.FinchInvalidDataException
+import com.tryfinch.api.core.checkRequired
import com.tryfinch.api.services.async.hris.BenefitServiceAsync
-import java.util.Collections
import java.util.Objects
import java.util.Optional
import java.util.concurrent.CompletableFuture
import java.util.concurrent.Executor
import java.util.function.Predicate
-import kotlin.jvm.optionals.getOrNull
-/** List all company-wide deductions and contributions. */
+/** @see [BenefitServiceAsync.list] */
class HrisBenefitListPageAsync
private constructor(
- private val benefitsService: BenefitServiceAsync,
+ private val service: BenefitServiceAsync,
private val params: HrisBenefitListParams,
- private val response: Response,
+ private val items: List,
) {
- fun response(): Response = response
+ fun hasNextPage(): Boolean = items.isNotEmpty()
- fun items(): List = response().items()
+ fun getNextPageParams(): Optional = Optional.empty()
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return /* spotless:off */ other is HrisBenefitListPageAsync && benefitsService == other.benefitsService && params == other.params && response == other.response /* spotless:on */
- }
-
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(benefitsService, params, response) /* spotless:on */
-
- override fun toString() =
- "HrisBenefitListPageAsync{benefitsService=$benefitsService, params=$params, response=$response}"
-
- fun hasNextPage(): Boolean {
- return !items().isEmpty()
- }
-
- fun getNextPageParams(): Optional {
- return Optional.empty()
- }
-
- fun getNextPage(): CompletableFuture> {
- return getNextPageParams()
- .map { benefitsService.list(it).thenApply { Optional.of(it) } }
+ fun getNextPage(): CompletableFuture> =
+ getNextPageParams()
+ .map { service.list(it).thenApply { Optional.of(it) } }
.orElseGet { CompletableFuture.completedFuture(Optional.empty()) }
- }
fun autoPager(): AutoPager = AutoPager(this)
- companion object {
-
- @JvmStatic
- fun of(
- benefitsService: BenefitServiceAsync,
- params: HrisBenefitListParams,
- response: Response,
- ) = HrisBenefitListPageAsync(benefitsService, params, response)
- }
-
- class Response(
- private val items: JsonField>,
- private val additionalProperties: MutableMap,
- ) {
-
- @JsonCreator
- private constructor(
- @JsonProperty("items") items: JsonField> = JsonMissing.of()
- ) : this(items, mutableMapOf())
-
- fun items(): List = items.getOptional("items").getOrNull() ?: listOf()
-
- @JsonProperty("items")
- fun _items(): Optional>> = Optional.ofNullable(items)
-
- @JsonAnySetter
- private fun putAdditionalProperty(key: String, value: JsonValue) {
- additionalProperties.put(key, value)
- }
-
- @JsonAnyGetter
- @ExcludeMissing
- fun _additionalProperties(): Map =
- Collections.unmodifiableMap(additionalProperties)
+ /** The parameters that were used to request this page. */
+ fun params(): HrisBenefitListParams = params
- private var validated: Boolean = false
+ /** The response that this page was parsed from. */
+ fun items(): List = items
- fun validate(): Response = apply {
- if (validated) {
- return@apply
- }
+ fun toBuilder() = Builder().from(this)
- items().map { it.validate() }
- validated = true
- }
-
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: FinchInvalidDataException) {
- false
- }
-
- fun toBuilder() = Builder().from(this)
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return /* spotless:off */ other is Response && items == other.items && additionalProperties == other.additionalProperties /* spotless:on */
- }
+ companion object {
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(items, additionalProperties) /* spotless:on */
+ /**
+ * Returns a mutable builder for constructing an instance of [HrisBenefitListPageAsync].
+ *
+ * The following fields are required:
+ * ```java
+ * .service()
+ * .params()
+ * .items()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
- override fun toString() =
- "Response{items=$items, additionalProperties=$additionalProperties}"
+ /** A builder for [HrisBenefitListPageAsync]. */
+ class Builder internal constructor() {
- companion object {
+ private var service: BenefitServiceAsync? = null
+ private var params: HrisBenefitListParams? = null
+ private var items: List? = null
- /**
- * Returns a mutable builder for constructing an instance of [HrisBenefitListPageAsync].
- */
- @JvmStatic fun builder() = Builder()
+ @JvmSynthetic
+ internal fun from(hrisBenefitListPageAsync: HrisBenefitListPageAsync) = apply {
+ service = hrisBenefitListPageAsync.service
+ params = hrisBenefitListPageAsync.params
+ items = hrisBenefitListPageAsync.items
}
- class Builder {
-
- private var items: JsonField> = JsonMissing.of()
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(page: Response) = apply {
- this.items = page.items
- this.additionalProperties.putAll(page.additionalProperties)
- }
-
- fun items(items: List) = items(JsonField.of(items))
-
- fun items(items: JsonField>) = apply { this.items = items }
-
- fun putAdditionalProperty(key: String, value: JsonValue) = apply {
- this.additionalProperties.put(key, value)
- }
-
- /**
- * Returns an immutable instance of [Response].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- */
- fun build(): Response = Response(items, additionalProperties.toMutableMap())
- }
+ fun service(service: BenefitServiceAsync) = apply { this.service = service }
+
+ /** The parameters that were used to request this page. */
+ fun params(params: HrisBenefitListParams) = apply { this.params = params }
+
+ /** The response that this page was parsed from. */
+ fun items(items: List