From 238b853b930f203759499a7d9540c35b586a3915 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Feb 2025 21:57:20 +0000 Subject: [PATCH 01/65] docs: update URLs from stainlessapi.com to stainless.com (#467) More details at https://www.stainless.com/changelog/stainless-com --- README.md | 2 +- SECURITY.md | 4 ++-- .../com/tryfinch/api/models/ConnectSessionNewParamsTest.kt | 6 +++--- .../api/services/async/connect/SessionServiceAsyncTest.kt | 2 +- .../api/services/blocking/connect/SessionServiceTest.kt | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a4e73200..1c73217a 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The Finch Java SDK provides convenient access to the Finch REST API from applica The Finch Java SDK is similar to the Finch Kotlin SDK but with minor differences that make it more ergonomic for use in Java, such as `Optional` instead of nullable values, `Stream` instead of `Sequence`, and `CompletableFuture` instead of suspend functions. -It is generated with [Stainless](https://www.stainlessapi.com/). +It is generated with [Stainless](https://www.stainless.com/). The REST API documentation can be found [in the Finch Documentation Center](https://developer.tryfinch.com/). diff --git a/SECURITY.md b/SECURITY.md index 6cef554f..b6499508 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,9 +2,9 @@ ## Reporting Security Issues -This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. +This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. -To report a security issue, please contact the Stainless team at security@stainlessapi.com. +To report a security issue, please contact the Stainless team at security@stainless.com. ## Responsible Disclosure diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt index ee91137d..8ea1ce5d 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt @@ -14,7 +14,7 @@ class ConnectSessionNewParamsTest { .customerId("x") .customerName("x") .addProduct(ConnectSessionNewParams.ConnectProducts.COMPANY) - .customerEmail("dev@stainlessapi.com") + .customerEmail("dev@stainless.com") .integration( ConnectSessionNewParams.Integration.builder() .authMethod(ConnectSessionNewParams.Integration.AuthMethod.ASSISTED) @@ -35,7 +35,7 @@ class ConnectSessionNewParamsTest { .customerId("x") .customerName("x") .addProduct(ConnectSessionNewParams.ConnectProducts.COMPANY) - .customerEmail("dev@stainlessapi.com") + .customerEmail("dev@stainless.com") .integration( ConnectSessionNewParams.Integration.builder() .authMethod(ConnectSessionNewParams.Integration.AuthMethod.ASSISTED) @@ -55,7 +55,7 @@ class ConnectSessionNewParamsTest { assertThat(body.customerName()).isEqualTo("x") assertThat(body.products()) .isEqualTo(listOf(ConnectSessionNewParams.ConnectProducts.COMPANY)) - assertThat(body.customerEmail()).contains("dev@stainlessapi.com") + assertThat(body.customerEmail()).contains("dev@stainless.com") assertThat(body.integration()) .contains( ConnectSessionNewParams.Integration.builder() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncTest.kt index 87f1d9a0..9b5e85dc 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncTest.kt @@ -27,7 +27,7 @@ class SessionServiceAsyncTest { .customerId("x") .customerName("x") .addProduct(ConnectSessionNewParams.ConnectProducts.COMPANY) - .customerEmail("dev@stainlessapi.com") + .customerEmail("dev@stainless.com") .integration( ConnectSessionNewParams.Integration.builder() .authMethod(ConnectSessionNewParams.Integration.AuthMethod.ASSISTED) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceTest.kt index a7d71d39..2ddaf852 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceTest.kt @@ -27,7 +27,7 @@ class SessionServiceTest { .customerId("x") .customerName("x") .addProduct(ConnectSessionNewParams.ConnectProducts.COMPANY) - .customerEmail("dev@stainlessapi.com") + .customerEmail("dev@stainless.com") .integration( ConnectSessionNewParams.Integration.builder() .authMethod(ConnectSessionNewParams.Integration.AuthMethod.ASSISTED) From a3089549cd0743446d2b906db5fcd830f579ddd8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 3 Mar 2025 20:39:32 +0000 Subject: [PATCH 02/65] chore(internal): codegen related update (#469) --- .../api/services/ErrorHandlingTest.kt | 345 +++++------------- 1 file changed, 88 insertions(+), 257 deletions(-) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ErrorHandlingTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ErrorHandlingTest.kt index a51b273f..f6cea147 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ErrorHandlingTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ErrorHandlingTest.kt @@ -2,10 +2,8 @@ package com.tryfinch.api.services -import com.fasterxml.jackson.databind.json.JsonMapper import com.github.tomakehurst.wiremock.client.WireMock.anyUrl import com.github.tomakehurst.wiremock.client.WireMock.get -import com.github.tomakehurst.wiremock.client.WireMock.ok import com.github.tomakehurst.wiremock.client.WireMock.status import com.github.tomakehurst.wiremock.client.WireMock.stubFor import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo @@ -25,22 +23,30 @@ import com.tryfinch.api.errors.RateLimitException import com.tryfinch.api.errors.UnauthorizedException import com.tryfinch.api.errors.UnexpectedStatusCodeException import com.tryfinch.api.errors.UnprocessableEntityException -import com.tryfinch.api.models.Company -import com.tryfinch.api.models.HrisCompanyRetrieveParams -import com.tryfinch.api.models.Location import org.assertj.core.api.Assertions.assertThat -import org.assertj.core.api.Assertions.assertThatThrownBy -import org.assertj.core.api.InstanceOfAssertFactories +import org.assertj.core.api.Assertions.entry import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows @WireMockTest class ErrorHandlingTest { - private val JSON_MAPPER: JsonMapper = jsonMapper() + companion object { - private val FINCH_ERROR: FinchError = - FinchError.builder().putAdditionalProperty("key", JsonValue.from("value")).build() + private val ERROR: FinchError = + FinchError.builder() + .putAdditionalProperty("errorProperty", JsonValue.from("42")) + .build() + + private val ERROR_JSON: ByteArray = jsonMapper().writeValueAsBytes(ERROR) + + private const val HEADER_NAME: String = "Error-Header" + + private const val HEADER_VALUE: String = "42" + + private const val NOT_JSON: String = "Not JSON" + } private lateinit var client: FinchClient @@ -48,317 +54,142 @@ class ErrorHandlingTest { fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) { client = FinchOkHttpClient.builder() - .baseUrl(wmRuntimeInfo.getHttpBaseUrl()) + .baseUrl(wmRuntimeInfo.httpBaseUrl) .accessToken("My Access Token") - .clientId("4ab15e51-11ad-49f4-acae-f343b7794375") - .clientSecret("My Client Secret") - .webhookSecret("My Webhook Secret") .build() } @Test - fun companiesRetrieve200() { - val params = HrisCompanyRetrieveParams.builder().build() - - val expected = - Company.builder() - .id("id") - .addAccount( - Company.Account.builder() - .accountName("account_name") - .accountNumber("account_number") - .accountType(Company.Account.AccountType.CHECKING) - .institutionName("institution_name") - .routingNumber("routing_number") - .build() - ) - .addDepartment( - Company.Department.builder() - .name("name") - .parent(Company.Department.Parent.builder().name("name").build()) - .build() - ) - .ein("ein") - .entity( - Company.Entity.builder() - .subtype(Company.Entity.Subtype.S_CORPORATION) - .type(Company.Entity.Type.LLC) - .build() - ) - .legalName("legal_name") - .addLocation( - Location.builder() - .city("city") - .country("country") - .line1("line1") - .line2("line2") - .name("name") - .postalCode("postal_code") - .sourceId("source_id") - .state("state") - .build() - ) - .primaryEmail("primary_email") - .primaryPhoneNumber("primary_phone_number") - .build() - - stubFor(get(anyUrl()).willReturn(ok().withBody(toJson(expected)))) - - assertThat(client.hris().company().retrieve(params)).isEqualTo(expected) - } - - @Test - fun companiesRetrieve400() { - val params = HrisCompanyRetrieveParams.builder().build() - + fun companyRetrieve400() { + val companyService = client.hris().company() stubFor( get(anyUrl()) - .willReturn(status(400).withHeader("Foo", "Bar").withBody(toJson(FINCH_ERROR))) + .willReturn(status(400).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) ) - assertThatThrownBy({ client.hris().company().retrieve(params) }) - .satisfies({ e -> - assertBadRequest(e, Headers.builder().put("Foo", "Bar").build(), FINCH_ERROR) - }) + val e = assertThrows { companyService.retrieve() } + + assertThat(e.statusCode()).isEqualTo(400) + assertThat(e.error()).isEqualTo(ERROR) + assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) } @Test - fun companiesRetrieve401() { - val params = HrisCompanyRetrieveParams.builder().build() - + fun companyRetrieve401() { + val companyService = client.hris().company() stubFor( get(anyUrl()) - .willReturn(status(401).withHeader("Foo", "Bar").withBody(toJson(FINCH_ERROR))) + .willReturn(status(401).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) ) - assertThatThrownBy({ client.hris().company().retrieve(params) }) - .satisfies({ e -> - assertUnauthorized(e, Headers.builder().put("Foo", "Bar").build(), FINCH_ERROR) - }) + val e = assertThrows { companyService.retrieve() } + + assertThat(e.statusCode()).isEqualTo(401) + assertThat(e.error()).isEqualTo(ERROR) + assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) } @Test - fun companiesRetrieve403() { - val params = HrisCompanyRetrieveParams.builder().build() - + fun companyRetrieve403() { + val companyService = client.hris().company() stubFor( get(anyUrl()) - .willReturn(status(403).withHeader("Foo", "Bar").withBody(toJson(FINCH_ERROR))) + .willReturn(status(403).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) ) - assertThatThrownBy({ client.hris().company().retrieve(params) }) - .satisfies({ e -> - assertPermissionDenied(e, Headers.builder().put("Foo", "Bar").build(), FINCH_ERROR) - }) + val e = assertThrows { companyService.retrieve() } + + assertThat(e.statusCode()).isEqualTo(403) + assertThat(e.error()).isEqualTo(ERROR) + assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) } @Test - fun companiesRetrieve404() { - val params = HrisCompanyRetrieveParams.builder().build() - + fun companyRetrieve404() { + val companyService = client.hris().company() stubFor( get(anyUrl()) - .willReturn(status(404).withHeader("Foo", "Bar").withBody(toJson(FINCH_ERROR))) + .willReturn(status(404).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) ) - assertThatThrownBy({ client.hris().company().retrieve(params) }) - .satisfies({ e -> - assertNotFound(e, Headers.builder().put("Foo", "Bar").build(), FINCH_ERROR) - }) + val e = assertThrows { companyService.retrieve() } + + assertThat(e.statusCode()).isEqualTo(404) + assertThat(e.error()).isEqualTo(ERROR) + assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) } @Test - fun companiesRetrieve422() { - val params = HrisCompanyRetrieveParams.builder().build() - + fun companyRetrieve422() { + val companyService = client.hris().company() stubFor( get(anyUrl()) - .willReturn(status(422).withHeader("Foo", "Bar").withBody(toJson(FINCH_ERROR))) + .willReturn(status(422).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) ) - assertThatThrownBy({ client.hris().company().retrieve(params) }) - .satisfies({ e -> - assertUnprocessableEntity( - e, - Headers.builder().put("Foo", "Bar").build(), - FINCH_ERROR, - ) - }) + val e = assertThrows { companyService.retrieve() } + + assertThat(e.statusCode()).isEqualTo(422) + assertThat(e.error()).isEqualTo(ERROR) + assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) } @Test - fun companiesRetrieve429() { - val params = HrisCompanyRetrieveParams.builder().build() - + fun companyRetrieve429() { + val companyService = client.hris().company() stubFor( get(anyUrl()) - .willReturn(status(429).withHeader("Foo", "Bar").withBody(toJson(FINCH_ERROR))) + .willReturn(status(429).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) ) - assertThatThrownBy({ client.hris().company().retrieve(params) }) - .satisfies({ e -> - assertRateLimit(e, Headers.builder().put("Foo", "Bar").build(), FINCH_ERROR) - }) + val e = assertThrows { companyService.retrieve() } + + assertThat(e.statusCode()).isEqualTo(429) + assertThat(e.error()).isEqualTo(ERROR) + assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) } @Test - fun companiesRetrieve500() { - val params = HrisCompanyRetrieveParams.builder().build() - + fun companyRetrieve500() { + val companyService = client.hris().company() stubFor( get(anyUrl()) - .willReturn(status(500).withHeader("Foo", "Bar").withBody(toJson(FINCH_ERROR))) + .willReturn(status(500).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) ) - assertThatThrownBy({ client.hris().company().retrieve(params) }) - .satisfies({ e -> - assertInternalServer(e, Headers.builder().put("Foo", "Bar").build(), FINCH_ERROR) - }) + val e = assertThrows { companyService.retrieve() } + + assertThat(e.statusCode()).isEqualTo(500) + assertThat(e.error()).isEqualTo(ERROR) + assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) } @Test - fun unexpectedStatusCode() { - val params = HrisCompanyRetrieveParams.builder().build() - + fun companyRetrieve999() { + val companyService = client.hris().company() stubFor( get(anyUrl()) - .willReturn(status(999).withHeader("Foo", "Bar").withBody(toJson(FINCH_ERROR))) + .willReturn(status(999).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) ) - assertThatThrownBy({ client.hris().company().retrieve(params) }) - .satisfies({ e -> - assertUnexpectedStatusCodeException( - e, - 999, - Headers.builder().put("Foo", "Bar").build(), - toJson(FINCH_ERROR), - ) - }) - } - - @Test - fun invalidBody() { - val params = HrisCompanyRetrieveParams.builder().build() + val e = assertThrows { companyService.retrieve() } - stubFor(get(anyUrl()).willReturn(status(200).withBody("Not JSON"))) - - assertThatThrownBy({ client.hris().company().retrieve(params) }) - .satisfies({ e -> - assertThat(e) - .isInstanceOf(FinchException::class.java) - .hasMessage("Error reading response") - }) + assertThat(e.statusCode()).isEqualTo(999) + assertThat(e.error()).isEqualTo(ERROR) + assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) } @Test - fun invalidErrorBody() { - val params = HrisCompanyRetrieveParams.builder().build() - - stubFor(get(anyUrl()).willReturn(status(400).withBody("Not JSON"))) - - assertThatThrownBy({ client.hris().company().retrieve(params) }) - .satisfies({ e -> - assertBadRequest(e, Headers.builder().build(), FinchError.builder().build()) - }) - } - - private fun toJson(body: T): ByteArray { - return JSON_MAPPER.writeValueAsBytes(body) - } - - private fun assertUnexpectedStatusCodeException( - throwable: Throwable, - statusCode: Int, - headers: Headers, - responseBody: ByteArray, - ) { - assertThat(throwable) - .asInstanceOf( - InstanceOfAssertFactories.throwable(UnexpectedStatusCodeException::class.java) - ) - .satisfies({ e -> - assertThat(e.statusCode()).isEqualTo(statusCode) - assertThat(e.body()).isEqualTo(String(responseBody)) - assertThat(e.headers().toMap()).containsAllEntriesOf(headers.toMap()) - }) - } - - private fun assertBadRequest(throwable: Throwable, headers: Headers, error: FinchError) { - assertThat(throwable) - .asInstanceOf(InstanceOfAssertFactories.throwable(BadRequestException::class.java)) - .satisfies({ e -> - assertThat(e.statusCode()).isEqualTo(400) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers().toMap()).containsAllEntriesOf(headers.toMap()) - }) - } - - private fun assertUnauthorized(throwable: Throwable, headers: Headers, error: FinchError) { - assertThat(throwable) - .asInstanceOf(InstanceOfAssertFactories.throwable(UnauthorizedException::class.java)) - .satisfies({ e -> - assertThat(e.statusCode()).isEqualTo(401) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers().toMap()).containsAllEntriesOf(headers.toMap()) - }) - } - - private fun assertPermissionDenied(throwable: Throwable, headers: Headers, error: FinchError) { - assertThat(throwable) - .asInstanceOf( - InstanceOfAssertFactories.throwable(PermissionDeniedException::class.java) - ) - .satisfies({ e -> - assertThat(e.statusCode()).isEqualTo(403) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers().toMap()).containsAllEntriesOf(headers.toMap()) - }) - } - - private fun assertNotFound(throwable: Throwable, headers: Headers, error: FinchError) { - assertThat(throwable) - .asInstanceOf(InstanceOfAssertFactories.throwable(NotFoundException::class.java)) - .satisfies({ e -> - assertThat(e.statusCode()).isEqualTo(404) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers().toMap()).containsAllEntriesOf(headers.toMap()) - }) - } - - private fun assertUnprocessableEntity( - throwable: Throwable, - headers: Headers, - error: FinchError, - ) { - assertThat(throwable) - .asInstanceOf( - InstanceOfAssertFactories.throwable(UnprocessableEntityException::class.java) - ) - .satisfies({ e -> - assertThat(e.statusCode()).isEqualTo(422) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers().toMap()).containsAllEntriesOf(headers.toMap()) - }) - } + fun companyRetrieveInvalidJsonBody() { + val companyService = client.hris().company() + stubFor( + get(anyUrl()) + .willReturn(status(200).withHeader(HEADER_NAME, HEADER_VALUE).withBody(NOT_JSON)) + ) - private fun assertRateLimit(throwable: Throwable, headers: Headers, error: FinchError) { - assertThat(throwable) - .asInstanceOf(InstanceOfAssertFactories.throwable(RateLimitException::class.java)) - .satisfies({ e -> - assertThat(e.statusCode()).isEqualTo(429) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers().toMap()).containsAllEntriesOf(headers.toMap()) - }) - } + val e = assertThrows { companyService.retrieve() } - private fun assertInternalServer(throwable: Throwable, headers: Headers, error: FinchError) { - assertThat(throwable) - .asInstanceOf(InstanceOfAssertFactories.throwable(InternalServerException::class.java)) - .satisfies({ e -> - assertThat(e.statusCode()).isEqualTo(500) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers().toMap()).containsAllEntriesOf(headers.toMap()) - }) + assertThat(e).hasMessage("Error reading response") } private fun Headers.toMap(): Map> = From 4d3b414c120045834dc829e12cbc185c88fe2764 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Mar 2025 16:59:12 +0000 Subject: [PATCH 03/65] feat(client): allow configuring timeouts granularly (#470) Note that previously the `timeout(Duration)` method on the client and `RequestOptions` corresponded to connect, read, write, and request timeout. Now it only corresponds to the request timeout. Use the new `timeout(Timeout)` method to configure other timeout values granularly. --- .../api/client/okhttp/FinchOkHttpClient.kt | 18 +- .../client/okhttp/FinchOkHttpClientAsync.kt | 18 +- .../api/client/okhttp/OkHttpClient.kt | 27 +-- .../com/tryfinch/api/core/ClientOptions.kt | 6 + .../com/tryfinch/api/core/RequestOptions.kt | 33 ++-- .../kotlin/com/tryfinch/api/core/Timeout.kt | 187 ++++++++++++++++++ .../async/AccessTokenServiceAsyncImpl.kt | 3 +- .../services/async/AccountServiceAsyncImpl.kt | 6 +- .../async/ProviderServiceAsyncImpl.kt | 3 +- .../RequestForwardingServiceAsyncImpl.kt | 3 +- .../async/connect/SessionServiceAsyncImpl.kt | 6 +- .../async/hris/BenefitServiceAsyncImpl.kt | 15 +- .../async/hris/CompanyServiceAsyncImpl.kt | 3 +- .../async/hris/DirectoryServiceAsyncImpl.kt | 6 +- .../async/hris/DocumentServiceAsyncImpl.kt | 6 +- .../async/hris/EmploymentServiceAsyncImpl.kt | 3 +- .../async/hris/IndividualServiceAsyncImpl.kt | 3 +- .../hris/PayStatementServiceAsyncImpl.kt | 3 +- .../async/hris/PaymentServiceAsyncImpl.kt | 3 +- .../benefits/IndividualServiceAsyncImpl.kt | 9 +- .../async/jobs/AutomatedServiceAsyncImpl.kt | 9 +- .../async/jobs/ManualServiceAsyncImpl.kt | 3 +- .../async/payroll/PayGroupServiceAsyncImpl.kt | 6 +- .../async/sandbox/CompanyServiceAsyncImpl.kt | 3 +- .../sandbox/ConnectionServiceAsyncImpl.kt | 3 +- .../sandbox/DirectoryServiceAsyncImpl.kt | 1 + .../sandbox/EmploymentServiceAsyncImpl.kt | 3 +- .../sandbox/IndividualServiceAsyncImpl.kt | 3 +- .../async/sandbox/JobServiceAsyncImpl.kt | 3 +- .../async/sandbox/PaymentServiceAsyncImpl.kt | 3 +- .../connections/AccountServiceAsyncImpl.kt | 6 +- .../jobs/ConfigurationServiceAsyncImpl.kt | 6 +- .../blocking/AccessTokenServiceImpl.kt | 3 +- .../services/blocking/AccountServiceImpl.kt | 6 +- .../services/blocking/ProviderServiceImpl.kt | 3 +- .../blocking/RequestForwardingServiceImpl.kt | 3 +- .../blocking/connect/SessionServiceImpl.kt | 6 +- .../blocking/hris/BenefitServiceImpl.kt | 15 +- .../blocking/hris/CompanyServiceImpl.kt | 3 +- .../blocking/hris/DirectoryServiceImpl.kt | 6 +- .../blocking/hris/DocumentServiceImpl.kt | 6 +- .../blocking/hris/EmploymentServiceImpl.kt | 3 +- .../blocking/hris/IndividualServiceImpl.kt | 3 +- .../blocking/hris/PayStatementServiceImpl.kt | 3 +- .../blocking/hris/PaymentServiceImpl.kt | 3 +- .../hris/benefits/IndividualServiceImpl.kt | 9 +- .../blocking/jobs/AutomatedServiceImpl.kt | 9 +- .../blocking/jobs/ManualServiceImpl.kt | 3 +- .../blocking/payroll/PayGroupServiceImpl.kt | 6 +- .../blocking/sandbox/CompanyServiceImpl.kt | 3 +- .../blocking/sandbox/ConnectionServiceImpl.kt | 3 +- .../blocking/sandbox/DirectoryServiceImpl.kt | 1 + .../blocking/sandbox/EmploymentServiceImpl.kt | 3 +- .../blocking/sandbox/IndividualServiceImpl.kt | 3 +- .../blocking/sandbox/JobServiceImpl.kt | 3 +- .../blocking/sandbox/PaymentServiceImpl.kt | 3 +- .../sandbox/connections/AccountServiceImpl.kt | 6 +- .../sandbox/jobs/ConfigurationServiceImpl.kt | 6 +- 58 files changed, 420 insertions(+), 111 deletions(-) create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt 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 9cb8ed19..030cb02a 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 @@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.json.JsonMapper import com.tryfinch.api.client.FinchClient import com.tryfinch.api.client.FinchClientImpl import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.Timeout import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import java.net.Proxy @@ -27,8 +28,7 @@ class FinchOkHttpClient private constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() private var baseUrl: String = ClientOptions.PRODUCTION_URL - // The default timeout for the client is 1 minute. - private var timeout: Duration = Duration.ofSeconds(60) + private var timeout: Timeout = Timeout.default() private var proxy: Proxy? = null fun baseUrl(baseUrl: String) = apply { @@ -120,7 +120,19 @@ class FinchOkHttpClient private constructor() { clientOptions.removeAllQueryParams(keys) } - fun timeout(timeout: Duration) = apply { this.timeout = timeout } + fun timeout(timeout: Timeout) = apply { + clientOptions.timeout(timeout) + this.timeout = timeout + } + + /** + * Sets the maximum time allowed for a complete HTTP call, not including retries. + * + * See [Timeout.request] for more details. + * + * For fine-grained control, pass a [Timeout] object. + */ + fun timeout(timeout: Duration) = timeout(Timeout.builder().request(timeout).build()) fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) } 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 29934ab4..cc8fc8c6 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 @@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.json.JsonMapper import com.tryfinch.api.client.FinchClientAsync import com.tryfinch.api.client.FinchClientAsyncImpl import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.Timeout import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import java.net.Proxy @@ -27,8 +28,7 @@ class FinchOkHttpClientAsync private constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() private var baseUrl: String = ClientOptions.PRODUCTION_URL - // The default timeout for the client is 1 minute. - private var timeout: Duration = Duration.ofSeconds(60) + private var timeout: Timeout = Timeout.default() private var proxy: Proxy? = null fun baseUrl(baseUrl: String) = apply { @@ -120,7 +120,19 @@ class FinchOkHttpClientAsync private constructor() { clientOptions.removeAllQueryParams(keys) } - fun timeout(timeout: Duration) = apply { this.timeout = timeout } + fun timeout(timeout: Timeout) = apply { + clientOptions.timeout(timeout) + this.timeout = timeout + } + + /** + * Sets the maximum time allowed for a complete HTTP call, not including retries. + * + * See [Timeout.request] for more details. + * + * For fine-grained control, pass a [Timeout] object. + */ + fun timeout(timeout: Duration) = timeout(Timeout.builder().request(timeout).build()) fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) } diff --git a/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/OkHttpClient.kt b/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/OkHttpClient.kt index 7c59fad7..be523572 100644 --- a/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/OkHttpClient.kt +++ b/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/OkHttpClient.kt @@ -1,6 +1,7 @@ package com.tryfinch.api.client.okhttp import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.Timeout import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.HttpClient @@ -88,13 +89,12 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val ) } - val timeout = requestOptions.timeout - if (timeout != null) { + requestOptions.timeout?.let { clientBuilder - .connectTimeout(timeout) - .readTimeout(timeout) - .writeTimeout(timeout) - .callTimeout(if (timeout.seconds == 0L) timeout else timeout.plusSeconds(30)) + .connectTimeout(it.connect()) + .readTimeout(it.read()) + .writeTimeout(it.write()) + .callTimeout(it.request()) } val client = clientBuilder.build() @@ -195,23 +195,24 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val class Builder internal constructor() { private var baseUrl: HttpUrl? = null - // The default timeout is 1 minute. - private var timeout: Duration = Duration.ofSeconds(60) + private var timeout: Timeout = Timeout.default() private var proxy: Proxy? = null fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl.toHttpUrl() } - fun timeout(timeout: Duration) = apply { this.timeout = timeout } + fun timeout(timeout: Timeout) = apply { this.timeout = timeout } + + fun timeout(timeout: Duration) = timeout(Timeout.builder().request(timeout).build()) fun proxy(proxy: Proxy?) = apply { this.proxy = proxy } fun build(): OkHttpClient = OkHttpClient( okhttp3.OkHttpClient.Builder() - .connectTimeout(timeout) - .readTimeout(timeout) - .writeTimeout(timeout) - .callTimeout(if (timeout.seconds == 0L) timeout else timeout.plusSeconds(30)) + .connectTimeout(timeout.connect()) + .readTimeout(timeout.read()) + .writeTimeout(timeout.write()) + .callTimeout(timeout.request()) .proxy(proxy) .build(), checkRequired("baseUrl", baseUrl), 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 f34021de..563721bd 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 @@ -22,6 +22,7 @@ private constructor( @get:JvmName("headers") val headers: Headers, @get:JvmName("queryParams") val queryParams: QueryParams, @get:JvmName("responseValidation") val responseValidation: Boolean, + @get:JvmName("timeout") val timeout: Timeout, @get:JvmName("maxRetries") val maxRetries: Int, @get:JvmName("accessToken") val accessToken: String?, @get:JvmName("clientId") val clientId: String?, @@ -50,6 +51,7 @@ private constructor( private var headers: Headers.Builder = Headers.builder() private var queryParams: QueryParams.Builder = QueryParams.builder() private var responseValidation: Boolean = false + private var timeout: Timeout = Timeout.default() private var maxRetries: Int = 2 private var accessToken: String? = null private var clientId: String? = null @@ -65,6 +67,7 @@ private constructor( headers = clientOptions.headers.toBuilder() queryParams = clientOptions.queryParams.toBuilder() responseValidation = clientOptions.responseValidation + timeout = clientOptions.timeout maxRetries = clientOptions.maxRetries accessToken = clientOptions.accessToken clientId = clientOptions.clientId @@ -84,6 +87,8 @@ private constructor( this.responseValidation = responseValidation } + fun timeout(timeout: Timeout) = apply { this.timeout = timeout } + fun maxRetries(maxRetries: Int) = apply { this.maxRetries = maxRetries } fun accessToken(accessToken: String?) = apply { this.accessToken = accessToken } @@ -235,6 +240,7 @@ private constructor( headers.build(), queryParams.build(), responseValidation, + timeout, maxRetries, accessToken, clientId, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/RequestOptions.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/RequestOptions.kt index cee1a369..89fdd644 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/RequestOptions.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/RequestOptions.kt @@ -2,13 +2,7 @@ package com.tryfinch.api.core import java.time.Duration -class RequestOptions private constructor(val responseValidation: Boolean?, val timeout: Duration?) { - fun applyDefaults(options: RequestOptions): RequestOptions { - return RequestOptions( - responseValidation = this.responseValidation ?: options.responseValidation, - timeout = this.timeout ?: options.timeout, - ) - } +class RequestOptions private constructor(val responseValidation: Boolean?, val timeout: Timeout?) { companion object { @@ -16,22 +10,37 @@ class RequestOptions private constructor(val responseValidation: Boolean?, val t @JvmStatic fun none() = NONE + @JvmSynthetic + internal fun from(clientOptions: ClientOptions): RequestOptions = + builder() + .responseValidation(clientOptions.responseValidation) + .timeout(clientOptions.timeout) + .build() + @JvmStatic fun builder() = Builder() } + fun applyDefaults(options: RequestOptions): RequestOptions = + RequestOptions( + responseValidation = responseValidation ?: options.responseValidation, + timeout = + if (options.timeout != null && timeout != null) timeout.assign(options.timeout) + else timeout ?: options.timeout, + ) + class Builder internal constructor() { private var responseValidation: Boolean? = null - private var timeout: Duration? = null + private var timeout: Timeout? = null fun responseValidation(responseValidation: Boolean) = apply { this.responseValidation = responseValidation } - fun timeout(timeout: Duration) = apply { this.timeout = timeout } + fun timeout(timeout: Timeout) = apply { this.timeout = timeout } - fun build(): RequestOptions { - return RequestOptions(responseValidation, timeout) - } + fun timeout(timeout: Duration) = timeout(Timeout.builder().request(timeout).build()) + + fun build(): RequestOptions = RequestOptions(responseValidation, timeout) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt new file mode 100644 index 00000000..4a639d2d --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt @@ -0,0 +1,187 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.core + +import java.time.Duration +import java.util.Objects +import java.util.Optional + +/** A class containing timeouts for various processing phases of a request. */ +class Timeout +private constructor( + private val connect: Duration?, + private val read: Duration?, + private val write: Duration?, + private val request: Duration?, +) { + + /** + * The maximum time allowed to establish a connection with a host. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `Duration.ofMinutes(1)`. + */ + fun connect(): Duration = connect ?: Duration.ofMinutes(1) + + /** + * The maximum time allowed between two data packets when waiting for the server’s response. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `request()`. + */ + fun read(): Duration = read ?: request() + + /** + * The maximum time allowed between two data packets when sending the request to the server. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `request()`. + */ + fun write(): Duration = write ?: request() + + /** + * The maximum time allowed for a complete HTTP call, not including retries. + * + * This includes resolving DNS, connecting, writing the request body, server processing, as well + * as reading the response body. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `Duration.ofMinutes(1)`. + */ + fun request(): Duration = request ?: Duration.ofMinutes(1) + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun default() = builder().build() + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Timeout]. */ + class Builder internal constructor() { + + private var connect: Duration? = null + private var read: Duration? = null + private var write: Duration? = null + private var request: Duration? = null + + @JvmSynthetic + internal fun from(timeout: Timeout) = apply { + connect = timeout.connect + read = timeout.read + write = timeout.write + request = timeout.request + } + + /** + * The maximum time allowed to establish a connection with a host. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `Duration.ofMinutes(1)`. + */ + fun connect(connect: Duration?) = apply { this.connect = connect } + + /** + * The maximum time allowed to establish a connection with a host. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `Duration.ofMinutes(1)`. + */ + fun connect(connect: Optional) = connect(connect.orElse(null)) + + /** + * The maximum time allowed between two data packets when waiting for the server’s response. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `request()`. + */ + fun read(read: Duration?) = apply { this.read = read } + + /** + * The maximum time allowed between two data packets when waiting for the server’s response. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `request()`. + */ + fun read(read: Optional) = read(read.orElse(null)) + + /** + * The maximum time allowed between two data packets when sending the request to the server. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `request()`. + */ + fun write(write: Duration?) = apply { this.write = write } + + /** + * The maximum time allowed between two data packets when sending the request to the server. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `request()`. + */ + fun write(write: Optional) = write(write.orElse(null)) + + /** + * The maximum time allowed for a complete HTTP call, not including retries. + * + * This includes resolving DNS, connecting, writing the request body, server processing, as + * well as reading the response body. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `Duration.ofMinutes(1)`. + */ + fun request(request: Duration?) = apply { this.request = request } + + /** + * The maximum time allowed for a complete HTTP call, not including retries. + * + * This includes resolving DNS, connecting, writing the request body, server processing, as + * well as reading the response body. + * + * A value of [Duration.ZERO] means there's no timeout. + * + * Defaults to `Duration.ofMinutes(1)`. + */ + fun request(request: Optional) = request(request.orElse(null)) + + fun build(): Timeout = Timeout(connect, read, write, request) + } + + @JvmSynthetic + internal fun assign(target: Timeout): Timeout = + target + .toBuilder() + .apply { + connect?.let(this::connect) + read?.let(this::read) + write?.let(this::write) + request?.let(this::request) + } + .build() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Timeout && connect == other.connect && read == other.read && write == other.write && request == other.request /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(connect, read, write, request) /* spotless:on */ + + override fun toString() = + "Timeout{connect=$connect, read=$read, write=$write, request=$request}" +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt index 3a5a40a0..777a2064 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt @@ -65,13 +65,14 @@ class AccessTokenServiceAsyncImpl internal constructor(private val clientOptions .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { createHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt index 218b9c5d..c81ff903 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt @@ -39,13 +39,14 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { disconnectHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -66,13 +67,14 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl .addPathSegments("introspect") .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { introspectHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt index 08227c2a..38d919f5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt @@ -36,13 +36,14 @@ class ProviderServiceAsyncImpl internal constructor(private val clientOptions: C .addPathSegments("providers") .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { listHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.forEach { it.validate() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt index bcc50f5c..29826d68 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt @@ -42,13 +42,14 @@ internal constructor(private val clientOptions: ClientOptions) : RequestForwardi .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { forwardHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt index 385c1cb5..c8c29eaf 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt @@ -39,13 +39,14 @@ class SessionServiceAsyncImpl internal constructor(private val clientOptions: Cl .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { newHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -68,13 +69,14 @@ class SessionServiceAsyncImpl internal constructor(private val clientOptions: Cl .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { reauthenticateHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt index 88f2f69f..12bac153 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt @@ -58,13 +58,14 @@ class BenefitServiceAsyncImpl internal constructor(private val clientOptions: Cl .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { createHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -85,13 +86,14 @@ class BenefitServiceAsyncImpl internal constructor(private val clientOptions: Cl .addPathSegments("employer", "benefits", params.getPathParam(0)) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { retrieveHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -114,13 +116,14 @@ class BenefitServiceAsyncImpl internal constructor(private val clientOptions: Cl .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { updateHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -141,13 +144,14 @@ class BenefitServiceAsyncImpl internal constructor(private val clientOptions: Cl .addPathSegments("employer", "benefits") .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { listHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.forEach { it.validate() } } } @@ -175,13 +179,14 @@ class BenefitServiceAsyncImpl internal constructor(private val clientOptions: Cl .addPathSegments("employer", "benefits", "meta") .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { listSupportedBenefitsHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.forEach { it.validate() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt index 36830f68..cb13462e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt @@ -35,13 +35,14 @@ class CompanyServiceAsyncImpl internal constructor(private val clientOptions: Cl .addPathSegments("employer", "company") .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { retrieveHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt index 00b8c0bb..5b80c3c3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt @@ -38,13 +38,14 @@ class DirectoryServiceAsyncImpl internal constructor(private val clientOptions: .addPathSegments("employer", "directory") .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { listHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -68,13 +69,14 @@ class DirectoryServiceAsyncImpl internal constructor(private val clientOptions: .addPathSegments("employer", "directory") .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { listIndividualsHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt index a3faa516..63046e4a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt @@ -39,13 +39,14 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C .addPathSegments("employer", "documents") .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { listHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -70,13 +71,14 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C .addPathSegments("employer", "documents", params.getPathParam(0)) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { retreiveHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt index 07a11f84..011d0b08 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt @@ -38,13 +38,14 @@ class EmploymentServiceAsyncImpl internal constructor(private val clientOptions: .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { retrieveManyHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt index a901d00d..93b6a39f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt @@ -38,13 +38,14 @@ class IndividualServiceAsyncImpl internal constructor(private val clientOptions: .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { retrieveManyHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt index 5b5ac320..cc6aaf13 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt @@ -42,13 +42,14 @@ class PayStatementServiceAsyncImpl internal constructor(private val clientOption .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { retrieveManyHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt index db387453..c6d41215 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt @@ -36,13 +36,14 @@ class PaymentServiceAsyncImpl internal constructor(private val clientOptions: Cl .addPathSegments("employer", "payment") .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { listHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.forEach { it.validate() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt index db7f5262..2b171804 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt @@ -43,13 +43,14 @@ class IndividualServiceAsyncImpl internal constructor(private val clientOptions: .addPathSegments("employer", "benefits", params.getPathParam(0), "enrolled") .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { enrolledIdsHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -71,13 +72,14 @@ class IndividualServiceAsyncImpl internal constructor(private val clientOptions: .addPathSegments("employer", "benefits", params.getPathParam(0), "individuals") .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { retrieveManyBenefitsHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.forEach { it.validate() } } } @@ -109,13 +111,14 @@ class IndividualServiceAsyncImpl internal constructor(private val clientOptions: .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { unenrollManyHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.forEach { it.validate() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt index 9a621fc9..7cc0db63 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt @@ -56,13 +56,14 @@ class AutomatedServiceAsyncImpl internal constructor(private val clientOptions: .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { createHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -83,13 +84,14 @@ class AutomatedServiceAsyncImpl internal constructor(private val clientOptions: .addPathSegments("jobs", "automated", params.getPathParam(0)) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { retrieveHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -115,13 +117,14 @@ class AutomatedServiceAsyncImpl internal constructor(private val clientOptions: .addPathSegments("jobs", "automated") .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { listHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt index 4b05c57a..41fc8512 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt @@ -38,13 +38,14 @@ class ManualServiceAsyncImpl internal constructor(private val clientOptions: Cli .addPathSegments("jobs", "manual", params.getPathParam(0)) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { retrieveHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt index c9fa6c1a..0ad0ec0c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt @@ -39,13 +39,14 @@ class PayGroupServiceAsyncImpl internal constructor(private val clientOptions: C .addPathSegments("employer", "pay-groups", params.getPathParam(0)) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { retrieveHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -67,13 +68,14 @@ class PayGroupServiceAsyncImpl internal constructor(private val clientOptions: C .addPathSegments("employer", "pay-groups") .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { listHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.forEach { it.validate() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt index 4ca29904..50a32b37 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt @@ -37,13 +37,14 @@ class CompanyServiceAsyncImpl internal constructor(private val clientOptions: Cl .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { updateHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt index aecc772e..dfc9fea5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt @@ -44,13 +44,14 @@ class ConnectionServiceAsyncImpl internal constructor(private val clientOptions: .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { createHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt index f65ae934..5c545f53 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt @@ -37,6 +37,7 @@ class DirectoryServiceAsyncImpl internal constructor(private val clientOptions: .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response.use { createHandler.handle(it) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt index 11baffe9..ce5d3fb9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt @@ -38,13 +38,14 @@ class EmploymentServiceAsyncImpl internal constructor(private val clientOptions: .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { updateHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt index d194f2c1..5c5316b0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt @@ -38,13 +38,14 @@ class IndividualServiceAsyncImpl internal constructor(private val clientOptions: .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { updateHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt index ae344f6c..6536c2b5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt @@ -45,13 +45,14 @@ class JobServiceAsyncImpl internal constructor(private val clientOptions: Client .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { createHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt index 13b829d5..59bf38ed 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt @@ -37,13 +37,14 @@ class PaymentServiceAsyncImpl internal constructor(private val clientOptions: Cl .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { createHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt index b84f6266..7a9df3e0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt @@ -39,13 +39,14 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { createHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -70,13 +71,14 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { updateHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt index b3ebe7aa..c91ec2d3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt @@ -38,13 +38,14 @@ class ConfigurationServiceAsyncImpl internal constructor(private val clientOptio .addPathSegments("sandbox", "jobs", "configuration") .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { retrieveHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.forEach { it.validate() } } } @@ -67,13 +68,14 @@ class ConfigurationServiceAsyncImpl internal constructor(private val clientOptio .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> response .use { updateHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt index d1bab69e..e99d3e9a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt @@ -64,11 +64,12 @@ class AccessTokenServiceImpl internal constructor(private val clientOptions: Cli .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { createHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt index 45a7f120..c2b0c4ef 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt @@ -38,11 +38,12 @@ class AccountServiceImpl internal constructor(private val clientOptions: ClientO .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { disconnectHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -62,11 +63,12 @@ class AccountServiceImpl internal constructor(private val clientOptions: ClientO .addPathSegments("introspect") .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { introspectHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt index b74c1193..d21a5a0e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt @@ -35,11 +35,12 @@ class ProviderServiceImpl internal constructor(private val clientOptions: Client .addPathSegments("providers") .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { listHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.forEach { it.validate() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt index 8121df1d..3ecd100b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt @@ -41,11 +41,12 @@ class RequestForwardingServiceImpl internal constructor(private val clientOption .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { forwardHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt index 98ac5eb3..429c9e8e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt @@ -38,11 +38,12 @@ class SessionServiceImpl internal constructor(private val clientOptions: ClientO .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { newHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -64,11 +65,12 @@ class SessionServiceImpl internal constructor(private val clientOptions: ClientO .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { reauthenticateHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt index 212bc6bc..a344d6c5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt @@ -55,11 +55,12 @@ class BenefitServiceImpl internal constructor(private val clientOptions: ClientO .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { createHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -79,11 +80,12 @@ class BenefitServiceImpl internal constructor(private val clientOptions: ClientO .addPathSegments("employer", "benefits", params.getPathParam(0)) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { retrieveHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -105,11 +107,12 @@ class BenefitServiceImpl internal constructor(private val clientOptions: ClientO .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { updateHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -129,11 +132,12 @@ class BenefitServiceImpl internal constructor(private val clientOptions: ClientO .addPathSegments("employer", "benefits") .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { listHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.forEach { it.validate() } } } @@ -160,11 +164,12 @@ class BenefitServiceImpl internal constructor(private val clientOptions: ClientO .addPathSegments("employer", "benefits", "meta") .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { listSupportedBenefitsHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.forEach { it.validate() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt index f8642c39..0ac88f59 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt @@ -34,11 +34,12 @@ class CompanyServiceImpl internal constructor(private val clientOptions: ClientO .addPathSegments("employer", "company") .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { retrieveHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt index d20b1bcf..ee2c0c1b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt @@ -37,11 +37,12 @@ class DirectoryServiceImpl internal constructor(private val clientOptions: Clien .addPathSegments("employer", "directory") .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { listHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -64,11 +65,12 @@ class DirectoryServiceImpl internal constructor(private val clientOptions: Clien .addPathSegments("employer", "directory") .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { listIndividualsHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt index fb50f412..5c8d6495 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt @@ -38,11 +38,12 @@ class DocumentServiceImpl internal constructor(private val clientOptions: Client .addPathSegments("employer", "documents") .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { listHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -66,11 +67,12 @@ class DocumentServiceImpl internal constructor(private val clientOptions: Client .addPathSegments("employer", "documents", params.getPathParam(0)) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { retreiveHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt index 1f65f3bc..82ffeeba 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt @@ -37,11 +37,12 @@ class EmploymentServiceImpl internal constructor(private val clientOptions: Clie .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { retrieveManyHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt index 55949402..4965d514 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt @@ -37,11 +37,12 @@ class IndividualServiceImpl internal constructor(private val clientOptions: Clie .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { retrieveManyHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt index 129ec2f5..2403cee3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt @@ -41,11 +41,12 @@ class PayStatementServiceImpl internal constructor(private val clientOptions: Cl .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { retrieveManyHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt index 3fc047c3..e60312b7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt @@ -35,11 +35,12 @@ class PaymentServiceImpl internal constructor(private val clientOptions: ClientO .addPathSegments("employer", "payment") .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { listHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.forEach { it.validate() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt index 51cb9c63..806aa60b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt @@ -42,11 +42,12 @@ class IndividualServiceImpl internal constructor(private val clientOptions: Clie .addPathSegments("employer", "benefits", params.getPathParam(0), "enrolled") .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { enrolledIdsHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -67,11 +68,12 @@ class IndividualServiceImpl internal constructor(private val clientOptions: Clie .addPathSegments("employer", "benefits", params.getPathParam(0), "individuals") .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { retrieveManyBenefitsHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.forEach { it.validate() } } } @@ -102,11 +104,12 @@ class IndividualServiceImpl internal constructor(private val clientOptions: Clie .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { unenrollManyHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.forEach { it.validate() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt index 89ff745a..08b18f99 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt @@ -55,11 +55,12 @@ class AutomatedServiceImpl internal constructor(private val clientOptions: Clien .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { createHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -79,11 +80,12 @@ class AutomatedServiceImpl internal constructor(private val clientOptions: Clien .addPathSegments("jobs", "automated", params.getPathParam(0)) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { retrieveHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -108,11 +110,12 @@ class AutomatedServiceImpl internal constructor(private val clientOptions: Clien .addPathSegments("jobs", "automated") .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { listHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt index 9ce1917a..184eb69d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt @@ -37,11 +37,12 @@ class ManualServiceImpl internal constructor(private val clientOptions: ClientOp .addPathSegments("jobs", "manual", params.getPathParam(0)) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { retrieveHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt index f4653cda..4e83756c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt @@ -38,11 +38,12 @@ class PayGroupServiceImpl internal constructor(private val clientOptions: Client .addPathSegments("employer", "pay-groups", params.getPathParam(0)) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { retrieveHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -63,11 +64,12 @@ class PayGroupServiceImpl internal constructor(private val clientOptions: Client .addPathSegments("employer", "pay-groups") .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { listHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.forEach { it.validate() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt index 63e3b740..6fe25256 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt @@ -36,11 +36,12 @@ class CompanyServiceImpl internal constructor(private val clientOptions: ClientO .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { updateHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt index 8f8fdd38..8f670c3f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt @@ -43,11 +43,12 @@ class ConnectionServiceImpl internal constructor(private val clientOptions: Clie .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { createHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt index acc30e28..a2dae656 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt @@ -36,6 +36,7 @@ class DirectoryServiceImpl internal constructor(private val clientOptions: Clien .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response.use { createHandler.handle(it) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt index a538224d..604f55d8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt @@ -37,11 +37,12 @@ class EmploymentServiceImpl internal constructor(private val clientOptions: Clie .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { updateHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt index feb15e1f..8f15579c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt @@ -37,11 +37,12 @@ class IndividualServiceImpl internal constructor(private val clientOptions: Clie .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { updateHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt index a2a60c9d..590077ad 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt @@ -43,11 +43,12 @@ class JobServiceImpl internal constructor(private val clientOptions: ClientOptio .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { createHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt index 61b5783b..53c639a6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt @@ -36,11 +36,12 @@ class PaymentServiceImpl internal constructor(private val clientOptions: ClientO .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { createHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt index 6f053eb8..2a56a2c3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt @@ -38,11 +38,12 @@ class AccountServiceImpl internal constructor(private val clientOptions: ClientO .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { createHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } @@ -66,11 +67,12 @@ class AccountServiceImpl internal constructor(private val clientOptions: ClientO .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { updateHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt index 08046405..1275e945 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt @@ -37,11 +37,12 @@ class ConfigurationServiceImpl internal constructor(private val clientOptions: C .addPathSegments("sandbox", "jobs", "configuration") .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { retrieveHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.forEach { it.validate() } } } @@ -63,11 +64,12 @@ class ConfigurationServiceImpl internal constructor(private val clientOptions: C .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response .use { updateHandler.handle(it) } .also { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + if (requestOptions.responseValidation!!) { it.validate() } } From 481c99cf2bc062b137c99a69bfce289c3e570a5a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 5 Mar 2025 22:38:49 +0000 Subject: [PATCH 04/65] feat(client): support raw response access (#471) --- finch-java-core/build.gradle.kts | 1 + .../com/tryfinch/api/client/FinchClient.kt | 27 ++ .../tryfinch/api/client/FinchClientAsync.kt | 27 ++ .../api/client/FinchClientAsyncImpl.kt | 65 ++++ .../tryfinch/api/client/FinchClientImpl.kt | 65 ++++ .../tryfinch/api/core/http/HttpResponseFor.kt | 23 ++ .../services/async/AccessTokenServiceAsync.kt | 25 ++ .../async/AccessTokenServiceAsyncImpl.kt | 108 +++--- .../api/services/async/AccountServiceAsync.kt | 55 +++ .../services/async/AccountServiceAsyncImpl.kt | 122 ++++--- .../api/services/async/ConnectServiceAsync.kt | 13 + .../services/async/ConnectServiceAsyncImpl.kt | 16 + .../api/services/async/HrisServiceAsync.kt | 25 ++ .../services/async/HrisServiceAsyncImpl.kt | 58 +++ .../api/services/async/JobServiceAsync.kt | 13 + .../api/services/async/JobServiceAsyncImpl.kt | 22 ++ .../api/services/async/PayrollServiceAsync.kt | 13 + .../services/async/PayrollServiceAsyncImpl.kt | 16 + .../services/async/ProviderServiceAsync.kt | 34 ++ .../async/ProviderServiceAsyncImpl.kt | 78 ++-- .../async/RequestForwardingServiceAsync.kt | 25 ++ .../RequestForwardingServiceAsyncImpl.kt | 72 ++-- .../api/services/async/SandboxServiceAsync.kt | 25 ++ .../services/async/SandboxServiceAsyncImpl.kt | 52 +++ .../async/connect/SessionServiceAsync.kt | 35 ++ .../async/connect/SessionServiceAsyncImpl.kt | 126 ++++--- .../async/hris/BenefitServiceAsync.kt | 101 ++++++ .../async/hris/BenefitServiceAsyncImpl.kt | 339 ++++++++++-------- .../async/hris/CompanyServiceAsync.kt | 32 ++ .../async/hris/CompanyServiceAsyncImpl.kt | 64 ++-- .../async/hris/DirectoryServiceAsync.kt | 57 +++ .../async/hris/DirectoryServiceAsyncImpl.kt | 142 +++++--- .../async/hris/DocumentServiceAsync.kt | 45 +++ .../async/hris/DocumentServiceAsyncImpl.kt | 128 ++++--- .../async/hris/EmploymentServiceAsync.kt | 25 ++ .../async/hris/EmploymentServiceAsyncImpl.kt | 76 ++-- .../async/hris/IndividualServiceAsync.kt | 35 ++ .../async/hris/IndividualServiceAsyncImpl.kt | 76 ++-- .../async/hris/PayStatementServiceAsync.kt | 25 ++ .../hris/PayStatementServiceAsyncImpl.kt | 80 +++-- .../async/hris/PaymentServiceAsync.kt | 24 ++ .../async/hris/PaymentServiceAsyncImpl.kt | 78 ++-- .../hris/benefits/IndividualServiceAsync.kt | 47 +++ .../benefits/IndividualServiceAsyncImpl.kt | 219 ++++++----- .../async/jobs/AutomatedServiceAsync.kt | 66 ++++ .../async/jobs/AutomatedServiceAsyncImpl.kt | 212 ++++++----- .../services/async/jobs/ManualServiceAsync.kt | 24 ++ .../async/jobs/ManualServiceAsyncImpl.kt | 67 ++-- .../async/payroll/PayGroupServiceAsync.kt | 45 +++ .../async/payroll/PayGroupServiceAsyncImpl.kt | 138 ++++--- .../async/sandbox/CompanyServiceAsync.kt | 24 ++ .../async/sandbox/CompanyServiceAsyncImpl.kt | 67 ++-- .../async/sandbox/ConnectionServiceAsync.kt | 27 ++ .../sandbox/ConnectionServiceAsyncImpl.kt | 76 ++-- .../async/sandbox/DirectoryServiceAsync.kt | 34 ++ .../sandbox/DirectoryServiceAsyncImpl.kt | 52 ++- .../async/sandbox/EmploymentServiceAsync.kt | 25 ++ .../sandbox/EmploymentServiceAsyncImpl.kt | 68 ++-- .../async/sandbox/IndividualServiceAsync.kt | 25 ++ .../sandbox/IndividualServiceAsyncImpl.kt | 68 ++-- .../services/async/sandbox/JobServiceAsync.kt | 24 ++ .../async/sandbox/JobServiceAsyncImpl.kt | 74 ++-- .../async/sandbox/PaymentServiceAsync.kt | 34 ++ .../async/sandbox/PaymentServiceAsyncImpl.kt | 67 ++-- .../connections/AccountServiceAsync.kt | 46 +++ .../connections/AccountServiceAsyncImpl.kt | 129 ++++--- .../sandbox/jobs/ConfigurationServiceAsync.kt | 47 +++ .../jobs/ConfigurationServiceAsyncImpl.kt | 126 ++++--- .../services/blocking/AccessTokenService.kt | 24 ++ .../blocking/AccessTokenServiceImpl.kt | 102 +++--- .../api/services/blocking/AccountService.kt | 49 +++ .../services/blocking/AccountServiceImpl.kt | 110 +++--- .../api/services/blocking/ConnectService.kt | 11 + .../services/blocking/ConnectServiceImpl.kt | 16 + .../api/services/blocking/HrisService.kt | 25 ++ .../api/services/blocking/HrisServiceImpl.kt | 58 +++ .../api/services/blocking/JobService.kt | 13 + .../api/services/blocking/JobServiceImpl.kt | 22 ++ .../api/services/blocking/PayrollService.kt | 11 + .../services/blocking/PayrollServiceImpl.kt | 16 + .../api/services/blocking/ProviderService.kt | 30 ++ .../services/blocking/ProviderServiceImpl.kt | 72 ++-- .../blocking/RequestForwardingService.kt | 25 ++ .../blocking/RequestForwardingServiceImpl.kt | 66 ++-- .../api/services/blocking/SandboxService.kt | 23 ++ .../services/blocking/SandboxServiceImpl.kt | 52 +++ .../blocking/connect/SessionService.kt | 33 ++ .../blocking/connect/SessionServiceImpl.kt | 114 +++--- .../services/blocking/hris/BenefitService.kt | 95 +++++ .../blocking/hris/BenefitServiceImpl.kt | 307 +++++++++------- .../services/blocking/hris/CompanyService.kt | 30 ++ .../blocking/hris/CompanyServiceImpl.kt | 58 ++- .../blocking/hris/DirectoryService.kt | 53 +++ .../blocking/hris/DirectoryServiceImpl.kt | 125 ++++--- .../services/blocking/hris/DocumentService.kt | 41 +++ .../blocking/hris/DocumentServiceImpl.kt | 116 +++--- .../blocking/hris/EmploymentService.kt | 22 ++ .../blocking/hris/EmploymentServiceImpl.kt | 70 ++-- .../blocking/hris/IndividualService.kt | 32 ++ .../blocking/hris/IndividualServiceImpl.kt | 70 ++-- .../blocking/hris/PayStatementService.kt | 24 ++ .../blocking/hris/PayStatementServiceImpl.kt | 74 ++-- .../services/blocking/hris/PaymentService.kt | 22 ++ .../blocking/hris/PaymentServiceImpl.kt | 72 ++-- .../hris/benefits/IndividualService.kt | 44 +++ .../hris/benefits/IndividualServiceImpl.kt | 198 +++++----- .../blocking/jobs/AutomatedService.kt | 60 ++++ .../blocking/jobs/AutomatedServiceImpl.kt | 190 +++++----- .../services/blocking/jobs/ManualService.kt | 22 ++ .../blocking/jobs/ManualServiceImpl.kt | 61 ++-- .../blocking/payroll/PayGroupService.kt | 41 +++ .../blocking/payroll/PayGroupServiceImpl.kt | 124 ++++--- .../blocking/sandbox/CompanyService.kt | 22 ++ .../blocking/sandbox/CompanyServiceImpl.kt | 61 ++-- .../blocking/sandbox/ConnectionService.kt | 24 ++ .../blocking/sandbox/ConnectionServiceImpl.kt | 70 ++-- .../blocking/sandbox/DirectoryService.kt | 30 ++ .../blocking/sandbox/DirectoryServiceImpl.kt | 48 ++- .../blocking/sandbox/EmploymentService.kt | 22 ++ .../blocking/sandbox/EmploymentServiceImpl.kt | 62 ++-- .../blocking/sandbox/IndividualService.kt | 22 ++ .../blocking/sandbox/IndividualServiceImpl.kt | 62 ++-- .../services/blocking/sandbox/JobService.kt | 24 ++ .../blocking/sandbox/JobServiceImpl.kt | 68 ++-- .../blocking/sandbox/PaymentService.kt | 30 ++ .../blocking/sandbox/PaymentServiceImpl.kt | 61 ++-- .../sandbox/connections/AccountService.kt | 42 +++ .../sandbox/connections/AccountServiceImpl.kt | 117 +++--- .../sandbox/jobs/ConfigurationService.kt | 46 +++ .../sandbox/jobs/ConfigurationServiceImpl.kt | 114 +++--- 130 files changed, 5984 insertions(+), 2063 deletions(-) create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpResponseFor.kt diff --git a/finch-java-core/build.gradle.kts b/finch-java-core/build.gradle.kts index af4554e6..c813a0c9 100644 --- a/finch-java-core/build.gradle.kts +++ b/finch-java-core/build.gradle.kts @@ -6,6 +6,7 @@ plugins { dependencies { api("com.fasterxml.jackson.core:jackson-core:2.18.1") api("com.fasterxml.jackson.core:jackson-databind:2.18.1") + 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") diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClient.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClient.kt index bf99f84a..4d6662df 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClient.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClient.kt @@ -38,6 +38,11 @@ interface FinchClient { */ fun async(): FinchClientAsync + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun accessTokens(): AccessTokenService fun hris(): HrisService @@ -100,4 +105,26 @@ interface FinchClient { * method. */ fun close() + + /** A view of [FinchClient] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + fun accessTokens(): AccessTokenService.WithRawResponse + + fun hris(): HrisService.WithRawResponse + + fun providers(): ProviderService.WithRawResponse + + fun account(): AccountService.WithRawResponse + + fun requestForwarding(): RequestForwardingService.WithRawResponse + + fun jobs(): JobService.WithRawResponse + + fun sandbox(): SandboxService.WithRawResponse + + fun payroll(): PayrollService.WithRawResponse + + fun connect(): ConnectService.WithRawResponse + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsync.kt index e20d730b..d829a593 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsync.kt @@ -39,6 +39,11 @@ interface FinchClientAsync { */ fun sync(): FinchClient + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun accessTokens(): AccessTokenServiceAsync fun hris(): HrisServiceAsync @@ -101,4 +106,26 @@ interface FinchClientAsync { * method. */ fun close() + + /** A view of [FinchClientAsync] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + fun accessTokens(): AccessTokenServiceAsync.WithRawResponse + + fun hris(): HrisServiceAsync.WithRawResponse + + fun providers(): ProviderServiceAsync.WithRawResponse + + fun account(): AccountServiceAsync.WithRawResponse + + fun requestForwarding(): RequestForwardingServiceAsync.WithRawResponse + + fun jobs(): JobServiceAsync.WithRawResponse + + fun sandbox(): SandboxServiceAsync.WithRawResponse + + fun payroll(): PayrollServiceAsync.WithRawResponse + + fun connect(): ConnectServiceAsync.WithRawResponse + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsyncImpl.kt index 1a33fcc6..0da99f5b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsyncImpl.kt @@ -52,6 +52,10 @@ class FinchClientAsyncImpl(private val clientOptions: ClientOptions) : FinchClie private val sync: FinchClient by lazy { FinchClientImpl(clientOptions) } + private val withRawResponse: FinchClientAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + private val accessTokens: AccessTokenServiceAsync by lazy { AccessTokenServiceAsyncImpl(clientOptionsWithUserAgent) } @@ -93,6 +97,8 @@ class FinchClientAsyncImpl(private val clientOptions: ClientOptions) : FinchClie override fun sync(): FinchClient = sync + override fun withRawResponse(): FinchClientAsync.WithRawResponse = withRawResponse + override fun accessTokens(): AccessTokenServiceAsync = accessTokens override fun hris(): HrisServiceAsync = hris @@ -189,4 +195,63 @@ class FinchClientAsyncImpl(private val clientOptions: ClientOptions) : FinchClie ) override fun close() = clientOptions.httpClient.close() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + FinchClientAsync.WithRawResponse { + + private val accessTokens: AccessTokenServiceAsync.WithRawResponse by lazy { + AccessTokenServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val hris: HrisServiceAsync.WithRawResponse by lazy { + HrisServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val providers: ProviderServiceAsync.WithRawResponse by lazy { + ProviderServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val account: AccountServiceAsync.WithRawResponse by lazy { + AccountServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val requestForwarding: RequestForwardingServiceAsync.WithRawResponse by lazy { + RequestForwardingServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val jobs: JobServiceAsync.WithRawResponse by lazy { + JobServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val sandbox: SandboxServiceAsync.WithRawResponse by lazy { + SandboxServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val payroll: PayrollServiceAsync.WithRawResponse by lazy { + PayrollServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val connect: ConnectServiceAsync.WithRawResponse by lazy { + ConnectServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun accessTokens(): AccessTokenServiceAsync.WithRawResponse = accessTokens + + override fun hris(): HrisServiceAsync.WithRawResponse = hris + + override fun providers(): ProviderServiceAsync.WithRawResponse = providers + + override fun account(): AccountServiceAsync.WithRawResponse = account + + override fun requestForwarding(): RequestForwardingServiceAsync.WithRawResponse = + requestForwarding + + override fun jobs(): JobServiceAsync.WithRawResponse = jobs + + override fun sandbox(): SandboxServiceAsync.WithRawResponse = sandbox + + override fun payroll(): PayrollServiceAsync.WithRawResponse = payroll + + override fun connect(): ConnectServiceAsync.WithRawResponse = connect + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt index 3f10b2e8..b57428bf 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt @@ -51,6 +51,10 @@ class FinchClientImpl(private val clientOptions: ClientOptions) : FinchClient { private val async: FinchClientAsync by lazy { FinchClientAsyncImpl(clientOptions) } + private val withRawResponse: FinchClient.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + private val accessTokens: AccessTokenService by lazy { AccessTokenServiceImpl(clientOptionsWithUserAgent) } @@ -82,6 +86,8 @@ class FinchClientImpl(private val clientOptions: ClientOptions) : FinchClient { override fun async(): FinchClientAsync = async + override fun withRawResponse(): FinchClient.WithRawResponse = withRawResponse + override fun accessTokens(): AccessTokenService = accessTokens override fun hris(): HrisService = hris @@ -178,4 +184,63 @@ class FinchClientImpl(private val clientOptions: ClientOptions) : FinchClient { ) override fun close() = clientOptions.httpClient.close() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + FinchClient.WithRawResponse { + + private val accessTokens: AccessTokenService.WithRawResponse by lazy { + AccessTokenServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val hris: HrisService.WithRawResponse by lazy { + HrisServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val providers: ProviderService.WithRawResponse by lazy { + ProviderServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val account: AccountService.WithRawResponse by lazy { + AccountServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val requestForwarding: RequestForwardingService.WithRawResponse by lazy { + RequestForwardingServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val jobs: JobService.WithRawResponse by lazy { + JobServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val sandbox: SandboxService.WithRawResponse by lazy { + SandboxServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val payroll: PayrollService.WithRawResponse by lazy { + PayrollServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val connect: ConnectService.WithRawResponse by lazy { + ConnectServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun accessTokens(): AccessTokenService.WithRawResponse = accessTokens + + override fun hris(): HrisService.WithRawResponse = hris + + override fun providers(): ProviderService.WithRawResponse = providers + + override fun account(): AccountService.WithRawResponse = account + + override fun requestForwarding(): RequestForwardingService.WithRawResponse = + requestForwarding + + override fun jobs(): JobService.WithRawResponse = jobs + + override fun sandbox(): SandboxService.WithRawResponse = sandbox + + override fun payroll(): PayrollService.WithRawResponse = payroll + + override fun connect(): ConnectService.WithRawResponse = connect + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpResponseFor.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpResponseFor.kt new file mode 100644 index 00000000..23f27c4f --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpResponseFor.kt @@ -0,0 +1,23 @@ +package com.tryfinch.api.core.http + +import java.io.InputStream + +interface HttpResponseFor : HttpResponse { + + fun parse(): T +} + +@JvmSynthetic +internal fun HttpResponse.parseable(parse: () -> T): HttpResponseFor = + object : HttpResponseFor { + + override fun parse(): T = parse() + + override fun statusCode(): Int = this@parseable.statusCode() + + override fun headers(): Headers = this@parseable.headers() + + override fun body(): InputStream = this@parseable.body() + + override fun close() = this@parseable.close() + } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsync.kt index 42797f29..c512c630 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsync.kt @@ -4,17 +4,42 @@ package com.tryfinch.api.services.async +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.AccessTokenCreateParams import com.tryfinch.api.models.CreateAccessTokenResponse import java.util.concurrent.CompletableFuture interface AccessTokenServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Exchange the authorization code for an access token */ @JvmOverloads fun create( params: AccessTokenCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [AccessTokenServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /auth/token`, but is otherwise the same as + * [AccessTokenServiceAsync.create]. + */ + @JvmOverloads + @MustBeClosed + fun create( + params: AccessTokenCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt index 777a2064..8191c54c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError @@ -21,61 +23,79 @@ import java.util.concurrent.CompletableFuture class AccessTokenServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : AccessTokenServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: AccessTokenServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): AccessTokenServiceAsync.WithRawResponse = withRawResponse - /** Exchange the authorization code for an access token */ override fun create( params: AccessTokenCreateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val builder = params.toBuilder() + ): CompletableFuture = + // post /auth/token + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + AccessTokenServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: AccessTokenCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val builder = params.toBuilder() - if (!params.clientSecret().isPresent) { - if (clientOptions.clientSecret == null || clientOptions.clientSecret.isEmpty()) { - throw FinchException( - "client_secret must be provided as an argument or with the FINCH_CLIENT_SECRET environment variable" - ) + if (!params.clientSecret().isPresent) { + if (clientOptions.clientSecret == null || clientOptions.clientSecret.isEmpty()) { + throw FinchException( + "client_secret must be provided as an argument or with the FINCH_CLIENT_SECRET environment variable" + ) + } + builder.clientSecret(clientOptions.clientSecret) } - builder.clientSecret(clientOptions.clientSecret) - } - if (!params.clientId().isPresent) { - if (clientOptions.clientId == null || clientOptions.clientId.isEmpty()) { - throw FinchException( - "client_id must be provided as an argument or with the FINCH_CLIENT_ID environment variable" - ) + if (!params.clientId().isPresent) { + if (clientOptions.clientId == null || clientOptions.clientId.isEmpty()) { + throw FinchException( + "client_id must be provided as an argument or with the FINCH_CLIENT_ID environment variable" + ) + } + builder.clientId(clientOptions.clientId) } - builder.clientId(clientOptions.clientId) - } - val modifiedParams = builder.build() + val modifiedParams = builder.build() - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("auth", "token") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params._queryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params._headers()) - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("auth", "token") + .putAllQueryParams(clientOptions.queryParams) + .replaceAllQueryParams(params._queryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params._headers()) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsync.kt index f40cf58d..9daab298 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsync.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.async +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.AccountDisconnectParams import com.tryfinch.api.models.AccountIntrospectParams import com.tryfinch.api.models.DisconnectResponse @@ -13,6 +15,11 @@ import java.util.concurrent.CompletableFuture interface AccountServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Disconnect one or more `access_token`s from your application. */ @JvmOverloads fun disconnect( @@ -34,4 +41,52 @@ interface AccountServiceAsync { /** Read account information associated with an `access_token` */ fun introspect(requestOptions: RequestOptions): CompletableFuture = introspect(AccountIntrospectParams.none(), requestOptions) + + /** + * A view of [AccountServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /disconnect`, but is otherwise the same as + * [AccountServiceAsync.disconnect]. + */ + @JvmOverloads + @MustBeClosed + fun disconnect( + params: AccountDisconnectParams = AccountDisconnectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `post /disconnect`, but is otherwise the same as + * [AccountServiceAsync.disconnect]. + */ + @MustBeClosed + fun disconnect( + requestOptions: RequestOptions + ): CompletableFuture> = + disconnect(AccountDisconnectParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /introspect`, but is otherwise the same as + * [AccountServiceAsync.introspect]. + */ + @JvmOverloads + @MustBeClosed + fun introspect( + params: AccountIntrospectParams = AccountIntrospectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /introspect`, but is otherwise the same as + * [AccountServiceAsync.introspect]. + */ + @MustBeClosed + fun introspect( + requestOptions: RequestOptions + ): CompletableFuture> = + introspect(AccountIntrospectParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt index c81ff903..844d6572 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError @@ -22,62 +24,88 @@ import java.util.concurrent.CompletableFuture class AccountServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : AccountServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: AccountServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val disconnectHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): AccountServiceAsync.WithRawResponse = withRawResponse - /** Disconnect one or more `access_token`s from your application. */ override fun disconnect( params: AccountDisconnectParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("disconnect") - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { disconnectHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } + ): CompletableFuture = + // post /disconnect + withRawResponse().disconnect(params, requestOptions).thenApply { it.parse() } - private val introspectHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** Read account information associated with an `access_token` */ override fun introspect( params: AccountIntrospectParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("introspect") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { introspectHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompletableFuture = + // get /introspect + withRawResponse().introspect(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + AccountServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val disconnectHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun disconnect( + params: AccountDisconnectParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("disconnect") + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { disconnectHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val introspectHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun introspect( + params: AccountIntrospectParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("introspect") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { introspectHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ConnectServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ConnectServiceAsync.kt index 7029f435..53ceda78 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ConnectServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ConnectServiceAsync.kt @@ -6,5 +6,18 @@ import com.tryfinch.api.services.async.connect.SessionServiceAsync interface ConnectServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun sessions(): SessionServiceAsync + + /** + * A view of [ConnectServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + fun sessions(): SessionServiceAsync.WithRawResponse + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ConnectServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ConnectServiceAsyncImpl.kt index a019a5c1..f93bc643 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ConnectServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ConnectServiceAsyncImpl.kt @@ -9,7 +9,23 @@ import com.tryfinch.api.services.async.connect.SessionServiceAsyncImpl class ConnectServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : ConnectServiceAsync { + private val withRawResponse: ConnectServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + private val sessions: SessionServiceAsync by lazy { SessionServiceAsyncImpl(clientOptions) } + override fun withRawResponse(): ConnectServiceAsync.WithRawResponse = withRawResponse + override fun sessions(): SessionServiceAsync = sessions + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + ConnectServiceAsync.WithRawResponse { + + private val sessions: SessionServiceAsync.WithRawResponse by lazy { + SessionServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun sessions(): SessionServiceAsync.WithRawResponse = sessions + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/HrisServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/HrisServiceAsync.kt index 1e10b682..9a2feba1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/HrisServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/HrisServiceAsync.kt @@ -13,6 +13,11 @@ import com.tryfinch.api.services.async.hris.PaymentServiceAsync interface HrisServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun company(): CompanyServiceAsync fun directory(): DirectoryServiceAsync @@ -28,4 +33,24 @@ interface HrisServiceAsync { fun documents(): DocumentServiceAsync fun benefits(): BenefitServiceAsync + + /** A view of [HrisServiceAsync] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + fun company(): CompanyServiceAsync.WithRawResponse + + fun directory(): DirectoryServiceAsync.WithRawResponse + + fun individuals(): IndividualServiceAsync.WithRawResponse + + fun employments(): EmploymentServiceAsync.WithRawResponse + + fun payments(): PaymentServiceAsync.WithRawResponse + + fun payStatements(): PayStatementServiceAsync.WithRawResponse + + fun documents(): DocumentServiceAsync.WithRawResponse + + fun benefits(): BenefitServiceAsync.WithRawResponse + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/HrisServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/HrisServiceAsyncImpl.kt index 913a435f..93d03324 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/HrisServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/HrisServiceAsyncImpl.kt @@ -23,6 +23,10 @@ import com.tryfinch.api.services.async.hris.PaymentServiceAsyncImpl class HrisServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : HrisServiceAsync { + private val withRawResponse: HrisServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + private val company: CompanyServiceAsync by lazy { CompanyServiceAsyncImpl(clientOptions) } private val directory: DirectoryServiceAsync by lazy { @@ -47,6 +51,8 @@ class HrisServiceAsyncImpl internal constructor(private val clientOptions: Clien private val benefits: BenefitServiceAsync by lazy { BenefitServiceAsyncImpl(clientOptions) } + override fun withRawResponse(): HrisServiceAsync.WithRawResponse = withRawResponse + override fun company(): CompanyServiceAsync = company override fun directory(): DirectoryServiceAsync = directory @@ -62,4 +68,56 @@ class HrisServiceAsyncImpl internal constructor(private val clientOptions: Clien override fun documents(): DocumentServiceAsync = documents override fun benefits(): BenefitServiceAsync = benefits + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + HrisServiceAsync.WithRawResponse { + + private val company: CompanyServiceAsync.WithRawResponse by lazy { + CompanyServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val directory: DirectoryServiceAsync.WithRawResponse by lazy { + DirectoryServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val individuals: IndividualServiceAsync.WithRawResponse by lazy { + IndividualServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val employments: EmploymentServiceAsync.WithRawResponse by lazy { + EmploymentServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val payments: PaymentServiceAsync.WithRawResponse by lazy { + PaymentServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val payStatements: PayStatementServiceAsync.WithRawResponse by lazy { + PayStatementServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val documents: DocumentServiceAsync.WithRawResponse by lazy { + DocumentServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val benefits: BenefitServiceAsync.WithRawResponse by lazy { + BenefitServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun company(): CompanyServiceAsync.WithRawResponse = company + + override fun directory(): DirectoryServiceAsync.WithRawResponse = directory + + override fun individuals(): IndividualServiceAsync.WithRawResponse = individuals + + override fun employments(): EmploymentServiceAsync.WithRawResponse = employments + + override fun payments(): PaymentServiceAsync.WithRawResponse = payments + + override fun payStatements(): PayStatementServiceAsync.WithRawResponse = payStatements + + override fun documents(): DocumentServiceAsync.WithRawResponse = documents + + override fun benefits(): BenefitServiceAsync.WithRawResponse = benefits + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/JobServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/JobServiceAsync.kt index 312850ad..5b415166 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/JobServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/JobServiceAsync.kt @@ -7,7 +7,20 @@ import com.tryfinch.api.services.async.jobs.ManualServiceAsync interface JobServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun automated(): AutomatedServiceAsync fun manual(): ManualServiceAsync + + /** A view of [JobServiceAsync] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + fun automated(): AutomatedServiceAsync.WithRawResponse + + fun manual(): ManualServiceAsync.WithRawResponse + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/JobServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/JobServiceAsyncImpl.kt index 264fb526..5849135c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/JobServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/JobServiceAsyncImpl.kt @@ -11,13 +11,35 @@ import com.tryfinch.api.services.async.jobs.ManualServiceAsyncImpl class JobServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : JobServiceAsync { + private val withRawResponse: JobServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + private val automated: AutomatedServiceAsync by lazy { AutomatedServiceAsyncImpl(clientOptions) } private val manual: ManualServiceAsync by lazy { ManualServiceAsyncImpl(clientOptions) } + override fun withRawResponse(): JobServiceAsync.WithRawResponse = withRawResponse + override fun automated(): AutomatedServiceAsync = automated override fun manual(): ManualServiceAsync = manual + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + JobServiceAsync.WithRawResponse { + + private val automated: AutomatedServiceAsync.WithRawResponse by lazy { + AutomatedServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val manual: ManualServiceAsync.WithRawResponse by lazy { + ManualServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun automated(): AutomatedServiceAsync.WithRawResponse = automated + + override fun manual(): ManualServiceAsync.WithRawResponse = manual + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/PayrollServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/PayrollServiceAsync.kt index b7a093e1..66caaaaa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/PayrollServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/PayrollServiceAsync.kt @@ -6,5 +6,18 @@ import com.tryfinch.api.services.async.payroll.PayGroupServiceAsync interface PayrollServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun payGroups(): PayGroupServiceAsync + + /** + * A view of [PayrollServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + fun payGroups(): PayGroupServiceAsync.WithRawResponse + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/PayrollServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/PayrollServiceAsyncImpl.kt index a856537b..6c3ca41f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/PayrollServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/PayrollServiceAsyncImpl.kt @@ -9,7 +9,23 @@ import com.tryfinch.api.services.async.payroll.PayGroupServiceAsyncImpl class PayrollServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : PayrollServiceAsync { + private val withRawResponse: PayrollServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + private val payGroups: PayGroupServiceAsync by lazy { PayGroupServiceAsyncImpl(clientOptions) } + override fun withRawResponse(): PayrollServiceAsync.WithRawResponse = withRawResponse + override fun payGroups(): PayGroupServiceAsync = payGroups + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + PayrollServiceAsync.WithRawResponse { + + private val payGroups: PayGroupServiceAsync.WithRawResponse by lazy { + PayGroupServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun payGroups(): PayGroupServiceAsync.WithRawResponse = payGroups + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsync.kt index 954bba83..1aeedeb4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsync.kt @@ -4,13 +4,20 @@ package com.tryfinch.api.services.async +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.ProviderListPageAsync import com.tryfinch.api.models.ProviderListParams import java.util.concurrent.CompletableFuture interface ProviderServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Return details on all available payroll and HR systems. */ @JvmOverloads fun list( @@ -21,4 +28,31 @@ interface ProviderServiceAsync { /** Return details on all available payroll and HR systems. */ fun list(requestOptions: RequestOptions): CompletableFuture = list(ProviderListParams.none(), requestOptions) + + /** + * A view of [ProviderServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /providers`, but is otherwise the same as + * [ProviderServiceAsync.list]. + */ + @JvmOverloads + @MustBeClosed + fun list( + params: ProviderListParams = ProviderListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /providers`, but is otherwise the same as + * [ProviderServiceAsync.list]. + */ + @MustBeClosed + fun list( + requestOptions: RequestOptions + ): CompletableFuture> = + list(ProviderListParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt index 38d919f5..cf52e0a4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.Provider @@ -20,40 +22,58 @@ import java.util.concurrent.CompletableFuture class ProviderServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : ProviderServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: ProviderServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val listHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): ProviderServiceAsync.WithRawResponse = withRawResponse - /** Return details on all available payroll and HR systems. */ override fun list( params: ProviderListParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("providers") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.forEach { it.validate() } - } - } - .let { - ProviderListPageAsync.of( - this, - params, - ProviderListPageAsync.Response.builder().items(it).build(), - ) + ): CompletableFuture = + // get /providers + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + ProviderServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun list( + params: ProviderListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("providers") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + .let { + ProviderListPageAsync.of( + ProviderServiceAsyncImpl(clientOptions), + params, + ProviderListPageAsync.Response.builder().items(it).build(), + ) + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsync.kt index 824ada2d..e23f3e6f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsync.kt @@ -4,13 +4,20 @@ package com.tryfinch.api.services.async +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.RequestForwardingForwardParams import com.tryfinch.api.models.RequestForwardingForwardResponse import java.util.concurrent.CompletableFuture interface RequestForwardingServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** * The Forward API allows you to make direct requests to an employment system. If Finch’s * unified API doesn’t have a data model that cleanly fits your needs, then Forward allows you @@ -21,4 +28,22 @@ interface RequestForwardingServiceAsync { params: RequestForwardingForwardParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [RequestForwardingServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /forward`, but is otherwise the same as + * [RequestForwardingServiceAsync.forward]. + */ + @JvmOverloads + @MustBeClosed + fun forward( + params: RequestForwardingForwardParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt index 29826d68..f8cb4bea 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError @@ -20,39 +22,53 @@ import java.util.concurrent.CompletableFuture class RequestForwardingServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : RequestForwardingServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: RequestForwardingServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val forwardHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): RequestForwardingServiceAsync.WithRawResponse = withRawResponse - /** - * The Forward API allows you to make direct requests to an employment system. If Finch’s - * unified API doesn’t have a data model that cleanly fits your needs, then Forward allows you - * to push or pull data models directly against an integration’s API. - */ override fun forward( params: RequestForwardingForwardParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("forward") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { forwardHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompletableFuture = + // post /forward + withRawResponse().forward(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + RequestForwardingServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val forwardHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun forward( + params: RequestForwardingForwardParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("forward") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { forwardHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/SandboxServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/SandboxServiceAsync.kt index ca38451b..d7cf62b6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/SandboxServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/SandboxServiceAsync.kt @@ -12,6 +12,11 @@ import com.tryfinch.api.services.async.sandbox.PaymentServiceAsync interface SandboxServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun connections(): ConnectionServiceAsync fun company(): CompanyServiceAsync @@ -25,4 +30,24 @@ interface SandboxServiceAsync { fun payment(): PaymentServiceAsync fun jobs(): JobServiceAsync + + /** + * A view of [SandboxServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + fun connections(): ConnectionServiceAsync.WithRawResponse + + fun company(): CompanyServiceAsync.WithRawResponse + + fun directory(): DirectoryServiceAsync.WithRawResponse + + fun individual(): IndividualServiceAsync.WithRawResponse + + fun employment(): EmploymentServiceAsync.WithRawResponse + + fun payment(): PaymentServiceAsync.WithRawResponse + + fun jobs(): JobServiceAsync.WithRawResponse + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/SandboxServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/SandboxServiceAsyncImpl.kt index d68cb53a..409d5daf 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/SandboxServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/SandboxServiceAsyncImpl.kt @@ -21,6 +21,10 @@ import com.tryfinch.api.services.async.sandbox.PaymentServiceAsyncImpl class SandboxServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : SandboxServiceAsync { + private val withRawResponse: SandboxServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + private val connections: ConnectionServiceAsync by lazy { ConnectionServiceAsyncImpl(clientOptions) } @@ -43,6 +47,8 @@ class SandboxServiceAsyncImpl internal constructor(private val clientOptions: Cl private val jobs: JobServiceAsync by lazy { JobServiceAsyncImpl(clientOptions) } + override fun withRawResponse(): SandboxServiceAsync.WithRawResponse = withRawResponse + override fun connections(): ConnectionServiceAsync = connections override fun company(): CompanyServiceAsync = company @@ -56,4 +62,50 @@ class SandboxServiceAsyncImpl internal constructor(private val clientOptions: Cl override fun payment(): PaymentServiceAsync = payment override fun jobs(): JobServiceAsync = jobs + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + SandboxServiceAsync.WithRawResponse { + + private val connections: ConnectionServiceAsync.WithRawResponse by lazy { + ConnectionServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val company: CompanyServiceAsync.WithRawResponse by lazy { + CompanyServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val directory: DirectoryServiceAsync.WithRawResponse by lazy { + DirectoryServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val individual: IndividualServiceAsync.WithRawResponse by lazy { + IndividualServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val employment: EmploymentServiceAsync.WithRawResponse by lazy { + EmploymentServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val payment: PaymentServiceAsync.WithRawResponse by lazy { + PaymentServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val jobs: JobServiceAsync.WithRawResponse by lazy { + JobServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun connections(): ConnectionServiceAsync.WithRawResponse = connections + + override fun company(): CompanyServiceAsync.WithRawResponse = company + + override fun directory(): DirectoryServiceAsync.WithRawResponse = directory + + override fun individual(): IndividualServiceAsync.WithRawResponse = individual + + override fun employment(): EmploymentServiceAsync.WithRawResponse = employment + + override fun payment(): PaymentServiceAsync.WithRawResponse = payment + + override fun jobs(): JobServiceAsync.WithRawResponse = jobs + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsync.kt index e79109d7..c9034fb8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsync.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.async.connect +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.ConnectSessionNewParams import com.tryfinch.api.models.ConnectSessionReauthenticateParams import com.tryfinch.api.models.SessionNewResponse @@ -13,6 +15,11 @@ import java.util.concurrent.CompletableFuture interface SessionServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Create a new connect session for an employer */ @JvmOverloads fun new_( @@ -26,4 +33,32 @@ interface SessionServiceAsync { params: ConnectSessionReauthenticateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [SessionServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /connect/sessions`, but is otherwise the same as + * [SessionServiceAsync.new_]. + */ + @JvmOverloads + @MustBeClosed + fun new_( + params: ConnectSessionNewParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `post /connect/sessions/reauthenticate`, but is otherwise + * the same as [SessionServiceAsync.reauthenticate]. + */ + @JvmOverloads + @MustBeClosed + fun reauthenticate( + params: ConnectSessionReauthenticateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt index c8c29eaf..3b5b900f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError @@ -22,64 +24,90 @@ import java.util.concurrent.CompletableFuture class SessionServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : SessionServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: SessionServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val newHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): SessionServiceAsync.WithRawResponse = withRawResponse - /** Create a new connect session for an employer */ override fun new_( params: ConnectSessionNewParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("connect", "sessions") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { newHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } + ): CompletableFuture = + // post /connect/sessions + withRawResponse().new_(params, requestOptions).thenApply { it.parse() } - private val reauthenticateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Create a new Connect session for reauthenticating an existing connection */ override fun reauthenticate( params: ConnectSessionReauthenticateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("connect", "sessions", "reauthenticate") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { reauthenticateHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompletableFuture = + // post /connect/sessions/reauthenticate + withRawResponse().reauthenticate(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + SessionServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val newHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun new_( + params: ConnectSessionNewParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("connect", "sessions") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { newHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val reauthenticateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun reauthenticate( + params: ConnectSessionReauthenticateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("connect", "sessions", "reauthenticate") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { reauthenticateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsync.kt index c764d97d..93601924 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsync.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.async.hris +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.CompanyBenefit import com.tryfinch.api.models.CreateCompanyBenefitsResponse import com.tryfinch.api.models.HrisBenefitCreateParams @@ -20,6 +22,11 @@ import java.util.concurrent.CompletableFuture interface BenefitServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun individuals(): IndividualServiceAsync /** @@ -77,4 +84,98 @@ interface BenefitServiceAsync { requestOptions: RequestOptions ): CompletableFuture = listSupportedBenefits(HrisBenefitListSupportedBenefitsParams.none(), requestOptions) + + /** + * A view of [BenefitServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + fun individuals(): IndividualServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post /employer/benefits`, but is otherwise the same as + * [BenefitServiceAsync.create]. + */ + @JvmOverloads + @MustBeClosed + fun create( + params: HrisBenefitCreateParams = HrisBenefitCreateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `post /employer/benefits`, but is otherwise the same as + * [BenefitServiceAsync.create]. + */ + @MustBeClosed + fun create( + requestOptions: RequestOptions + ): CompletableFuture> = + create(HrisBenefitCreateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /employer/benefits/{benefit_id}`, but is otherwise + * the same as [BenefitServiceAsync.retrieve]. + */ + @JvmOverloads + @MustBeClosed + fun retrieve( + params: HrisBenefitRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `post /employer/benefits/{benefit_id}`, but is otherwise + * the same as [BenefitServiceAsync.update]. + */ + @JvmOverloads + @MustBeClosed + fun update( + params: HrisBenefitUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /employer/benefits`, but is otherwise the same as + * [BenefitServiceAsync.list]. + */ + @JvmOverloads + @MustBeClosed + fun list( + params: HrisBenefitListParams = HrisBenefitListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /employer/benefits`, but is otherwise the same as + * [BenefitServiceAsync.list]. + */ + @MustBeClosed + fun list( + requestOptions: RequestOptions + ): CompletableFuture> = + list(HrisBenefitListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /employer/benefits/meta`, but is otherwise the same + * as [BenefitServiceAsync.listSupportedBenefits]. + */ + @JvmOverloads + @MustBeClosed + fun listSupportedBenefits( + params: HrisBenefitListSupportedBenefitsParams = + HrisBenefitListSupportedBenefitsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /employer/benefits/meta`, but is otherwise the same + * as [BenefitServiceAsync.listSupportedBenefits]. + */ + @MustBeClosed + fun listSupportedBenefits( + requestOptions: RequestOptions + ): CompletableFuture> = + listSupportedBenefits(HrisBenefitListSupportedBenefitsParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt index 12bac153..8c0c7451 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError @@ -31,174 +33,229 @@ import java.util.concurrent.CompletableFuture class BenefitServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : BenefitServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: BenefitServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } private val individuals: IndividualServiceAsync by lazy { IndividualServiceAsyncImpl(clientOptions) } - override fun individuals(): IndividualServiceAsync = individuals + override fun withRawResponse(): BenefitServiceAsync.WithRawResponse = withRawResponse - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun individuals(): IndividualServiceAsync = individuals - /** - * Creates a new company-wide deduction or contribution. Please use the `/providers` endpoint to - * view available types for each provider. - */ override fun create( params: HrisBenefitCreateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("employer", "benefits") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } + ): CompletableFuture = + // post /employer/benefits + withRawResponse().create(params, requestOptions).thenApply { it.parse() } - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** Lists deductions and contributions information for a given item */ override fun retrieve( params: HrisBenefitRetrieveParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "benefits", params.getPathParam(0)) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + ): CompletableFuture = + // get /employer/benefits/{benefit_id} + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } - /** Updates an existing company-wide deduction or contribution */ override fun update( params: HrisBenefitUpdateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("employer", "benefits", params.getPathParam(0)) - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } + ): CompletableFuture = + // post /employer/benefits/{benefit_id} + withRawResponse().update(params, requestOptions).thenApply { it.parse() } - private val listHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** List all company-wide deductions and contributions. */ override fun list( params: HrisBenefitListParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "benefits") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.forEach { it.validate() } - } - } - .let { - HrisBenefitListPageAsync.of( - this, - params, - HrisBenefitListPageAsync.Response.builder().items(it).build(), - ) - } - } - } + ): CompletableFuture = + // get /employer/benefits + withRawResponse().list(params, requestOptions).thenApply { it.parse() } - private val listSupportedBenefitsHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** Get deductions metadata */ override fun listSupportedBenefits( params: HrisBenefitListSupportedBenefitsParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "benefits", "meta") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { listSupportedBenefitsHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.forEach { it.validate() } - } + ): CompletableFuture = + // get /employer/benefits/meta + withRawResponse().listSupportedBenefits(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + BenefitServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val individuals: IndividualServiceAsync.WithRawResponse by lazy { + IndividualServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun individuals(): IndividualServiceAsync.WithRawResponse = individuals + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: HrisBenefitCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("employer", "benefits") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun retrieve( + params: HrisBenefitRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "benefits", params.getPathParam(0)) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - .let { - HrisBenefitListSupportedBenefitsPageAsync.of( - this, - params, - HrisBenefitListSupportedBenefitsPageAsync.Response.builder() - .items(it) - .build(), - ) + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun update( + params: HrisBenefitUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("employer", "benefits", params.getPathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: HrisBenefitListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "benefits") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + .let { + HrisBenefitListPageAsync.of( + BenefitServiceAsyncImpl(clientOptions), + params, + HrisBenefitListPageAsync.Response.builder().items(it).build(), + ) + } + } + } + } + + private val listSupportedBenefitsHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun listSupportedBenefits( + params: HrisBenefitListSupportedBenefitsParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "benefits", "meta") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { listSupportedBenefitsHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + .let { + HrisBenefitListSupportedBenefitsPageAsync.of( + BenefitServiceAsyncImpl(clientOptions), + params, + HrisBenefitListSupportedBenefitsPageAsync.Response.builder() + .items(it) + .build(), + ) + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt index aaee4fc4..73fe1bc4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt @@ -4,13 +4,20 @@ package com.tryfinch.api.services.async.hris +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.Company import com.tryfinch.api.models.HrisCompanyRetrieveParams import java.util.concurrent.CompletableFuture interface CompanyServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Read basic company data */ @JvmOverloads fun retrieve( @@ -21,4 +28,29 @@ interface CompanyServiceAsync { /** Read basic company data */ fun retrieve(requestOptions: RequestOptions): CompletableFuture = retrieve(HrisCompanyRetrieveParams.none(), requestOptions) + + /** + * A view of [CompanyServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /employer/company`, but is otherwise the same as + * [CompanyServiceAsync.retrieve]. + */ + @JvmOverloads + @MustBeClosed + fun retrieve( + params: HrisCompanyRetrieveParams = HrisCompanyRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /employer/company`, but is otherwise the same as + * [CompanyServiceAsync.retrieve]. + */ + @MustBeClosed + fun retrieve(requestOptions: RequestOptions): CompletableFuture> = + retrieve(HrisCompanyRetrieveParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt index cb13462e..73b3e72f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.Company @@ -19,33 +21,51 @@ import java.util.concurrent.CompletableFuture class CompanyServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : CompanyServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: CompanyServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): CompanyServiceAsync.WithRawResponse = withRawResponse - /** Read basic company data */ override fun retrieve( params: HrisCompanyRetrieveParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "company") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompletableFuture = + // get /employer/company + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + CompanyServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun retrieve( + params: HrisCompanyRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "company") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsync.kt index 01ae6ff8..e409643d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsync.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.async.hris +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.HrisDirectoryListIndividualsPageAsync import com.tryfinch.api.models.HrisDirectoryListIndividualsParams import com.tryfinch.api.models.HrisDirectoryListPageAsync @@ -13,6 +15,11 @@ import java.util.concurrent.CompletableFuture interface DirectoryServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Read company directory and organization structure */ @JvmOverloads fun list( @@ -38,4 +45,54 @@ interface DirectoryServiceAsync { requestOptions: RequestOptions ): CompletableFuture = listIndividuals(HrisDirectoryListIndividualsParams.none(), requestOptions) + + /** + * A view of [DirectoryServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /employer/directory`, but is otherwise the same as + * [DirectoryServiceAsync.list]. + */ + @JvmOverloads + @MustBeClosed + fun list( + params: HrisDirectoryListParams = HrisDirectoryListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /employer/directory`, but is otherwise the same as + * [DirectoryServiceAsync.list]. + */ + @MustBeClosed + fun list( + requestOptions: RequestOptions + ): CompletableFuture> = + list(HrisDirectoryListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /employer/directory`, but is otherwise the same as + * [DirectoryServiceAsync.listIndividuals]. + */ + @Deprecated("use `list` instead") + @JvmOverloads + @MustBeClosed + fun listIndividuals( + params: HrisDirectoryListIndividualsParams = HrisDirectoryListIndividualsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /employer/directory`, but is otherwise the same as + * [DirectoryServiceAsync.listIndividuals]. + */ + @Deprecated("use `list` instead") + @MustBeClosed + fun listIndividuals( + requestOptions: RequestOptions + ): CompletableFuture> = + listIndividuals(HrisDirectoryListIndividualsParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt index 5b80c3c3..979b49f7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisDirectoryListIndividualsPageAsync @@ -21,66 +23,104 @@ import java.util.concurrent.CompletableFuture class DirectoryServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : DirectoryServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: DirectoryServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): DirectoryServiceAsync.WithRawResponse = withRawResponse - /** Read company directory and organization structure */ override fun list( params: HrisDirectoryListParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "directory") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - .let { HrisDirectoryListPageAsync.of(this, params, it) } - } - } + ): CompletableFuture = + // get /employer/directory + withRawResponse().list(params, requestOptions).thenApply { it.parse() } - private val listIndividualsHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Read company directory and organization structure */ - @Deprecated("use `list` instead") override fun listIndividuals( params: HrisDirectoryListIndividualsParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "directory") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { listIndividualsHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompletableFuture = + // get /employer/directory + withRawResponse().listIndividuals(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + DirectoryServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: HrisDirectoryListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "directory") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + HrisDirectoryListPageAsync.of( + DirectoryServiceAsyncImpl(clientOptions), + params, + it, + ) + } + } + } + } + + private val listIndividualsHandler: + Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun listIndividuals( + params: HrisDirectoryListIndividualsParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "directory") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { listIndividualsHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + HrisDirectoryListIndividualsPageAsync.of( + DirectoryServiceAsyncImpl(clientOptions), + params, + it, + ) + } } - .let { HrisDirectoryListIndividualsPageAsync.of(this, params, it) } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsync.kt index 59291b23..67b9bb33 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsync.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.async.hris +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.DocumentListResponse import com.tryfinch.api.models.DocumentRetreiveResponse import com.tryfinch.api.models.HrisDocumentListParams @@ -13,6 +15,11 @@ import java.util.concurrent.CompletableFuture interface DocumentServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** * **Beta:** This endpoint is in beta and may change. Retrieve a list of company-wide documents. */ @@ -37,4 +44,42 @@ interface DocumentServiceAsync { params: HrisDocumentRetreiveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [DocumentServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /employer/documents`, but is otherwise the same as + * [DocumentServiceAsync.list]. + */ + @JvmOverloads + @MustBeClosed + fun list( + params: HrisDocumentListParams = HrisDocumentListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /employer/documents`, but is otherwise the same as + * [DocumentServiceAsync.list]. + */ + @MustBeClosed + fun list( + requestOptions: RequestOptions + ): CompletableFuture> = + list(HrisDocumentListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /employer/documents/{document_id}`, but is otherwise + * the same as [DocumentServiceAsync.retreive]. + */ + @JvmOverloads + @MustBeClosed + fun retreive( + params: HrisDocumentRetreiveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt index 63046e4a..87873f13 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.DocumentListResponse @@ -21,67 +23,89 @@ import java.util.concurrent.CompletableFuture class DocumentServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : DocumentServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: DocumentServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): DocumentServiceAsync.WithRawResponse = withRawResponse - /** - * **Beta:** This endpoint is in beta and may change. Retrieve a list of company-wide documents. - */ override fun list( params: HrisDocumentListParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "documents") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } + ): CompletableFuture = + // get /employer/documents + withRawResponse().list(params, requestOptions).thenApply { it.parse() } - private val retreiveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** - * **Beta:** This endpoint is in beta and may change. Retrieve details of a specific document by - * its ID. - */ override fun retreive( params: HrisDocumentRetreiveParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "documents", params.getPathParam(0)) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { retreiveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompletableFuture = + // get /employer/documents/{document_id} + withRawResponse().retreive(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + DocumentServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: HrisDocumentListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "documents") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val retreiveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retreive( + params: HrisDocumentRetreiveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "documents", params.getPathParam(0)) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { retreiveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsync.kt index d12c27bc..e9efd10e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsync.kt @@ -4,17 +4,42 @@ package com.tryfinch.api.services.async.hris +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.HrisEmploymentRetrieveManyPageAsync import com.tryfinch.api.models.HrisEmploymentRetrieveManyParams import java.util.concurrent.CompletableFuture interface EmploymentServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Read individual employment and income data */ @JvmOverloads fun retrieveMany( params: HrisEmploymentRetrieveManyParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [EmploymentServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /employer/employment`, but is otherwise the same as + * [EmploymentServiceAsync.retrieveMany]. + */ + @JvmOverloads + @MustBeClosed + fun retrieveMany( + params: HrisEmploymentRetrieveManyParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt index 011d0b08..d8d52232 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError @@ -20,36 +22,60 @@ import java.util.concurrent.CompletableFuture class EmploymentServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : EmploymentServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: EmploymentServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val retrieveManyHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): EmploymentServiceAsync.WithRawResponse = withRawResponse - /** Read individual employment and income data */ override fun retrieveMany( params: HrisEmploymentRetrieveManyParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("employer", "employment") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { retrieveManyHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompletableFuture = + // post /employer/employment + withRawResponse().retrieveMany(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + EmploymentServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val retrieveManyHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieveMany( + params: HrisEmploymentRetrieveManyParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("employer", "employment") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { retrieveManyHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + HrisEmploymentRetrieveManyPageAsync.of( + EmploymentServiceAsyncImpl(clientOptions), + params, + it, + ) + } } - .let { HrisEmploymentRetrieveManyPageAsync.of(this, params, it) } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt index c1e2218e..305edae8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt @@ -4,13 +4,20 @@ package com.tryfinch.api.services.async.hris +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.HrisIndividualRetrieveManyPageAsync import com.tryfinch.api.models.HrisIndividualRetrieveManyParams import java.util.concurrent.CompletableFuture interface IndividualServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Read individual data, excluding income and employment data */ @JvmOverloads fun retrieveMany( @@ -23,4 +30,32 @@ interface IndividualServiceAsync { requestOptions: RequestOptions ): CompletableFuture = retrieveMany(HrisIndividualRetrieveManyParams.none(), requestOptions) + + /** + * A view of [IndividualServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /employer/individual`, but is otherwise the same as + * [IndividualServiceAsync.retrieveMany]. + */ + @JvmOverloads + @MustBeClosed + fun retrieveMany( + params: HrisIndividualRetrieveManyParams = HrisIndividualRetrieveManyParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `post /employer/individual`, but is otherwise the same as + * [IndividualServiceAsync.retrieveMany]. + */ + @MustBeClosed + fun retrieveMany( + requestOptions: RequestOptions + ): CompletableFuture> = + retrieveMany(HrisIndividualRetrieveManyParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt index 93b6a39f..32e6cae6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError @@ -20,36 +22,60 @@ import java.util.concurrent.CompletableFuture class IndividualServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : IndividualServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: IndividualServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val retrieveManyHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): IndividualServiceAsync.WithRawResponse = withRawResponse - /** Read individual data, excluding income and employment data */ override fun retrieveMany( params: HrisIndividualRetrieveManyParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("employer", "individual") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { retrieveManyHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompletableFuture = + // post /employer/individual + withRawResponse().retrieveMany(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + IndividualServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val retrieveManyHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieveMany( + params: HrisIndividualRetrieveManyParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("employer", "individual") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { retrieveManyHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + HrisIndividualRetrieveManyPageAsync.of( + IndividualServiceAsyncImpl(clientOptions), + params, + it, + ) + } } - .let { HrisIndividualRetrieveManyPageAsync.of(this, params, it) } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsync.kt index 6cb4e5d8..eeaf46e2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsync.kt @@ -4,13 +4,20 @@ package com.tryfinch.api.services.async.hris +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.HrisPayStatementRetrieveManyPageAsync import com.tryfinch.api.models.HrisPayStatementRetrieveManyParams import java.util.concurrent.CompletableFuture interface PayStatementServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** * Read detailed pay statements for each individual. * @@ -21,4 +28,22 @@ interface PayStatementServiceAsync { params: HrisPayStatementRetrieveManyParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [PayStatementServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /employer/pay-statement`, but is otherwise the same + * as [PayStatementServiceAsync.retrieveMany]. + */ + @JvmOverloads + @MustBeClosed + fun retrieveMany( + params: HrisPayStatementRetrieveManyParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt index cc6aaf13..e5bcd39b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError @@ -20,40 +22,60 @@ import java.util.concurrent.CompletableFuture class PayStatementServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : PayStatementServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: PayStatementServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val retrieveManyHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): PayStatementServiceAsync.WithRawResponse = withRawResponse - /** - * Read detailed pay statements for each individual. - * - * Deduction and contribution types are supported by the payroll systems that supports Benefits. - */ override fun retrieveMany( params: HrisPayStatementRetrieveManyParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("employer", "pay-statement") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { retrieveManyHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompletableFuture = + // post /employer/pay-statement + withRawResponse().retrieveMany(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + PayStatementServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val retrieveManyHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieveMany( + params: HrisPayStatementRetrieveManyParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("employer", "pay-statement") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { retrieveManyHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + HrisPayStatementRetrieveManyPageAsync.of( + PayStatementServiceAsyncImpl(clientOptions), + params, + it, + ) + } } - .let { HrisPayStatementRetrieveManyPageAsync.of(this, params, it) } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsync.kt index 98dee989..fb8e00b1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsync.kt @@ -4,17 +4,41 @@ package com.tryfinch.api.services.async.hris +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.HrisPaymentListPageAsync import com.tryfinch.api.models.HrisPaymentListParams import java.util.concurrent.CompletableFuture interface PaymentServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Read payroll and contractor related payments by the company. */ @JvmOverloads fun list( params: HrisPaymentListParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [PaymentServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /employer/payment`, but is otherwise the same as + * [PaymentServiceAsync.list]. + */ + @JvmOverloads + @MustBeClosed + fun list( + params: HrisPaymentListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt index c6d41215..6e624d47 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisPaymentListPageAsync @@ -20,40 +22,58 @@ import java.util.concurrent.CompletableFuture class PaymentServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : PaymentServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: PaymentServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val listHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): PaymentServiceAsync.WithRawResponse = withRawResponse - /** Read payroll and contractor related payments by the company. */ override fun list( params: HrisPaymentListParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "payment") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.forEach { it.validate() } - } - } - .let { - HrisPaymentListPageAsync.of( - this, - params, - HrisPaymentListPageAsync.Response.builder().items(it).build(), - ) + ): CompletableFuture = + // get /employer/payment + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + PaymentServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun list( + params: HrisPaymentListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "payment") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + .let { + HrisPaymentListPageAsync.of( + PaymentServiceAsyncImpl(clientOptions), + params, + HrisPaymentListPageAsync.Response.builder().items(it).build(), + ) + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsync.kt index 62575fe9..b9b32319 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsync.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.async.hris.benefits +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.HrisBenefitIndividualEnrolledIdsParams import com.tryfinch.api.models.HrisBenefitIndividualRetrieveManyBenefitsPageAsync import com.tryfinch.api.models.HrisBenefitIndividualRetrieveManyBenefitsParams @@ -15,6 +17,11 @@ import java.util.concurrent.CompletableFuture interface IndividualServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Lists individuals currently enrolled in a given deduction. */ @JvmOverloads fun enrolledIds( @@ -35,4 +42,44 @@ interface IndividualServiceAsync { params: HrisBenefitIndividualUnenrollManyParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [IndividualServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /employer/benefits/{benefit_id}/enrolled`, but is + * otherwise the same as [IndividualServiceAsync.enrolledIds]. + */ + @JvmOverloads + @MustBeClosed + fun enrolledIds( + params: HrisBenefitIndividualEnrolledIdsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /employer/benefits/{benefit_id}/individuals`, but is + * otherwise the same as [IndividualServiceAsync.retrieveManyBenefits]. + */ + @JvmOverloads + @MustBeClosed + fun retrieveManyBenefits( + params: HrisBenefitIndividualRetrieveManyBenefitsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `delete /employer/benefits/{benefit_id}/individuals`, but + * is otherwise the same as [IndividualServiceAsync.unenrollMany]. + */ + @JvmOverloads + @MustBeClosed + fun unenrollMany( + params: HrisBenefitIndividualUnenrollManyParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt index 2b171804..51ae2666 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError @@ -26,111 +28,146 @@ import java.util.concurrent.CompletableFuture class IndividualServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : IndividualServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: IndividualServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val enrolledIdsHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): IndividualServiceAsync.WithRawResponse = withRawResponse - /** Lists individuals currently enrolled in a given deduction. */ override fun enrolledIds( params: HrisBenefitIndividualEnrolledIdsParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "benefits", params.getPathParam(0), "enrolled") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { enrolledIdsHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } + ): CompletableFuture = + // get /employer/benefits/{benefit_id}/enrolled + withRawResponse().enrolledIds(params, requestOptions).thenApply { it.parse() } - private val retrieveManyBenefitsHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Get enrollment information for the given individuals. */ override fun retrieveManyBenefits( params: HrisBenefitIndividualRetrieveManyBenefitsParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "benefits", params.getPathParam(0), "individuals") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { retrieveManyBenefitsHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.forEach { it.validate() } - } - } - .let { - HrisBenefitIndividualRetrieveManyBenefitsPageAsync.of( - this, - params, - HrisBenefitIndividualRetrieveManyBenefitsPageAsync.Response.builder() - .items(it) - .build(), - ) - } - } - } + ): CompletableFuture = + // get /employer/benefits/{benefit_id}/individuals + withRawResponse().retrieveManyBenefits(params, requestOptions).thenApply { it.parse() } - private val unenrollManyHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Unenroll individuals from a deduction or contribution */ override fun unenrollMany( params: HrisBenefitIndividualUnenrollManyParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.DELETE) - .addPathSegments("employer", "benefits", params.getPathParam(0), "individuals") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { unenrollManyHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.forEach { it.validate() } - } + ): CompletableFuture = + // delete /employer/benefits/{benefit_id}/individuals + withRawResponse().unenrollMany(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + IndividualServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val enrolledIdsHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun enrolledIds( + params: HrisBenefitIndividualEnrolledIdsParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "benefits", params.getPathParam(0), "enrolled") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { enrolledIdsHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val retrieveManyBenefitsHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieveManyBenefits( + params: HrisBenefitIndividualRetrieveManyBenefitsParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "benefits", params.getPathParam(0), "individuals") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { retrieveManyBenefitsHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + .let { + HrisBenefitIndividualRetrieveManyBenefitsPageAsync.of( + IndividualServiceAsyncImpl(clientOptions), + params, + HrisBenefitIndividualRetrieveManyBenefitsPageAsync.Response + .builder() + .items(it) + .build(), + ) + } } - .let { - HrisBenefitIndividualUnenrollManyPageAsync.of( - this, - params, - HrisBenefitIndividualUnenrollManyPageAsync.Response.builder() - .items(it) - .build(), - ) + } + } + + private val unenrollManyHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun unenrollMany( + params: HrisBenefitIndividualUnenrollManyParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .addPathSegments("employer", "benefits", params.getPathParam(0), "individuals") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { unenrollManyHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + .let { + HrisBenefitIndividualUnenrollManyPageAsync.of( + IndividualServiceAsyncImpl(clientOptions), + params, + HrisBenefitIndividualUnenrollManyPageAsync.Response.builder() + .items(it) + .build(), + ) + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsync.kt index 3d03563b..0638cb5d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsync.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.async.jobs +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.AutomatedAsyncJob import com.tryfinch.api.models.AutomatedCreateResponse import com.tryfinch.api.models.JobAutomatedCreateParams @@ -15,6 +17,11 @@ import java.util.concurrent.CompletableFuture interface AutomatedServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** * Enqueue an automated job. * @@ -79,4 +86,63 @@ interface AutomatedServiceAsync { */ fun list(requestOptions: RequestOptions): CompletableFuture = list(JobAutomatedListParams.none(), requestOptions) + + /** + * A view of [AutomatedServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /jobs/automated`, but is otherwise the same as + * [AutomatedServiceAsync.create]. + */ + @JvmOverloads + @MustBeClosed + fun create( + params: JobAutomatedCreateParams = JobAutomatedCreateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `post /jobs/automated`, but is otherwise the same as + * [AutomatedServiceAsync.create]. + */ + @MustBeClosed + fun create( + requestOptions: RequestOptions + ): CompletableFuture> = + create(JobAutomatedCreateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /jobs/automated/{job_id}`, but is otherwise the same + * as [AutomatedServiceAsync.retrieve]. + */ + @JvmOverloads + @MustBeClosed + fun retrieve( + params: JobAutomatedRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /jobs/automated`, but is otherwise the same as + * [AutomatedServiceAsync.list]. + */ + @JvmOverloads + @MustBeClosed + fun list( + params: JobAutomatedListParams = JobAutomatedListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /jobs/automated`, but is otherwise the same as + * [AutomatedServiceAsync.list]. + */ + @MustBeClosed + fun list( + requestOptions: RequestOptions + ): CompletableFuture> = + list(JobAutomatedListParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt index 7cc0db63..2f0e9752 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError @@ -24,111 +26,133 @@ import java.util.concurrent.CompletableFuture class AutomatedServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : AutomatedServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** - * Enqueue an automated job. - * - * `data_sync_all`: Enqueue a job to re-sync all data for a connection. `data_sync_all` has a - * concurrency limit of 1 job at a time per connection. This means that if this endpoint is - * called while a job is already in progress for this connection, Finch will return the `job_id` - * of the job that is currently in progress. Finch allows a fixed window rate limit of 1 forced - * refresh per hour per connection. - * - * `w4_form_employee_sync`: Enqueues a job for sync W-4 data for a particular individual, - * identified by `individual_id`. This feature is currently in beta. - * - * This endpoint is available for _Scale_ tier customers as an add-on. To request access to this - * endpoint, please contact your Finch account manager. - */ + private val withRawResponse: AutomatedServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): AutomatedServiceAsync.WithRawResponse = withRawResponse + override fun create( params: JobAutomatedCreateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("jobs", "automated") - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } + ): CompletableFuture = + // post /jobs/automated + withRawResponse().create(params, requestOptions).thenApply { it.parse() } - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** Get an automated job by `job_id`. */ override fun retrieve( params: JobAutomatedRetrieveParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("jobs", "automated", params.getPathParam(0)) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } + ): CompletableFuture = + // get /jobs/automated/{job_id} + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** - * Get all automated jobs. Automated jobs are completed by a machine. By default, jobs are - * sorted in descending order by submission time. For scheduled jobs such as data syncs, only - * the next scheduled job is shown. - */ override fun list( params: JobAutomatedListParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("jobs", "automated") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompletableFuture = + // get /jobs/automated + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + AutomatedServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: JobAutomatedCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("jobs", "automated") + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun retrieve( + params: JobAutomatedRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("jobs", "automated", params.getPathParam(0)) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: JobAutomatedListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("jobs", "automated") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + JobAutomatedListPageAsync.of( + AutomatedServiceAsyncImpl(clientOptions), + params, + it, + ) + } } - .let { JobAutomatedListPageAsync.of(this, params, it) } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsync.kt index b3b9e674..172baec1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsync.kt @@ -4,13 +4,20 @@ package com.tryfinch.api.services.async.jobs +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.JobManualRetrieveParams import com.tryfinch.api.models.ManualAsyncJob import java.util.concurrent.CompletableFuture interface ManualServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** * Get a manual job by `job_id`. Manual jobs are completed by a human and include Assisted * Benefits jobs. @@ -20,4 +27,21 @@ interface ManualServiceAsync { params: JobManualRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [ManualServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /jobs/manual/{job_id}`, but is otherwise the same as + * [ManualServiceAsync.retrieve]. + */ + @JvmOverloads + @MustBeClosed + fun retrieve( + params: JobManualRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt index 41fc8512..4669943c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.JobManualRetrieveParams @@ -19,36 +21,51 @@ import java.util.concurrent.CompletableFuture class ManualServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : ManualServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: ManualServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): ManualServiceAsync.WithRawResponse = withRawResponse - /** - * Get a manual job by `job_id`. Manual jobs are completed by a human and include Assisted - * Benefits jobs. - */ override fun retrieve( params: JobManualRetrieveParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("jobs", "manual", params.getPathParam(0)) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompletableFuture = + // get /jobs/manual/{job_id} + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + ManualServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun retrieve( + params: JobManualRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("jobs", "manual", params.getPathParam(0)) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsync.kt index bc144858..1a955daa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsync.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.async.payroll +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.PayGroupRetrieveResponse import com.tryfinch.api.models.PayrollPayGroupListPageAsync import com.tryfinch.api.models.PayrollPayGroupListParams @@ -13,6 +15,11 @@ import java.util.concurrent.CompletableFuture interface PayGroupServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Read information from a single pay group */ @JvmOverloads fun retrieve( @@ -30,4 +37,42 @@ interface PayGroupServiceAsync { /** Read company pay groups and frequencies */ fun list(requestOptions: RequestOptions): CompletableFuture = list(PayrollPayGroupListParams.none(), requestOptions) + + /** + * A view of [PayGroupServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /employer/pay-groups/{pay_group_id}`, but is + * otherwise the same as [PayGroupServiceAsync.retrieve]. + */ + @JvmOverloads + @MustBeClosed + fun retrieve( + params: PayrollPayGroupRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /employer/pay-groups`, but is otherwise the same as + * [PayGroupServiceAsync.list]. + */ + @JvmOverloads + @MustBeClosed + fun list( + params: PayrollPayGroupListParams = PayrollPayGroupListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /employer/pay-groups`, but is otherwise the same as + * [PayGroupServiceAsync.list]. + */ + @MustBeClosed + fun list( + requestOptions: RequestOptions + ): CompletableFuture> = + list(PayrollPayGroupListParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt index 0ad0ec0c..7df11930 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.PayGroupListResponse @@ -22,70 +24,98 @@ import java.util.concurrent.CompletableFuture class PayGroupServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : PayGroupServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: PayGroupServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): PayGroupServiceAsync.WithRawResponse = withRawResponse - /** Read information from a single pay group */ override fun retrieve( params: PayrollPayGroupRetrieveParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "pay-groups", params.getPathParam(0)) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } + ): CompletableFuture = + // get /employer/pay-groups/{pay_group_id} + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } - private val listHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Read company pay groups and frequencies */ override fun list( params: PayrollPayGroupListParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "pay-groups") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.forEach { it.validate() } - } + ): CompletableFuture = + // get /employer/pay-groups + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + PayGroupServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieve( + params: PayrollPayGroupRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "pay-groups", params.getPathParam(0)) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - .let { - PayrollPayGroupListPageAsync.of( - this, - params, - PayrollPayGroupListPageAsync.Response.builder().items(it).build(), - ) + } + } + + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: PayrollPayGroupListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "pay-groups") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + .let { + PayrollPayGroupListPageAsync.of( + PayGroupServiceAsyncImpl(clientOptions), + params, + PayrollPayGroupListPageAsync.Response.builder() + .items(it) + .build(), + ) + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsync.kt index 09dc9208..8e415cc1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsync.kt @@ -4,17 +4,41 @@ package com.tryfinch.api.services.async.sandbox +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.CompanyUpdateResponse import com.tryfinch.api.models.SandboxCompanyUpdateParams import java.util.concurrent.CompletableFuture interface CompanyServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Update a sandbox company's data */ @JvmOverloads fun update( params: SandboxCompanyUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [CompanyServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `put /sandbox/company`, but is otherwise the same as + * [CompanyServiceAsync.update]. + */ + @JvmOverloads + @MustBeClosed + fun update( + params: SandboxCompanyUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt index 50a32b37..3d38f445 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError @@ -20,34 +22,53 @@ import java.util.concurrent.CompletableFuture class CompanyServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : CompanyServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: CompanyServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): CompanyServiceAsync.WithRawResponse = withRawResponse - /** Update a sandbox company's data */ override fun update( params: SandboxCompanyUpdateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.PUT) - .addPathSegments("sandbox", "company") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompletableFuture = + // put /sandbox/company + withRawResponse().update(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + CompanyServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun update( + params: SandboxCompanyUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("sandbox", "company") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsync.kt index 02284513..f899f084 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsync.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.async.sandbox +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.ConnectionCreateResponse import com.tryfinch.api.models.SandboxConnectionCreateParams import com.tryfinch.api.services.async.sandbox.connections.AccountServiceAsync @@ -12,6 +14,11 @@ import java.util.concurrent.CompletableFuture interface ConnectionServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun accounts(): AccountServiceAsync /** Create a new connection (new company/provider pair) with a new account */ @@ -20,4 +27,24 @@ interface ConnectionServiceAsync { params: SandboxConnectionCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [ConnectionServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + fun accounts(): AccountServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post /sandbox/connections`, but is otherwise the same as + * [ConnectionServiceAsync.create]. + */ + @JvmOverloads + @MustBeClosed + fun create( + params: SandboxConnectionCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt index dfc9fea5..c4491a8e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError @@ -22,39 +24,63 @@ import java.util.concurrent.CompletableFuture class ConnectionServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : ConnectionServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: ConnectionServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } private val accounts: AccountServiceAsync by lazy { AccountServiceAsyncImpl(clientOptions) } - override fun accounts(): AccountServiceAsync = accounts + override fun withRawResponse(): ConnectionServiceAsync.WithRawResponse = withRawResponse - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun accounts(): AccountServiceAsync = accounts - /** Create a new connection (new company/provider pair) with a new account */ override fun create( params: SandboxConnectionCreateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("sandbox", "connections") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompletableFuture = + // post /sandbox/connections + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + ConnectionServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val accounts: AccountServiceAsync.WithRawResponse by lazy { + AccountServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun accounts(): AccountServiceAsync.WithRawResponse = accounts + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: SandboxConnectionCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("sandbox", "connections") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt index 8155d37a..8bc5dc1c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt @@ -4,13 +4,20 @@ package com.tryfinch.api.services.async.sandbox +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.SandboxDirectoryCreateParams import java.util.concurrent.CompletableFuture interface DirectoryServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Add new individuals to a sandbox company */ @JvmOverloads fun create( @@ -21,4 +28,31 @@ interface DirectoryServiceAsync { /** Add new individuals to a sandbox company */ fun create(requestOptions: RequestOptions): CompletableFuture> = create(SandboxDirectoryCreateParams.none(), requestOptions) + + /** + * A view of [DirectoryServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /sandbox/directory`, but is otherwise the same as + * [DirectoryServiceAsync.create]. + */ + @JvmOverloads + @MustBeClosed + fun create( + params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture>> + + /** + * Returns a raw HTTP response for `post /sandbox/directory`, but is otherwise the same as + * [DirectoryServiceAsync.create]. + */ + @MustBeClosed + fun create( + requestOptions: RequestOptions + ): CompletableFuture>> = + create(SandboxDirectoryCreateParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt index 5c545f53..1cfba40e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt @@ -11,6 +11,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError @@ -20,26 +22,44 @@ import java.util.concurrent.CompletableFuture class DirectoryServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : DirectoryServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: DirectoryServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val createHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): DirectoryServiceAsync.WithRawResponse = withRawResponse - /** Add new individuals to a sandbox company */ override fun create( params: SandboxDirectoryCreateParams, requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("sandbox", "directory") - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> response.use { createHandler.handle(it) } } + ): CompletableFuture> = + // post /sandbox/directory + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + DirectoryServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun create( + params: SandboxDirectoryCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture>> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("sandbox", "directory") + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { response.use { createHandler.handle(it) } } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsync.kt index 00219b33..d77a28d2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsync.kt @@ -4,17 +4,42 @@ package com.tryfinch.api.services.async.sandbox +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.EmploymentUpdateResponse import com.tryfinch.api.models.SandboxEmploymentUpdateParams import java.util.concurrent.CompletableFuture interface EmploymentServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Update sandbox employment */ @JvmOverloads fun update( params: SandboxEmploymentUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [EmploymentServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `put /sandbox/employment/{individual_id}`, but is + * otherwise the same as [EmploymentServiceAsync.update]. + */ + @JvmOverloads + @MustBeClosed + fun update( + params: SandboxEmploymentUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt index ce5d3fb9..6bca07b9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError @@ -20,35 +22,53 @@ import java.util.concurrent.CompletableFuture class EmploymentServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : EmploymentServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: EmploymentServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): EmploymentServiceAsync.WithRawResponse = withRawResponse - /** Update sandbox employment */ override fun update( params: SandboxEmploymentUpdateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.PUT) - .addPathSegments("sandbox", "employment", params.getPathParam(0)) - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompletableFuture = + // put /sandbox/employment/{individual_id} + withRawResponse().update(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + EmploymentServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun update( + params: SandboxEmploymentUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("sandbox", "employment", params.getPathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsync.kt index 81695b1c..39a7b71d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsync.kt @@ -4,17 +4,42 @@ package com.tryfinch.api.services.async.sandbox +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.IndividualUpdateResponse import com.tryfinch.api.models.SandboxIndividualUpdateParams import java.util.concurrent.CompletableFuture interface IndividualServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Update sandbox individual */ @JvmOverloads fun update( params: SandboxIndividualUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [IndividualServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `put /sandbox/individual/{individual_id}`, but is + * otherwise the same as [IndividualServiceAsync.update]. + */ + @JvmOverloads + @MustBeClosed + fun update( + params: SandboxIndividualUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt index 5c5316b0..fedf9674 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError @@ -20,35 +22,53 @@ import java.util.concurrent.CompletableFuture class IndividualServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : IndividualServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: IndividualServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): IndividualServiceAsync.WithRawResponse = withRawResponse - /** Update sandbox individual */ override fun update( params: SandboxIndividualUpdateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.PUT) - .addPathSegments("sandbox", "individual", params.getPathParam(0)) - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompletableFuture = + // put /sandbox/individual/{individual_id} + withRawResponse().update(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + IndividualServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun update( + params: SandboxIndividualUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("sandbox", "individual", params.getPathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsync.kt index 56612e5b..97bd0191 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsync.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.async.sandbox +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.JobCreateResponse import com.tryfinch.api.models.SandboxJobCreateParams import com.tryfinch.api.services.async.sandbox.jobs.ConfigurationServiceAsync @@ -12,6 +14,11 @@ import java.util.concurrent.CompletableFuture interface JobServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun configuration(): ConfigurationServiceAsync /** Enqueue a new sandbox job */ @@ -20,4 +27,21 @@ interface JobServiceAsync { params: SandboxJobCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** A view of [JobServiceAsync] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + fun configuration(): ConfigurationServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post /sandbox/jobs`, but is otherwise the same as + * [JobServiceAsync.create]. + */ + @JvmOverloads + @MustBeClosed + fun create( + params: SandboxJobCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt index 6536c2b5..e5c1d162 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError @@ -22,40 +24,64 @@ import java.util.concurrent.CompletableFuture class JobServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : JobServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: JobServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } private val configuration: ConfigurationServiceAsync by lazy { ConfigurationServiceAsyncImpl(clientOptions) } - override fun configuration(): ConfigurationServiceAsync = configuration + override fun withRawResponse(): JobServiceAsync.WithRawResponse = withRawResponse - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun configuration(): ConfigurationServiceAsync = configuration - /** Enqueue a new sandbox job */ override fun create( params: SandboxJobCreateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("sandbox", "jobs") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompletableFuture = + // post /sandbox/jobs + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + JobServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val configuration: ConfigurationServiceAsync.WithRawResponse by lazy { + ConfigurationServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun configuration(): ConfigurationServiceAsync.WithRawResponse = configuration + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun create( + params: SandboxJobCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("sandbox", "jobs") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsync.kt index efd8f707..6f92bca6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsync.kt @@ -4,13 +4,20 @@ package com.tryfinch.api.services.async.sandbox +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.PaymentCreateResponse import com.tryfinch.api.models.SandboxPaymentCreateParams import java.util.concurrent.CompletableFuture interface PaymentServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Add a new sandbox payment */ @JvmOverloads fun create( @@ -21,4 +28,31 @@ interface PaymentServiceAsync { /** Add a new sandbox payment */ fun create(requestOptions: RequestOptions): CompletableFuture = create(SandboxPaymentCreateParams.none(), requestOptions) + + /** + * A view of [PaymentServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /sandbox/payment`, but is otherwise the same as + * [PaymentServiceAsync.create]. + */ + @JvmOverloads + @MustBeClosed + fun create( + params: SandboxPaymentCreateParams = SandboxPaymentCreateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `post /sandbox/payment`, but is otherwise the same as + * [PaymentServiceAsync.create]. + */ + @MustBeClosed + fun create( + requestOptions: RequestOptions + ): CompletableFuture> = + create(SandboxPaymentCreateParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt index 59bf38ed..d3fdc07c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError @@ -20,34 +22,53 @@ import java.util.concurrent.CompletableFuture class PaymentServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : PaymentServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: PaymentServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): PaymentServiceAsync.WithRawResponse = withRawResponse - /** Add a new sandbox payment */ override fun create( params: SandboxPaymentCreateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("sandbox", "payment") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompletableFuture = + // post /sandbox/payment + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + PaymentServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: SandboxPaymentCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("sandbox", "payment") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsync.kt index ff94d659..96ad2913 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsync.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.async.sandbox.connections +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.AccountCreateResponse import com.tryfinch.api.models.AccountUpdateResponse import com.tryfinch.api.models.SandboxConnectionAccountCreateParams @@ -13,6 +15,11 @@ import java.util.concurrent.CompletableFuture interface AccountServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Create a new account for an existing connection (company/provider pair) */ @JvmOverloads fun create( @@ -36,4 +43,43 @@ interface AccountServiceAsync { */ fun update(requestOptions: RequestOptions): CompletableFuture = update(SandboxConnectionAccountUpdateParams.none(), requestOptions) + + /** + * A view of [AccountServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /sandbox/connections/accounts`, but is otherwise + * the same as [AccountServiceAsync.create]. + */ + @JvmOverloads + @MustBeClosed + fun create( + params: SandboxConnectionAccountCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `put /sandbox/connections/accounts`, but is otherwise the + * same as [AccountServiceAsync.update]. + */ + @JvmOverloads + @MustBeClosed + fun update( + params: SandboxConnectionAccountUpdateParams = + SandboxConnectionAccountUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `put /sandbox/connections/accounts`, but is otherwise the + * same as [AccountServiceAsync.update]. + */ + @MustBeClosed + fun update( + requestOptions: RequestOptions + ): CompletableFuture> = + update(SandboxConnectionAccountUpdateParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt index 7a9df3e0..0267b549 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError @@ -22,66 +24,91 @@ import java.util.concurrent.CompletableFuture class AccountServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : AccountServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: AccountServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): AccountServiceAsync.WithRawResponse = withRawResponse - /** Create a new account for an existing connection (company/provider pair) */ override fun create( params: SandboxConnectionAccountCreateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("sandbox", "connections", "accounts") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } + ): CompletableFuture = + // post /sandbox/connections/accounts + withRawResponse().create(params, requestOptions).thenApply { it.parse() } - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** - * Update an existing sandbox account. Change the connection status to understand how the Finch - * API responds. - */ override fun update( params: SandboxConnectionAccountUpdateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.PUT) - .addPathSegments("sandbox", "connections", "accounts") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompletableFuture = + // put /sandbox/connections/accounts + withRawResponse().update(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + AccountServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: SandboxConnectionAccountCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("sandbox", "connections", "accounts") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun update( + params: SandboxConnectionAccountUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("sandbox", "connections", "accounts") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsync.kt index 89dd69a8..3e26990e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsync.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.async.sandbox.jobs +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.SandboxJobConfiguration import com.tryfinch.api.models.SandboxJobConfigurationRetrieveParams import com.tryfinch.api.models.SandboxJobConfigurationUpdateParams @@ -12,6 +14,11 @@ import java.util.concurrent.CompletableFuture interface ConfigurationServiceAsync { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Get configurations for sandbox jobs */ @JvmOverloads fun retrieve( @@ -30,4 +37,44 @@ interface ConfigurationServiceAsync { params: SandboxJobConfigurationUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * A view of [ConfigurationServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /sandbox/jobs/configuration`, but is otherwise the + * same as [ConfigurationServiceAsync.retrieve]. + */ + @JvmOverloads + @MustBeClosed + fun retrieve( + params: SandboxJobConfigurationRetrieveParams = + SandboxJobConfigurationRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture>> + + /** + * Returns a raw HTTP response for `get /sandbox/jobs/configuration`, but is otherwise the + * same as [ConfigurationServiceAsync.retrieve]. + */ + @MustBeClosed + fun retrieve( + requestOptions: RequestOptions + ): CompletableFuture>> = + retrieve(SandboxJobConfigurationRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `put /sandbox/jobs/configuration`, but is otherwise the + * same as [ConfigurationServiceAsync.update]. + */ + @JvmOverloads + @MustBeClosed + fun update( + params: SandboxJobConfigurationUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt index c91ec2d3..24031ec9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError @@ -21,64 +23,90 @@ import java.util.concurrent.CompletableFuture class ConfigurationServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : ConfigurationServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: ConfigurationServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val retrieveHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): ConfigurationServiceAsync.WithRawResponse = withRawResponse - /** Get configurations for sandbox jobs */ override fun retrieve( params: SandboxJobConfigurationRetrieveParams, requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("sandbox", "jobs", "configuration") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.forEach { it.validate() } - } - } - } - } + ): CompletableFuture> = + // get /sandbox/jobs/configuration + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Update configurations for sandbox jobs */ override fun update( params: SandboxJobConfigurationUpdateParams, requestOptions: RequestOptions, - ): CompletableFuture { - val request = - HttpRequest.builder() - .method(HttpMethod.PUT) - .addPathSegments("sandbox", "jobs", "configuration") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response - .use { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompletableFuture = + // put /sandbox/jobs/configuration + withRawResponse().update(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + ConfigurationServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val retrieveHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieve( + params: SandboxJobConfigurationRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture>> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("sandbox", "jobs", "configuration") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + } + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun update( + params: SandboxJobConfigurationUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("sandbox", "jobs", "configuration") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - } + } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenService.kt index 5eb189ed..f7129051 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenService.kt @@ -4,16 +4,40 @@ package com.tryfinch.api.services.blocking +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.AccessTokenCreateParams import com.tryfinch.api.models.CreateAccessTokenResponse interface AccessTokenService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Exchange the authorization code for an access token */ @JvmOverloads fun create( params: AccessTokenCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CreateAccessTokenResponse + + /** + * A view of [AccessTokenService] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /auth/token`, but is otherwise the same as + * [AccessTokenService.create]. + */ + @JvmOverloads + @MustBeClosed + fun create( + params: AccessTokenCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt index e99d3e9a..56d0e107 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError @@ -20,58 +22,76 @@ import com.tryfinch.api.models.CreateAccessTokenResponse class AccessTokenServiceImpl internal constructor(private val clientOptions: ClientOptions) : AccessTokenService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: AccessTokenService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): AccessTokenService.WithRawResponse = withRawResponse - /** Exchange the authorization code for an access token */ override fun create( params: AccessTokenCreateParams, requestOptions: RequestOptions, - ): CreateAccessTokenResponse { - val builder = params.toBuilder() + ): CreateAccessTokenResponse = + // post /auth/token + withRawResponse().create(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + AccessTokenService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - if (!params.clientSecret().isPresent) { - if (clientOptions.clientSecret == null || clientOptions.clientSecret.isEmpty()) { - throw FinchException( - "client_secret must be provided as an argument or with the FINCH_CLIENT_SECRET environment variable" - ) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: AccessTokenCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val builder = params.toBuilder() + + if (!params.clientSecret().isPresent) { + if (clientOptions.clientSecret == null || clientOptions.clientSecret.isEmpty()) { + throw FinchException( + "client_secret must be provided as an argument or with the FINCH_CLIENT_SECRET environment variable" + ) + } + builder.clientSecret(clientOptions.clientSecret) } - builder.clientSecret(clientOptions.clientSecret) - } - if (!params.clientId().isPresent) { - if (clientOptions.clientId == null || clientOptions.clientId.isEmpty()) { - throw FinchException( - "client_id must be provided as an argument or with the FINCH_CLIENT_ID environment variable" - ) + if (!params.clientId().isPresent) { + if (clientOptions.clientId == null || clientOptions.clientId.isEmpty()) { + throw FinchException( + "client_id must be provided as an argument or with the FINCH_CLIENT_ID environment variable" + ) + } + builder.clientId(clientOptions.clientId) } - builder.clientId(clientOptions.clientId) - } - val modifiedParams = builder.build() + val modifiedParams = builder.build() - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("auth", "token") - .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params._queryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params._headers()) - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("auth", "token") + .putAllQueryParams(clientOptions.queryParams) + .replaceAllQueryParams(params._queryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params._headers()) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountService.kt index fb69f10a..8fe2d5fe 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountService.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.blocking +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.AccountDisconnectParams import com.tryfinch.api.models.AccountIntrospectParams import com.tryfinch.api.models.DisconnectResponse @@ -12,6 +14,11 @@ import com.tryfinch.api.models.Introspection interface AccountService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Disconnect one or more `access_token`s from your application. */ @JvmOverloads fun disconnect( @@ -33,4 +40,46 @@ interface AccountService { /** Read account information associated with an `access_token` */ fun introspect(requestOptions: RequestOptions): Introspection = introspect(AccountIntrospectParams.none(), requestOptions) + + /** A view of [AccountService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /disconnect`, but is otherwise the same as + * [AccountService.disconnect]. + */ + @JvmOverloads + @MustBeClosed + fun disconnect( + params: AccountDisconnectParams = AccountDisconnectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `post /disconnect`, but is otherwise the same as + * [AccountService.disconnect]. + */ + @MustBeClosed + fun disconnect(requestOptions: RequestOptions): HttpResponseFor = + disconnect(AccountDisconnectParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /introspect`, but is otherwise the same as + * [AccountService.introspect]. + */ + @JvmOverloads + @MustBeClosed + fun introspect( + params: AccountIntrospectParams = AccountIntrospectParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /introspect`, but is otherwise the same as + * [AccountService.introspect]. + */ + @MustBeClosed + fun introspect(requestOptions: RequestOptions): HttpResponseFor = + introspect(AccountIntrospectParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt index c2b0c4ef..0009c8d3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError @@ -21,56 +23,82 @@ import com.tryfinch.api.models.Introspection class AccountServiceImpl internal constructor(private val clientOptions: ClientOptions) : AccountService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: AccountService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val disconnectHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): AccountService.WithRawResponse = withRawResponse - /** Disconnect one or more `access_token`s from your application. */ override fun disconnect( params: AccountDisconnectParams, requestOptions: RequestOptions, - ): DisconnectResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("disconnect") - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { disconnectHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } + ): DisconnectResponse = + // post /disconnect + withRawResponse().disconnect(params, requestOptions).parse() - private val introspectHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** Read account information associated with an `access_token` */ override fun introspect( params: AccountIntrospectParams, requestOptions: RequestOptions, - ): Introspection { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("introspect") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { introspectHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): Introspection = + // get /introspect + withRawResponse().introspect(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + AccountService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val disconnectHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun disconnect( + params: AccountDisconnectParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("disconnect") + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { disconnectHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val introspectHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun introspect( + params: AccountIntrospectParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("introspect") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { introspectHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ConnectService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ConnectService.kt index daddf9ae..5ac1c0d8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ConnectService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ConnectService.kt @@ -6,5 +6,16 @@ import com.tryfinch.api.services.blocking.connect.SessionService interface ConnectService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun sessions(): SessionService + + /** A view of [ConnectService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + fun sessions(): SessionService.WithRawResponse + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ConnectServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ConnectServiceImpl.kt index 52c64ab3..762f16c3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ConnectServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ConnectServiceImpl.kt @@ -9,7 +9,23 @@ import com.tryfinch.api.services.blocking.connect.SessionServiceImpl class ConnectServiceImpl internal constructor(private val clientOptions: ClientOptions) : ConnectService { + private val withRawResponse: ConnectService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + private val sessions: SessionService by lazy { SessionServiceImpl(clientOptions) } + override fun withRawResponse(): ConnectService.WithRawResponse = withRawResponse + override fun sessions(): SessionService = sessions + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + ConnectService.WithRawResponse { + + private val sessions: SessionService.WithRawResponse by lazy { + SessionServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun sessions(): SessionService.WithRawResponse = sessions + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/HrisService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/HrisService.kt index 5e993449..eae9dfe1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/HrisService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/HrisService.kt @@ -13,6 +13,11 @@ import com.tryfinch.api.services.blocking.hris.PaymentService interface HrisService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun company(): CompanyService fun directory(): DirectoryService @@ -28,4 +33,24 @@ interface HrisService { fun documents(): DocumentService fun benefits(): BenefitService + + /** A view of [HrisService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + fun company(): CompanyService.WithRawResponse + + fun directory(): DirectoryService.WithRawResponse + + fun individuals(): IndividualService.WithRawResponse + + fun employments(): EmploymentService.WithRawResponse + + fun payments(): PaymentService.WithRawResponse + + fun payStatements(): PayStatementService.WithRawResponse + + fun documents(): DocumentService.WithRawResponse + + fun benefits(): BenefitService.WithRawResponse + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/HrisServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/HrisServiceImpl.kt index 78b7de0a..15fd8b2e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/HrisServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/HrisServiceImpl.kt @@ -22,6 +22,10 @@ import com.tryfinch.api.services.blocking.hris.PaymentServiceImpl class HrisServiceImpl internal constructor(private val clientOptions: ClientOptions) : HrisService { + private val withRawResponse: HrisService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + private val company: CompanyService by lazy { CompanyServiceImpl(clientOptions) } private val directory: DirectoryService by lazy { DirectoryServiceImpl(clientOptions) } @@ -40,6 +44,8 @@ class HrisServiceImpl internal constructor(private val clientOptions: ClientOpti private val benefits: BenefitService by lazy { BenefitServiceImpl(clientOptions) } + override fun withRawResponse(): HrisService.WithRawResponse = withRawResponse + override fun company(): CompanyService = company override fun directory(): DirectoryService = directory @@ -55,4 +61,56 @@ class HrisServiceImpl internal constructor(private val clientOptions: ClientOpti override fun documents(): DocumentService = documents override fun benefits(): BenefitService = benefits + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + HrisService.WithRawResponse { + + private val company: CompanyService.WithRawResponse by lazy { + CompanyServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val directory: DirectoryService.WithRawResponse by lazy { + DirectoryServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val individuals: IndividualService.WithRawResponse by lazy { + IndividualServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val employments: EmploymentService.WithRawResponse by lazy { + EmploymentServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val payments: PaymentService.WithRawResponse by lazy { + PaymentServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val payStatements: PayStatementService.WithRawResponse by lazy { + PayStatementServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val documents: DocumentService.WithRawResponse by lazy { + DocumentServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val benefits: BenefitService.WithRawResponse by lazy { + BenefitServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun company(): CompanyService.WithRawResponse = company + + override fun directory(): DirectoryService.WithRawResponse = directory + + override fun individuals(): IndividualService.WithRawResponse = individuals + + override fun employments(): EmploymentService.WithRawResponse = employments + + override fun payments(): PaymentService.WithRawResponse = payments + + override fun payStatements(): PayStatementService.WithRawResponse = payStatements + + override fun documents(): DocumentService.WithRawResponse = documents + + override fun benefits(): BenefitService.WithRawResponse = benefits + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/JobService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/JobService.kt index 02568840..09461d9d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/JobService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/JobService.kt @@ -7,7 +7,20 @@ import com.tryfinch.api.services.blocking.jobs.ManualService interface JobService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun automated(): AutomatedService fun manual(): ManualService + + /** A view of [JobService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + fun automated(): AutomatedService.WithRawResponse + + fun manual(): ManualService.WithRawResponse + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/JobServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/JobServiceImpl.kt index 29bdd632..bd836478 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/JobServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/JobServiceImpl.kt @@ -10,11 +10,33 @@ import com.tryfinch.api.services.blocking.jobs.ManualServiceImpl class JobServiceImpl internal constructor(private val clientOptions: ClientOptions) : JobService { + private val withRawResponse: JobService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + private val automated: AutomatedService by lazy { AutomatedServiceImpl(clientOptions) } private val manual: ManualService by lazy { ManualServiceImpl(clientOptions) } + override fun withRawResponse(): JobService.WithRawResponse = withRawResponse + override fun automated(): AutomatedService = automated override fun manual(): ManualService = manual + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + JobService.WithRawResponse { + + private val automated: AutomatedService.WithRawResponse by lazy { + AutomatedServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val manual: ManualService.WithRawResponse by lazy { + ManualServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun automated(): AutomatedService.WithRawResponse = automated + + override fun manual(): ManualService.WithRawResponse = manual + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/PayrollService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/PayrollService.kt index 4bc0ad62..872b220a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/PayrollService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/PayrollService.kt @@ -6,5 +6,16 @@ import com.tryfinch.api.services.blocking.payroll.PayGroupService interface PayrollService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun payGroups(): PayGroupService + + /** A view of [PayrollService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + fun payGroups(): PayGroupService.WithRawResponse + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/PayrollServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/PayrollServiceImpl.kt index ca423f3d..f3e89397 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/PayrollServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/PayrollServiceImpl.kt @@ -9,7 +9,23 @@ import com.tryfinch.api.services.blocking.payroll.PayGroupServiceImpl class PayrollServiceImpl internal constructor(private val clientOptions: ClientOptions) : PayrollService { + private val withRawResponse: PayrollService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + private val payGroups: PayGroupService by lazy { PayGroupServiceImpl(clientOptions) } + override fun withRawResponse(): PayrollService.WithRawResponse = withRawResponse + override fun payGroups(): PayGroupService = payGroups + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + PayrollService.WithRawResponse { + + private val payGroups: PayGroupService.WithRawResponse by lazy { + PayGroupServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun payGroups(): PayGroupService.WithRawResponse = payGroups + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderService.kt index b37847a4..f30b29ef 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderService.kt @@ -4,12 +4,19 @@ package com.tryfinch.api.services.blocking +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.ProviderListPage import com.tryfinch.api.models.ProviderListParams interface ProviderService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Return details on all available payroll and HR systems. */ @JvmOverloads fun list( @@ -20,4 +27,27 @@ interface ProviderService { /** Return details on all available payroll and HR systems. */ fun list(requestOptions: RequestOptions): ProviderListPage = list(ProviderListParams.none(), requestOptions) + + /** A view of [ProviderService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /providers`, but is otherwise the same as + * [ProviderService.list]. + */ + @JvmOverloads + @MustBeClosed + fun list( + params: ProviderListParams = ProviderListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /providers`, but is otherwise the same as + * [ProviderService.list]. + */ + @MustBeClosed + fun list(requestOptions: RequestOptions): HttpResponseFor = + list(ProviderListParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt index d21a5a0e..86a84fe3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.Provider @@ -19,37 +21,55 @@ import com.tryfinch.api.models.ProviderListParams class ProviderServiceImpl internal constructor(private val clientOptions: ClientOptions) : ProviderService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: ProviderService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val listHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): ProviderService.WithRawResponse = withRawResponse - /** Return details on all available payroll and HR systems. */ override fun list( params: ProviderListParams, requestOptions: RequestOptions, - ): ProviderListPage { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("providers") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.forEach { it.validate() } - } - } - .let { - ProviderListPage.of( - this, - params, - ProviderListPage.Response.builder().items(it).build(), - ) + ): ProviderListPage = + // get /providers + withRawResponse().list(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + ProviderService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun list( + params: ProviderListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("providers") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + .let { + ProviderListPage.of( + ProviderServiceImpl(clientOptions), + params, + ProviderListPage.Response.builder().items(it).build(), + ) + } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingService.kt index 7bcd0174..acae431f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingService.kt @@ -4,12 +4,19 @@ package com.tryfinch.api.services.blocking +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.RequestForwardingForwardParams import com.tryfinch.api.models.RequestForwardingForwardResponse interface RequestForwardingService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** * The Forward API allows you to make direct requests to an employment system. If Finch’s * unified API doesn’t have a data model that cleanly fits your needs, then Forward allows you @@ -20,4 +27,22 @@ interface RequestForwardingService { params: RequestForwardingForwardParams, requestOptions: RequestOptions = RequestOptions.none(), ): RequestForwardingForwardResponse + + /** + * A view of [RequestForwardingService] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /forward`, but is otherwise the same as + * [RequestForwardingService.forward]. + */ + @JvmOverloads + @MustBeClosed + fun forward( + params: RequestForwardingForwardParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt index 3ecd100b..85a43df8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError @@ -19,36 +21,50 @@ import com.tryfinch.api.models.RequestForwardingForwardResponse class RequestForwardingServiceImpl internal constructor(private val clientOptions: ClientOptions) : RequestForwardingService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: RequestForwardingService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val forwardHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): RequestForwardingService.WithRawResponse = withRawResponse - /** - * The Forward API allows you to make direct requests to an employment system. If Finch’s - * unified API doesn’t have a data model that cleanly fits your needs, then Forward allows you - * to push or pull data models directly against an integration’s API. - */ override fun forward( params: RequestForwardingForwardParams, requestOptions: RequestOptions, - ): RequestForwardingForwardResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("forward") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { forwardHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): RequestForwardingForwardResponse = + // post /forward + withRawResponse().forward(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + RequestForwardingService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val forwardHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun forward( + params: RequestForwardingForwardParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("forward") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { forwardHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/SandboxService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/SandboxService.kt index ca8510ec..413e04e5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/SandboxService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/SandboxService.kt @@ -12,6 +12,11 @@ import com.tryfinch.api.services.blocking.sandbox.PaymentService interface SandboxService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun connections(): ConnectionService fun company(): CompanyService @@ -25,4 +30,22 @@ interface SandboxService { fun payment(): PaymentService fun jobs(): JobService + + /** A view of [SandboxService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + fun connections(): ConnectionService.WithRawResponse + + fun company(): CompanyService.WithRawResponse + + fun directory(): DirectoryService.WithRawResponse + + fun individual(): IndividualService.WithRawResponse + + fun employment(): EmploymentService.WithRawResponse + + fun payment(): PaymentService.WithRawResponse + + fun jobs(): JobService.WithRawResponse + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/SandboxServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/SandboxServiceImpl.kt index 7eeca782..a52a4ba6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/SandboxServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/SandboxServiceImpl.kt @@ -21,6 +21,10 @@ import com.tryfinch.api.services.blocking.sandbox.PaymentServiceImpl class SandboxServiceImpl internal constructor(private val clientOptions: ClientOptions) : SandboxService { + private val withRawResponse: SandboxService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + private val connections: ConnectionService by lazy { ConnectionServiceImpl(clientOptions) } private val company: CompanyService by lazy { CompanyServiceImpl(clientOptions) } @@ -35,6 +39,8 @@ class SandboxServiceImpl internal constructor(private val clientOptions: ClientO private val jobs: JobService by lazy { JobServiceImpl(clientOptions) } + override fun withRawResponse(): SandboxService.WithRawResponse = withRawResponse + override fun connections(): ConnectionService = connections override fun company(): CompanyService = company @@ -48,4 +54,50 @@ class SandboxServiceImpl internal constructor(private val clientOptions: ClientO override fun payment(): PaymentService = payment override fun jobs(): JobService = jobs + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + SandboxService.WithRawResponse { + + private val connections: ConnectionService.WithRawResponse by lazy { + ConnectionServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val company: CompanyService.WithRawResponse by lazy { + CompanyServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val directory: DirectoryService.WithRawResponse by lazy { + DirectoryServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val individual: IndividualService.WithRawResponse by lazy { + IndividualServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val employment: EmploymentService.WithRawResponse by lazy { + EmploymentServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val payment: PaymentService.WithRawResponse by lazy { + PaymentServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val jobs: JobService.WithRawResponse by lazy { + JobServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun connections(): ConnectionService.WithRawResponse = connections + + override fun company(): CompanyService.WithRawResponse = company + + override fun directory(): DirectoryService.WithRawResponse = directory + + override fun individual(): IndividualService.WithRawResponse = individual + + override fun employment(): EmploymentService.WithRawResponse = employment + + override fun payment(): PaymentService.WithRawResponse = payment + + override fun jobs(): JobService.WithRawResponse = jobs + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionService.kt index dc3e860f..4971debd 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionService.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.blocking.connect +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.ConnectSessionNewParams import com.tryfinch.api.models.ConnectSessionReauthenticateParams import com.tryfinch.api.models.SessionNewResponse @@ -12,6 +14,11 @@ import com.tryfinch.api.models.SessionReauthenticateResponse interface SessionService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Create a new connect session for an employer */ @JvmOverloads fun new_( @@ -25,4 +32,30 @@ interface SessionService { params: ConnectSessionReauthenticateParams, requestOptions: RequestOptions = RequestOptions.none(), ): SessionReauthenticateResponse + + /** A view of [SessionService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /connect/sessions`, but is otherwise the same as + * [SessionService.new_]. + */ + @JvmOverloads + @MustBeClosed + fun new_( + params: ConnectSessionNewParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `post /connect/sessions/reauthenticate`, but is otherwise + * the same as [SessionService.reauthenticate]. + */ + @JvmOverloads + @MustBeClosed + fun reauthenticate( + params: ConnectSessionReauthenticateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt index 429c9e8e..cdc51dca 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError @@ -21,58 +23,84 @@ import com.tryfinch.api.models.SessionReauthenticateResponse class SessionServiceImpl internal constructor(private val clientOptions: ClientOptions) : SessionService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: SessionService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val newHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): SessionService.WithRawResponse = withRawResponse - /** Create a new connect session for an employer */ override fun new_( params: ConnectSessionNewParams, requestOptions: RequestOptions, - ): SessionNewResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("connect", "sessions") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { newHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } + ): SessionNewResponse = + // post /connect/sessions + withRawResponse().new_(params, requestOptions).parse() - private val reauthenticateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Create a new Connect session for reauthenticating an existing connection */ override fun reauthenticate( params: ConnectSessionReauthenticateParams, requestOptions: RequestOptions, - ): SessionReauthenticateResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("connect", "sessions", "reauthenticate") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { reauthenticateHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): SessionReauthenticateResponse = + // post /connect/sessions/reauthenticate + withRawResponse().reauthenticate(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + SessionService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val newHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun new_( + params: ConnectSessionNewParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("connect", "sessions") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { newHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val reauthenticateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun reauthenticate( + params: ConnectSessionReauthenticateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("connect", "sessions", "reauthenticate") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { reauthenticateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitService.kt index 6b03b8da..f091e9b4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitService.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.blocking.hris +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.CompanyBenefit import com.tryfinch.api.models.CreateCompanyBenefitsResponse import com.tryfinch.api.models.HrisBenefitCreateParams @@ -19,6 +21,11 @@ import com.tryfinch.api.services.blocking.hris.benefits.IndividualService interface BenefitService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun individuals(): IndividualService /** @@ -76,4 +83,92 @@ interface BenefitService { requestOptions: RequestOptions ): HrisBenefitListSupportedBenefitsPage = listSupportedBenefits(HrisBenefitListSupportedBenefitsParams.none(), requestOptions) + + /** A view of [BenefitService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + fun individuals(): IndividualService.WithRawResponse + + /** + * Returns a raw HTTP response for `post /employer/benefits`, but is otherwise the same as + * [BenefitService.create]. + */ + @JvmOverloads + @MustBeClosed + fun create( + params: HrisBenefitCreateParams = HrisBenefitCreateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `post /employer/benefits`, but is otherwise the same as + * [BenefitService.create]. + */ + @MustBeClosed + fun create(requestOptions: RequestOptions): HttpResponseFor = + create(HrisBenefitCreateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /employer/benefits/{benefit_id}`, but is otherwise + * the same as [BenefitService.retrieve]. + */ + @JvmOverloads + @MustBeClosed + fun retrieve( + params: HrisBenefitRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `post /employer/benefits/{benefit_id}`, but is otherwise + * the same as [BenefitService.update]. + */ + @JvmOverloads + @MustBeClosed + fun update( + params: HrisBenefitUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /employer/benefits`, but is otherwise the same as + * [BenefitService.list]. + */ + @JvmOverloads + @MustBeClosed + fun list( + params: HrisBenefitListParams = HrisBenefitListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /employer/benefits`, but is otherwise the same as + * [BenefitService.list]. + */ + @MustBeClosed + fun list(requestOptions: RequestOptions): HttpResponseFor = + list(HrisBenefitListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /employer/benefits/meta`, but is otherwise the same + * as [BenefitService.listSupportedBenefits]. + */ + @JvmOverloads + @MustBeClosed + fun listSupportedBenefits( + params: HrisBenefitListSupportedBenefitsParams = + HrisBenefitListSupportedBenefitsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /employer/benefits/meta`, but is otherwise the same + * as [BenefitService.listSupportedBenefits]. + */ + @MustBeClosed + fun listSupportedBenefits( + requestOptions: RequestOptions + ): HttpResponseFor = + listSupportedBenefits(HrisBenefitListSupportedBenefitsParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt index a344d6c5..695f7df6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError @@ -30,155 +32,212 @@ import com.tryfinch.api.services.blocking.hris.benefits.IndividualServiceImpl class BenefitServiceImpl internal constructor(private val clientOptions: ClientOptions) : BenefitService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: BenefitService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } private val individuals: IndividualService by lazy { IndividualServiceImpl(clientOptions) } - override fun individuals(): IndividualService = individuals + override fun withRawResponse(): BenefitService.WithRawResponse = withRawResponse - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun individuals(): IndividualService = individuals - /** - * Creates a new company-wide deduction or contribution. Please use the `/providers` endpoint to - * view available types for each provider. - */ override fun create( params: HrisBenefitCreateParams, requestOptions: RequestOptions, - ): CreateCompanyBenefitsResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("employer", "benefits") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } + ): CreateCompanyBenefitsResponse = + // post /employer/benefits + withRawResponse().create(params, requestOptions).parse() - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** Lists deductions and contributions information for a given item */ override fun retrieve( params: HrisBenefitRetrieveParams, requestOptions: RequestOptions, - ): CompanyBenefit { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "benefits", params.getPathParam(0)) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } + ): CompanyBenefit = + // get /employer/benefits/{benefit_id} + withRawResponse().retrieve(params, requestOptions).parse() - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Updates an existing company-wide deduction or contribution */ override fun update( params: HrisBenefitUpdateParams, requestOptions: RequestOptions, - ): UpdateCompanyBenefitResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("employer", "benefits", params.getPathParam(0)) - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - - private val listHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) + ): UpdateCompanyBenefitResponse = + // post /employer/benefits/{benefit_id} + withRawResponse().update(params, requestOptions).parse() - /** List all company-wide deductions and contributions. */ override fun list( params: HrisBenefitListParams, requestOptions: RequestOptions, - ): HrisBenefitListPage { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "benefits") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.forEach { it.validate() } - } - } - .let { - HrisBenefitListPage.of( - this, - params, - HrisBenefitListPage.Response.builder().items(it).build(), - ) - } - } + ): HrisBenefitListPage = + // get /employer/benefits + withRawResponse().list(params, requestOptions).parse() - private val listSupportedBenefitsHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** Get deductions metadata */ override fun listSupportedBenefits( params: HrisBenefitListSupportedBenefitsParams, requestOptions: RequestOptions, - ): HrisBenefitListSupportedBenefitsPage { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "benefits", "meta") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { listSupportedBenefitsHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.forEach { it.validate() } - } + ): HrisBenefitListSupportedBenefitsPage = + // get /employer/benefits/meta + withRawResponse().listSupportedBenefits(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + BenefitService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val individuals: IndividualService.WithRawResponse by lazy { + IndividualServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun individuals(): IndividualService.WithRawResponse = individuals + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: HrisBenefitCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("employer", "benefits") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun retrieve( + params: HrisBenefitRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "benefits", params.getPathParam(0)) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun update( + params: HrisBenefitUpdateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("employer", "benefits", params.getPathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: HrisBenefitListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "benefits") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + .let { + HrisBenefitListPage.of( + BenefitServiceImpl(clientOptions), + params, + HrisBenefitListPage.Response.builder().items(it).build(), + ) + } } - .let { - HrisBenefitListSupportedBenefitsPage.of( - this, - params, - HrisBenefitListSupportedBenefitsPage.Response.builder().items(it).build(), - ) + } + + private val listSupportedBenefitsHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun listSupportedBenefits( + params: HrisBenefitListSupportedBenefitsParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "benefits", "meta") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { listSupportedBenefitsHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + .let { + HrisBenefitListSupportedBenefitsPage.of( + BenefitServiceImpl(clientOptions), + params, + HrisBenefitListSupportedBenefitsPage.Response.builder() + .items(it) + .build(), + ) + } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt index def4fcd0..c5e38566 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt @@ -4,12 +4,19 @@ package com.tryfinch.api.services.blocking.hris +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.Company import com.tryfinch.api.models.HrisCompanyRetrieveParams interface CompanyService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Read basic company data */ @JvmOverloads fun retrieve( @@ -20,4 +27,27 @@ interface CompanyService { /** Read basic company data */ fun retrieve(requestOptions: RequestOptions): Company = retrieve(HrisCompanyRetrieveParams.none(), requestOptions) + + /** A view of [CompanyService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /employer/company`, but is otherwise the same as + * [CompanyService.retrieve]. + */ + @JvmOverloads + @MustBeClosed + fun retrieve( + params: HrisCompanyRetrieveParams = HrisCompanyRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /employer/company`, but is otherwise the same as + * [CompanyService.retrieve]. + */ + @MustBeClosed + fun retrieve(requestOptions: RequestOptions): HttpResponseFor = + retrieve(HrisCompanyRetrieveParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt index 0ac88f59..d008d4eb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.Company @@ -18,30 +20,48 @@ import com.tryfinch.api.models.HrisCompanyRetrieveParams class CompanyServiceImpl internal constructor(private val clientOptions: ClientOptions) : CompanyService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: CompanyService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): CompanyService.WithRawResponse = withRawResponse - /** Read basic company data */ override fun retrieve( params: HrisCompanyRetrieveParams, requestOptions: RequestOptions, - ): Company { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "company") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): Company = + // get /employer/company + withRawResponse().retrieve(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + CompanyService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun retrieve( + params: HrisCompanyRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "company") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryService.kt index 6304c989..3e182d97 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryService.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.blocking.hris +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.HrisDirectoryListIndividualsPage import com.tryfinch.api.models.HrisDirectoryListIndividualsParams import com.tryfinch.api.models.HrisDirectoryListPage @@ -12,6 +14,11 @@ import com.tryfinch.api.models.HrisDirectoryListParams interface DirectoryService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Read company directory and organization structure */ @JvmOverloads fun list( @@ -35,4 +42,50 @@ interface DirectoryService { @Deprecated("use `list` instead") fun listIndividuals(requestOptions: RequestOptions): HrisDirectoryListIndividualsPage = listIndividuals(HrisDirectoryListIndividualsParams.none(), requestOptions) + + /** A view of [DirectoryService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /employer/directory`, but is otherwise the same as + * [DirectoryService.list]. + */ + @JvmOverloads + @MustBeClosed + fun list( + params: HrisDirectoryListParams = HrisDirectoryListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /employer/directory`, but is otherwise the same as + * [DirectoryService.list]. + */ + @MustBeClosed + fun list(requestOptions: RequestOptions): HttpResponseFor = + list(HrisDirectoryListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /employer/directory`, but is otherwise the same as + * [DirectoryService.listIndividuals]. + */ + @Deprecated("use `list` instead") + @JvmOverloads + @MustBeClosed + fun listIndividuals( + params: HrisDirectoryListIndividualsParams = HrisDirectoryListIndividualsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /employer/directory`, but is otherwise the same as + * [DirectoryService.listIndividuals]. + */ + @Deprecated("use `list` instead") + @MustBeClosed + fun listIndividuals( + requestOptions: RequestOptions + ): HttpResponseFor = + listIndividuals(HrisDirectoryListIndividualsParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt index ee2c0c1b..9e4c9c80 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisDirectoryListIndividualsPage @@ -20,60 +22,93 @@ import com.tryfinch.api.models.HrisDirectoryListParams class DirectoryServiceImpl internal constructor(private val clientOptions: ClientOptions) : DirectoryService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: DirectoryService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): DirectoryService.WithRawResponse = withRawResponse - /** Read company directory and organization structure */ override fun list( params: HrisDirectoryListParams, requestOptions: RequestOptions, - ): HrisDirectoryListPage { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "directory") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - .let { HrisDirectoryListPage.of(this, params, it) } - } + ): HrisDirectoryListPage = + // get /employer/directory + withRawResponse().list(params, requestOptions).parse() - private val listIndividualsHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Read company directory and organization structure */ - @Deprecated("use `list` instead") override fun listIndividuals( params: HrisDirectoryListIndividualsParams, requestOptions: RequestOptions, - ): HrisDirectoryListIndividualsPage { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "directory") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { listIndividualsHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): HrisDirectoryListIndividualsPage = + // get /employer/directory + withRawResponse().listIndividuals(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + DirectoryService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: HrisDirectoryListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "directory") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + HrisDirectoryListPage.of(DirectoryServiceImpl(clientOptions), params, it) + } + } + } + + private val listIndividualsHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun listIndividuals( + params: HrisDirectoryListIndividualsParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "directory") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { listIndividualsHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + HrisDirectoryListIndividualsPage.of( + DirectoryServiceImpl(clientOptions), + params, + it, + ) + } } - .let { HrisDirectoryListIndividualsPage.of(this, params, it) } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentService.kt index ca9377fc..24e8a405 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentService.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.blocking.hris +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.DocumentListResponse import com.tryfinch.api.models.DocumentRetreiveResponse import com.tryfinch.api.models.HrisDocumentListParams @@ -12,6 +14,11 @@ import com.tryfinch.api.models.HrisDocumentRetreiveParams interface DocumentService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** * **Beta:** This endpoint is in beta and may change. Retrieve a list of company-wide documents. */ @@ -36,4 +43,38 @@ interface DocumentService { params: HrisDocumentRetreiveParams, requestOptions: RequestOptions = RequestOptions.none(), ): DocumentRetreiveResponse + + /** A view of [DocumentService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /employer/documents`, but is otherwise the same as + * [DocumentService.list]. + */ + @JvmOverloads + @MustBeClosed + fun list( + params: HrisDocumentListParams = HrisDocumentListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /employer/documents`, but is otherwise the same as + * [DocumentService.list]. + */ + @MustBeClosed + fun list(requestOptions: RequestOptions): HttpResponseFor = + list(HrisDocumentListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /employer/documents/{document_id}`, but is otherwise + * the same as [DocumentService.retreive]. + */ + @JvmOverloads + @MustBeClosed + fun retreive( + params: HrisDocumentRetreiveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt index 5c8d6495..6f5541a3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.DocumentListResponse @@ -20,61 +22,83 @@ import com.tryfinch.api.models.HrisDocumentRetreiveParams class DocumentServiceImpl internal constructor(private val clientOptions: ClientOptions) : DocumentService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: DocumentService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): DocumentService.WithRawResponse = withRawResponse - /** - * **Beta:** This endpoint is in beta and may change. Retrieve a list of company-wide documents. - */ override fun list( params: HrisDocumentListParams, requestOptions: RequestOptions, - ): DocumentListResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "documents") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } + ): DocumentListResponse = + // get /employer/documents + withRawResponse().list(params, requestOptions).parse() - private val retreiveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** - * **Beta:** This endpoint is in beta and may change. Retrieve details of a specific document by - * its ID. - */ override fun retreive( params: HrisDocumentRetreiveParams, requestOptions: RequestOptions, - ): DocumentRetreiveResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "documents", params.getPathParam(0)) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { retreiveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): DocumentRetreiveResponse = + // get /employer/documents/{document_id} + withRawResponse().retreive(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + DocumentService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: HrisDocumentListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "documents") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val retreiveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retreive( + params: HrisDocumentRetreiveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "documents", params.getPathParam(0)) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { retreiveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentService.kt index 98beeb34..d426d63d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentService.kt @@ -4,16 +4,38 @@ package com.tryfinch.api.services.blocking.hris +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.HrisEmploymentRetrieveManyPage import com.tryfinch.api.models.HrisEmploymentRetrieveManyParams interface EmploymentService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Read individual employment and income data */ @JvmOverloads fun retrieveMany( params: HrisEmploymentRetrieveManyParams, requestOptions: RequestOptions = RequestOptions.none(), ): HrisEmploymentRetrieveManyPage + + /** A view of [EmploymentService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /employer/employment`, but is otherwise the same as + * [EmploymentService.retrieveMany]. + */ + @JvmOverloads + @MustBeClosed + fun retrieveMany( + params: HrisEmploymentRetrieveManyParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt index 82ffeeba..08091ed6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError @@ -19,33 +21,57 @@ import com.tryfinch.api.models.HrisEmploymentRetrieveManyParams class EmploymentServiceImpl internal constructor(private val clientOptions: ClientOptions) : EmploymentService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: EmploymentService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val retrieveManyHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): EmploymentService.WithRawResponse = withRawResponse - /** Read individual employment and income data */ override fun retrieveMany( params: HrisEmploymentRetrieveManyParams, requestOptions: RequestOptions, - ): HrisEmploymentRetrieveManyPage { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("employer", "employment") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { retrieveManyHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): HrisEmploymentRetrieveManyPage = + // post /employer/employment + withRawResponse().retrieveMany(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + EmploymentService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val retrieveManyHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieveMany( + params: HrisEmploymentRetrieveManyParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("employer", "employment") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { retrieveManyHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + HrisEmploymentRetrieveManyPage.of( + EmploymentServiceImpl(clientOptions), + params, + it, + ) + } } - .let { HrisEmploymentRetrieveManyPage.of(this, params, it) } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt index 1c0a766b..c08de1f8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt @@ -4,12 +4,19 @@ package com.tryfinch.api.services.blocking.hris +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.HrisIndividualRetrieveManyPage import com.tryfinch.api.models.HrisIndividualRetrieveManyParams interface IndividualService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Read individual data, excluding income and employment data */ @JvmOverloads fun retrieveMany( @@ -20,4 +27,29 @@ interface IndividualService { /** Read individual data, excluding income and employment data */ fun retrieveMany(requestOptions: RequestOptions): HrisIndividualRetrieveManyPage = retrieveMany(HrisIndividualRetrieveManyParams.none(), requestOptions) + + /** A view of [IndividualService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /employer/individual`, but is otherwise the same as + * [IndividualService.retrieveMany]. + */ + @JvmOverloads + @MustBeClosed + fun retrieveMany( + params: HrisIndividualRetrieveManyParams = HrisIndividualRetrieveManyParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `post /employer/individual`, but is otherwise the same as + * [IndividualService.retrieveMany]. + */ + @MustBeClosed + fun retrieveMany( + requestOptions: RequestOptions + ): HttpResponseFor = + retrieveMany(HrisIndividualRetrieveManyParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt index 4965d514..d9305d4c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError @@ -19,33 +21,57 @@ import com.tryfinch.api.models.HrisIndividualRetrieveManyParams class IndividualServiceImpl internal constructor(private val clientOptions: ClientOptions) : IndividualService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: IndividualService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val retrieveManyHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): IndividualService.WithRawResponse = withRawResponse - /** Read individual data, excluding income and employment data */ override fun retrieveMany( params: HrisIndividualRetrieveManyParams, requestOptions: RequestOptions, - ): HrisIndividualRetrieveManyPage { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("employer", "individual") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { retrieveManyHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): HrisIndividualRetrieveManyPage = + // post /employer/individual + withRawResponse().retrieveMany(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + IndividualService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val retrieveManyHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieveMany( + params: HrisIndividualRetrieveManyParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("employer", "individual") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { retrieveManyHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + HrisIndividualRetrieveManyPage.of( + IndividualServiceImpl(clientOptions), + params, + it, + ) + } } - .let { HrisIndividualRetrieveManyPage.of(this, params, it) } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementService.kt index aa04af04..d634fc29 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementService.kt @@ -4,12 +4,19 @@ package com.tryfinch.api.services.blocking.hris +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.HrisPayStatementRetrieveManyPage import com.tryfinch.api.models.HrisPayStatementRetrieveManyParams interface PayStatementService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** * Read detailed pay statements for each individual. * @@ -20,4 +27,21 @@ interface PayStatementService { params: HrisPayStatementRetrieveManyParams, requestOptions: RequestOptions = RequestOptions.none(), ): HrisPayStatementRetrieveManyPage + + /** + * A view of [PayStatementService] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /employer/pay-statement`, but is otherwise the same + * as [PayStatementService.retrieveMany]. + */ + @JvmOverloads + @MustBeClosed + fun retrieveMany( + params: HrisPayStatementRetrieveManyParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt index 2403cee3..ffc89df9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError @@ -19,37 +21,57 @@ import com.tryfinch.api.models.HrisPayStatementRetrieveManyParams class PayStatementServiceImpl internal constructor(private val clientOptions: ClientOptions) : PayStatementService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: PayStatementService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val retrieveManyHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): PayStatementService.WithRawResponse = withRawResponse - /** - * Read detailed pay statements for each individual. - * - * Deduction and contribution types are supported by the payroll systems that supports Benefits. - */ override fun retrieveMany( params: HrisPayStatementRetrieveManyParams, requestOptions: RequestOptions, - ): HrisPayStatementRetrieveManyPage { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("employer", "pay-statement") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { retrieveManyHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): HrisPayStatementRetrieveManyPage = + // post /employer/pay-statement + withRawResponse().retrieveMany(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + PayStatementService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val retrieveManyHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieveMany( + params: HrisPayStatementRetrieveManyParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("employer", "pay-statement") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { retrieveManyHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + HrisPayStatementRetrieveManyPage.of( + PayStatementServiceImpl(clientOptions), + params, + it, + ) + } } - .let { HrisPayStatementRetrieveManyPage.of(this, params, it) } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentService.kt index c1f5ea2d..6a60094c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentService.kt @@ -4,16 +4,38 @@ package com.tryfinch.api.services.blocking.hris +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.HrisPaymentListPage import com.tryfinch.api.models.HrisPaymentListParams interface PaymentService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Read payroll and contractor related payments by the company. */ @JvmOverloads fun list( params: HrisPaymentListParams, requestOptions: RequestOptions = RequestOptions.none(), ): HrisPaymentListPage + + /** A view of [PaymentService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /employer/payment`, but is otherwise the same as + * [PaymentService.list]. + */ + @JvmOverloads + @MustBeClosed + fun list( + params: HrisPaymentListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt index e60312b7..0fc3e15a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisPaymentListPage @@ -19,37 +21,55 @@ import com.tryfinch.api.models.Payment class PaymentServiceImpl internal constructor(private val clientOptions: ClientOptions) : PaymentService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: PaymentService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val listHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): PaymentService.WithRawResponse = withRawResponse - /** Read payroll and contractor related payments by the company. */ override fun list( params: HrisPaymentListParams, requestOptions: RequestOptions, - ): HrisPaymentListPage { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "payment") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.forEach { it.validate() } - } - } - .let { - HrisPaymentListPage.of( - this, - params, - HrisPaymentListPage.Response.builder().items(it).build(), - ) + ): HrisPaymentListPage = + // get /employer/payment + withRawResponse().list(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + PaymentService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun list( + params: HrisPaymentListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "payment") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + .let { + HrisPaymentListPage.of( + PaymentServiceImpl(clientOptions), + params, + HrisPaymentListPage.Response.builder().items(it).build(), + ) + } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualService.kt index 4ca4e5f0..da7c3402 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualService.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.blocking.hris.benefits +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.HrisBenefitIndividualEnrolledIdsParams import com.tryfinch.api.models.HrisBenefitIndividualRetrieveManyBenefitsPage import com.tryfinch.api.models.HrisBenefitIndividualRetrieveManyBenefitsParams @@ -14,6 +16,11 @@ import com.tryfinch.api.models.IndividualEnrolledIdsResponse interface IndividualService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Lists individuals currently enrolled in a given deduction. */ @JvmOverloads fun enrolledIds( @@ -34,4 +41,41 @@ interface IndividualService { params: HrisBenefitIndividualUnenrollManyParams, requestOptions: RequestOptions = RequestOptions.none(), ): HrisBenefitIndividualUnenrollManyPage + + /** A view of [IndividualService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /employer/benefits/{benefit_id}/enrolled`, but is + * otherwise the same as [IndividualService.enrolledIds]. + */ + @JvmOverloads + @MustBeClosed + fun enrolledIds( + params: HrisBenefitIndividualEnrolledIdsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /employer/benefits/{benefit_id}/individuals`, but is + * otherwise the same as [IndividualService.retrieveManyBenefits]. + */ + @JvmOverloads + @MustBeClosed + fun retrieveManyBenefits( + params: HrisBenefitIndividualRetrieveManyBenefitsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `delete /employer/benefits/{benefit_id}/individuals`, but + * is otherwise the same as [IndividualService.unenrollMany]. + */ + @JvmOverloads + @MustBeClosed + fun unenrollMany( + params: HrisBenefitIndividualUnenrollManyParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt index 806aa60b..68999b04 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError @@ -25,100 +27,136 @@ import com.tryfinch.api.models.UnenrolledIndividual class IndividualServiceImpl internal constructor(private val clientOptions: ClientOptions) : IndividualService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: IndividualService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val enrolledIdsHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): IndividualService.WithRawResponse = withRawResponse - /** Lists individuals currently enrolled in a given deduction. */ override fun enrolledIds( params: HrisBenefitIndividualEnrolledIdsParams, requestOptions: RequestOptions, - ): IndividualEnrolledIdsResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "benefits", params.getPathParam(0), "enrolled") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { enrolledIdsHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } + ): IndividualEnrolledIdsResponse = + // get /employer/benefits/{benefit_id}/enrolled + withRawResponse().enrolledIds(params, requestOptions).parse() - private val retrieveManyBenefitsHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Get enrollment information for the given individuals. */ override fun retrieveManyBenefits( params: HrisBenefitIndividualRetrieveManyBenefitsParams, requestOptions: RequestOptions, - ): HrisBenefitIndividualRetrieveManyBenefitsPage { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "benefits", params.getPathParam(0), "individuals") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { retrieveManyBenefitsHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.forEach { it.validate() } - } - } - .let { - HrisBenefitIndividualRetrieveManyBenefitsPage.of( - this, - params, - HrisBenefitIndividualRetrieveManyBenefitsPage.Response.builder() - .items(it) - .build(), - ) - } - } + ): HrisBenefitIndividualRetrieveManyBenefitsPage = + // get /employer/benefits/{benefit_id}/individuals + withRawResponse().retrieveManyBenefits(params, requestOptions).parse() - private val unenrollManyHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Unenroll individuals from a deduction or contribution */ override fun unenrollMany( params: HrisBenefitIndividualUnenrollManyParams, requestOptions: RequestOptions, - ): HrisBenefitIndividualUnenrollManyPage { - val request = - HttpRequest.builder() - .method(HttpMethod.DELETE) - .addPathSegments("employer", "benefits", params.getPathParam(0), "individuals") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { unenrollManyHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.forEach { it.validate() } - } + ): HrisBenefitIndividualUnenrollManyPage = + // delete /employer/benefits/{benefit_id}/individuals + withRawResponse().unenrollMany(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + IndividualService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val enrolledIdsHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun enrolledIds( + params: HrisBenefitIndividualEnrolledIdsParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "benefits", params.getPathParam(0), "enrolled") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { enrolledIdsHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val retrieveManyBenefitsHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieveManyBenefits( + params: HrisBenefitIndividualRetrieveManyBenefitsParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "benefits", params.getPathParam(0), "individuals") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { retrieveManyBenefitsHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + .let { + HrisBenefitIndividualRetrieveManyBenefitsPage.of( + IndividualServiceImpl(clientOptions), + params, + HrisBenefitIndividualRetrieveManyBenefitsPage.Response.builder() + .items(it) + .build(), + ) + } } - .let { - HrisBenefitIndividualUnenrollManyPage.of( - this, - params, - HrisBenefitIndividualUnenrollManyPage.Response.builder().items(it).build(), - ) + } + + private val unenrollManyHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun unenrollMany( + params: HrisBenefitIndividualUnenrollManyParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .addPathSegments("employer", "benefits", params.getPathParam(0), "individuals") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { unenrollManyHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + .let { + HrisBenefitIndividualUnenrollManyPage.of( + IndividualServiceImpl(clientOptions), + params, + HrisBenefitIndividualUnenrollManyPage.Response.builder() + .items(it) + .build(), + ) + } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt index 1755269a..3b0674d3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.blocking.jobs +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.AutomatedAsyncJob import com.tryfinch.api.models.AutomatedCreateResponse import com.tryfinch.api.models.JobAutomatedCreateParams @@ -14,6 +16,11 @@ import com.tryfinch.api.models.JobAutomatedRetrieveParams interface AutomatedService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** * Enqueue an automated job. * @@ -78,4 +85,57 @@ interface AutomatedService { */ fun list(requestOptions: RequestOptions): JobAutomatedListPage = list(JobAutomatedListParams.none(), requestOptions) + + /** A view of [AutomatedService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /jobs/automated`, but is otherwise the same as + * [AutomatedService.create]. + */ + @JvmOverloads + @MustBeClosed + fun create( + params: JobAutomatedCreateParams = JobAutomatedCreateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `post /jobs/automated`, but is otherwise the same as + * [AutomatedService.create]. + */ + @MustBeClosed + fun create(requestOptions: RequestOptions): HttpResponseFor = + create(JobAutomatedCreateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /jobs/automated/{job_id}`, but is otherwise the same + * as [AutomatedService.retrieve]. + */ + @JvmOverloads + @MustBeClosed + fun retrieve( + params: JobAutomatedRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /jobs/automated`, but is otherwise the same as + * [AutomatedService.list]. + */ + @JvmOverloads + @MustBeClosed + fun list( + params: JobAutomatedListParams = JobAutomatedListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /jobs/automated`, but is otherwise the same as + * [AutomatedService.list]. + */ + @MustBeClosed + fun list(requestOptions: RequestOptions): HttpResponseFor = + list(JobAutomatedListParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt index 08b18f99..9aa68f29 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError @@ -23,102 +25,120 @@ import com.tryfinch.api.models.JobAutomatedRetrieveParams class AutomatedServiceImpl internal constructor(private val clientOptions: ClientOptions) : AutomatedService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** - * Enqueue an automated job. - * - * `data_sync_all`: Enqueue a job to re-sync all data for a connection. `data_sync_all` has a - * concurrency limit of 1 job at a time per connection. This means that if this endpoint is - * called while a job is already in progress for this connection, Finch will return the `job_id` - * of the job that is currently in progress. Finch allows a fixed window rate limit of 1 forced - * refresh per hour per connection. - * - * `w4_form_employee_sync`: Enqueues a job for sync W-4 data for a particular individual, - * identified by `individual_id`. This feature is currently in beta. - * - * This endpoint is available for _Scale_ tier customers as an add-on. To request access to this - * endpoint, please contact your Finch account manager. - */ + private val withRawResponse: AutomatedService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): AutomatedService.WithRawResponse = withRawResponse + override fun create( params: JobAutomatedCreateParams, requestOptions: RequestOptions, - ): AutomatedCreateResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("jobs", "automated") - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } + ): AutomatedCreateResponse = + // post /jobs/automated + withRawResponse().create(params, requestOptions).parse() - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** Get an automated job by `job_id`. */ override fun retrieve( params: JobAutomatedRetrieveParams, requestOptions: RequestOptions, - ): AutomatedAsyncJob { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("jobs", "automated", params.getPathParam(0)) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } + ): AutomatedAsyncJob = + // get /jobs/automated/{job_id} + withRawResponse().retrieve(params, requestOptions).parse() - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** - * Get all automated jobs. Automated jobs are completed by a machine. By default, jobs are - * sorted in descending order by submission time. For scheduled jobs such as data syncs, only - * the next scheduled job is shown. - */ override fun list( params: JobAutomatedListParams, requestOptions: RequestOptions, - ): JobAutomatedListPage { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("jobs", "automated") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): JobAutomatedListPage = + // get /jobs/automated + withRawResponse().list(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + AutomatedService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: JobAutomatedCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("jobs", "automated") + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun retrieve( + params: JobAutomatedRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("jobs", "automated", params.getPathParam(0)) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: JobAutomatedListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("jobs", "automated") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + JobAutomatedListPage.of(AutomatedServiceImpl(clientOptions), params, it) + } } - .let { JobAutomatedListPage.of(this, params, it) } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualService.kt index b6b76e59..a5dc8a12 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualService.kt @@ -4,12 +4,19 @@ package com.tryfinch.api.services.blocking.jobs +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.JobManualRetrieveParams import com.tryfinch.api.models.ManualAsyncJob interface ManualService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** * Get a manual job by `job_id`. Manual jobs are completed by a human and include Assisted * Benefits jobs. @@ -19,4 +26,19 @@ interface ManualService { params: JobManualRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): ManualAsyncJob + + /** A view of [ManualService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /jobs/manual/{job_id}`, but is otherwise the same as + * [ManualService.retrieve]. + */ + @JvmOverloads + @MustBeClosed + fun retrieve( + params: JobManualRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt index 184eb69d..f26e3589 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.JobManualRetrieveParams @@ -18,33 +20,48 @@ import com.tryfinch.api.models.ManualAsyncJob class ManualServiceImpl internal constructor(private val clientOptions: ClientOptions) : ManualService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: ManualService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): ManualService.WithRawResponse = withRawResponse - /** - * Get a manual job by `job_id`. Manual jobs are completed by a human and include Assisted - * Benefits jobs. - */ override fun retrieve( params: JobManualRetrieveParams, requestOptions: RequestOptions, - ): ManualAsyncJob { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("jobs", "manual", params.getPathParam(0)) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): ManualAsyncJob = + // get /jobs/manual/{job_id} + withRawResponse().retrieve(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + ManualService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun retrieve( + params: JobManualRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("jobs", "manual", params.getPathParam(0)) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupService.kt index b5c0e37b..1d048242 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupService.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.blocking.payroll +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.PayGroupRetrieveResponse import com.tryfinch.api.models.PayrollPayGroupListPage import com.tryfinch.api.models.PayrollPayGroupListParams @@ -12,6 +14,11 @@ import com.tryfinch.api.models.PayrollPayGroupRetrieveParams interface PayGroupService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Read information from a single pay group */ @JvmOverloads fun retrieve( @@ -29,4 +36,38 @@ interface PayGroupService { /** Read company pay groups and frequencies */ fun list(requestOptions: RequestOptions): PayrollPayGroupListPage = list(PayrollPayGroupListParams.none(), requestOptions) + + /** A view of [PayGroupService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /employer/pay-groups/{pay_group_id}`, but is + * otherwise the same as [PayGroupService.retrieve]. + */ + @JvmOverloads + @MustBeClosed + fun retrieve( + params: PayrollPayGroupRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /employer/pay-groups`, but is otherwise the same as + * [PayGroupService.list]. + */ + @JvmOverloads + @MustBeClosed + fun list( + params: PayrollPayGroupListParams = PayrollPayGroupListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /employer/pay-groups`, but is otherwise the same as + * [PayGroupService.list]. + */ + @MustBeClosed + fun list(requestOptions: RequestOptions): HttpResponseFor = + list(PayrollPayGroupListParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt index 4e83756c..1eea0891 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.PayGroupListResponse @@ -21,64 +23,90 @@ import com.tryfinch.api.models.PayrollPayGroupRetrieveParams class PayGroupServiceImpl internal constructor(private val clientOptions: ClientOptions) : PayGroupService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: PayGroupService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): PayGroupService.WithRawResponse = withRawResponse - /** Read information from a single pay group */ override fun retrieve( params: PayrollPayGroupRetrieveParams, requestOptions: RequestOptions, - ): PayGroupRetrieveResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "pay-groups", params.getPathParam(0)) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } + ): PayGroupRetrieveResponse = + // get /employer/pay-groups/{pay_group_id} + withRawResponse().retrieve(params, requestOptions).parse() - private val listHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Read company pay groups and frequencies */ override fun list( params: PayrollPayGroupListParams, requestOptions: RequestOptions, - ): PayrollPayGroupListPage { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("employer", "pay-groups") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.forEach { it.validate() } - } + ): PayrollPayGroupListPage = + // get /employer/pay-groups + withRawResponse().list(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + PayGroupService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieve( + params: PayrollPayGroupRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "pay-groups", params.getPathParam(0)) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } - .let { - PayrollPayGroupListPage.of( - this, - params, - PayrollPayGroupListPage.Response.builder().items(it).build(), - ) + } + + private val listHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: PayrollPayGroupListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "pay-groups") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + .let { + PayrollPayGroupListPage.of( + PayGroupServiceImpl(clientOptions), + params, + PayrollPayGroupListPage.Response.builder().items(it).build(), + ) + } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyService.kt index 7c7c7238..a5ed0378 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyService.kt @@ -4,16 +4,38 @@ package com.tryfinch.api.services.blocking.sandbox +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.CompanyUpdateResponse import com.tryfinch.api.models.SandboxCompanyUpdateParams interface CompanyService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Update a sandbox company's data */ @JvmOverloads fun update( params: SandboxCompanyUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompanyUpdateResponse + + /** A view of [CompanyService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `put /sandbox/company`, but is otherwise the same as + * [CompanyService.update]. + */ + @JvmOverloads + @MustBeClosed + fun update( + params: SandboxCompanyUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt index 6fe25256..63895a22 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError @@ -19,31 +21,50 @@ import com.tryfinch.api.models.SandboxCompanyUpdateParams class CompanyServiceImpl internal constructor(private val clientOptions: ClientOptions) : CompanyService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: CompanyService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): CompanyService.WithRawResponse = withRawResponse - /** Update a sandbox company's data */ override fun update( params: SandboxCompanyUpdateParams, requestOptions: RequestOptions, - ): CompanyUpdateResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.PUT) - .addPathSegments("sandbox", "company") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): CompanyUpdateResponse = + // put /sandbox/company + withRawResponse().update(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + CompanyService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun update( + params: SandboxCompanyUpdateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("sandbox", "company") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionService.kt index c1bca965..d568e6ab 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionService.kt @@ -4,13 +4,20 @@ package com.tryfinch.api.services.blocking.sandbox +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.ConnectionCreateResponse import com.tryfinch.api.models.SandboxConnectionCreateParams import com.tryfinch.api.services.blocking.sandbox.connections.AccountService interface ConnectionService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun accounts(): AccountService /** Create a new connection (new company/provider pair) with a new account */ @@ -19,4 +26,21 @@ interface ConnectionService { params: SandboxConnectionCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): ConnectionCreateResponse + + /** A view of [ConnectionService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + fun accounts(): AccountService.WithRawResponse + + /** + * Returns a raw HTTP response for `post /sandbox/connections`, but is otherwise the same as + * [ConnectionService.create]. + */ + @JvmOverloads + @MustBeClosed + fun create( + params: SandboxConnectionCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt index 8f670c3f..120660ee 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError @@ -21,36 +23,60 @@ import com.tryfinch.api.services.blocking.sandbox.connections.AccountServiceImpl class ConnectionServiceImpl internal constructor(private val clientOptions: ClientOptions) : ConnectionService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: ConnectionService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } private val accounts: AccountService by lazy { AccountServiceImpl(clientOptions) } - override fun accounts(): AccountService = accounts + override fun withRawResponse(): ConnectionService.WithRawResponse = withRawResponse - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun accounts(): AccountService = accounts - /** Create a new connection (new company/provider pair) with a new account */ override fun create( params: SandboxConnectionCreateParams, requestOptions: RequestOptions, - ): ConnectionCreateResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("sandbox", "connections") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): ConnectionCreateResponse = + // post /sandbox/connections + withRawResponse().create(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + ConnectionService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val accounts: AccountService.WithRawResponse by lazy { + AccountServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun accounts(): AccountService.WithRawResponse = accounts + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: SandboxConnectionCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("sandbox", "connections") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt index 210e1395..ee539194 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt @@ -4,12 +4,19 @@ package com.tryfinch.api.services.blocking.sandbox +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.SandboxDirectoryCreateParams interface DirectoryService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Add new individuals to a sandbox company */ @JvmOverloads fun create( @@ -20,4 +27,27 @@ interface DirectoryService { /** Add new individuals to a sandbox company */ fun create(requestOptions: RequestOptions): List = create(SandboxDirectoryCreateParams.none(), requestOptions) + + /** A view of [DirectoryService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /sandbox/directory`, but is otherwise the same as + * [DirectoryService.create]. + */ + @JvmOverloads + @MustBeClosed + fun create( + params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor> + + /** + * Returns a raw HTTP response for `post /sandbox/directory`, but is otherwise the same as + * [DirectoryService.create]. + */ + @MustBeClosed + fun create(requestOptions: RequestOptions): HttpResponseFor> = + create(SandboxDirectoryCreateParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt index a2dae656..00a9ce1a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt @@ -11,6 +11,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError @@ -19,25 +21,41 @@ import com.tryfinch.api.models.SandboxDirectoryCreateParams class DirectoryServiceImpl internal constructor(private val clientOptions: ClientOptions) : DirectoryService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: DirectoryService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val createHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): DirectoryService.WithRawResponse = withRawResponse - /** Add new individuals to a sandbox company */ override fun create( params: SandboxDirectoryCreateParams, requestOptions: RequestOptions, - ): List { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("sandbox", "directory") - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response.use { createHandler.handle(it) } + ): List = + // post /sandbox/directory + withRawResponse().create(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + DirectoryService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun create( + params: SandboxDirectoryCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("sandbox", "directory") + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { response.use { createHandler.handle(it) } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentService.kt index 6d26b611..1b0509c1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentService.kt @@ -4,16 +4,38 @@ package com.tryfinch.api.services.blocking.sandbox +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.EmploymentUpdateResponse import com.tryfinch.api.models.SandboxEmploymentUpdateParams interface EmploymentService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Update sandbox employment */ @JvmOverloads fun update( params: SandboxEmploymentUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): EmploymentUpdateResponse + + /** A view of [EmploymentService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `put /sandbox/employment/{individual_id}`, but is + * otherwise the same as [EmploymentService.update]. + */ + @JvmOverloads + @MustBeClosed + fun update( + params: SandboxEmploymentUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt index 604f55d8..75701c91 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError @@ -19,32 +21,50 @@ import com.tryfinch.api.models.SandboxEmploymentUpdateParams class EmploymentServiceImpl internal constructor(private val clientOptions: ClientOptions) : EmploymentService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: EmploymentService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): EmploymentService.WithRawResponse = withRawResponse - /** Update sandbox employment */ override fun update( params: SandboxEmploymentUpdateParams, requestOptions: RequestOptions, - ): EmploymentUpdateResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.PUT) - .addPathSegments("sandbox", "employment", params.getPathParam(0)) - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): EmploymentUpdateResponse = + // put /sandbox/employment/{individual_id} + withRawResponse().update(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + EmploymentService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun update( + params: SandboxEmploymentUpdateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("sandbox", "employment", params.getPathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualService.kt index 34657b8f..5c1670b6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualService.kt @@ -4,16 +4,38 @@ package com.tryfinch.api.services.blocking.sandbox +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.IndividualUpdateResponse import com.tryfinch.api.models.SandboxIndividualUpdateParams interface IndividualService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Update sandbox individual */ @JvmOverloads fun update( params: SandboxIndividualUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): IndividualUpdateResponse + + /** A view of [IndividualService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `put /sandbox/individual/{individual_id}`, but is + * otherwise the same as [IndividualService.update]. + */ + @JvmOverloads + @MustBeClosed + fun update( + params: SandboxIndividualUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt index 8f15579c..93b1c96e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError @@ -19,32 +21,50 @@ import com.tryfinch.api.models.SandboxIndividualUpdateParams class IndividualServiceImpl internal constructor(private val clientOptions: ClientOptions) : IndividualService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: IndividualService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): IndividualService.WithRawResponse = withRawResponse - /** Update sandbox individual */ override fun update( params: SandboxIndividualUpdateParams, requestOptions: RequestOptions, - ): IndividualUpdateResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.PUT) - .addPathSegments("sandbox", "individual", params.getPathParam(0)) - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): IndividualUpdateResponse = + // put /sandbox/individual/{individual_id} + withRawResponse().update(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + IndividualService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun update( + params: SandboxIndividualUpdateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("sandbox", "individual", params.getPathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobService.kt index 65e3c055..868a6622 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobService.kt @@ -4,13 +4,20 @@ package com.tryfinch.api.services.blocking.sandbox +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.JobCreateResponse import com.tryfinch.api.models.SandboxJobCreateParams import com.tryfinch.api.services.blocking.sandbox.jobs.ConfigurationService interface JobService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + fun configuration(): ConfigurationService /** Enqueue a new sandbox job */ @@ -19,4 +26,21 @@ interface JobService { params: SandboxJobCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): JobCreateResponse + + /** A view of [JobService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + fun configuration(): ConfigurationService.WithRawResponse + + /** + * Returns a raw HTTP response for `post /sandbox/jobs`, but is otherwise the same as + * [JobService.create]. + */ + @JvmOverloads + @MustBeClosed + fun create( + params: SandboxJobCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt index 590077ad..8ea4fd5e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError @@ -20,37 +22,61 @@ import com.tryfinch.api.services.blocking.sandbox.jobs.ConfigurationServiceImpl class JobServiceImpl internal constructor(private val clientOptions: ClientOptions) : JobService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: JobService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } private val configuration: ConfigurationService by lazy { ConfigurationServiceImpl(clientOptions) } - override fun configuration(): ConfigurationService = configuration + override fun withRawResponse(): JobService.WithRawResponse = withRawResponse - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun configuration(): ConfigurationService = configuration - /** Enqueue a new sandbox job */ override fun create( params: SandboxJobCreateParams, requestOptions: RequestOptions, - ): JobCreateResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("sandbox", "jobs") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): JobCreateResponse = + // post /sandbox/jobs + withRawResponse().create(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + JobService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val configuration: ConfigurationService.WithRawResponse by lazy { + ConfigurationServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun configuration(): ConfigurationService.WithRawResponse = configuration + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun create( + params: SandboxJobCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("sandbox", "jobs") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentService.kt index 6e20efa2..c0bd3867 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentService.kt @@ -4,12 +4,19 @@ package com.tryfinch.api.services.blocking.sandbox +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.PaymentCreateResponse import com.tryfinch.api.models.SandboxPaymentCreateParams interface PaymentService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Add a new sandbox payment */ @JvmOverloads fun create( @@ -20,4 +27,27 @@ interface PaymentService { /** Add a new sandbox payment */ fun create(requestOptions: RequestOptions): PaymentCreateResponse = create(SandboxPaymentCreateParams.none(), requestOptions) + + /** A view of [PaymentService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /sandbox/payment`, but is otherwise the same as + * [PaymentService.create]. + */ + @JvmOverloads + @MustBeClosed + fun create( + params: SandboxPaymentCreateParams = SandboxPaymentCreateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `post /sandbox/payment`, but is otherwise the same as + * [PaymentService.create]. + */ + @MustBeClosed + fun create(requestOptions: RequestOptions): HttpResponseFor = + create(SandboxPaymentCreateParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt index 53c639a6..143704ae 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError @@ -19,31 +21,50 @@ import com.tryfinch.api.models.SandboxPaymentCreateParams class PaymentServiceImpl internal constructor(private val clientOptions: ClientOptions) : PaymentService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: PaymentService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): PaymentService.WithRawResponse = withRawResponse - /** Add a new sandbox payment */ override fun create( params: SandboxPaymentCreateParams, requestOptions: RequestOptions, - ): PaymentCreateResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("sandbox", "payment") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): PaymentCreateResponse = + // post /sandbox/payment + withRawResponse().create(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + PaymentService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: SandboxPaymentCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("sandbox", "payment") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountService.kt index a2c8266f..a1ca85ba 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountService.kt @@ -4,7 +4,9 @@ package com.tryfinch.api.services.blocking.sandbox.connections +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.AccountCreateResponse import com.tryfinch.api.models.AccountUpdateResponse import com.tryfinch.api.models.SandboxConnectionAccountCreateParams @@ -12,6 +14,11 @@ import com.tryfinch.api.models.SandboxConnectionAccountUpdateParams interface AccountService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Create a new account for an existing connection (company/provider pair) */ @JvmOverloads fun create( @@ -35,4 +42,39 @@ interface AccountService { */ fun update(requestOptions: RequestOptions): AccountUpdateResponse = update(SandboxConnectionAccountUpdateParams.none(), requestOptions) + + /** A view of [AccountService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /sandbox/connections/accounts`, but is otherwise + * the same as [AccountService.create]. + */ + @JvmOverloads + @MustBeClosed + fun create( + params: SandboxConnectionAccountCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `put /sandbox/connections/accounts`, but is otherwise the + * same as [AccountService.update]. + */ + @JvmOverloads + @MustBeClosed + fun update( + params: SandboxConnectionAccountUpdateParams = + SandboxConnectionAccountUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `put /sandbox/connections/accounts`, but is otherwise the + * same as [AccountService.update]. + */ + @MustBeClosed + fun update(requestOptions: RequestOptions): HttpResponseFor = + update(SandboxConnectionAccountUpdateParams.none(), requestOptions) + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt index 2a56a2c3..667138e5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError @@ -21,60 +23,85 @@ import com.tryfinch.api.models.SandboxConnectionAccountUpdateParams class AccountServiceImpl internal constructor(private val clientOptions: ClientOptions) : AccountService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: AccountService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + override fun withRawResponse(): AccountService.WithRawResponse = withRawResponse - /** Create a new account for an existing connection (company/provider pair) */ override fun create( params: SandboxConnectionAccountCreateParams, requestOptions: RequestOptions, - ): AccountCreateResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("sandbox", "connections", "accounts") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } + ): AccountCreateResponse = + // post /sandbox/connections/accounts + withRawResponse().create(params, requestOptions).parse() - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** - * Update an existing sandbox account. Change the connection status to understand how the Finch - * API responds. - */ override fun update( params: SandboxConnectionAccountUpdateParams, requestOptions: RequestOptions, - ): AccountUpdateResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.PUT) - .addPathSegments("sandbox", "connections", "accounts") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): AccountUpdateResponse = + // put /sandbox/connections/accounts + withRawResponse().update(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + AccountService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun create( + params: SandboxConnectionAccountCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("sandbox", "connections", "accounts") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun update( + params: SandboxConnectionAccountUpdateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("sandbox", "connections", "accounts") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationService.kt index 4dfb7f1b..b0bd512d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationService.kt @@ -4,13 +4,20 @@ package com.tryfinch.api.services.blocking.sandbox.jobs +import com.google.errorprone.annotations.MustBeClosed import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.SandboxJobConfiguration import com.tryfinch.api.models.SandboxJobConfigurationRetrieveParams import com.tryfinch.api.models.SandboxJobConfigurationUpdateParams interface ConfigurationService { + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + /** Get configurations for sandbox jobs */ @JvmOverloads fun retrieve( @@ -29,4 +36,43 @@ interface ConfigurationService { params: SandboxJobConfigurationUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): SandboxJobConfiguration + + /** + * A view of [ConfigurationService] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `get /sandbox/jobs/configuration`, but is otherwise the + * same as [ConfigurationService.retrieve]. + */ + @JvmOverloads + @MustBeClosed + fun retrieve( + params: SandboxJobConfigurationRetrieveParams = + SandboxJobConfigurationRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor> + + /** + * Returns a raw HTTP response for `get /sandbox/jobs/configuration`, but is otherwise the + * same as [ConfigurationService.retrieve]. + */ + @MustBeClosed + fun retrieve( + requestOptions: RequestOptions + ): HttpResponseFor> = + retrieve(SandboxJobConfigurationRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `put /sandbox/jobs/configuration`, but is otherwise the + * same as [ConfigurationService.update]. + */ + @JvmOverloads + @MustBeClosed + fun update( + params: SandboxJobConfigurationUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt index 1275e945..cfd29961 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt @@ -10,6 +10,8 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError @@ -20,58 +22,84 @@ import com.tryfinch.api.models.SandboxJobConfigurationUpdateParams class ConfigurationServiceImpl internal constructor(private val clientOptions: ClientOptions) : ConfigurationService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val withRawResponse: ConfigurationService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } - private val retrieveHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + override fun withRawResponse(): ConfigurationService.WithRawResponse = withRawResponse - /** Get configurations for sandbox jobs */ override fun retrieve( params: SandboxJobConfigurationRetrieveParams, requestOptions: RequestOptions, - ): List { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("sandbox", "jobs", "configuration") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.forEach { it.validate() } - } - } - } + ): List = + // get /sandbox/jobs/configuration + withRawResponse().retrieve(params, requestOptions).parse() - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Update configurations for sandbox jobs */ override fun update( params: SandboxJobConfigurationUpdateParams, requestOptions: RequestOptions, - ): SandboxJobConfiguration { - val request = - HttpRequest.builder() - .method(HttpMethod.PUT) - .addPathSegments("sandbox", "jobs", "configuration") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response - .use { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } + ): SandboxJobConfiguration = + // put /sandbox/jobs/configuration + withRawResponse().update(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + ConfigurationService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val retrieveHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieve( + params: SandboxJobConfigurationRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("sandbox", "jobs", "configuration") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun update( + params: SandboxJobConfigurationUpdateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("sandbox", "jobs", "configuration") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } } + } } } From 7cb2a7f642d7bcaf67deec5d5f355682fe9b8e3e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Mar 2025 19:58:57 +0000 Subject: [PATCH 05/65] chore(client)!: refactor multipart formdata impl (#473) chore(internal): move `HttpRequestBodies` file chore(internal): extract function for checking for lists in json fields # Migration 1. Builder methods that used to take `contentType` and `filename` as positional parameters after the main argument now no longer do. To set a custom `contentType` or `filename`, pass `MultipartField`, which can be constructed via `MultipartField.builder()`. 2. It's unlikely you were referencing it, but `MultipartFormValue` is now called `MultipartField` if you were. --- .../kotlin/com/tryfinch/api/core/Check.kt | 12 ++ .../tryfinch/api/core/HttpRequestBodies.kt | 108 --------------- .../kotlin/com/tryfinch/api/core/Values.kt | 127 +++++++++--------- .../api/core/http/HttpRequestBodies.kt | 90 +++++++++++++ .../api/models/AccountCreateResponse.kt | 11 +- .../api/models/AccountUpdateResponse.kt | 11 +- .../models/BenefitFeaturesAndOperations.kt | 41 ++---- .../kotlin/com/tryfinch/api/models/Company.kt | 31 +---- .../api/models/CompanyUpdateResponse.kt | 31 +---- .../api/models/ConnectSessionNewParams.kt | 11 +- .../ConnectSessionReauthenticateParams.kt | 11 +- .../api/models/ConnectionCreateResponse.kt | 11 +- .../api/models/CreateAccessTokenResponse.kt | 11 +- .../api/models/DocumentListResponse.kt | 11 +- .../com/tryfinch/api/models/EmploymentData.kt | 21 +-- .../api/models/EmploymentUpdateResponse.kt | 21 +-- ...HrisBenefitIndividualUnenrollManyParams.kt | 11 +- .../HrisEmploymentRetrieveManyParams.kt | 11 +- .../HrisIndividualRetrieveManyParams.kt | 21 +-- .../HrisPayStatementRetrieveManyParams.kt | 11 +- .../com/tryfinch/api/models/Individual.kt | 21 +-- .../models/IndividualEnrolledIdsResponse.kt | 11 +- .../api/models/IndividualUpdateResponse.kt | 21 +-- .../com/tryfinch/api/models/Introspection.kt | 31 +---- .../com/tryfinch/api/models/ManualAsyncJob.kt | 11 +- .../api/models/PayGroupListResponse.kt | 11 +- .../api/models/PayGroupRetrieveResponse.kt | 21 +-- .../com/tryfinch/api/models/PayStatement.kt | 41 ++---- .../api/models/PayStatementResponseBody.kt | 11 +- .../kotlin/com/tryfinch/api/models/Payment.kt | 31 +---- .../com/tryfinch/api/models/Provider.kt | 21 +-- .../api/models/SandboxCompanyUpdateParams.kt | 31 +---- .../SandboxConnectionAccountCreateParams.kt | 11 +- .../models/SandboxConnectionCreateParams.kt | 11 +- .../models/SandboxDirectoryCreateParams.kt | 41 ++---- .../models/SandboxEmploymentUpdateParams.kt | 21 +-- .../models/SandboxIndividualUpdateParams.kt | 21 +-- .../api/models/SandboxPaymentCreateParams.kt | 51 ++----- .../tryfinch/api/models/SupportedBenefit.kt | 41 ++---- .../async/AccessTokenServiceAsyncImpl.kt | 2 +- .../services/async/AccountServiceAsyncImpl.kt | 2 +- .../RequestForwardingServiceAsyncImpl.kt | 2 +- .../async/connect/SessionServiceAsyncImpl.kt | 2 +- .../async/hris/BenefitServiceAsyncImpl.kt | 2 +- .../async/hris/EmploymentServiceAsyncImpl.kt | 2 +- .../async/hris/IndividualServiceAsyncImpl.kt | 2 +- .../hris/PayStatementServiceAsyncImpl.kt | 2 +- .../benefits/IndividualServiceAsyncImpl.kt | 2 +- .../async/jobs/AutomatedServiceAsyncImpl.kt | 2 +- .../async/sandbox/CompanyServiceAsyncImpl.kt | 2 +- .../sandbox/ConnectionServiceAsyncImpl.kt | 2 +- .../sandbox/DirectoryServiceAsyncImpl.kt | 2 +- .../sandbox/EmploymentServiceAsyncImpl.kt | 2 +- .../sandbox/IndividualServiceAsyncImpl.kt | 2 +- .../async/sandbox/JobServiceAsyncImpl.kt | 2 +- .../async/sandbox/PaymentServiceAsyncImpl.kt | 2 +- .../connections/AccountServiceAsyncImpl.kt | 2 +- .../jobs/ConfigurationServiceAsyncImpl.kt | 2 +- .../blocking/AccessTokenServiceImpl.kt | 2 +- .../services/blocking/AccountServiceImpl.kt | 2 +- .../blocking/RequestForwardingServiceImpl.kt | 2 +- .../blocking/connect/SessionServiceImpl.kt | 2 +- .../blocking/hris/BenefitServiceImpl.kt | 2 +- .../blocking/hris/EmploymentServiceImpl.kt | 2 +- .../blocking/hris/IndividualServiceImpl.kt | 2 +- .../blocking/hris/PayStatementServiceImpl.kt | 2 +- .../hris/benefits/IndividualServiceImpl.kt | 2 +- .../blocking/jobs/AutomatedServiceImpl.kt | 2 +- .../blocking/sandbox/CompanyServiceImpl.kt | 2 +- .../blocking/sandbox/ConnectionServiceImpl.kt | 2 +- .../blocking/sandbox/DirectoryServiceImpl.kt | 2 +- .../blocking/sandbox/EmploymentServiceImpl.kt | 2 +- .../blocking/sandbox/IndividualServiceImpl.kt | 2 +- .../blocking/sandbox/JobServiceImpl.kt | 2 +- .../blocking/sandbox/PaymentServiceImpl.kt | 2 +- .../sandbox/connections/AccountServiceImpl.kt | 2 +- .../sandbox/jobs/ConfigurationServiceImpl.kt | 2 +- 77 files changed, 375 insertions(+), 773 deletions(-) delete mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/core/HttpRequestBodies.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpRequestBodies.kt 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 38ad8b3e..50c06050 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 @@ -5,6 +5,18 @@ package com.tryfinch.api.core fun checkRequired(name: String, value: T?): T = checkNotNull(value) { "`$name` is required, but was not set" } +@JvmSynthetic +internal fun checkKnown(name: String, value: JsonField): T = + value.asKnown().orElseThrow { + IllegalStateException("`$name` is not a known type: ${value.javaClass.simpleName}") + } + +@JvmSynthetic +internal fun checkKnown(name: String, value: MultipartField): T = + value.value.asKnown().orElseThrow { + IllegalStateException("`$name` is not a known type: ${value.javaClass.simpleName}") + } + @JvmSynthetic internal fun checkLength(name: String, value: String, length: Int): String = value.also { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/HttpRequestBodies.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/HttpRequestBodies.kt deleted file mode 100644 index 4d3d1862..00000000 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/HttpRequestBodies.kt +++ /dev/null @@ -1,108 +0,0 @@ -@file:JvmName("HttpRequestBodies") - -package com.tryfinch.api.core - -import com.fasterxml.jackson.databind.json.JsonMapper -import com.tryfinch.api.core.http.HttpRequestBody -import com.tryfinch.api.errors.FinchException -import java.io.ByteArrayOutputStream -import java.io.OutputStream -import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder - -@JvmSynthetic -internal inline fun json(jsonMapper: JsonMapper, value: T): HttpRequestBody { - return object : HttpRequestBody { - private var cachedBytes: ByteArray? = null - - private fun serialize(): ByteArray { - if (cachedBytes != null) return cachedBytes!! - - val buffer = ByteArrayOutputStream() - try { - jsonMapper.writeValue(buffer, value) - cachedBytes = buffer.toByteArray() - return cachedBytes!! - } catch (e: Exception) { - throw FinchException("Error writing request", e) - } - } - - override fun writeTo(outputStream: OutputStream) { - outputStream.write(serialize()) - } - - override fun contentType(): String = "application/json" - - override fun contentLength(): Long { - return serialize().size.toLong() - } - - override fun repeatable(): Boolean = true - - override fun close() {} - } -} - -@JvmSynthetic -internal fun multipartFormData( - jsonMapper: JsonMapper, - parts: Array?>, -): HttpRequestBody { - val builder = MultipartEntityBuilder.create() - parts.forEach { part -> - if (part?.value != null) { - when (part.value) { - is JsonValue -> { - val buffer = ByteArrayOutputStream() - try { - jsonMapper.writeValue(buffer, part.value) - } catch (e: Exception) { - throw FinchException("Error serializing value to json", e) - } - builder.addBinaryBody( - part.name, - buffer.toByteArray(), - part.contentType, - part.filename, - ) - } - is Boolean -> - builder.addTextBody( - part.name, - if (part.value) "true" else "false", - part.contentType, - ) - is Int -> builder.addTextBody(part.name, part.value.toString(), part.contentType) - is Long -> builder.addTextBody(part.name, part.value.toString(), part.contentType) - is Double -> builder.addTextBody(part.name, part.value.toString(), part.contentType) - is ByteArray -> - builder.addBinaryBody(part.name, part.value, part.contentType, part.filename) - is String -> builder.addTextBody(part.name, part.value, part.contentType) - is Enum -> builder.addTextBody(part.name, part.value.toString(), part.contentType) - else -> - throw IllegalArgumentException( - "Unsupported content type: ${part.value::class.java.simpleName}" - ) - } - } - } - val entity = builder.build() - - return object : HttpRequestBody { - override fun writeTo(outputStream: OutputStream) { - try { - return entity.writeTo(outputStream) - } catch (e: Exception) { - throw FinchException("Error writing request", e) - } - } - - override fun contentType(): String = entity.contentType - - override fun contentLength(): Long = -1 - - override fun repeatable(): Boolean = entity.isRepeatable - - override fun close() = entity.close() - } -} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt index 95574500..b5242672 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt @@ -27,10 +27,8 @@ import com.fasterxml.jackson.databind.node.JsonNodeType.POJO import com.fasterxml.jackson.databind.node.JsonNodeType.STRING import com.fasterxml.jackson.databind.ser.std.NullSerializer import com.tryfinch.api.errors.FinchInvalidDataException -import java.nio.charset.Charset import java.util.Objects import java.util.Optional -import org.apache.hc.core5.http.ContentType @JsonDeserialize(using = JsonField.Deserializer::class) sealed class JsonField { @@ -287,12 +285,12 @@ private constructor( return true } - return other is KnownValue<*> && value == other.value + return other is KnownValue<*> && value contentEquals other.value } - override fun hashCode() = value.hashCode() + override fun hashCode() = contentHash(value) - override fun toString() = value.toString() + override fun toString() = value.contentToString() companion object { @JsonCreator @JvmStatic fun of(value: T) = KnownValue(value) @@ -462,15 +460,63 @@ annotation class ExcludeMissing ) annotation class NoAutoDetect -class MultipartFormValue -internal constructor( - val name: String, - val value: T, - val contentType: ContentType, - val filename: String? = null, +class MultipartField +private constructor( + @get:JvmName("value") val value: JsonField, + @get:JvmName("contentType") val contentType: String, + private val filename: String?, ) { - private val hashCode: Int by lazy { contentHash(name, value, contentType, filename) } + companion object { + + @JvmStatic fun of(value: T?) = builder().value(value).build() + + @JvmStatic fun of(value: JsonField) = builder().value(value).build() + + @JvmStatic fun builder() = Builder() + } + + fun filename(): Optional = Optional.ofNullable(filename) + + @JvmSynthetic + internal fun map(transform: (T) -> R): MultipartField = + MultipartField.builder() + .value(value.map(transform)) + .contentType(contentType) + .filename(filename) + .build() + + /** A builder for [MultipartField]. */ + class Builder internal constructor() { + + private var value: JsonField? = null + private var contentType: String? = null + private var filename: String? = null + + fun value(value: JsonField) = apply { this.value = value } + + fun value(value: T?) = value(JsonField.ofNullable(value)) + + fun contentType(contentType: String) = apply { this.contentType = contentType } + + fun filename(filename: String?) = apply { this.filename = filename } + + fun filename(filename: Optional) = filename(filename.orElse(null)) + + fun build(): MultipartField { + val value = checkRequired("value", value) + return MultipartField( + value, + contentType + ?: if (value is KnownValue && value.value is ByteArray) + "application/octet-stream" + else "text/plain; charset=utf-8", + filename, + ) + } + } + + private val hashCode: Int by lazy { contentHash(value, contentType, filename) } override fun hashCode(): Int = hashCode @@ -479,63 +525,12 @@ internal constructor( return true } - return other is MultipartFormValue<*> && - name == other.name && - value contentEquals other.value && + return other is MultipartField<*> && + value == other.value && contentType == other.contentType && filename == other.filename } override fun toString(): String = - "MultipartFormValue{name=$name, contentType=$contentType, filename=$filename, value=${valueToString()}}" - - private fun valueToString(): String = - when (value) { - is ByteArray -> "ByteArray of size ${value.size}" - else -> value.toString() - } - - companion object { - internal fun fromString( - name: String, - value: String, - contentType: ContentType, - ): MultipartFormValue = MultipartFormValue(name, value, contentType) - - internal fun fromBoolean( - name: String, - value: Boolean, - contentType: ContentType, - ): MultipartFormValue = MultipartFormValue(name, value, contentType) - - internal fun fromLong( - name: String, - value: Long, - contentType: ContentType, - ): MultipartFormValue = MultipartFormValue(name, value, contentType) - - internal fun fromDouble( - name: String, - value: Double, - contentType: ContentType, - ): MultipartFormValue = MultipartFormValue(name, value, contentType) - - internal fun fromEnum( - name: String, - value: T, - contentType: ContentType, - ): MultipartFormValue = MultipartFormValue(name, value, contentType) - - internal fun fromByteArray( - name: String, - value: ByteArray, - contentType: ContentType, - filename: String? = null, - ): MultipartFormValue = MultipartFormValue(name, value, contentType, filename) - } -} - -internal object ContentTypes { - val DefaultText = ContentType.create(ContentType.TEXT_PLAIN.mimeType, Charset.forName("UTF-8")) - val DefaultBinary = ContentType.DEFAULT_BINARY + "MultipartField{value=$value, contentType=$contentType, filename=$filename}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpRequestBodies.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpRequestBodies.kt new file mode 100644 index 00000000..f24d9dd3 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpRequestBodies.kt @@ -0,0 +1,90 @@ +// File generated from our OpenAPI spec by Stainless. + +@file:JvmName("HttpRequestBodies") + +package com.tryfinch.api.core.http + +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.databind.node.JsonNodeType +import com.tryfinch.api.core.MultipartField +import com.tryfinch.api.errors.FinchInvalidDataException +import java.io.OutputStream +import kotlin.jvm.optionals.getOrNull +import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder +import org.apache.hc.core5.http.ContentType +import org.apache.hc.core5.http.HttpEntity + +@JvmSynthetic +internal inline fun json(jsonMapper: JsonMapper, value: T): HttpRequestBody = + object : HttpRequestBody { + private val bytes: ByteArray by lazy { jsonMapper.writeValueAsBytes(value) } + + override fun writeTo(outputStream: OutputStream) = outputStream.write(bytes) + + override fun contentType(): String = "application/json" + + override fun contentLength(): Long = bytes.size.toLong() + + override fun repeatable(): Boolean = true + + override fun close() {} + } + +@JvmSynthetic +internal fun multipartFormData( + jsonMapper: JsonMapper, + fields: Map>, +): HttpRequestBody = + object : HttpRequestBody { + private val entity: HttpEntity by lazy { + MultipartEntityBuilder.create() + .apply { + fields.forEach { (name, field) -> + val node = jsonMapper.valueToTree(field.value) + serializePart(name, node).forEach { (name, bytes) -> + addBinaryBody( + name, + bytes, + ContentType.parseLenient(field.contentType), + field.filename().getOrNull(), + ) + } + } + } + .build() + } + + private fun serializePart(name: String, node: JsonNode): Sequence> = + when (node.nodeType) { + JsonNodeType.MISSING, + JsonNodeType.NULL -> emptySequence() + JsonNodeType.BINARY -> sequenceOf(name to node.binaryValue()) + JsonNodeType.STRING -> sequenceOf(name to node.textValue().toByteArray()) + JsonNodeType.BOOLEAN -> + sequenceOf(name to node.booleanValue().toString().toByteArray()) + JsonNodeType.NUMBER -> + sequenceOf(name to node.numberValue().toString().toByteArray()) + JsonNodeType.ARRAY -> + node.elements().asSequence().flatMap { element -> + serializePart("$name[]", element) + } + JsonNodeType.OBJECT -> + node.fields().asSequence().flatMap { (key, value) -> + serializePart("$name[$key]", value) + } + JsonNodeType.POJO, + null -> + throw FinchInvalidDataException("Unexpected JsonNode type: ${node.nodeType}") + } + + override fun writeTo(outputStream: OutputStream) = entity.writeTo(outputStream) + + override fun contentType(): String = entity.contentType + + override fun contentLength(): Long = entity.contentLength + + override fun repeatable(): Boolean = entity.isRepeatable + + override fun close() = entity.close() + } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt index fbbf3441..5051662d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable @@ -190,14 +191,8 @@ private constructor( fun addProduct(product: String) = apply { products = - (products ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(product) + (products ?: JsonField.of(mutableListOf())).also { + checkKnown("products", it).add(product) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt index ef5ca08a..0a4a418e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable @@ -168,14 +169,8 @@ private constructor( fun addProduct(product: String) = apply { products = - (products ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(product) + (products ?: JsonField.of(mutableListOf())).also { + checkKnown("products", it).add(product) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt index e59b1426..0df90c76 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -350,14 +351,8 @@ private constructor( */ fun addCompanyContribution(companyContribution: CompanyContribution) = apply { this.companyContribution = - (this.companyContribution ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(companyContribution) + (this.companyContribution ?: JsonField.of(mutableListOf())).also { + checkKnown("companyContribution", it).add(companyContribution) } } @@ -385,14 +380,8 @@ private constructor( /** Supported deduction types. An empty array indicates deductions are not supported. */ fun addEmployeeDeduction(employeeDeduction: EmployeeDeduction) = apply { this.employeeDeduction = - (this.employeeDeduction ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(employeeDeduction) + (this.employeeDeduction ?: JsonField.of(mutableListOf())).also { + checkKnown("employeeDeduction", it).add(employeeDeduction) } } @@ -408,14 +397,8 @@ private constructor( /** The list of frequencies supported by the provider for this benefit */ fun addFrequency(frequency: BenefitFrequency) = apply { frequencies = - (frequencies ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(frequency) + (frequencies ?: JsonField.of(mutableListOf())).also { + checkKnown("frequencies", it).add(frequency) } } @@ -448,14 +431,8 @@ private constructor( */ fun addHsaContributionLimit(hsaContributionLimit: HsaContributionLimit) = apply { this.hsaContributionLimit = - (this.hsaContributionLimit ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(hsaContributionLimit) + (this.hsaContributionLimit ?: JsonField.of(mutableListOf())).also { + checkKnown("hsaContributionLimit", it).add(hsaContributionLimit) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt index 4501824b..ff5bf5f4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable @@ -191,14 +192,8 @@ private constructor( /** An array of bank account objects associated with the payroll/HRIS system. */ fun addAccount(account: Account) = apply { accounts = - (accounts ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(account) + (accounts ?: JsonField.of(mutableListOf())).also { + checkKnown("accounts", it).add(account) } } @@ -218,14 +213,8 @@ private constructor( /** The array of company departments. */ fun addDepartment(department: Department) = apply { departments = - (departments ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(department) + (departments ?: JsonField.of(mutableListOf())).also { + checkKnown("departments", it).add(department) } } @@ -266,14 +255,8 @@ private constructor( fun addLocation(location: Location) = apply { locations = - (locations ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(location) + (locations ?: JsonField.of(mutableListOf())).also { + checkKnown("locations", it).add(location) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt index 6e276c55..5dbdf1af 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable @@ -175,14 +176,8 @@ private constructor( /** An array of bank account objects associated with the payroll/HRIS system. */ fun addAccount(account: Account) = apply { accounts = - (accounts ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(account) + (accounts ?: JsonField.of(mutableListOf())).also { + checkKnown("accounts", it).add(account) } } @@ -202,14 +197,8 @@ private constructor( /** The array of company departments. */ fun addDepartment(department: Department) = apply { departments = - (departments ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(department) + (departments ?: JsonField.of(mutableListOf())).also { + checkKnown("departments", it).add(department) } } @@ -250,14 +239,8 @@ private constructor( fun addLocation(location: Location) = apply { locations = - (locations ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(location) + (locations ?: JsonField.of(mutableListOf())).also { + checkKnown("locations", it).add(location) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt index 622a3456..b6a90863 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -251,14 +252,8 @@ private constructor( fun addProduct(product: ConnectProducts) = apply { products = - (products ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(product) + (products ?: JsonField.of(mutableListOf())).also { + checkKnown("products", it).add(product) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt index 50101242..da4644e5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -221,14 +222,8 @@ private constructor( /** The products to request access to (optional for reauthentication) */ fun addProduct(product: ConnectProducts) = apply { products = - (products ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(product) + (products ?: JsonField.of(mutableListOf())).also { + checkKnown("products", it).add(product) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt index 36084ea1..fa3dfdc8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable @@ -201,14 +202,8 @@ private constructor( fun addProduct(product: String) = apply { products = - (products ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(product) + (products ?: JsonField.of(mutableListOf())).also { + checkKnown("products", it).add(product) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt index 1030bc51..67aef12f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable @@ -277,14 +278,8 @@ private constructor( /** An array of the authorized products associated with the `access_token`. */ fun addProduct(product: String) = apply { products = - (products ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(product) + (products ?: JsonField.of(mutableListOf())).also { + checkKnown("products", it).add(product) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt index ed73b872..8fad3473 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt @@ -11,6 +11,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable @@ -84,14 +85,8 @@ private constructor( fun addDocument(document: DocumentResponse) = apply { documents = - (documents ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(document) + (documents ?: JsonField.of(mutableListOf())).also { + checkKnown("documents", it).add(document) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt index 75f7e6db..a18314c7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -369,14 +370,8 @@ private constructor( */ fun addCustomField(customField: CustomField) = apply { customFields = - (customFields ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(customField) + (customFields ?: JsonField.of(mutableListOf())).also { + checkKnown("customFields", it).add(customField) } } @@ -472,14 +467,8 @@ private constructor( /** The array of income history. */ fun addIncomeHistory(incomeHistory: Income) = apply { this.incomeHistory = - (this.incomeHistory ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(incomeHistory) + (this.incomeHistory ?: JsonField.of(mutableListOf())).also { + checkKnown("incomeHistory", it).add(incomeHistory) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt index f900c3bb..022b8418 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -339,14 +340,8 @@ private constructor( */ fun addCustomField(customField: CustomField) = apply { customFields = - (customFields ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(customField) + (customFields ?: JsonField.of(mutableListOf())).also { + checkKnown("customFields", it).add(customField) } } @@ -433,14 +428,8 @@ private constructor( /** The array of income history. */ fun addIncomeHistory(incomeHistory: Income) = apply { this.incomeHistory = - (this.incomeHistory ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(incomeHistory) + (this.incomeHistory ?: JsonField.of(mutableListOf())).also { + checkKnown("incomeHistory", it).add(incomeHistory) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt index 9994d336..ffb8bc4c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -122,14 +123,8 @@ private constructor( /** Array of individual_ids to unenroll. */ fun addIndividualId(individualId: String) = apply { individualIds = - (individualIds ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(individualId) + (individualIds ?: JsonField.of(mutableListOf())).also { + checkKnown("individualIds", it).add(individualId) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt index 7dc8e0fa..a9a6d5cf 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -110,14 +111,8 @@ private constructor( /** The array of batch requests. */ fun addRequest(request: Request) = apply { requests = - (requests ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(request) + (requests ?: JsonField.of(mutableListOf())).also { + checkKnown("requests", it).add(request) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt index 3809d289..23b067d4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap @@ -123,14 +124,8 @@ private constructor( fun addRequest(request: Request) = apply { requests = - (requests ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(request) + (requests ?: JsonField.of(mutableListOf())).also { + checkKnown("requests", it).add(request) } } @@ -399,14 +394,8 @@ private constructor( fun addInclude(include: String) = apply { this.include = - (this.include ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(include) + (this.include ?: JsonField.of(mutableListOf())).also { + checkKnown("include", it).add(include) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt index 7bf49d28..6628153c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -114,14 +115,8 @@ private constructor( /** The array of batch requests. */ fun addRequest(request: Request) = apply { requests = - (requests ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(request) + (requests ?: JsonField.of(mutableListOf())).also { + checkKnown("requests", it).add(request) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt index e2f8fcb0..79ce4062 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -245,14 +246,8 @@ private constructor( fun addEmail(email: Email) = apply { emails = - (emails ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(email) + (emails ?: JsonField.of(mutableListOf())).also { + checkKnown("emails", it).add(email) } } @@ -336,14 +331,8 @@ private constructor( fun addPhoneNumber(phoneNumber: PhoneNumber) = apply { phoneNumbers = - (phoneNumbers ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(phoneNumber) + (phoneNumbers ?: JsonField.of(mutableListOf())).also { + checkKnown("phoneNumbers", it).add(phoneNumber) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt index 4d93c7c2..d14959ad 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt @@ -11,6 +11,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable @@ -88,14 +89,8 @@ private constructor( fun addIndividualId(individualId: String) = apply { individualIds = - (individualIds ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(individualId) + (individualIds ?: JsonField.of(mutableListOf())).also { + checkKnown("individualIds", it).add(individualId) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt index cd046d07..613b0a88 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -245,14 +246,8 @@ private constructor( fun addEmail(email: Email) = apply { emails = - (emails ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(email) + (emails ?: JsonField.of(mutableListOf())).also { + checkKnown("emails", it).add(email) } } @@ -336,14 +331,8 @@ private constructor( fun addPhoneNumber(phoneNumber: PhoneNumber) = apply { phoneNumbers = - (phoneNumbers ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(phoneNumber) + (phoneNumbers ?: JsonField.of(mutableListOf())).also { + checkKnown("phoneNumbers", it).add(phoneNumber) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt index d3ea4304..01202602 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable @@ -344,14 +345,8 @@ private constructor( fun addAuthenticationMethod(authenticationMethod: AuthenticationMethod) = apply { authenticationMethods = - (authenticationMethods ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(authenticationMethod) + (authenticationMethods ?: JsonField.of(mutableListOf())).also { + checkKnown("authenticationMethods", it).add(authenticationMethod) } } @@ -513,14 +508,8 @@ private constructor( /** An array of the authorized products associated with the `access_token`. */ fun addProduct(product: String) = apply { products = - (products ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(product) + (products ?: JsonField.of(mutableListOf())).also { + checkKnown("products", it).add(product) } } @@ -674,14 +663,8 @@ private constructor( /** An array of the authorized products associated with the `access_token`. */ fun addProduct(product: String) = apply { products = - (products ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(product) + (products ?: JsonField.of(mutableListOf())).also { + checkKnown("products", it).add(product) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt index ded94816..7e44f78e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable @@ -101,14 +102,8 @@ private constructor( /** Specific information about the job, such as individual statuses for batch jobs. */ fun addBody(body: JsonValue) = apply { this.body = - (this.body ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(body) + (this.body ?: JsonField.of(mutableListOf())).also { + checkKnown("body", it).add(body) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt index 55d23e26..1dc7432d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -115,14 +116,8 @@ private constructor( /** List of pay frequencies associated with this pay group */ fun addPayFrequency(payFrequency: PayFrequency) = apply { payFrequencies = - (payFrequencies ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(payFrequency) + (payFrequencies ?: JsonField.of(mutableListOf())).also { + checkKnown("payFrequencies", it).add(payFrequency) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt index 40f1c2b2..ed5a74dc 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable @@ -116,14 +117,8 @@ private constructor( fun addIndividualId(individualId: String) = apply { individualIds = - (individualIds ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(individualId) + (individualIds ?: JsonField.of(mutableListOf())).also { + checkKnown("individualIds", it).add(individualId) } } @@ -145,14 +140,8 @@ private constructor( /** List of pay frequencies associated with this pay group */ fun addPayFrequency(payFrequency: PayFrequency) = apply { payFrequencies = - (payFrequencies ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(payFrequency) + (payFrequencies ?: JsonField.of(mutableListOf())).also { + checkKnown("payFrequencies", it).add(payFrequency) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt index 0553227d..18ae0b15 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -194,14 +195,8 @@ private constructor( /** The array of earnings objects associated with this pay statement */ fun addEarning(earning: Earning) = apply { earnings = - (earnings ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(earning) + (earnings ?: JsonField.of(mutableListOf())).also { + checkKnown("earnings", it).add(earning) } } @@ -221,14 +216,8 @@ private constructor( /** The array of deductions objects associated with this pay statement. */ fun addEmployeeDeduction(employeeDeduction: EmployeeDeduction) = apply { employeeDeductions = - (employeeDeductions ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(employeeDeduction) + (employeeDeductions ?: JsonField.of(mutableListOf())).also { + checkKnown("employeeDeductions", it).add(employeeDeduction) } } @@ -245,14 +234,8 @@ private constructor( fun addEmployerContribution(employerContribution: EmployerContribution) = apply { employerContributions = - (employerContributions ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(employerContribution) + (employerContributions ?: JsonField.of(mutableListOf())).also { + checkKnown("employerContributions", it).add(employerContribution) } } @@ -303,15 +286,7 @@ private constructor( /** The array of taxes objects associated with this pay statement. */ fun addTax(tax: Tax) = apply { taxes = - (taxes ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(tax) - } + (taxes ?: JsonField.of(mutableListOf())).also { checkKnown("taxes", it).add(tax) } } /** The number of hours worked for this pay period */ diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt index 4fdae059..f00af605 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt @@ -11,6 +11,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects @@ -95,14 +96,8 @@ private constructor( /** The array of pay statements for the current payment. */ fun addPayStatement(payStatement: PayStatement) = apply { payStatements = - (payStatements ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(payStatement) + (payStatements ?: JsonField.of(mutableListOf())).also { + checkKnown("payStatements", it).add(payStatement) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt index bc5df509..2c10a01f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -264,14 +265,8 @@ private constructor( /** Array of every individual on this payment. */ fun addIndividualId(individualId: String) = apply { individualIds = - (individualIds ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(individualId) + (individualIds ?: JsonField.of(mutableListOf())).also { + checkKnown("individualIds", it).add(individualId) } } @@ -303,14 +298,8 @@ private constructor( /** List of pay frequencies associated with this payment. */ fun addPayFrequency(payFrequency: PayFrequency) = apply { payFrequencies = - (payFrequencies ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(payFrequency) + (payFrequencies ?: JsonField.of(mutableListOf())).also { + checkKnown("payFrequencies", it).add(payFrequency) } } @@ -328,14 +317,8 @@ private constructor( /** Array of the Finch id (uuidv4) of every pay group associated with this payment. */ fun addPayGroupId(payGroupId: String) = apply { payGroupIds = - (payGroupIds ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(payGroupId) + (payGroupIds ?: JsonField.of(mutableListOf())).also { + checkKnown("payGroupIds", it).add(payGroupId) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt index ea274b56..7656aee6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable @@ -208,14 +209,8 @@ private constructor( /** The list of authentication methods supported by the provider. */ fun addAuthenticationMethod(authenticationMethod: AuthenticationMethod) = apply { authenticationMethods = - (authenticationMethods ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(authenticationMethod) + (authenticationMethods ?: JsonField.of(mutableListOf())).also { + checkKnown("authenticationMethods", it).add(authenticationMethod) } } @@ -282,14 +277,8 @@ private constructor( /** The list of Finch products supported on this payroll provider. */ fun addProduct(product: String) = apply { products = - (products ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(product) + (products ?: JsonField.of(mutableListOf())).also { + checkKnown("products", it).add(product) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt index d4593243..f6ab848c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -248,14 +249,8 @@ private constructor( /** An array of bank account objects associated with the payroll/HRIS system. */ fun addAccount(account: Account) = apply { accounts = - (accounts ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(account) + (accounts ?: JsonField.of(mutableListOf())).also { + checkKnown("accounts", it).add(account) } } @@ -275,14 +270,8 @@ private constructor( /** The array of company departments. */ fun addDepartment(department: Department) = apply { departments = - (departments ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(department) + (departments ?: JsonField.of(mutableListOf())).also { + checkKnown("departments", it).add(department) } } @@ -323,14 +312,8 @@ private constructor( fun addLocation(location: Location) = apply { locations = - (locations ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(location) + (locations ?: JsonField.of(mutableListOf())).also { + checkKnown("locations", it).add(location) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt index e450d723..80ed9555 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -202,14 +203,8 @@ private constructor( */ fun addProduct(product: String) = apply { products = - (products ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(product) + (products ?: JsonField.of(mutableListOf())).also { + checkKnown("products", it).add(product) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt index cf3c8589..88c8f610 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -209,14 +210,8 @@ private constructor( fun addProduct(product: String) = apply { products = - (products ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(product) + (products ?: JsonField.of(mutableListOf())).also { + checkKnown("products", it).add(product) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt index 3bca9b07..2b23dd8a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap @@ -475,14 +476,8 @@ private constructor( */ fun addCustomField(customField: CustomField) = apply { customFields = - (customFields ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(customField) + (customFields ?: JsonField.of(mutableListOf())).also { + checkKnown("customFields", it).add(customField) } } @@ -513,14 +508,8 @@ private constructor( fun addEmail(email: Email) = apply { emails = - (emails ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(email) + (emails ?: JsonField.of(mutableListOf())).also { + checkKnown("emails", it).add(email) } } @@ -643,14 +632,8 @@ private constructor( /** The array of income history. */ fun addIncomeHistory(incomeHistory: Income) = apply { this.incomeHistory = - (this.incomeHistory ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(incomeHistory) + (this.incomeHistory ?: JsonField.of(mutableListOf())).also { + checkKnown("incomeHistory", it).add(incomeHistory) } } @@ -722,14 +705,8 @@ private constructor( fun addPhoneNumber(phoneNumber: PhoneNumber) = apply { phoneNumbers = - (phoneNumbers ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(phoneNumber) + (phoneNumbers ?: JsonField.of(mutableListOf())).also { + checkKnown("phoneNumbers", it).add(phoneNumber) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt index 0eee4350..1db1258e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -478,14 +479,8 @@ private constructor( */ fun addCustomField(customField: CustomField) = apply { customFields = - (customFields ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(customField) + (customFields ?: JsonField.of(mutableListOf())).also { + checkKnown("customFields", it).add(customField) } } @@ -576,14 +571,8 @@ private constructor( /** The array of income history. */ fun addIncomeHistory(incomeHistory: Income) = apply { this.incomeHistory = - (this.incomeHistory ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(incomeHistory) + (this.incomeHistory ?: JsonField.of(mutableListOf())).also { + checkKnown("incomeHistory", it).add(incomeHistory) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt index 8a1deb50..ba87d11d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -351,14 +352,8 @@ private constructor( fun addEmail(email: Email) = apply { emails = - (emails ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(email) + (emails ?: JsonField.of(mutableListOf())).also { + checkKnown("emails", it).add(email) } } @@ -444,14 +439,8 @@ private constructor( fun addPhoneNumber(phoneNumber: PhoneNumber) = apply { phoneNumbers = - (phoneNumbers ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(phoneNumber) + (phoneNumbers ?: JsonField.of(mutableListOf())).also { + checkKnown("phoneNumbers", it).add(phoneNumber) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt index 27e89a23..28879f63 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap @@ -142,14 +143,8 @@ private constructor( fun addPayStatement(payStatement: PayStatement) = apply { payStatements = - (payStatements ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(payStatement) + (payStatements ?: JsonField.of(mutableListOf())).also { + checkKnown("payStatements", it).add(payStatement) } } @@ -557,14 +552,8 @@ private constructor( /** The array of earnings objects associated with this pay statement */ fun addEarning(earning: Earning) = apply { earnings = - (earnings ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(earning) + (earnings ?: JsonField.of(mutableListOf())).also { + checkKnown("earnings", it).add(earning) } } @@ -585,14 +574,8 @@ private constructor( /** The array of deductions objects associated with this pay statement. */ fun addEmployeeDeduction(employeeDeduction: EmployeeDeduction) = apply { employeeDeductions = - (employeeDeductions ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(employeeDeduction) + (employeeDeductions ?: JsonField.of(mutableListOf())).also { + checkKnown("employeeDeductions", it).add(employeeDeduction) } } @@ -611,14 +594,8 @@ private constructor( fun addEmployerContribution(employerContribution: EmployerContribution) = apply { employerContributions = - (employerContributions ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(employerContribution) + (employerContributions ?: JsonField.of(mutableListOf())).also { + checkKnown("employerContributions", it).add(employerContribution) } } @@ -669,14 +646,8 @@ private constructor( /** The array of taxes objects associated with this pay statement. */ fun addTax(tax: Tax) = apply { taxes = - (taxes ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(tax) + (taxes ?: JsonField.of(mutableListOf())).also { + checkKnown("taxes", it).add(tax) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt index b23e5480..b841a243 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -245,14 +246,8 @@ private constructor( */ fun addCompanyContribution(companyContribution: CompanyContribution) = apply { this.companyContribution = - (this.companyContribution ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(companyContribution) + (this.companyContribution ?: JsonField.of(mutableListOf())).also { + checkKnown("companyContribution", it).add(companyContribution) } } @@ -278,14 +273,8 @@ private constructor( /** Supported deduction types. An empty array indicates deductions are not supported. */ fun addEmployeeDeduction(employeeDeduction: EmployeeDeduction) = apply { this.employeeDeduction = - (this.employeeDeduction ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(employeeDeduction) + (this.employeeDeduction ?: JsonField.of(mutableListOf())).also { + checkKnown("employeeDeduction", it).add(employeeDeduction) } } @@ -301,14 +290,8 @@ private constructor( /** The list of frequencies supported by the provider for this benefit */ fun addFrequency(frequency: BenefitFrequency) = apply { frequencies = - (frequencies ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(frequency) + (frequencies ?: JsonField.of(mutableListOf())).also { + checkKnown("frequencies", it).add(frequency) } } @@ -341,14 +324,8 @@ private constructor( */ fun addHsaContributionLimit(hsaContributionLimit: HsaContributionLimit) = apply { this.hsaContributionLimit = - (this.hsaContributionLimit ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(hsaContributionLimit) + (this.hsaContributionLimit ?: JsonField.of(mutableListOf())).also { + checkKnown("hsaContributionLimit", it).add(hsaContributionLimit) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt index 8191c54c..02fb02b1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.errors.FinchException diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt index 844d6572..b83e838c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.AccountDisconnectParams diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt index f8cb4bea..928639ef 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.RequestForwardingForwardParams diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt index 3b5b900f..6fabcee7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.ConnectSessionNewParams diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt index 8c0c7451..123e0006 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.CompanyBenefit diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt index d8d52232..b8560f58 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisEmploymentRetrieveManyPageAsync diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt index 32e6cae6..5e9396af 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisIndividualRetrieveManyPageAsync diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt index e5bcd39b..b98f420d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisPayStatementRetrieveManyPageAsync diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt index 51ae2666..d75ae1ed 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisBenefitIndividualEnrolledIdsParams diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt index 2f0e9752..8c0e34ad 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.AutomatedAsyncJob diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt index 3d38f445..c30cd494 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.CompanyUpdateResponse diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt index c4491a8e..8788f49f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.ConnectionCreateResponse diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt index 1cfba40e..45f5202f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt @@ -12,8 +12,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.SandboxDirectoryCreateParams diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt index 6bca07b9..8efd07c5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.EmploymentUpdateResponse diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt index fedf9674..ee2c9a30 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.IndividualUpdateResponse diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt index e5c1d162..429a1aaa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.JobCreateResponse diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt index d3fdc07c..50278e61 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.PaymentCreateResponse diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt index 0267b549..5c1d24c3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.AccountCreateResponse diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt index 24031ec9..d9ba55aa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.SandboxJobConfiguration diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt index 56d0e107..fb2f408c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.errors.FinchException diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt index 0009c8d3..5cfc5591 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.AccountDisconnectParams diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt index 85a43df8..874c63ad 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.RequestForwardingForwardParams diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt index cdc51dca..47105698 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.ConnectSessionNewParams diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt index 695f7df6..d078194e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.CompanyBenefit diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt index 08091ed6..068ed532 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisEmploymentRetrieveManyPage diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt index d9305d4c..134703fc 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisIndividualRetrieveManyPage diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt index ffc89df9..70a23159 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisPayStatementRetrieveManyPage diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt index 68999b04..432f2d09 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisBenefitIndividualEnrolledIdsParams diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt index 9aa68f29..e72e2a74 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.AutomatedAsyncJob diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt index 63895a22..9be8246e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.CompanyUpdateResponse diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt index 120660ee..9efd11c8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.ConnectionCreateResponse diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt index 00a9ce1a..26ad0318 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt @@ -12,8 +12,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.SandboxDirectoryCreateParams diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt index 75701c91..fb69229c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.EmploymentUpdateResponse diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt index 93b1c96e..7cc8a380 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.IndividualUpdateResponse diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt index 8ea4fd5e..1919ba6e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.JobCreateResponse diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt index 143704ae..1fa0d6fa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.PaymentCreateResponse diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt index 667138e5..6603e97c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.AccountCreateResponse diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt index cfd29961..7af28ebd 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt @@ -11,8 +11,8 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable -import com.tryfinch.api.core.json import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.SandboxJobConfiguration From 81a5824dbff19ae8328a747aed49dc5ea1fbc2c8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Mar 2025 20:34:58 +0000 Subject: [PATCH 06/65] docs: add raw response readme documentation (#474) --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 1c73217a..9773d605 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,32 @@ CompletableFuture page = client.hris().directory().l The asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s. +## Raw responses + +The SDK defines methods that deserialize responses into instances of Java classes. However, these methods don't provide access to the response headers, status code, or the raw response body. + +To access this data, prefix any HTTP method call on a client or service with `withRawResponse()`: + +```java +import com.tryfinch.api.core.http.Headers; +import com.tryfinch.api.core.http.HttpResponseFor; +import com.tryfinch.api.models.HrisDirectoryListPage; +import com.tryfinch.api.models.HrisDirectoryListParams; + +HttpResponseFor page = client.hris().directory().withRawResponse().list(); + +int statusCode = page.statusCode(); +Headers headers = page.headers(); +``` + +You can still deserialize the response into an instance of a Java class if needed: + +```java +import com.tryfinch.api.models.HrisDirectoryListPage; + +HrisDirectoryListPage parsedPage = page.parse(); +``` + ## Error handling The SDK throws custom unchecked exception types: From 2d0c4c8f7d3b629db18937db95415474b10f8bc9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Mar 2025 23:00:11 +0000 Subject: [PATCH 07/65] docs: note required fields in `builder` javadoc (#475) --- .../api/client/okhttp/FinchOkHttpClient.kt | 1 + .../client/okhttp/FinchOkHttpClientAsync.kt | 1 + .../com/tryfinch/api/core/ClientOptions.kt | 8 + .../kotlin/com/tryfinch/api/core/Timeout.kt | 1 + .../com/tryfinch/api/errors/FinchError.kt | 1 + .../api/models/AccessTokenCreateParams.kt | 16 ++ .../api/models/AccountCreateResponse.kt | 14 ++ .../api/models/AccountDisconnectParams.kt | 1 + .../api/models/AccountIntrospectParams.kt | 1 + .../tryfinch/api/models/AccountUpdateEvent.kt | 142 ++++++++++++++++++ .../api/models/AccountUpdateResponse.kt | 12 ++ .../tryfinch/api/models/AutomatedAsyncJob.kt | 17 +++ .../api/models/AutomatedCreateResponse.kt | 11 ++ .../tryfinch/api/models/BaseWebhookEvent.kt | 9 ++ .../api/models/BenefitContribution.kt | 1 + .../models/BenefitFeaturesAndOperations.kt | 4 + .../tryfinch/api/models/BenefitsSupport.kt | 1 + .../kotlin/com/tryfinch/api/models/Company.kt | 20 +++ .../com/tryfinch/api/models/CompanyBenefit.kt | 11 ++ .../com/tryfinch/api/models/CompanyEvent.kt | 10 ++ .../api/models/CompanyUpdateResponse.kt | 19 +++ .../api/models/ConnectSessionNewParams.kt | 21 +++ .../ConnectSessionReauthenticateParams.kt | 17 +++ .../api/models/ConnectionCreateResponse.kt | 14 ++ .../api/models/CreateAccessTokenResponse.kt | 15 ++ .../models/CreateCompanyBenefitsResponse.kt | 9 ++ .../com/tryfinch/api/models/DirectoryEvent.kt | 10 ++ .../tryfinch/api/models/DisconnectResponse.kt | 8 + .../api/models/DocumentListResponse.kt | 9 ++ .../tryfinch/api/models/DocumentResponse.kt | 1 + .../com/tryfinch/api/models/EmploymentData.kt | 5 + .../api/models/EmploymentDataResponse.kt | 1 + .../tryfinch/api/models/EmploymentEvent.kt | 10 ++ .../api/models/EmploymentUpdateResponse.kt | 5 + .../tryfinch/api/models/EnrolledIndividual.kt | 2 + .../api/models/HrisBenefitCreateParams.kt | 2 + .../HrisBenefitIndividualEnrolledIdsParams.kt | 9 ++ ...nefitIndividualRetrieveManyBenefitsPage.kt | 4 + ...IndividualRetrieveManyBenefitsPageAsync.kt | 4 + ...fitIndividualRetrieveManyBenefitsParams.kt | 9 ++ .../HrisBenefitIndividualUnenrollManyPage.kt | 4 + ...sBenefitIndividualUnenrollManyPageAsync.kt | 4 + ...HrisBenefitIndividualUnenrollManyParams.kt | 10 ++ .../api/models/HrisBenefitListPage.kt | 1 + .../api/models/HrisBenefitListPageAsync.kt | 3 + .../api/models/HrisBenefitListParams.kt | 1 + .../HrisBenefitListSupportedBenefitsPage.kt | 4 + ...isBenefitListSupportedBenefitsPageAsync.kt | 4 + .../HrisBenefitListSupportedBenefitsParams.kt | 4 + .../api/models/HrisBenefitRetrieveParams.kt | 8 + .../api/models/HrisBenefitUpdateParams.kt | 9 ++ .../api/models/HrisCompanyRetrieveParams.kt | 3 + .../HrisDirectoryListIndividualsPage.kt | 4 + .../HrisDirectoryListIndividualsPageAsync.kt | 4 + .../HrisDirectoryListIndividualsParams.kt | 4 + .../api/models/HrisDirectoryListPage.kt | 3 + .../api/models/HrisDirectoryListPageAsync.kt | 4 + .../api/models/HrisDirectoryListParams.kt | 1 + .../api/models/HrisDocumentListParams.kt | 1 + .../api/models/HrisDocumentRetreiveParams.kt | 8 + .../models/HrisEmploymentRetrieveManyPage.kt | 4 + .../HrisEmploymentRetrieveManyPageAsync.kt | 4 + .../HrisEmploymentRetrieveManyParams.kt | 25 +++ .../models/HrisIndividualRetrieveManyPage.kt | 4 + .../HrisIndividualRetrieveManyPageAsync.kt | 4 + .../HrisIndividualRetrieveManyParams.kt | 7 + .../HrisPayStatementRetrieveManyPage.kt | 4 + .../HrisPayStatementRetrieveManyPageAsync.kt | 4 + .../HrisPayStatementRetrieveManyParams.kt | 25 +++ .../api/models/HrisPaymentListPage.kt | 1 + .../api/models/HrisPaymentListPageAsync.kt | 3 + .../api/models/HrisPaymentListParams.kt | 9 ++ .../kotlin/com/tryfinch/api/models/Income.kt | 1 + .../com/tryfinch/api/models/Individual.kt | 3 + .../tryfinch/api/models/IndividualBenefit.kt | 2 + .../models/IndividualEnrolledIdsResponse.kt | 10 ++ .../tryfinch/api/models/IndividualEvent.kt | 10 ++ .../api/models/IndividualInDirectory.kt | 3 + .../tryfinch/api/models/IndividualResponse.kt | 1 + .../api/models/IndividualUpdateResponse.kt | 3 + .../com/tryfinch/api/models/Introspection.kt | 26 ++++ .../api/models/JobAutomatedCreateParams.kt | 26 ++++ .../api/models/JobAutomatedListPage.kt | 1 + .../api/models/JobAutomatedListPageAsync.kt | 4 + .../api/models/JobAutomatedListParams.kt | 1 + .../api/models/JobAutomatedRetrieveParams.kt | 8 + .../tryfinch/api/models/JobCompletionEvent.kt | 18 +++ .../tryfinch/api/models/JobCreateResponse.kt | 11 ++ .../api/models/JobManualRetrieveParams.kt | 8 + .../com/tryfinch/api/models/Location.kt | 1 + .../com/tryfinch/api/models/ManualAsyncJob.kt | 10 ++ .../kotlin/com/tryfinch/api/models/Money.kt | 1 + .../api/models/OperationSupportMatrix.kt | 1 + .../kotlin/com/tryfinch/api/models/Paging.kt | 1 + .../api/models/PayGroupListResponse.kt | 1 + .../api/models/PayGroupRetrieveResponse.kt | 11 ++ .../com/tryfinch/api/models/PayStatement.kt | 29 ++++ .../tryfinch/api/models/PayStatementEvent.kt | 10 ++ .../api/models/PayStatementResponse.kt | 1 + .../api/models/PayStatementResponseBody.kt | 1 + .../kotlin/com/tryfinch/api/models/Payment.kt | 2 + .../api/models/PaymentCreateResponse.kt | 9 ++ .../com/tryfinch/api/models/PaymentEvent.kt | 18 +++ .../api/models/PayrollPayGroupListPage.kt | 3 + .../models/PayrollPayGroupListPageAsync.kt | 4 + .../api/models/PayrollPayGroupListParams.kt | 3 + .../models/PayrollPayGroupRetrieveParams.kt | 9 ++ .../com/tryfinch/api/models/Provider.kt | 95 ++++++++++++ .../tryfinch/api/models/ProviderListPage.kt | 1 + .../api/models/ProviderListPageAsync.kt | 3 + .../tryfinch/api/models/ProviderListParams.kt | 1 + .../models/RequestForwardingForwardParams.kt | 19 +++ .../RequestForwardingForwardResponse.kt | 24 +++ .../api/models/SandboxCompanyUpdateParams.kt | 34 +++++ .../SandboxConnectionAccountCreateParams.kt | 19 +++ .../SandboxConnectionAccountUpdateParams.kt | 5 + .../models/SandboxConnectionCreateParams.kt | 17 +++ .../models/SandboxDirectoryCreateParams.kt | 12 ++ .../models/SandboxEmploymentUpdateParams.kt | 14 ++ .../models/SandboxIndividualUpdateParams.kt | 12 ++ .../api/models/SandboxJobConfiguration.kt | 9 ++ .../SandboxJobConfigurationRetrieveParams.kt | 4 + .../SandboxJobConfigurationUpdateParams.kt | 9 ++ .../api/models/SandboxJobCreateParams.kt | 16 ++ .../api/models/SandboxPaymentCreateParams.kt | 37 +++++ .../tryfinch/api/models/SessionNewResponse.kt | 9 ++ .../models/SessionReauthenticateResponse.kt | 10 ++ .../api/models/SupportPerBenefitType.kt | 1 + .../tryfinch/api/models/SupportedBenefit.kt | 1 + .../api/models/UnenrolledIndividual.kt | 2 + .../models/UpdateCompanyBenefitResponse.kt | 8 + .../kotlin/com/tryfinch/api/models/W42005.kt | 2 + .../kotlin/com/tryfinch/api/models/W42020.kt | 2 + 133 files changed, 1251 insertions(+) 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 030cb02a..8a359cf5 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 @@ -18,6 +18,7 @@ class FinchOkHttpClient private constructor() { companion object { + /** Returns a mutable builder for constructing an instance of [FinchOkHttpClient]. */ @JvmStatic fun builder() = Builder() @JvmStatic fun fromEnv(): FinchClient = builder().fromEnv().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 cc8fc8c6..88241e66 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 @@ -18,6 +18,7 @@ class FinchOkHttpClientAsync private constructor() { companion object { + /** Returns a mutable builder for constructing an instance of [FinchOkHttpClientAsync]. */ @JvmStatic fun builder() = Builder() @JvmStatic fun fromEnv(): FinchClientAsync = builder().fromEnv().build() 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 563721bd..557f4b0b 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 @@ -36,6 +36,14 @@ private constructor( const val PRODUCTION_URL = "https://api.tryfinch.com" + /** + * Returns a mutable builder for constructing an instance of [ClientOptions]. + * + * The following fields are required: + * ```java + * .httpClient() + * ``` + */ @JvmStatic fun builder() = Builder() @JvmStatic fun fromEnv(): ClientOptions = builder().fromEnv().build() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt index 4a639d2d..208cd4e2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt @@ -60,6 +60,7 @@ private constructor( @JvmStatic fun default() = builder().build() + /** Returns a mutable builder for constructing an instance of [Timeout]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt index db1b299f..39ad220f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt @@ -27,6 +27,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [FinchError]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt index 38868876..06c2adcc 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt @@ -120,6 +120,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .code() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -212,6 +220,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [AccessTokenCreateParams]. + * + * The following fields are required: + * ```java + * .code() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt index 5051662d..322dbf3e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt @@ -121,6 +121,20 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [AccountCreateResponse]. + * + * The following fields are required: + * ```java + * .accessToken() + * .accountId() + * .authenticationType() + * .companyId() + * .connectionId() + * .products() + * .providerId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt index 1e95395e..9f7514f4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt @@ -39,6 +39,7 @@ private constructor( @JvmStatic fun none(): AccountDisconnectParams = builder().build() + /** Returns a mutable builder for constructing an instance of [AccountDisconnectParams]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt index c9718b4c..032683db 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt @@ -29,6 +29,7 @@ private constructor( @JvmStatic fun none(): AccountIntrospectParams = builder().build() + /** Returns a mutable builder for constructing an instance of [AccountIntrospectParams]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt index 5925dc19..7d18bc8d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt @@ -116,6 +116,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [AccountUpdateEvent]. + * + * The following fields are required: + * ```java + * .accountId() + * .companyId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -260,6 +269,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Data]. + * + * The following fields are required: + * ```java + * .authenticationMethod() + * .status() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -384,6 +402,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [AuthenticationMethod]. + */ @JvmStatic fun builder() = Builder() } @@ -579,6 +600,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [SupportedFields]. + */ @JvmStatic fun builder() = Builder() } @@ -808,6 +832,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SupportedCompanyFields]. + */ @JvmStatic fun builder() = Builder() } @@ -1011,6 +1039,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Accounts]. + */ @JvmStatic fun builder() = Builder() } @@ -1168,6 +1199,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [Departments]. + */ @JvmStatic fun builder() = Builder() } @@ -1260,6 +1295,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [Parent]. + */ @JvmStatic fun builder() = Builder() } @@ -1391,6 +1430,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Entity]. + */ @JvmStatic fun builder() = Builder() } @@ -1554,6 +1596,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [Locations]. + */ @JvmStatic fun builder() = Builder() } @@ -1727,6 +1773,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SupportedDirectoryFields]. + */ @JvmStatic fun builder() = Builder() } @@ -1889,6 +1939,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [Individuals]. + */ @JvmStatic fun builder() = Builder() } @@ -2031,6 +2085,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [Manager]. + */ @JvmStatic fun builder() = Builder() } @@ -2164,6 +2222,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Paging]. + */ @JvmStatic fun builder() = Builder() } @@ -2459,6 +2520,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SupportedEmploymentFields]. + */ @JvmStatic fun builder() = Builder() } @@ -2687,6 +2752,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [Department]. + */ @JvmStatic fun builder() = Builder() } @@ -2799,6 +2868,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [Employment]. + */ @JvmStatic fun builder() = Builder() } @@ -2930,6 +3003,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Income]. + */ @JvmStatic fun builder() = Builder() } @@ -3099,6 +3175,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Location]. + */ @JvmStatic fun builder() = Builder() } @@ -3241,6 +3320,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Manager]. + */ @JvmStatic fun builder() = Builder() } @@ -3482,6 +3564,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SupportedIndividualFields]. + */ @JvmStatic fun builder() = Builder() } @@ -3681,6 +3767,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Emails]. + */ @JvmStatic fun builder() = Builder() } @@ -3796,6 +3885,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [PhoneNumbers]. + */ @JvmStatic fun builder() = Builder() } @@ -3958,6 +4051,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [Residence]. + */ @JvmStatic fun builder() = Builder() } @@ -4147,6 +4244,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SupportedPayGroupFields]. + */ @JvmStatic fun builder() = Builder() } @@ -4291,6 +4392,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SupportedPayStatementFields]. + */ @JvmStatic fun builder() = Builder() } @@ -4400,6 +4505,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Paging]. + * + * The following fields are required: + * ```java + * .count() + * .offset() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -4617,6 +4731,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [PayStatements]. + */ @JvmStatic fun builder() = Builder() } @@ -4824,6 +4942,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [Earnings]. + */ @JvmStatic fun builder() = Builder() } @@ -5001,6 +5123,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [EmployeeDeductions]. + */ @JvmStatic fun builder() = Builder() } @@ -5165,6 +5291,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [EmployerContributions]. + */ @JvmStatic fun builder() = Builder() } @@ -5337,6 +5467,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [Taxes]. + */ @JvmStatic fun builder() = Builder() } @@ -5630,6 +5764,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SupportedPaymentFields]. + */ @JvmStatic fun builder() = Builder() } @@ -5830,6 +5968,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [PayPeriod]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt index 0a4a418e..bb19c19a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt @@ -113,6 +113,18 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [AccountUpdateResponse]. + * + * The following fields are required: + * ```java + * .accountId() + * .authenticationType() + * .companyId() + * .products() + * .providerId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt index 4a7fd197..8e448688 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt @@ -152,6 +152,22 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [AutomatedAsyncJob]. + * + * The following fields are required: + * ```java + * .completedAt() + * .createdAt() + * .jobId() + * .jobUrl() + * .params() + * .scheduledAt() + * .startedAt() + * .status() + * .type() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -349,6 +365,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Params]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt index ea36d6ea..50ee28d7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt @@ -83,6 +83,17 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [AutomatedCreateResponse]. + * + * The following fields are required: + * ```java + * .allowedRefreshes() + * .jobId() + * .jobUrl() + * .remainingRefreshes() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt index 51555300..9c4a9990 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt @@ -93,6 +93,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [BaseWebhookEvent]. + * + * The following fields are required: + * ```java + * .accountId() + * .companyId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt index bfef1c4b..4805034c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt @@ -59,6 +59,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [BenefitContribution]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt index 0df90c76..19b25387 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt @@ -66,6 +66,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [BenefitFeaturesAndOperations]. + */ @JvmStatic fun builder() = Builder() } @@ -252,6 +255,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [BenefitFeature]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt index 80e52ec7..f887a5d1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt @@ -177,6 +177,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [BenefitsSupport]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt index ff5bf5f4..846ed3ce 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt @@ -141,6 +141,22 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Company]. + * + * The following fields are required: + * ```java + * .id() + * .accounts() + * .departments() + * .ein() + * .entity() + * .legalName() + * .locations() + * .primaryEmail() + * .primaryPhoneNumber() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -413,6 +429,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Account]. */ @JvmStatic fun builder() = Builder() } @@ -707,6 +724,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Department]. */ @JvmStatic fun builder() = Builder() } @@ -801,6 +819,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Parent]. */ @JvmStatic fun builder() = Builder() } @@ -931,6 +950,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Entity]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt index 9f519ebf..632865f4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt @@ -80,6 +80,17 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [CompanyBenefit]. + * + * The following fields are required: + * ```java + * .benefitId() + * .description() + * .frequency() + * .type() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt index 160468eb..29d8479e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt @@ -116,6 +116,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [CompanyEvent]. + * + * The following fields are required: + * ```java + * .accountId() + * .companyId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -241,6 +250,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Data]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt index 5dbdf1af..a2f99650 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt @@ -133,6 +133,21 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [CompanyUpdateResponse]. + * + * The following fields are required: + * ```java + * .accounts() + * .departments() + * .ein() + * .entity() + * .legalName() + * .locations() + * .primaryEmail() + * .primaryPhoneNumber() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -396,6 +411,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Account]. */ @JvmStatic fun builder() = Builder() } @@ -690,6 +706,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Department]. */ @JvmStatic fun builder() = Builder() } @@ -784,6 +801,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Parent]. */ @JvmStatic fun builder() = Builder() } @@ -914,6 +932,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Entity]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt index b6a90863..c49cf357 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt @@ -203,6 +203,16 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .customerId() + * .customerName() + * .products() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -386,6 +396,16 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [ConnectSessionNewParams]. + * + * The following fields are required: + * ```java + * .customerId() + * .customerName() + * .products() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -792,6 +812,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Integration]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt index da4644e5..0a1d1aa0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt @@ -148,6 +148,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .connectionId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -289,6 +297,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [ConnectSessionReauthenticateParams]. + * + * The following fields are required: + * ```java + * .connectionId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt index fa3dfdc8..0ffd9785 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt @@ -130,6 +130,20 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [ConnectionCreateResponse]. + * + * The following fields are required: + * ```java + * .accessToken() + * .accountId() + * .authenticationType() + * .companyId() + * .connectionId() + * .products() + * .providerId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt index 67aef12f..48371d66 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt @@ -173,6 +173,21 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [CreateAccessTokenResponse]. + * + * The following fields are required: + * ```java + * .accessToken() + * .accountId() + * .clientType() + * .companyId() + * .connectionId() + * .connectionType() + * .products() + * .providerId() + * ``` + */ @JvmStatic fun builder() = Builder() } 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 c526676e..debd9112 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 @@ -49,6 +49,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [CreateCompanyBenefitsResponse]. + * + * The following fields are required: + * ```java + * .benefitId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt index 078fdd80..b7d4d199 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt @@ -116,6 +116,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [DirectoryEvent]. + * + * The following fields are required: + * ```java + * .accountId() + * .companyId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -252,6 +261,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Data]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt index a2b8ff0a..90850d4a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt @@ -51,6 +51,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [DisconnectResponse]. + * + * The following fields are required: + * ```java + * .status() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt index 8fad3473..dc86fdfe 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt @@ -60,6 +60,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [DocumentListResponse]. + * + * The following fields are required: + * ```java + * .documents() + * .paging() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt index d0469b43..0f91b3f0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt @@ -100,6 +100,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [DocumentResponse]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt index a18314c7..1750e349 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt @@ -274,6 +274,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [EmploymentData]. */ @JvmStatic fun builder() = Builder() } @@ -644,6 +645,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [CustomField]. */ @JvmStatic fun builder() = Builder() } @@ -744,6 +746,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Department]. */ @JvmStatic fun builder() = Builder() } @@ -859,6 +862,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Employment]. */ @JvmStatic fun builder() = Builder() } @@ -1345,6 +1349,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Manager]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt index 28da48df..be8638ad 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt @@ -66,6 +66,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [EmploymentDataResponse]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt index b67ef641..e63e58df 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt @@ -116,6 +116,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [EmploymentEvent]. + * + * The following fields are required: + * ```java + * .accountId() + * .companyId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -252,6 +261,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Data]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt index 022b8418..2861c8a5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt @@ -254,6 +254,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [EmploymentUpdateResponse]. */ @JvmStatic fun builder() = Builder() } @@ -591,6 +592,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [CustomField]. */ @JvmStatic fun builder() = Builder() } @@ -693,6 +695,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Department]. */ @JvmStatic fun builder() = Builder() } @@ -808,6 +811,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Employment]. */ @JvmStatic fun builder() = Builder() } @@ -1291,6 +1295,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Manager]. */ @JvmStatic fun builder() = Builder() } 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 index 8f31d858..ae6ed621 100644 --- 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 @@ -69,6 +69,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [EnrolledIndividual]. */ @JvmStatic fun builder() = Builder() } @@ -183,6 +184,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Body]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt index 868e087a..62d1501a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt @@ -130,6 +130,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Body]. */ @JvmStatic fun builder() = Builder() } @@ -229,6 +230,7 @@ private constructor( @JvmStatic fun none(): HrisBenefitCreateParams = builder().build() + /** Returns a mutable builder for constructing an instance of [HrisBenefitCreateParams]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt index 4e98d670..a7b4b653 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt @@ -38,6 +38,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisBenefitIndividualEnrolledIdsParams]. + * + * The following fields are required: + * ```java + * .benefitId() + * ``` + */ @JvmStatic fun builder() = Builder() } 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 d00f2f3a..39e181ff 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 @@ -115,6 +115,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisBenefitIndividualRetrieveManyBenefitsPage]. + */ @JvmStatic fun builder() = Builder() } 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 6c87b64f..b3158194 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 @@ -119,6 +119,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisBenefitIndividualRetrieveManyBenefitsPageAsync]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt index bb05a6ef..05fc584b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt @@ -51,6 +51,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisBenefitIndividualRetrieveManyBenefitsParams]. + * + * The following fields are required: + * ```java + * .benefitId() + * ``` + */ @JvmStatic fun builder() = Builder() } 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 index fbd19014..1cd310d6 100644 --- 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 @@ -115,6 +115,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisBenefitIndividualUnenrollManyPage]. + */ @JvmStatic fun builder() = Builder() } 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 index 2540f64e..301a184a 100644 --- 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 @@ -118,6 +118,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisBenefitIndividualUnenrollManyPageAsync]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt index ffb8bc4c..feed07ae 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt @@ -96,6 +96,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Body]. */ @JvmStatic fun builder() = Builder() } @@ -176,6 +177,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisBenefitIndividualUnenrollManyParams]. + * + * The following fields are required: + * ```java + * .benefitId() + * ``` + */ @JvmStatic fun builder() = Builder() } 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 b2a4c5d6..1c735b00 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 @@ -112,6 +112,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [HrisBenefitListPage]. */ @JvmStatic fun builder() = Builder() } 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 fcd50f1f..298d710a 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 @@ -118,6 +118,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [HrisBenefitListPageAsync]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt index 63ae4bf0..b192711f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt @@ -29,6 +29,7 @@ private constructor( @JvmStatic fun none(): HrisBenefitListParams = builder().build() + /** Returns a mutable builder for constructing an instance of [HrisBenefitListParams]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt index 5e65cc88..bb4827f0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt @@ -115,6 +115,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisBenefitListSupportedBenefitsPage]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt index e21eb7f7..328c56e5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt @@ -118,6 +118,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisBenefitListSupportedBenefitsPageAsync]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt index c783f66b..5dcb05af 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt @@ -29,6 +29,10 @@ private constructor( @JvmStatic fun none(): HrisBenefitListSupportedBenefitsParams = builder().build() + /** + * Returns a mutable builder for constructing an instance of + * [HrisBenefitListSupportedBenefitsParams]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt index 05594957..698a746a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt @@ -38,6 +38,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [HrisBenefitRetrieveParams]. + * + * The following fields are required: + * ```java + * .benefitId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt index f3e83adb..0cee2045 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt @@ -95,6 +95,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Body]. */ @JvmStatic fun builder() = Builder() } @@ -162,6 +163,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [HrisBenefitUpdateParams]. + * + * The following fields are required: + * ```java + * .benefitId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt index cd51a0ed..d61d83f5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt @@ -29,6 +29,9 @@ private constructor( @JvmStatic fun none(): HrisCompanyRetrieveParams = builder().build() + /** + * Returns a mutable builder for constructing an instance of [HrisCompanyRetrieveParams]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt index 4b994a9e..19fd08eb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt @@ -141,6 +141,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisDirectoryListIndividualsPage]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt index ca3201d0..8c7303e8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt @@ -144,6 +144,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisDirectoryListIndividualsPageAsync]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt index aa21caf7..80de4b0e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt @@ -45,6 +45,10 @@ private constructor( @JvmStatic fun none(): HrisDirectoryListIndividualsParams = builder().build() + /** + * Returns a mutable builder for constructing an instance of + * [HrisDirectoryListIndividualsParams]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt index 4a31c2c6..e25b83b3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt @@ -140,6 +140,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [HrisDirectoryListPage]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt index 861ffde7..11e6edbd 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt @@ -143,6 +143,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisDirectoryListPageAsync]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt index ed4d67ad..224d277e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt @@ -44,6 +44,7 @@ private constructor( @JvmStatic fun none(): HrisDirectoryListParams = builder().build() + /** Returns a mutable builder for constructing an instance of [HrisDirectoryListParams]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt index 8e51b518..a9e4e08f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt @@ -62,6 +62,7 @@ private constructor( @JvmStatic fun none(): HrisDocumentListParams = builder().build() + /** Returns a mutable builder for constructing an instance of [HrisDocumentListParams]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt index 5fbb6079..bd3c0e75 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt @@ -41,6 +41,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [HrisDocumentRetreiveParams]. + * + * The following fields are required: + * ```java + * .documentId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt index fb7c68c0..7e3973cb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt @@ -117,6 +117,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisEmploymentRetrieveManyPage]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt index 16233a7b..ccbed61f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt @@ -120,6 +120,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisEmploymentRetrieveManyPageAsync]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt index a9a6d5cf..b29b8fd4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt @@ -85,6 +85,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .requests() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -164,6 +172,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisEmploymentRetrieveManyParams]. + * + * The following fields are required: + * ```java + * .requests() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -364,6 +381,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Request]. + * + * The following fields are required: + * ```java + * .individualId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt index 580aacb5..ff673c35 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt @@ -116,6 +116,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisIndividualRetrieveManyPage]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt index 8693075d..5eb68548 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt @@ -119,6 +119,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisIndividualRetrieveManyPageAsync]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt index 23b067d4..3a9feeec 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt @@ -93,6 +93,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Body]. */ @JvmStatic fun builder() = Builder() } @@ -180,6 +181,10 @@ private constructor( @JvmStatic fun none(): HrisIndividualRetrieveManyParams = builder().build() + /** + * Returns a mutable builder for constructing an instance of + * [HrisIndividualRetrieveManyParams]. + */ @JvmStatic fun builder() = Builder() } @@ -371,6 +376,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Options]. */ @JvmStatic fun builder() = Builder() } @@ -480,6 +486,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Request]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt index 6e8a850e..ccb29181 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt @@ -120,6 +120,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisPayStatementRetrieveManyPage]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt index e1e84e39..9744e741 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt @@ -123,6 +123,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisPayStatementRetrieveManyPageAsync]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt index 6628153c..943785a1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt @@ -89,6 +89,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .requests() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -168,6 +176,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [HrisPayStatementRetrieveManyParams]. + * + * The following fields are required: + * ```java + * .requests() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -378,6 +395,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Request]. + * + * The following fields are required: + * ```java + * .paymentId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt index c321b38f..1a214077 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt @@ -111,6 +111,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [HrisPaymentListPage]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt index c2d3ad50..f758f458 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt @@ -117,6 +117,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [HrisPaymentListPageAsync]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt index f0dc741f..f0f87256 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt @@ -43,6 +43,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [HrisPaymentListParams]. + * + * The following fields are required: + * ```java + * .endDate() + * .startDate() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt index b0cf2130..ade8976c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt @@ -93,6 +93,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Income]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt index 79ce4062..e4a98ffa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt @@ -185,6 +185,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Individual]. */ @JvmStatic fun builder() = Builder() } @@ -454,6 +455,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Email]. */ @JvmStatic fun builder() = Builder() } @@ -908,6 +910,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [PhoneNumber]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt index e760e125..8e4c7bc9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt @@ -66,6 +66,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [IndividualBenefit]. */ @JvmStatic fun builder() = Builder() } @@ -212,6 +213,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Body]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt index d14959ad..30c9fe11 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt @@ -60,6 +60,16 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [IndividualEnrolledIdsResponse]. + * + * The following fields are required: + * ```java + * .benefitId() + * .individualIds() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt index 16e4a305..b2329f70 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt @@ -116,6 +116,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [IndividualEvent]. + * + * The following fields are required: + * ```java + * .accountId() + * .companyId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -252,6 +261,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Data]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt index fe785bc0..c8047de4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt @@ -112,6 +112,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [IndividualInDirectory]. */ @JvmStatic fun builder() = Builder() } @@ -272,6 +273,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Department]. */ @JvmStatic fun builder() = Builder() } @@ -371,6 +373,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Manager]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt index c78a32ba..f259e1f2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt @@ -66,6 +66,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [IndividualResponse]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt index 613b0a88..297b3014 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt @@ -185,6 +185,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [IndividualUpdateResponse]. */ @JvmStatic fun builder() = Builder() } @@ -454,6 +455,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Email]. */ @JvmStatic fun builder() = Builder() } @@ -908,6 +910,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [PhoneNumber]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt index 01202602..8e0086bd 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt @@ -276,6 +276,29 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Introspection]. + * + * The following fields are required: + * ```java + * .accountId() + * .authenticationMethods() + * .clientId() + * .clientType() + * .companyId() + * .connectionId() + * .connectionStatus() + * .connectionType() + * .customerEmail() + * .customerId() + * .customerName() + * .manual() + * .payrollProviderId() + * .products() + * .providerId() + * .username() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -626,6 +649,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [AuthenticationMethod]. */ @JvmStatic fun builder() = Builder() } @@ -747,6 +771,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [ConnectionStatus]. */ @JvmStatic fun builder() = Builder() } @@ -1104,6 +1129,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [ConnectionStatus]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt index 34e0c010..93538c87 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt @@ -247,6 +247,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [DataSyncAll]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -454,6 +462,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [W4FormEmployeeSync]. + * + * The following fields are required: + * ```java + * .params() + * .type() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -549,6 +566,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Params]. + * + * The following fields are required: + * ```java + * .individualId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -743,6 +768,7 @@ private constructor( @JvmStatic fun none(): JobAutomatedCreateParams = builder().build() + /** Returns a mutable builder for constructing an instance of [JobAutomatedCreateParams]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt index 3774d28b..13c755ff 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt @@ -142,6 +142,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [JobAutomatedListPage]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPageAsync.kt index f2ba3f01..50ec8c79 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPageAsync.kt @@ -145,6 +145,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [JobAutomatedListPageAsync]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt index d49551f0..975b418f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt @@ -48,6 +48,7 @@ private constructor( @JvmStatic fun none(): JobAutomatedListParams = builder().build() + /** Returns a mutable builder for constructing an instance of [JobAutomatedListParams]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParams.kt index 8f9419ca..2037c79e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParams.kt @@ -38,6 +38,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [JobAutomatedRetrieveParams]. + * + * The following fields are required: + * ```java + * .jobId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt index 59f91f23..1642ec99 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt @@ -116,6 +116,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [JobCompletionEvent]. + * + * The following fields are required: + * ```java + * .accountId() + * .companyId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -259,6 +268,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Data]. + * + * The following fields are required: + * ```java + * .jobId() + * .jobUrl() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt index b5f0299c..ea500558 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt @@ -83,6 +83,17 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [JobCreateResponse]. + * + * The following fields are required: + * ```java + * .allowedRefreshes() + * .jobId() + * .jobUrl() + * .remainingRefreshes() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobManualRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobManualRetrieveParams.kt index 32fc6bca..94d3cffa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobManualRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobManualRetrieveParams.kt @@ -41,6 +41,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [JobManualRetrieveParams]. + * + * The following fields are required: + * ```java + * .jobId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt index 20ce723d..e8e39ab8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt @@ -107,6 +107,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Location]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt index 7e44f78e..c83f6d5d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt @@ -69,6 +69,16 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [ManualAsyncJob]. + * + * The following fields are required: + * ```java + * .body() + * .jobId() + * .status() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt index 547abdfa..f834a0ec 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt @@ -57,6 +57,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Money]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt index 56ac7c5f..cdcee367 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt @@ -145,6 +145,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [OperationSupportMatrix]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt index d75f67c8..c5563cad 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt @@ -57,6 +57,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Paging]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt index 1dc7432d..f98790a6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt @@ -73,6 +73,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [PayGroupListResponse]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt index ed5a74dc..a903f493 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt @@ -82,6 +82,17 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [PayGroupRetrieveResponse]. + * + * The following fields are required: + * ```java + * .id() + * .individualIds() + * .name() + * .payFrequencies() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt index 18ae0b15..b3e5803e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt @@ -148,6 +148,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [PayStatement]. */ @JvmStatic fun builder() = Builder() } @@ -438,6 +439,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Earning]. */ @JvmStatic fun builder() = Builder() } @@ -604,6 +606,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Attributes]. */ @JvmStatic fun builder() = Builder() } @@ -695,6 +698,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Metadata]. */ @JvmStatic fun builder() = Builder() } @@ -782,6 +786,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [InnerMetadata]. + */ @JvmStatic fun builder() = Builder() } @@ -1148,6 +1156,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [EmployeeDeduction]. */ @JvmStatic fun builder() = Builder() } @@ -1302,6 +1311,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Attributes]. */ @JvmStatic fun builder() = Builder() } @@ -1393,6 +1403,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Metadata]. */ @JvmStatic fun builder() = Builder() } @@ -1480,6 +1491,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [InnerMetadata]. + */ @JvmStatic fun builder() = Builder() } @@ -1669,6 +1684,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [EmployerContribution]. */ @JvmStatic fun builder() = Builder() } @@ -1807,6 +1823,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Attributes]. */ @JvmStatic fun builder() = Builder() } @@ -1898,6 +1915,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Metadata]. */ @JvmStatic fun builder() = Builder() } @@ -1985,6 +2003,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [InnerMetadata]. + */ @JvmStatic fun builder() = Builder() } @@ -2284,6 +2306,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Tax]. */ @JvmStatic fun builder() = Builder() } @@ -2438,6 +2461,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Attributes]. */ @JvmStatic fun builder() = Builder() } @@ -2529,6 +2553,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Metadata]. */ @JvmStatic fun builder() = Builder() } @@ -2616,6 +2641,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [InnerMetadata]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt index 79a6bd0a..162aee87 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt @@ -116,6 +116,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [PayStatementEvent]. + * + * The following fields are required: + * ```java + * .accountId() + * .companyId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -262,6 +271,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Data]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt index 22aaf7fe..83364349 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt @@ -63,6 +63,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [PayStatementResponse]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt index f00af605..2d782bb4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt @@ -63,6 +63,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [PayStatementResponseBody]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt index 2c10a01f..51d74807 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt @@ -166,6 +166,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Payment]. */ @JvmStatic fun builder() = Builder() } @@ -553,6 +554,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [PayPeriod]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt index 72337ed1..1125691f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt @@ -61,6 +61,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [PaymentCreateResponse]. + * + * The following fields are required: + * ```java + * .payDate() + * .paymentId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt index dcd964b3..ec35d6cf 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt @@ -118,6 +118,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [PaymentEvent]. + * + * The following fields are required: + * ```java + * .accountId() + * .companyId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -261,6 +270,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [PaymentIdentifiers]. + * + * The following fields are required: + * ```java + * .payDate() + * .paymentId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt index aec5d816..829f3451 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt @@ -115,6 +115,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [PayrollPayGroupListPage]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt index 8e352508..6c24b034 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt @@ -118,6 +118,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [PayrollPayGroupListPageAsync]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt index 0b6a7c84..6f3e026a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt @@ -43,6 +43,9 @@ private constructor( @JvmStatic fun none(): PayrollPayGroupListParams = builder().build() + /** + * Returns a mutable builder for constructing an instance of [PayrollPayGroupListParams]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParams.kt index e78ff6a9..ba5d1826 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParams.kt @@ -38,6 +38,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [PayrollPayGroupRetrieveParams]. + * + * The following fields are required: + * ```java + * .payGroupId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt index 7656aee6..3a72c5f4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt @@ -157,6 +157,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Provider]. */ @JvmStatic fun builder() = Builder() } @@ -383,6 +384,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [AuthenticationMethod]. */ @JvmStatic fun builder() = Builder() } @@ -575,6 +577,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [SupportedFields]. */ @JvmStatic fun builder() = Builder() } @@ -799,6 +802,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SupportedCompanyFields]. + */ @JvmStatic fun builder() = Builder() } @@ -998,6 +1005,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Accounts]. */ @JvmStatic fun builder() = Builder() } @@ -1153,6 +1161,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Departments]. + */ @JvmStatic fun builder() = Builder() } @@ -1241,6 +1252,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Parent]. + */ @JvmStatic fun builder() = Builder() } @@ -1367,6 +1381,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Entity]. */ @JvmStatic fun builder() = Builder() } @@ -1517,6 +1532,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Locations]. + */ @JvmStatic fun builder() = Builder() } @@ -1684,6 +1702,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SupportedDirectoryFields]. + */ @JvmStatic fun builder() = Builder() } @@ -1843,6 +1865,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Individuals]. + */ @JvmStatic fun builder() = Builder() } @@ -1979,6 +2004,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Manager]. + */ @JvmStatic fun builder() = Builder() } @@ -2105,6 +2133,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Paging]. */ @JvmStatic fun builder() = Builder() } @@ -2397,6 +2426,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SupportedEmploymentFields]. + */ @JvmStatic fun builder() = Builder() } @@ -2614,6 +2647,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Department]. + */ @JvmStatic fun builder() = Builder() } @@ -2723,6 +2759,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Employment]. + */ @JvmStatic fun builder() = Builder() } @@ -2849,6 +2888,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Income]. */ @JvmStatic fun builder() = Builder() } @@ -3007,6 +3047,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Location]. */ @JvmStatic fun builder() = Builder() } @@ -3145,6 +3186,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Manager]. */ @JvmStatic fun builder() = Builder() } @@ -3380,6 +3422,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SupportedIndividualFields]. + */ @JvmStatic fun builder() = Builder() } @@ -3573,6 +3619,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Emails]. */ @JvmStatic fun builder() = Builder() } @@ -3684,6 +3731,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [PhoneNumbers]. + */ @JvmStatic fun builder() = Builder() } @@ -3834,6 +3884,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Residence]. + */ @JvmStatic fun builder() = Builder() } @@ -4020,6 +4073,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SupportedPayGroupFields]. + */ @JvmStatic fun builder() = Builder() } @@ -4159,6 +4216,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SupportedPayStatementFields]. + */ @JvmStatic fun builder() = Builder() } @@ -4263,6 +4324,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Paging]. + * + * The following fields are required: + * ```java + * .count() + * .offset() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -4472,6 +4542,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [PayStatements]. + */ @JvmStatic fun builder() = Builder() } @@ -4672,6 +4746,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Earnings]. + */ @JvmStatic fun builder() = Builder() } @@ -4840,6 +4917,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [EmployeeDeductions]. + */ @JvmStatic fun builder() = Builder() } @@ -4996,6 +5077,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [EmployerContributions]. + */ @JvmStatic fun builder() = Builder() } @@ -5159,6 +5244,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Taxes]. + */ @JvmStatic fun builder() = Builder() } @@ -5446,6 +5534,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SupportedPaymentFields]. + */ @JvmStatic fun builder() = Builder() } @@ -5641,6 +5733,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [PayPeriod]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt index 3d4f3975..40a9266e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt @@ -111,6 +111,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [ProviderListPage]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt index 37cf24fe..b9cb81ba 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt @@ -117,6 +117,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [ProviderListPageAsync]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListParams.kt index 2940b01d..5f694c14 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListParams.kt @@ -29,6 +29,7 @@ private constructor( @JvmStatic fun none(): ProviderListParams = builder().build() + /** Returns a mutable builder for constructing an instance of [ProviderListParams]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt index 7379952c..bd01a332 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt @@ -183,6 +183,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .method() + * .route() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -315,6 +324,16 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [RequestForwardingForwardParams]. + * + * The following fields are required: + * ```java + * .method() + * .route() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt index 3a8cbd7e..7cc9db35 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt @@ -95,6 +95,18 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [RequestForwardingForwardResponse]. + * + * The following fields are required: + * ```java + * .data() + * .headers() + * .request() + * .statusCode() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -285,6 +297,18 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Request]. + * + * The following fields are required: + * ```java + * .data() + * .headers() + * .method() + * .params() + * .route() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt index f6ab848c..b3deed8b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt @@ -206,6 +206,21 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [CompanyWithoutId]. + * + * The following fields are required: + * ```java + * .accounts() + * .departments() + * .ein() + * .entity() + * .legalName() + * .locations() + * .primaryEmail() + * .primaryPhoneNumber() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -398,6 +413,21 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [SandboxCompanyUpdateParams]. + * + * The following fields are required: + * ```java + * .accounts() + * .departments() + * .ein() + * .entity() + * .legalName() + * .locations() + * .primaryEmail() + * .primaryPhoneNumber() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -723,6 +753,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Account]. */ @JvmStatic fun builder() = Builder() } @@ -1017,6 +1048,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Department]. */ @JvmStatic fun builder() = Builder() } @@ -1111,6 +1143,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Parent]. */ @JvmStatic fun builder() = Builder() } @@ -1241,6 +1274,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Entity]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt index 80ed9555..e7801891 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt @@ -145,6 +145,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .companyId() + * .providerId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -259,6 +268,16 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SandboxConnectionAccountCreateParams]. + * + * The following fields are required: + * ```java + * .companyId() + * .providerId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt index 521e6d18..f3bbcce4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt @@ -83,6 +83,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Body]. */ @JvmStatic fun builder() = Builder() } @@ -151,6 +152,10 @@ private constructor( @JvmStatic fun none(): SandboxConnectionAccountUpdateParams = builder().build() + /** + * Returns a mutable builder for constructing an instance of + * [SandboxConnectionAccountUpdateParams]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt index 88c8f610..e6eeb7b1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt @@ -152,6 +152,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .providerId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -266,6 +274,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SandboxConnectionCreateParams]. + * + * The following fields are required: + * ```java + * .providerId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt index 2b23dd8a..d33536ec 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt @@ -381,6 +381,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [IndividualOrEmployment]. + */ @JvmStatic fun builder() = Builder() } @@ -840,6 +843,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [CustomField]. */ @JvmStatic fun builder() = Builder() } @@ -946,6 +950,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Department]. */ @JvmStatic fun builder() = Builder() } @@ -1055,6 +1060,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Email]. */ @JvmStatic fun builder() = Builder() } @@ -1281,6 +1287,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Employment]. */ @JvmStatic fun builder() = Builder() } @@ -2037,6 +2044,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Manager]. */ @JvmStatic fun builder() = Builder() } @@ -2142,6 +2150,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [PhoneNumber]. */ @JvmStatic fun builder() = Builder() } @@ -2340,6 +2349,9 @@ private constructor( @JvmStatic fun none(): SandboxDirectoryCreateParams = builder().build() + /** + * Returns a mutable builder for constructing an instance of [SandboxDirectoryCreateParams]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt index 1db1258e..3202a4d9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt @@ -400,6 +400,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [EmploymentWithoutId]. */ @JvmStatic fun builder() = Builder() } @@ -718,6 +719,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SandboxEmploymentUpdateParams]. + * + * The following fields are required: + * ```java + * .individualId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -1097,6 +1107,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [CustomField]. */ @JvmStatic fun builder() = Builder() } @@ -1199,6 +1210,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Department]. */ @JvmStatic fun builder() = Builder() } @@ -1314,6 +1326,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Employment]. */ @JvmStatic fun builder() = Builder() } @@ -1797,6 +1810,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Manager]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt index ba87d11d..77d8b6c4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt @@ -299,6 +299,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [IndividualWithoutId]. */ @JvmStatic fun builder() = Builder() } @@ -543,6 +544,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SandboxIndividualUpdateParams]. + * + * The following fields are required: + * ```java + * .individualId() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -865,6 +875,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Email]. */ @JvmStatic fun builder() = Builder() } @@ -1319,6 +1330,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [PhoneNumber]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt index 28c765c7..1201b900 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt @@ -59,6 +59,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [SandboxJobConfiguration]. + * + * The following fields are required: + * ```java + * .completionStatus() + * .type() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt index b13948c7..4ae86208 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt @@ -29,6 +29,10 @@ private constructor( @JvmStatic fun none(): SandboxJobConfigurationRetrieveParams = builder().build() + /** + * Returns a mutable builder for constructing an instance of + * [SandboxJobConfigurationRetrieveParams]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt index 72a0a4d2..31f0fedb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt @@ -37,6 +37,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SandboxJobConfigurationUpdateParams]. + * + * The following fields are required: + * ```java + * .sandboxJobConfiguration() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt index 089b6b57..b19cd615 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt @@ -81,6 +81,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ @JvmStatic fun builder() = Builder() } @@ -146,6 +154,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [SandboxJobCreateParams]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt index 28879f63..799d5cd7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt @@ -111,6 +111,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Body]. */ @JvmStatic fun builder() = Builder() } @@ -204,6 +205,9 @@ private constructor( @JvmStatic fun none(): SandboxPaymentCreateParams = builder().build() + /** + * Returns a mutable builder for constructing an instance of [SandboxPaymentCreateParams]. + */ @JvmStatic fun builder() = Builder() } @@ -504,6 +508,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [PayStatement]. */ @JvmStatic fun builder() = Builder() } @@ -802,6 +807,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Earning]. */ @JvmStatic fun builder() = Builder() } @@ -973,6 +979,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Attributes]. */ @JvmStatic fun builder() = Builder() } @@ -1065,6 +1072,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Metadata]. */ @JvmStatic fun builder() = Builder() } @@ -1155,6 +1163,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [InnerMetadata]. + */ @JvmStatic fun builder() = Builder() } @@ -1525,6 +1537,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [EmployeeDeduction]. + */ @JvmStatic fun builder() = Builder() } @@ -1684,6 +1699,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Attributes]. */ @JvmStatic fun builder() = Builder() } @@ -1776,6 +1792,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Metadata]. */ @JvmStatic fun builder() = Builder() } @@ -1866,6 +1883,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [InnerMetadata]. + */ @JvmStatic fun builder() = Builder() } @@ -2056,6 +2077,9 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [EmployerContribution]. + */ @JvmStatic fun builder() = Builder() } @@ -2199,6 +2223,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Attributes]. */ @JvmStatic fun builder() = Builder() } @@ -2291,6 +2316,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Metadata]. */ @JvmStatic fun builder() = Builder() } @@ -2381,6 +2407,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [InnerMetadata]. + */ @JvmStatic fun builder() = Builder() } @@ -2687,6 +2717,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Tax]. */ @JvmStatic fun builder() = Builder() } @@ -2847,6 +2878,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Attributes]. */ @JvmStatic fun builder() = Builder() } @@ -2939,6 +2971,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Metadata]. */ @JvmStatic fun builder() = Builder() } @@ -3029,6 +3062,10 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [InnerMetadata]. + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt index 43a46246..34b65939 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt @@ -61,6 +61,15 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [SessionNewResponse]. + * + * The following fields are required: + * ```java + * .connectUrl() + * .sessionId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt index b6fe7686..ecb91c0e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt @@ -61,6 +61,16 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of + * [SessionReauthenticateResponse]. + * + * The following fields are required: + * ```java + * .connectUrl() + * .sessionId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt index 34774cef..f4a245c5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt @@ -63,6 +63,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [SupportPerBenefitType]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt index b841a243..696e8c2e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt @@ -150,6 +150,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [SupportedBenefit]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt index f5adb2ec..2ff55d27 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt @@ -66,6 +66,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [UnenrolledIndividual]. */ @JvmStatic fun builder() = Builder() } @@ -180,6 +181,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Body]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt index 95463baa..26e1ac2e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt @@ -49,6 +49,14 @@ private constructor( companion object { + /** + * Returns a mutable builder for constructing an instance of [UpdateCompanyBenefitResponse]. + * + * The following fields are required: + * ```java + * .benefitId() + * ``` + */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt index 4f4b07fe..34cb72de 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt @@ -71,6 +71,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [W42005]. */ @JvmStatic fun builder() = Builder() } @@ -229,6 +230,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Data]. */ @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt index 42baad1c..24d59d3d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt @@ -71,6 +71,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [W42020]. */ @JvmStatic fun builder() = Builder() } @@ -275,6 +276,7 @@ private constructor( companion object { + /** Returns a mutable builder for constructing an instance of [Data]. */ @JvmStatic fun builder() = Builder() } From fc827bc6bd38e80bf7f09b241e559e46d7adcf2a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Mar 2025 23:17:47 +0000 Subject: [PATCH 08/65] chore(client): expose `Optional`, not nullable, from `ClientOptions` (#476) --- .../com/tryfinch/api/core/ClientOptions.kt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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 557f4b0b..479a78ba 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 @@ -24,12 +24,20 @@ private constructor( @get:JvmName("responseValidation") val responseValidation: Boolean, @get:JvmName("timeout") val timeout: Timeout, @get:JvmName("maxRetries") val maxRetries: Int, - @get:JvmName("accessToken") val accessToken: String?, - @get:JvmName("clientId") val clientId: String?, - @get:JvmName("clientSecret") val clientSecret: String?, - @get:JvmName("webhookSecret") val webhookSecret: String?, + private val accessToken: String?, + private val clientId: String?, + private val clientSecret: String?, + private val webhookSecret: String?, ) { + fun accessToken(): Optional = Optional.ofNullable(accessToken) + + fun clientId(): Optional = Optional.ofNullable(clientId) + + fun clientSecret(): Optional = Optional.ofNullable(clientSecret) + + fun webhookSecret(): Optional = Optional.ofNullable(webhookSecret) + fun toBuilder() = Builder().from(this) companion object { From 83f00bd2aadd9049da1d8365dfa9bdd03d52a159 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 5 Mar 2025 22:45:21 +0000 Subject: [PATCH 09/65] feat(api): manual updates (#477) --- release-please-config.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release-please-config.json b/release-please-config.json index e1ea47ff..9d3ea4fe 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -69,7 +69,8 @@ "miguel-finch", "edkim-finch", "bteodosioFinch", - "ashar-finch" + "ashar-finch", + "minupalaniappan" ], "release-type": "simple", "extra-files": [ From 8af9db069644af54d9d80f27a540b08059b2d241 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 5 Mar 2025 18:08:19 +0000 Subject: [PATCH 10/65] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index bed01067..bbda2f82 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-7a816d4a5f0039230590a6662f3513d5756344ca662761ecbc49016593f65836.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-a8fb4796584347205fabadf0148a039a0259b7363ffa476579032acd2987311a.yml From 141a057e6981d86751caaac2f6a2a1389c19acc8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 6 Mar 2025 02:02:01 +0000 Subject: [PATCH 11/65] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index bbda2f82..7e688f99 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-a8fb4796584347205fabadf0148a039a0259b7363ffa476579032acd2987311a.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-777eedfd80c3e04a8739959418783d1c976180f4f09d7a883f7de5c2b6cda5a6.yml From 721cd2c2696a8929f3b7bbe27ba5df82f872df4f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 6 Mar 2025 05:06:44 +0000 Subject: [PATCH 12/65] feat(client): accept `InputStream` and `Path` for file params (#479) --- .../com/tryfinch/api/core/ObjectMappers.kt | 20 ++++++++++++ .../kotlin/com/tryfinch/api/core/Values.kt | 6 +++- .../api/core/http/HttpRequestBodies.kt | 31 ++++++++++++++----- 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt index 90d2ce0d..a610ce08 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt @@ -3,19 +3,24 @@ package com.tryfinch.api.core import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.core.JsonGenerator import com.fasterxml.jackson.databind.DeserializationFeature import com.fasterxml.jackson.databind.SerializationFeature +import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.cfg.CoercionAction.Fail import com.fasterxml.jackson.databind.cfg.CoercionInputShape.Integer import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.databind.module.SimpleModule import com.fasterxml.jackson.datatype.jdk8.Jdk8Module import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule import com.fasterxml.jackson.module.kotlin.jacksonMapperBuilder +import java.io.InputStream fun jsonMapper(): JsonMapper = jacksonMapperBuilder() .addModule(Jdk8Module()) .addModule(JavaTimeModule()) + .addModule(SimpleModule().addSerializer(InputStreamJsonSerializer)) .serializationInclusion(JsonInclude.Include.NON_ABSENT) .disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE) .disable(SerializationFeature.FLUSH_AFTER_WRITE_VALUE) @@ -23,3 +28,18 @@ fun jsonMapper(): JsonMapper = .disable(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS) .withCoercionConfig(String::class.java) { it.setCoercion(Integer, Fail) } .build() + +private object InputStreamJsonSerializer : BaseSerializer(InputStream::class) { + + override fun serialize( + value: InputStream?, + gen: JsonGenerator?, + serializers: SerializerProvider?, + ) { + if (value == null) { + gen?.writeNull() + } else { + value.use { gen?.writeBinary(it.readBytes()) } + } + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt index b5242672..f51b91e7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt @@ -27,6 +27,7 @@ import com.fasterxml.jackson.databind.node.JsonNodeType.POJO import com.fasterxml.jackson.databind.node.JsonNodeType.STRING import com.fasterxml.jackson.databind.ser.std.NullSerializer import com.tryfinch.api.errors.FinchInvalidDataException +import java.io.InputStream import java.util.Objects import java.util.Optional @@ -508,7 +509,10 @@ private constructor( return MultipartField( value, contentType - ?: if (value is KnownValue && value.value is ByteArray) + ?: if ( + value is KnownValue && + (value.value is InputStream || value.value is ByteArray) + ) "application/octet-stream" else "text/plain; charset=utf-8", filename, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpRequestBodies.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpRequestBodies.kt index f24d9dd3..310010fb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpRequestBodies.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpRequestBodies.kt @@ -9,6 +9,8 @@ import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.databind.node.JsonNodeType import com.tryfinch.api.core.MultipartField import com.tryfinch.api.errors.FinchInvalidDataException +import java.io.ByteArrayInputStream +import java.io.InputStream import java.io.OutputStream import kotlin.jvm.optionals.getOrNull import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder @@ -41,8 +43,18 @@ internal fun multipartFormData( MultipartEntityBuilder.create() .apply { fields.forEach { (name, field) -> - val node = jsonMapper.valueToTree(field.value) - serializePart(name, node).forEach { (name, bytes) -> + val knownValue = field.value.asKnown().getOrNull() + val parts = + if (knownValue is InputStream) { + // Read directly from the `InputStream` instead of reading it all + // into memory due to the `jsonMapper` serialization below. + sequenceOf(name to knownValue) + } else { + val node = jsonMapper.valueToTree(field.value) + serializePart(name, node) + } + + parts.forEach { (name, bytes) -> addBinaryBody( name, bytes, @@ -55,16 +67,19 @@ internal fun multipartFormData( .build() } - private fun serializePart(name: String, node: JsonNode): Sequence> = + private fun serializePart( + name: String, + node: JsonNode, + ): Sequence> = when (node.nodeType) { JsonNodeType.MISSING, JsonNodeType.NULL -> emptySequence() - JsonNodeType.BINARY -> sequenceOf(name to node.binaryValue()) - JsonNodeType.STRING -> sequenceOf(name to node.textValue().toByteArray()) + JsonNodeType.BINARY -> sequenceOf(name to ByteArrayInputStream(node.binaryValue())) + JsonNodeType.STRING -> sequenceOf(name to node.textValue().toInputStream()) JsonNodeType.BOOLEAN -> - sequenceOf(name to node.booleanValue().toString().toByteArray()) + sequenceOf(name to node.booleanValue().toString().toInputStream()) JsonNodeType.NUMBER -> - sequenceOf(name to node.numberValue().toString().toByteArray()) + sequenceOf(name to node.numberValue().toString().toInputStream()) JsonNodeType.ARRAY -> node.elements().asSequence().flatMap { element -> serializePart("$name[]", element) @@ -78,6 +93,8 @@ internal fun multipartFormData( throw FinchInvalidDataException("Unexpected JsonNode type: ${node.nodeType}") } + private fun String.toInputStream(): InputStream = ByteArrayInputStream(toByteArray()) + override fun writeTo(outputStream: OutputStream) = entity.writeTo(outputStream) override fun contentType(): String = entity.contentType From fcf521a7e262ad96d7f3703114b221a4d2622d50 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 6 Mar 2025 22:15:30 +0000 Subject: [PATCH 13/65] feat(client): detect binary incompatible jackson versions (#480) --- .../com/tryfinch/api/core/ObjectMappers.kt | 39 +++++++++++++++++++ .../tryfinch/api/core/handlers/JsonHandler.kt | 9 ++--- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt index a610ce08..7d2508c0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt @@ -9,11 +9,15 @@ import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.cfg.CoercionAction.Fail import com.fasterxml.jackson.databind.cfg.CoercionInputShape.Integer +import com.fasterxml.jackson.databind.exc.InvalidDefinitionException +import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.databind.module.SimpleModule import com.fasterxml.jackson.datatype.jdk8.Jdk8Module import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule import com.fasterxml.jackson.module.kotlin.jacksonMapperBuilder +import com.tryfinch.api.errors.FinchException +import com.tryfinch.api.errors.FinchInvalidDataException import java.io.InputStream fun jsonMapper(): JsonMapper = @@ -43,3 +47,38 @@ private object InputStreamJsonSerializer : BaseSerializer(InputStre } } } + +@JvmSynthetic +internal fun enhanceJacksonException(fallbackMessage: String, e: Exception): Exception { + // These exceptions should only happen if our code is wrong OR if the user is using a binary + // incompatible version of `com.fasterxml.jackson.core:jackson-databind`: + // https://javadoc.io/static/com.fasterxml.jackson.core/jackson-databind/2.18.1/index.html + val isUnexpectedException = + e is UnrecognizedPropertyException || e is InvalidDefinitionException + if (!isUnexpectedException) { + return FinchInvalidDataException(fallbackMessage, e) + } + + val jacksonVersion = JsonMapper::class.java.`package`.implementationVersion + if (jacksonVersion.isNullOrEmpty() || jacksonVersion == COMPILED_JACKSON_VERSION) { + return FinchInvalidDataException(fallbackMessage, e) + } + + return FinchException( + """ + Jackson threw an unexpected exception and its runtime version ($jacksonVersion) mismatches the version the SDK was compiled with ($COMPILED_JACKSON_VERSION). + + You may be using a version of `com.fasterxml.jackson.core:jackson-databind` that's not binary compatible with the SDK. + + This can happen if you are either: + 1. Directly depending on a different Jackson version + 2. Depending on some library that depends on a different Jackson version, potentially transitively + + Double-check that you are depending on a compatible Jackson version. + """ + .trimIndent(), + e, + ) +} + +const val COMPILED_JACKSON_VERSION = "2.18.1" diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/handlers/JsonHandler.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/handlers/JsonHandler.kt index 825b04fb..6943a1e6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/handlers/JsonHandler.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/handlers/JsonHandler.kt @@ -4,18 +4,17 @@ package com.tryfinch.api.core.handlers import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.enhanceJacksonException import com.tryfinch.api.core.http.HttpResponse import com.tryfinch.api.core.http.HttpResponse.Handler -import com.tryfinch.api.errors.FinchException @JvmSynthetic internal inline fun jsonHandler(jsonMapper: JsonMapper): Handler = object : Handler { - override fun handle(response: HttpResponse): T { + override fun handle(response: HttpResponse): T = try { - return jsonMapper.readValue(response.body(), jacksonTypeRef()) + jsonMapper.readValue(response.body(), jacksonTypeRef()) } catch (e: Exception) { - throw FinchException("Error reading response", e) + throw enhanceJacksonException("Error reading response", e) } - } } From ebc6f30543123460b1c6f297c6c1ad32453ff77c Mon Sep 17 00:00:00 2001 From: Tomer Aberbach Date: Fri, 7 Mar 2025 10:57:19 -0500 Subject: [PATCH 14/65] fix: compilation error --- .../api/client/FinchClientAsyncImpl.kt | 16 ++++++++-------- .../tryfinch/api/client/FinchClientImpl.kt | 16 ++++++++-------- .../async/AccessTokenServiceAsyncImpl.kt | 19 +++++++++++-------- .../services/async/WebhookServiceAsyncImpl.kt | 3 ++- .../blocking/AccessTokenServiceImpl.kt | 19 +++++++++++-------- .../services/blocking/WebhookServiceImpl.kt | 3 ++- 6 files changed, 42 insertions(+), 34 deletions(-) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsyncImpl.kt index 0da99f5b..fef86854 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsyncImpl.kt @@ -11,7 +11,7 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler -import com.tryfinch.api.core.json +import com.tryfinch.api.core.http.json import com.tryfinch.api.errors.FinchError import com.tryfinch.api.errors.FinchException import com.tryfinch.api.models.* @@ -127,10 +127,10 @@ class FinchClientAsyncImpl(private val clientOptions: ClientOptions) : FinchClie code: String, redirectUri: String?, ): CompletableFuture { - if (clientOptions.clientId == null) { + if (!clientOptions.clientId().isPresent) { throw FinchException("clientId must be set in order to call getAccessToken") } - if (clientOptions.clientSecret == null) { + if (!clientOptions.clientSecret().isPresent) { throw FinchException("clientSecret must be set in order to call getAccessToken") } val request = @@ -150,11 +150,11 @@ class FinchClientAsyncImpl(private val clientOptions: ClientOptions) : FinchClie } override fun getAuthUrl(products: String, redirectUri: String, sandbox: Boolean): String { - if (clientOptions.clientId == null) { + if (!clientOptions.clientId().isPresent) { throw FinchException("Expected the clientId to be set in order to call getAuthUrl") } return "https://connect.tryfinch.com/authorize" + - "?client_id=${URLEncoder.encode(clientOptions.clientId, Charsets.UTF_8.name())}" + + "?client_id=${URLEncoder.encode(clientOptions.clientId().get(), Charsets.UTF_8.name())}" + "&products=${URLEncoder.encode(products, Charsets.UTF_8.name())}" + "&redirect_uri=${URLEncoder.encode(redirectUri, Charsets.UTF_8.name())}" + "&sandbox=${if (sandbox) "true" else "false"}" @@ -168,9 +168,9 @@ class FinchClientAsyncImpl(private val clientOptions: ClientOptions) : FinchClie .clock(clientOptions.clock) .baseUrl(clientOptions.baseUrl) .accessToken(accessToken) - .apply { clientOptions.clientId?.let(::clientId) } - .apply { clientOptions.clientSecret?.let(::clientSecret) } - .apply { clientOptions.webhookSecret?.let(::webhookSecret) } + .clientId(clientOptions.clientId()) + .clientSecret(clientOptions.clientSecret()) + .webhookSecret(clientOptions.webhookSecret()) .headers(clientOptions.headers) .responseValidation(clientOptions.responseValidation) .build() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt index b57428bf..76053176 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt @@ -11,7 +11,7 @@ import com.tryfinch.api.core.handlers.withErrorHandler import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler -import com.tryfinch.api.core.json +import com.tryfinch.api.core.http.json import com.tryfinch.api.errors.FinchError import com.tryfinch.api.errors.FinchException import com.tryfinch.api.models.* @@ -116,10 +116,10 @@ class FinchClientImpl(private val clientOptions: ClientOptions) : FinchClient { code: String, redirectUri: String?, ): String { - if (clientOptions.clientId == null) { + if (!clientOptions.clientId().isPresent) { throw FinchException("clientId must be set in order to call getAccessToken") } - if (clientOptions.clientSecret == null) { + if (!clientOptions.clientSecret().isPresent) { throw FinchException("clientSecret must be set in order to call getAccessToken") } val request = @@ -139,11 +139,11 @@ class FinchClientImpl(private val clientOptions: ClientOptions) : FinchClient { } override fun getAuthUrl(products: String, redirectUri: String, sandbox: Boolean): String { - if (clientOptions.clientId == null) { + if (!clientOptions.clientId().isPresent) { throw FinchException("Expected the clientId to be set in order to call getAuthUrl") } return "https://connect.tryfinch.com/authorize" + - "?client_id=${URLEncoder.encode(clientOptions.clientId, Charsets.UTF_8.name())}" + + "?client_id=${URLEncoder.encode(clientOptions.clientId().get(), Charsets.UTF_8.name())}" + "&products=${URLEncoder.encode(products, Charsets.UTF_8.name())}" + "&redirect_uri=${URLEncoder.encode(redirectUri, Charsets.UTF_8.name())}" + "&sandbox=${if (sandbox) "true" else "false"}" @@ -157,9 +157,9 @@ class FinchClientImpl(private val clientOptions: ClientOptions) : FinchClient { .clock(clientOptions.clock) .baseUrl(clientOptions.baseUrl) .accessToken(accessToken) - .apply { clientOptions.clientId?.let(::clientId) } - .apply { clientOptions.clientSecret?.let(::clientSecret) } - .apply { clientOptions.webhookSecret?.let(::webhookSecret) } + .clientId(clientOptions.clientId()) + .clientSecret(clientOptions.clientSecret()) + .webhookSecret(clientOptions.webhookSecret()) .headers(clientOptions.headers) .responseValidation(clientOptions.responseValidation) .build() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt index 02fb02b1..b7d95430 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt @@ -19,6 +19,7 @@ import com.tryfinch.api.errors.FinchException import com.tryfinch.api.models.AccessTokenCreateParams import com.tryfinch.api.models.CreateAccessTokenResponse import java.util.concurrent.CompletableFuture +import kotlin.jvm.optionals.getOrNull class AccessTokenServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : AccessTokenServiceAsync { @@ -52,21 +53,23 @@ class AccessTokenServiceAsyncImpl internal constructor(private val clientOptions val builder = params.toBuilder() if (!params.clientSecret().isPresent) { - if (clientOptions.clientSecret == null || clientOptions.clientSecret.isEmpty()) { + val clientSecret = clientOptions.clientSecret().getOrNull() + if (clientSecret.isNullOrEmpty()) { throw FinchException( "client_secret must be provided as an argument or with the FINCH_CLIENT_SECRET environment variable" ) } - builder.clientSecret(clientOptions.clientSecret) + builder.clientSecret(clientSecret) } if (!params.clientId().isPresent) { - if (clientOptions.clientId == null || clientOptions.clientId.isEmpty()) { + val clientId = clientOptions.clientId().getOrNull() + if (clientId.isNullOrEmpty()) { throw FinchException( "client_id must be provided as an argument or with the FINCH_CLIENT_ID environment variable" ) } - builder.clientId(clientOptions.clientId) + builder.clientId(clientId) } val modifiedParams = builder.build() @@ -76,12 +79,12 @@ class AccessTokenServiceAsyncImpl internal constructor(private val clientOptions .method(HttpMethod.POST) .addPathSegments("auth", "token") .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params._queryParams()) + .replaceAllQueryParams(modifiedParams._queryParams()) .putAllHeaders(clientOptions.headers) - .putAllHeaders(params._headers()) - .body(json(clientOptions.jsonMapper, params._body())) + .putAllHeaders(modifiedParams._headers()) + .body(json(clientOptions.jsonMapper, modifiedParams._body())) .build() - .prepareAsync(clientOptions, params) + .prepareAsync(clientOptions, modifiedParams) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/WebhookServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/WebhookServiceAsyncImpl.kt index 598b6b8e..1a9df250 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/WebhookServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/WebhookServiceAsyncImpl.kt @@ -17,6 +17,7 @@ import java.time.Instant import java.util.Base64 import javax.crypto.Mac import javax.crypto.spec.SecretKeySpec +import kotlin.jvm.optionals.getOrNull class WebhookServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : WebhookServiceAsync { @@ -35,7 +36,7 @@ class WebhookServiceAsyncImpl internal constructor(private val clientOptions: Cl override fun verifySignature(payload: String, headers: Headers, secret: String?) { val webhookSecret = secret - ?: clientOptions.webhookSecret + ?: clientOptions.webhookSecret().getOrNull() ?: throw FinchException( "The webhook secret must either be set using the env var, FINCH_WEBHOOK_SECRET, on the client class, or passed to this method" ) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt index fb2f408c..a14fc7e5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt @@ -18,6 +18,7 @@ import com.tryfinch.api.errors.FinchError import com.tryfinch.api.errors.FinchException import com.tryfinch.api.models.AccessTokenCreateParams import com.tryfinch.api.models.CreateAccessTokenResponse +import kotlin.jvm.optionals.getOrNull class AccessTokenServiceImpl internal constructor(private val clientOptions: ClientOptions) : AccessTokenService { @@ -51,21 +52,23 @@ class AccessTokenServiceImpl internal constructor(private val clientOptions: Cli val builder = params.toBuilder() if (!params.clientSecret().isPresent) { - if (clientOptions.clientSecret == null || clientOptions.clientSecret.isEmpty()) { + val clientSecret = clientOptions.clientSecret().getOrNull() + if (clientSecret.isNullOrEmpty()) { throw FinchException( "client_secret must be provided as an argument or with the FINCH_CLIENT_SECRET environment variable" ) } - builder.clientSecret(clientOptions.clientSecret) + builder.clientSecret(clientSecret) } if (!params.clientId().isPresent) { - if (clientOptions.clientId == null || clientOptions.clientId.isEmpty()) { + val clientId = clientOptions.clientId().getOrNull() + if (clientId.isNullOrEmpty()) { throw FinchException( "client_id must be provided as an argument or with the FINCH_CLIENT_ID environment variable" ) } - builder.clientId(clientOptions.clientId) + builder.clientId(clientId) } val modifiedParams = builder.build() @@ -75,12 +78,12 @@ class AccessTokenServiceImpl internal constructor(private val clientOptions: Cli .method(HttpMethod.POST) .addPathSegments("auth", "token") .putAllQueryParams(clientOptions.queryParams) - .replaceAllQueryParams(params._queryParams()) + .replaceAllQueryParams(modifiedParams._queryParams()) .putAllHeaders(clientOptions.headers) - .putAllHeaders(params._headers()) - .body(json(clientOptions.jsonMapper, params._body())) + .putAllHeaders(modifiedParams._headers()) + .body(json(clientOptions.jsonMapper, modifiedParams._body())) .build() - .prepare(clientOptions, params) + .prepare(clientOptions, modifiedParams) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response.parseable { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/WebhookServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/WebhookServiceImpl.kt index 6cb6f7b2..3ddd9b12 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/WebhookServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/WebhookServiceImpl.kt @@ -17,6 +17,7 @@ import java.time.Instant import java.util.Base64 import javax.crypto.Mac import javax.crypto.spec.SecretKeySpec +import kotlin.jvm.optionals.getOrNull class WebhookServiceImpl internal constructor(private val clientOptions: ClientOptions) : WebhookService { @@ -35,7 +36,7 @@ class WebhookServiceImpl internal constructor(private val clientOptions: ClientO override fun verifySignature(payload: String, headers: Headers, secret: String?) { val webhookSecret = secret - ?: clientOptions.webhookSecret + ?: clientOptions.webhookSecret().getOrNull() ?: throw FinchException( "The webhook secret must either be set using the env var, FINCH_WEBHOOK_SECRET, on the client class, or passed to this method" ) From c5c4196d609a6db22887e580ad14323506f0aa2a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 10 Mar 2025 14:44:42 +0000 Subject: [PATCH 15/65] feat: generate and publish docs (#481) --- README.md | 5 ++--- build.gradle.kts | 19 +++++++++++++++++ .../src/main/kotlin/finch.publish.gradle.kts | 8 +++++++ finch-java/build.gradle.kts | 21 +++++++++++++++++++ 4 files changed, 50 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9773d605..33c168dc 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![Maven Central](https://img.shields.io/maven-central/v/com.tryfinch.api/finch-java)](https://central.sonatype.com/artifact/com.tryfinch.api/finch-java/4.2.0) +[![javadoc](https://javadoc.io/badge2/com.tryfinch.api/finch-java/4.2.0/javadoc.svg)](https://javadoc.io/doc/com.tryfinch.api/finch-java/4.2.0) @@ -12,9 +13,7 @@ The Finch Java SDK is similar to the Finch Kotlin SDK but with minor differences It is generated with [Stainless](https://www.stainless.com/). -The REST API documentation can be found [in the Finch Documentation Center](https://developer.tryfinch.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/4.2.0). ## Installation diff --git a/build.gradle.kts b/build.gradle.kts index 5b66da78..a42af4d0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,23 @@ +plugins { + id("org.jetbrains.dokka") version "2.0.0" +} + +repositories { + mavenCentral() +} + allprojects { group = "com.tryfinch.api" version = "4.2.0" // x-release-please-version } + +subprojects { + apply(plugin = "org.jetbrains.dokka") +} + +// Avoid race conditions between `dokkaJavadocCollector` and `dokkaJavadocJar` tasks +tasks.named("dokkaJavadocCollector").configure { + subprojects.flatMap { it.tasks } + .filter { it.project.name != "finch-java" && it.name == "dokkaJavadocJar" } + .forEach { mustRunAfter(it) } +} diff --git a/buildSrc/src/main/kotlin/finch.publish.gradle.kts b/buildSrc/src/main/kotlin/finch.publish.gradle.kts index e193185b..814dfc3e 100644 --- a/buildSrc/src/main/kotlin/finch.publish.gradle.kts +++ b/buildSrc/src/main/kotlin/finch.publish.gradle.kts @@ -1,3 +1,5 @@ +import com.vanniktech.maven.publish.JavadocJar +import com.vanniktech.maven.publish.KotlinJvm import com.vanniktech.maven.publish.MavenPublishBaseExtension import com.vanniktech.maven.publish.SonatypeHost @@ -19,6 +21,12 @@ configure { publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) coordinates(project.group.toString(), project.name, project.version.toString()) + configure( + KotlinJvm( + javadocJar = JavadocJar.Dokka("dokkaJavadoc"), + sourcesJar = true, + ) + ) pom { name.set("API Reference") diff --git a/finch-java/build.gradle.kts b/finch-java/build.gradle.kts index b12d5c3e..8f48de09 100644 --- a/finch-java/build.gradle.kts +++ b/finch-java/build.gradle.kts @@ -6,3 +6,24 @@ plugins { dependencies { api(project(":finch-java-client-okhttp")) } + +// Redefine `dokkaJavadoc` to: +// - Depend on the root project's task for merging the docs of all the projects +// - Forward that task's output to this task's output +tasks.named("dokkaJavadoc").configure { + actions.clear() + + val dokkaJavadocCollector = rootProject.tasks["dokkaJavadocCollector"] + dependsOn(dokkaJavadocCollector) + + val outputDirectory = project.layout.buildDirectory.dir("dokka/javadoc") + doLast { + copy { + from(dokkaJavadocCollector.outputs.files) + into(outputDirectory) + duplicatesStrategy = DuplicatesStrategy.INCLUDE + } + } + + outputs.dir(outputDirectory) +} From 473058a82d86a318c3c467d60e6cedfcd416fb22 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 7 Mar 2025 19:33:00 +0000 Subject: [PATCH 16/65] chore(internal): add `.kotlin` to `.gitignore` (#483) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 39c31e3e..4e81838d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .prism.log .gradle .idea +.kotlin build codegen.log kls_database.db From 9c0806b3134e745134ee74cbeda97d2e80584c57 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 7 Mar 2025 20:39:09 +0000 Subject: [PATCH 17/65] chore(internal): use `getOrNull` instead of `orElse(null)` (#484) --- .../api/client/okhttp/FinchOkHttpClient.kt | 9 ++- .../client/okhttp/FinchOkHttpClientAsync.kt | 9 ++- .../com/tryfinch/api/core/ClientOptions.kt | 9 ++- .../kotlin/com/tryfinch/api/core/Timeout.kt | 9 ++- .../tryfinch/api/models/AccountUpdateEvent.kt | 5 +- .../tryfinch/api/models/AutomatedAsyncJob.kt | 9 ++- .../api/models/BenefitContribution.kt | 6 +- .../models/BenefitFeaturesAndOperations.kt | 15 ++-- .../tryfinch/api/models/BenefitsSupport.kt | 25 ++++--- .../kotlin/com/tryfinch/api/models/Company.kt | 37 ++++----- .../com/tryfinch/api/models/CompanyBenefit.kt | 7 +- .../com/tryfinch/api/models/CompanyEvent.kt | 3 +- .../api/models/CompanyUpdateResponse.kt | 37 ++++----- .../api/models/ConnectSessionNewParams.kt | 33 ++++---- .../ConnectSessionReauthenticateParams.kt | 16 ++-- .../api/models/CreateAccessTokenResponse.kt | 3 +- .../tryfinch/api/models/DocumentResponse.kt | 6 +- .../com/tryfinch/api/models/EmploymentData.kt | 46 ++++++------ .../api/models/EmploymentUpdateResponse.kt | 42 +++++------ .../tryfinch/api/models/EnrolledIndividual.kt | 6 +- .../api/models/HrisBenefitCreateParams.kt | 9 ++- ...nefitIndividualRetrieveManyBenefitsPage.kt | 3 +- ...fitIndividualRetrieveManyBenefitsParams.kt | 3 +- .../HrisBenefitIndividualUnenrollManyPage.kt | 3 +- .../api/models/HrisBenefitListPage.kt | 3 +- .../HrisBenefitListSupportedBenefitsPage.kt | 3 +- .../HrisDirectoryListIndividualsPage.kt | 3 +- .../HrisDirectoryListIndividualsParams.kt | 7 +- .../api/models/HrisDirectoryListPage.kt | 3 +- .../api/models/HrisDirectoryListParams.kt | 7 +- .../api/models/HrisDocumentListParams.kt | 11 ++- .../models/HrisEmploymentRetrieveManyPage.kt | 3 +- .../models/HrisIndividualRetrieveManyPage.kt | 3 +- .../HrisIndividualRetrieveManyParams.kt | 5 +- .../HrisPayStatementRetrieveManyPage.kt | 3 +- .../api/models/HrisPaymentListPage.kt | 3 +- .../kotlin/com/tryfinch/api/models/Income.kt | 10 +-- .../com/tryfinch/api/models/Individual.kt | 31 ++++---- .../tryfinch/api/models/IndividualBenefit.kt | 13 ++-- .../api/models/IndividualInDirectory.kt | 16 ++-- .../api/models/IndividualUpdateResponse.kt | 29 +++---- .../com/tryfinch/api/models/Introspection.kt | 7 +- .../api/models/JobAutomatedCreateParams.kt | 2 +- .../api/models/JobAutomatedListPage.kt | 3 +- .../api/models/JobAutomatedListParams.kt | 7 +- .../com/tryfinch/api/models/Location.kt | 17 +++-- .../com/tryfinch/api/models/ManualAsyncJob.kt | 3 +- .../kotlin/com/tryfinch/api/models/Money.kt | 4 +- .../com/tryfinch/api/models/PayStatement.kt | 74 ++++++++---------- .../kotlin/com/tryfinch/api/models/Payment.kt | 29 ++++--- .../api/models/PayrollPayGroupListPage.kt | 3 +- .../api/models/PayrollPayGroupListParams.kt | 5 +- .../com/tryfinch/api/models/Provider.kt | 5 +- .../tryfinch/api/models/ProviderListPage.kt | 3 +- .../models/RequestForwardingForwardParams.kt | 5 +- .../RequestForwardingForwardResponse.kt | 5 +- .../api/models/SandboxCompanyUpdateParams.kt | 53 ++++++------- .../models/SandboxDirectoryCreateParams.kt | 66 ++++++++-------- .../models/SandboxEmploymentUpdateParams.kt | 75 +++++++++---------- .../models/SandboxIndividualUpdateParams.kt | 53 ++++++------- .../api/models/SandboxPaymentCreateParams.kt | 75 ++++++++----------- .../tryfinch/api/models/SupportedBenefit.kt | 17 ++--- .../api/models/UnenrolledIndividual.kt | 7 +- .../kotlin/com/tryfinch/api/models/W42005.kt | 10 +-- .../kotlin/com/tryfinch/api/models/W42020.kt | 32 +++----- 65 files changed, 528 insertions(+), 535 deletions(-) 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 8a359cf5..aeed980f 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 @@ -13,6 +13,7 @@ import java.net.Proxy import java.time.Clock import java.time.Duration import java.util.Optional +import kotlin.jvm.optionals.getOrNull class FinchOkHttpClient private constructor() { @@ -145,22 +146,22 @@ class FinchOkHttpClient private constructor() { fun accessToken(accessToken: String?) = apply { clientOptions.accessToken(accessToken) } - fun accessToken(accessToken: Optional) = accessToken(accessToken.orElse(null)) + fun accessToken(accessToken: Optional) = accessToken(accessToken.getOrNull()) fun clientId(clientId: String?) = apply { clientOptions.clientId(clientId) } - fun clientId(clientId: Optional) = clientId(clientId.orElse(null)) + fun clientId(clientId: Optional) = clientId(clientId.getOrNull()) fun clientSecret(clientSecret: String?) = apply { clientOptions.clientSecret(clientSecret) } - fun clientSecret(clientSecret: Optional) = clientSecret(clientSecret.orElse(null)) + fun clientSecret(clientSecret: Optional) = clientSecret(clientSecret.getOrNull()) fun webhookSecret(webhookSecret: String?) = apply { clientOptions.webhookSecret(webhookSecret) } fun webhookSecret(webhookSecret: Optional) = - webhookSecret(webhookSecret.orElse(null)) + webhookSecret(webhookSecret.getOrNull()) fun fromEnv() = apply { clientOptions.fromEnv() } 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 88241e66..6f744be2 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 @@ -13,6 +13,7 @@ import java.net.Proxy import java.time.Clock import java.time.Duration import java.util.Optional +import kotlin.jvm.optionals.getOrNull class FinchOkHttpClientAsync private constructor() { @@ -145,22 +146,22 @@ class FinchOkHttpClientAsync private constructor() { fun accessToken(accessToken: String?) = apply { clientOptions.accessToken(accessToken) } - fun accessToken(accessToken: Optional) = accessToken(accessToken.orElse(null)) + fun accessToken(accessToken: Optional) = accessToken(accessToken.getOrNull()) fun clientId(clientId: String?) = apply { clientOptions.clientId(clientId) } - fun clientId(clientId: Optional) = clientId(clientId.orElse(null)) + fun clientId(clientId: Optional) = clientId(clientId.getOrNull()) fun clientSecret(clientSecret: String?) = apply { clientOptions.clientSecret(clientSecret) } - fun clientSecret(clientSecret: Optional) = clientSecret(clientSecret.orElse(null)) + fun clientSecret(clientSecret: Optional) = clientSecret(clientSecret.getOrNull()) fun webhookSecret(webhookSecret: String?) = apply { clientOptions.webhookSecret(webhookSecret) } fun webhookSecret(webhookSecret: Optional) = - webhookSecret(webhookSecret.orElse(null)) + webhookSecret(webhookSecret.getOrNull()) fun fromEnv() = apply { clientOptions.fromEnv() } 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 479a78ba..9e700942 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 @@ -11,6 +11,7 @@ import com.tryfinch.api.core.http.RetryingHttpClient import java.time.Clock import java.util.Base64 import java.util.Optional +import kotlin.jvm.optionals.getOrNull class ClientOptions private constructor( @@ -109,20 +110,20 @@ private constructor( fun accessToken(accessToken: String?) = apply { this.accessToken = accessToken } - fun accessToken(accessToken: Optional) = accessToken(accessToken.orElse(null)) + fun accessToken(accessToken: Optional) = accessToken(accessToken.getOrNull()) fun clientId(clientId: String?) = apply { this.clientId = clientId } - fun clientId(clientId: Optional) = clientId(clientId.orElse(null)) + fun clientId(clientId: Optional) = clientId(clientId.getOrNull()) fun clientSecret(clientSecret: String?) = apply { this.clientSecret = clientSecret } - fun clientSecret(clientSecret: Optional) = clientSecret(clientSecret.orElse(null)) + fun clientSecret(clientSecret: Optional) = clientSecret(clientSecret.getOrNull()) fun webhookSecret(webhookSecret: String?) = apply { this.webhookSecret = webhookSecret } fun webhookSecret(webhookSecret: Optional) = - webhookSecret(webhookSecret.orElse(null)) + webhookSecret(webhookSecret.getOrNull()) fun headers(headers: Headers) = apply { this.headers.clear() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt index 208cd4e2..fc7d859e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt @@ -5,6 +5,7 @@ package com.tryfinch.api.core import java.time.Duration import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** A class containing timeouts for various processing phases of a request. */ class Timeout @@ -96,7 +97,7 @@ private constructor( * * Defaults to `Duration.ofMinutes(1)`. */ - fun connect(connect: Optional) = connect(connect.orElse(null)) + fun connect(connect: Optional) = connect(connect.getOrNull()) /** * The maximum time allowed between two data packets when waiting for the server’s response. @@ -114,7 +115,7 @@ private constructor( * * Defaults to `request()`. */ - fun read(read: Optional) = read(read.orElse(null)) + fun read(read: Optional) = read(read.getOrNull()) /** * The maximum time allowed between two data packets when sending the request to the server. @@ -132,7 +133,7 @@ private constructor( * * Defaults to `request()`. */ - fun write(write: Optional) = write(write.orElse(null)) + fun write(write: Optional) = write(write.getOrNull()) /** * The maximum time allowed for a complete HTTP call, not including retries. @@ -156,7 +157,7 @@ private constructor( * * Defaults to `Duration.ofMinutes(1)`. */ - fun request(request: Optional) = request(request.orElse(null)) + fun request(request: Optional) = request(request.getOrNull()) fun build(): Timeout = Timeout(connect, read, write, request) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt index 7d18bc8d..e6218257 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt @@ -18,6 +18,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class AccountUpdateEvent @@ -436,7 +437,7 @@ private constructor( * supported, the property will be null */ fun benefitsSupport(benefitsSupport: Optional) = - benefitsSupport(benefitsSupport.orElse(null)) + benefitsSupport(benefitsSupport.getOrNull()) /** * Each benefit type and their supported features. If the benefit type is not @@ -452,7 +453,7 @@ private constructor( /** The supported data fields returned by our HR and payroll endpoints */ fun supportedFields(supportedFields: Optional) = - supportedFields(supportedFields.orElse(null)) + supportedFields(supportedFields.getOrNull()) /** The supported data fields returned by our HR and payroll endpoints */ fun supportedFields(supportedFields: JsonField) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt index 8e448688..03b3230b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt @@ -19,6 +19,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class AutomatedAsyncJob @@ -205,7 +206,7 @@ private constructor( /** The datetime the job completed. */ fun completedAt(completedAt: Optional) = - completedAt(completedAt.orElse(null)) + completedAt(completedAt.getOrNull()) /** The datetime the job completed. */ fun completedAt(completedAt: JsonField) = apply { @@ -242,7 +243,7 @@ private constructor( fun params(params: Params?) = params(JsonField.ofNullable(params)) /** The input parameters for the job. */ - fun params(params: Optional) = params(params.orElse(null)) + fun params(params: Optional) = params(params.getOrNull()) /** The input parameters for the job. */ fun params(params: JsonField) = apply { this.params = params } @@ -261,7 +262,7 @@ private constructor( * be null. */ fun scheduledAt(scheduledAt: Optional) = - scheduledAt(scheduledAt.orElse(null)) + scheduledAt(scheduledAt.getOrNull()) /** * The datetime a job is scheduled to be run. For scheduled jobs, this datetime can be in @@ -276,7 +277,7 @@ private constructor( fun startedAt(startedAt: OffsetDateTime?) = startedAt(JsonField.ofNullable(startedAt)) /** The datetime a job entered into the job queue. */ - fun startedAt(startedAt: Optional) = startedAt(startedAt.orElse(null)) + fun startedAt(startedAt: Optional) = startedAt(startedAt.getOrNull()) /** The datetime a job entered into the job queue. */ fun startedAt(startedAt: JsonField) = apply { this.startedAt = startedAt } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt index 4805034c..0be9d94f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt @@ -17,6 +17,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class BenefitContribution @@ -84,8 +85,7 @@ private constructor( fun amount(amount: Long) = amount(amount as Long?) /** Contribution amount in cents (if `fixed`) or basis points (if `percent`). */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun amount(amount: Optional) = amount(amount.orElse(null) as Long?) + fun amount(amount: Optional) = amount(amount.getOrNull()) /** Contribution amount in cents (if `fixed`) or basis points (if `percent`). */ fun amount(amount: JsonField) = apply { this.amount = amount } @@ -94,7 +94,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) /** Contribution type. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** Contribution type. */ fun type(type: JsonField) = apply { this.type = type } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt index 19b25387..48c92ca9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt @@ -18,6 +18,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class BenefitFeaturesAndOperations @@ -292,9 +293,8 @@ private constructor( fun annualMaximum(annualMaximum: Boolean) = annualMaximum(annualMaximum as Boolean?) /** Whether the provider supports an annual maximum for this benefit. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun annualMaximum(annualMaximum: Optional) = - annualMaximum(annualMaximum.orElse(null) as Boolean?) + annualMaximum(annualMaximum.getOrNull()) /** Whether the provider supports an annual maximum for this benefit. */ fun annualMaximum(annualMaximum: JsonField) = apply { @@ -317,8 +317,7 @@ private constructor( * Whether the provider supports catch up for this benefit. This field will only be true * for retirement benefits. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun catchUp(catchUp: Optional) = catchUp(catchUp.orElse(null) as Boolean?) + fun catchUp(catchUp: Optional) = catchUp(catchUp.getOrNull()) /** * Whether the provider supports catch up for this benefit. This field will only be true @@ -338,7 +337,7 @@ private constructor( * supported. */ fun companyContribution(companyContribution: Optional>) = - companyContribution(companyContribution.orElse(null)) + companyContribution(companyContribution.getOrNull()) /** * Supported contribution types. An empty array indicates contributions are not @@ -362,7 +361,7 @@ private constructor( fun description(description: String?) = description(JsonField.ofNullable(description)) - fun description(description: Optional) = description(description.orElse(null)) + fun description(description: Optional) = description(description.getOrNull()) fun description(description: JsonField) = apply { this.description = description @@ -374,7 +373,7 @@ private constructor( /** Supported deduction types. An empty array indicates deductions are not supported. */ fun employeeDeduction(employeeDeduction: Optional>) = - employeeDeduction(employeeDeduction.orElse(null)) + employeeDeduction(employeeDeduction.getOrNull()) /** Supported deduction types. An empty array indicates deductions are not supported. */ fun employeeDeduction(employeeDeduction: JsonField>) = apply { @@ -418,7 +417,7 @@ private constructor( * supported for the benefit. This array only has values for HSA benefits. */ fun hsaContributionLimit(hsaContributionLimit: Optional>) = - hsaContributionLimit(hsaContributionLimit.orElse(null)) + hsaContributionLimit(hsaContributionLimit.getOrNull()) /** * Whether the provider supports HSA contribution limits. Empty if this feature is not diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt index f887a5d1..9a67fafc 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt @@ -15,6 +15,7 @@ import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * Each benefit type and their supported features. If the benefit type is not supported, the @@ -219,7 +220,7 @@ private constructor( commuter(JsonField.ofNullable(commuter)) fun commuter(commuter: Optional) = - commuter(commuter.orElse(null)) + commuter(commuter.getOrNull()) fun commuter(commuter: JsonField) = apply { this.commuter = commuter @@ -229,7 +230,7 @@ private constructor( customPostTax(JsonField.ofNullable(customPostTax)) fun customPostTax(customPostTax: Optional) = - customPostTax(customPostTax.orElse(null)) + customPostTax(customPostTax.getOrNull()) fun customPostTax(customPostTax: JsonField) = apply { this.customPostTax = customPostTax @@ -239,7 +240,7 @@ private constructor( customPreTax(JsonField.ofNullable(customPreTax)) fun customPreTax(customPreTax: Optional) = - customPreTax(customPreTax.orElse(null)) + customPreTax(customPreTax.getOrNull()) fun customPreTax(customPreTax: JsonField) = apply { this.customPreTax = customPreTax @@ -249,7 +250,7 @@ private constructor( fsaDependentCare(JsonField.ofNullable(fsaDependentCare)) fun fsaDependentCare(fsaDependentCare: Optional) = - fsaDependentCare(fsaDependentCare.orElse(null)) + fsaDependentCare(fsaDependentCare.getOrNull()) fun fsaDependentCare(fsaDependentCare: JsonField) = apply { this.fsaDependentCare = fsaDependentCare @@ -259,7 +260,7 @@ private constructor( fsaMedical(JsonField.ofNullable(fsaMedical)) fun fsaMedical(fsaMedical: Optional) = - fsaMedical(fsaMedical.orElse(null)) + fsaMedical(fsaMedical.getOrNull()) fun fsaMedical(fsaMedical: JsonField) = apply { this.fsaMedical = fsaMedical @@ -267,7 +268,7 @@ private constructor( fun hsaPost(hsaPost: BenefitFeaturesAndOperations?) = hsaPost(JsonField.ofNullable(hsaPost)) - fun hsaPost(hsaPost: Optional) = hsaPost(hsaPost.orElse(null)) + fun hsaPost(hsaPost: Optional) = hsaPost(hsaPost.getOrNull()) fun hsaPost(hsaPost: JsonField) = apply { this.hsaPost = hsaPost @@ -275,7 +276,7 @@ private constructor( fun hsaPre(hsaPre: BenefitFeaturesAndOperations?) = hsaPre(JsonField.ofNullable(hsaPre)) - fun hsaPre(hsaPre: Optional) = hsaPre(hsaPre.orElse(null)) + fun hsaPre(hsaPre: Optional) = hsaPre(hsaPre.getOrNull()) fun hsaPre(hsaPre: JsonField) = apply { this.hsaPre = hsaPre } @@ -283,7 +284,7 @@ private constructor( s125Dental(JsonField.ofNullable(s125Dental)) fun s125Dental(s125Dental: Optional) = - s125Dental(s125Dental.orElse(null)) + s125Dental(s125Dental.getOrNull()) fun s125Dental(s125Dental: JsonField) = apply { this.s125Dental = s125Dental @@ -293,7 +294,7 @@ private constructor( s125Medical(JsonField.ofNullable(s125Medical)) fun s125Medical(s125Medical: Optional) = - s125Medical(s125Medical.orElse(null)) + s125Medical(s125Medical.getOrNull()) fun s125Medical(s125Medical: JsonField) = apply { this.s125Medical = s125Medical @@ -303,7 +304,7 @@ private constructor( s125Vision(JsonField.ofNullable(s125Vision)) fun s125Vision(s125Vision: Optional) = - s125Vision(s125Vision.orElse(null)) + s125Vision(s125Vision.getOrNull()) fun s125Vision(s125Vision: JsonField) = apply { this.s125Vision = s125Vision @@ -311,7 +312,7 @@ private constructor( fun simple(simple: BenefitFeaturesAndOperations?) = simple(JsonField.ofNullable(simple)) - fun simple(simple: Optional) = simple(simple.orElse(null)) + fun simple(simple: Optional) = simple(simple.getOrNull()) fun simple(simple: JsonField) = apply { this.simple = simple } @@ -319,7 +320,7 @@ private constructor( simpleIra(JsonField.ofNullable(simpleIra)) fun simpleIra(simpleIra: Optional) = - simpleIra(simpleIra.orElse(null)) + simpleIra(simpleIra.getOrNull()) fun simpleIra(simpleIra: JsonField) = apply { this.simpleIra = simpleIra diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt index 846ed3ce..bf5c255d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt @@ -19,6 +19,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class Company @@ -198,7 +199,7 @@ private constructor( fun accounts(accounts: List?) = accounts(JsonField.ofNullable(accounts)) /** An array of bank account objects associated with the payroll/HRIS system. */ - fun accounts(accounts: Optional>) = accounts(accounts.orElse(null)) + fun accounts(accounts: Optional>) = accounts(accounts.getOrNull()) /** An array of bank account objects associated with the payroll/HRIS system. */ fun accounts(accounts: JsonField>) = apply { @@ -219,7 +220,7 @@ private constructor( /** The array of company departments. */ fun departments(departments: Optional>) = - departments(departments.orElse(null)) + departments(departments.getOrNull()) /** The array of company departments. */ fun departments(departments: JsonField>) = apply { @@ -238,7 +239,7 @@ private constructor( fun ein(ein: String?) = ein(JsonField.ofNullable(ein)) /** The employer identification number. */ - fun ein(ein: Optional) = ein(ein.orElse(null)) + fun ein(ein: Optional) = ein(ein.getOrNull()) /** The employer identification number. */ fun ein(ein: JsonField) = apply { this.ein = ein } @@ -247,7 +248,7 @@ private constructor( fun entity(entity: Entity?) = entity(JsonField.ofNullable(entity)) /** The entity type object. */ - fun entity(entity: Optional) = entity(entity.orElse(null)) + fun entity(entity: Optional) = entity(entity.getOrNull()) /** The entity type object. */ fun entity(entity: JsonField) = apply { this.entity = entity } @@ -256,14 +257,14 @@ private constructor( fun legalName(legalName: String?) = legalName(JsonField.ofNullable(legalName)) /** The legal name of the company. */ - fun legalName(legalName: Optional) = legalName(legalName.orElse(null)) + fun legalName(legalName: Optional) = legalName(legalName.getOrNull()) /** The legal name of the company. */ fun legalName(legalName: JsonField) = apply { this.legalName = legalName } fun locations(locations: List?) = locations(JsonField.ofNullable(locations)) - fun locations(locations: Optional>) = locations(locations.orElse(null)) + fun locations(locations: Optional>) = locations(locations.getOrNull()) fun locations(locations: JsonField>) = apply { this.locations = locations.map { it.toMutableList() } @@ -280,7 +281,7 @@ private constructor( fun primaryEmail(primaryEmail: String?) = primaryEmail(JsonField.ofNullable(primaryEmail)) /** The email of the main administrator on the account. */ - fun primaryEmail(primaryEmail: Optional) = primaryEmail(primaryEmail.orElse(null)) + fun primaryEmail(primaryEmail: Optional) = primaryEmail(primaryEmail.getOrNull()) /** The email of the main administrator on the account. */ fun primaryEmail(primaryEmail: JsonField) = apply { @@ -293,7 +294,7 @@ private constructor( /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ fun primaryPhoneNumber(primaryPhoneNumber: Optional) = - primaryPhoneNumber(primaryPhoneNumber.orElse(null)) + primaryPhoneNumber(primaryPhoneNumber.getOrNull()) /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ fun primaryPhoneNumber(primaryPhoneNumber: JsonField) = apply { @@ -457,7 +458,7 @@ private constructor( fun accountName(accountName: String?) = accountName(JsonField.ofNullable(accountName)) /** The name of the bank associated in the payroll/HRIS system. */ - fun accountName(accountName: Optional) = accountName(accountName.orElse(null)) + fun accountName(accountName: Optional) = accountName(accountName.getOrNull()) /** The name of the bank associated in the payroll/HRIS system. */ fun accountName(accountName: JsonField) = apply { @@ -470,7 +471,7 @@ private constructor( /** 10-12 digit number to specify the bank account */ fun accountNumber(accountNumber: Optional) = - accountNumber(accountNumber.orElse(null)) + accountNumber(accountNumber.getOrNull()) /** 10-12 digit number to specify the bank account */ fun accountNumber(accountNumber: JsonField) = apply { @@ -483,7 +484,7 @@ private constructor( /** The type of bank account. */ fun accountType(accountType: Optional) = - accountType(accountType.orElse(null)) + accountType(accountType.getOrNull()) /** The type of bank account. */ fun accountType(accountType: JsonField) = apply { @@ -496,7 +497,7 @@ private constructor( /** Name of the banking institution. */ fun institutionName(institutionName: Optional) = - institutionName(institutionName.orElse(null)) + institutionName(institutionName.getOrNull()) /** Name of the banking institution. */ fun institutionName(institutionName: JsonField) = apply { @@ -515,7 +516,7 @@ private constructor( * opened. */ fun routingNumber(routingNumber: Optional) = - routingNumber(routingNumber.orElse(null)) + routingNumber(routingNumber.getOrNull()) /** * A nine-digit code that's based on the U.S. Bank location where your account was @@ -746,7 +747,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** The department name. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The department name. */ fun name(name: JsonField) = apply { this.name = name } @@ -755,7 +756,7 @@ private constructor( fun parent(parent: Parent?) = parent(JsonField.ofNullable(parent)) /** The parent department, if present. */ - fun parent(parent: Optional) = parent(parent.orElse(null)) + fun parent(parent: Optional) = parent(parent.getOrNull()) /** The parent department, if present. */ fun parent(parent: JsonField) = apply { this.parent = parent } @@ -839,7 +840,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** The parent department's name. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The parent department's name. */ fun name(name: JsonField) = apply { this.name = name } @@ -972,7 +973,7 @@ private constructor( fun subtype(subtype: Subtype?) = subtype(JsonField.ofNullable(subtype)) /** The tax payer subtype of the company. */ - fun subtype(subtype: Optional) = subtype(subtype.orElse(null)) + fun subtype(subtype: Optional) = subtype(subtype.getOrNull()) /** The tax payer subtype of the company. */ fun subtype(subtype: JsonField) = apply { this.subtype = subtype } @@ -981,7 +982,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) /** The tax payer type of the company. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** The tax payer type of the company. */ fun type(type: JsonField) = apply { this.type = type } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt index 632865f4..5ea643d9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt @@ -16,6 +16,7 @@ import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class CompanyBenefit @@ -118,13 +119,13 @@ private constructor( fun description(description: String?) = description(JsonField.ofNullable(description)) - fun description(description: Optional) = description(description.orElse(null)) + fun description(description: Optional) = description(description.getOrNull()) fun description(description: JsonField) = apply { this.description = description } fun frequency(frequency: BenefitFrequency?) = frequency(JsonField.ofNullable(frequency)) - fun frequency(frequency: Optional) = frequency(frequency.orElse(null)) + fun frequency(frequency: Optional) = frequency(frequency.getOrNull()) fun frequency(frequency: JsonField) = apply { this.frequency = frequency } @@ -132,7 +133,7 @@ private constructor( fun type(type: BenefitType?) = type(JsonField.ofNullable(type)) /** Type of benefit. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** Type of benefit. */ fun type(type: JsonField) = apply { this.type = type } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt index 29d8479e..ceb6069d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt @@ -18,6 +18,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class CompanyEvent @@ -186,7 +187,7 @@ private constructor( fun data(data: Data?) = data(JsonField.ofNullable(data)) - fun data(data: Optional) = data(data.orElse(null)) + fun data(data: Optional) = data(data.getOrNull()) fun data(data: JsonField) = apply { this.data = data } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt index a2f99650..b9568f77 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt @@ -19,6 +19,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class CompanyUpdateResponse @@ -181,7 +182,7 @@ private constructor( fun accounts(accounts: List?) = accounts(JsonField.ofNullable(accounts)) /** An array of bank account objects associated with the payroll/HRIS system. */ - fun accounts(accounts: Optional>) = accounts(accounts.orElse(null)) + fun accounts(accounts: Optional>) = accounts(accounts.getOrNull()) /** An array of bank account objects associated with the payroll/HRIS system. */ fun accounts(accounts: JsonField>) = apply { @@ -202,7 +203,7 @@ private constructor( /** The array of company departments. */ fun departments(departments: Optional>) = - departments(departments.orElse(null)) + departments(departments.getOrNull()) /** The array of company departments. */ fun departments(departments: JsonField>) = apply { @@ -221,7 +222,7 @@ private constructor( fun ein(ein: String?) = ein(JsonField.ofNullable(ein)) /** The employer identification number. */ - fun ein(ein: Optional) = ein(ein.orElse(null)) + fun ein(ein: Optional) = ein(ein.getOrNull()) /** The employer identification number. */ fun ein(ein: JsonField) = apply { this.ein = ein } @@ -230,7 +231,7 @@ private constructor( fun entity(entity: Entity?) = entity(JsonField.ofNullable(entity)) /** The entity type object. */ - fun entity(entity: Optional) = entity(entity.orElse(null)) + fun entity(entity: Optional) = entity(entity.getOrNull()) /** The entity type object. */ fun entity(entity: JsonField) = apply { this.entity = entity } @@ -239,14 +240,14 @@ private constructor( fun legalName(legalName: String?) = legalName(JsonField.ofNullable(legalName)) /** The legal name of the company. */ - fun legalName(legalName: Optional) = legalName(legalName.orElse(null)) + fun legalName(legalName: Optional) = legalName(legalName.getOrNull()) /** The legal name of the company. */ fun legalName(legalName: JsonField) = apply { this.legalName = legalName } fun locations(locations: List?) = locations(JsonField.ofNullable(locations)) - fun locations(locations: Optional>) = locations(locations.orElse(null)) + fun locations(locations: Optional>) = locations(locations.getOrNull()) fun locations(locations: JsonField>) = apply { this.locations = locations.map { it.toMutableList() } @@ -263,7 +264,7 @@ private constructor( fun primaryEmail(primaryEmail: String?) = primaryEmail(JsonField.ofNullable(primaryEmail)) /** The email of the main administrator on the account. */ - fun primaryEmail(primaryEmail: Optional) = primaryEmail(primaryEmail.orElse(null)) + fun primaryEmail(primaryEmail: Optional) = primaryEmail(primaryEmail.getOrNull()) /** The email of the main administrator on the account. */ fun primaryEmail(primaryEmail: JsonField) = apply { @@ -276,7 +277,7 @@ private constructor( /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ fun primaryPhoneNumber(primaryPhoneNumber: Optional) = - primaryPhoneNumber(primaryPhoneNumber.orElse(null)) + primaryPhoneNumber(primaryPhoneNumber.getOrNull()) /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ fun primaryPhoneNumber(primaryPhoneNumber: JsonField) = apply { @@ -439,7 +440,7 @@ private constructor( fun accountName(accountName: String?) = accountName(JsonField.ofNullable(accountName)) /** The name of the bank associated in the payroll/HRIS system. */ - fun accountName(accountName: Optional) = accountName(accountName.orElse(null)) + fun accountName(accountName: Optional) = accountName(accountName.getOrNull()) /** The name of the bank associated in the payroll/HRIS system. */ fun accountName(accountName: JsonField) = apply { @@ -452,7 +453,7 @@ private constructor( /** 10-12 digit number to specify the bank account */ fun accountNumber(accountNumber: Optional) = - accountNumber(accountNumber.orElse(null)) + accountNumber(accountNumber.getOrNull()) /** 10-12 digit number to specify the bank account */ fun accountNumber(accountNumber: JsonField) = apply { @@ -465,7 +466,7 @@ private constructor( /** The type of bank account. */ fun accountType(accountType: Optional) = - accountType(accountType.orElse(null)) + accountType(accountType.getOrNull()) /** The type of bank account. */ fun accountType(accountType: JsonField) = apply { @@ -478,7 +479,7 @@ private constructor( /** Name of the banking institution. */ fun institutionName(institutionName: Optional) = - institutionName(institutionName.orElse(null)) + institutionName(institutionName.getOrNull()) /** Name of the banking institution. */ fun institutionName(institutionName: JsonField) = apply { @@ -497,7 +498,7 @@ private constructor( * opened. */ fun routingNumber(routingNumber: Optional) = - routingNumber(routingNumber.orElse(null)) + routingNumber(routingNumber.getOrNull()) /** * A nine-digit code that's based on the U.S. Bank location where your account was @@ -728,7 +729,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** The department name. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The department name. */ fun name(name: JsonField) = apply { this.name = name } @@ -737,7 +738,7 @@ private constructor( fun parent(parent: Parent?) = parent(JsonField.ofNullable(parent)) /** The parent department, if present. */ - fun parent(parent: Optional) = parent(parent.orElse(null)) + fun parent(parent: Optional) = parent(parent.getOrNull()) /** The parent department, if present. */ fun parent(parent: JsonField) = apply { this.parent = parent } @@ -821,7 +822,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** The parent department's name. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The parent department's name. */ fun name(name: JsonField) = apply { this.name = name } @@ -954,7 +955,7 @@ private constructor( fun subtype(subtype: Subtype?) = subtype(JsonField.ofNullable(subtype)) /** The tax payer subtype of the company. */ - fun subtype(subtype: Optional) = subtype(subtype.orElse(null)) + fun subtype(subtype: Optional) = subtype(subtype.getOrNull()) /** The tax payer subtype of the company. */ fun subtype(subtype: JsonField) = apply { this.subtype = subtype } @@ -963,7 +964,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) /** The tax payer type of the company. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** The tax payer type of the company. */ fun type(type: JsonField) = apply { this.type = type } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt index c49cf357..08194700 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt @@ -22,6 +22,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Create a new connect session for an employer */ class ConnectSessionNewParams @@ -271,7 +272,7 @@ private constructor( customerEmail(JsonField.ofNullable(customerEmail)) fun customerEmail(customerEmail: Optional) = - customerEmail(customerEmail.orElse(null)) + customerEmail(customerEmail.getOrNull()) fun customerEmail(customerEmail: JsonField) = apply { this.customerEmail = customerEmail @@ -281,7 +282,7 @@ private constructor( integration(JsonField.ofNullable(integration)) fun integration(integration: Optional) = - integration(integration.orElse(null)) + integration(integration.getOrNull()) fun integration(integration: JsonField) = apply { this.integration = integration @@ -291,8 +292,7 @@ private constructor( fun manual(manual: Boolean) = manual(manual as Boolean?) - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun manual(manual: Optional) = manual(manual.orElse(null) as Boolean?) + fun manual(manual: Optional) = manual(manual.getOrNull()) fun manual(manual: JsonField) = apply { this.manual = manual } @@ -314,9 +314,8 @@ private constructor( * The number of minutes until the session expires (defaults to 43,200, which is 30 * days) */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun minutesToExpire(minutesToExpire: Optional) = - minutesToExpire(minutesToExpire.orElse(null) as Double?) + minutesToExpire(minutesToExpire.getOrNull()) /** * The number of minutes until the session expires (defaults to 43,200, which is 30 @@ -328,7 +327,7 @@ private constructor( fun redirectUri(redirectUri: String?) = redirectUri(JsonField.ofNullable(redirectUri)) - fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.orElse(null)) + fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.getOrNull()) fun redirectUri(redirectUri: JsonField) = apply { this.redirectUri = redirectUri @@ -336,7 +335,7 @@ private constructor( fun sandbox(sandbox: Sandbox?) = sandbox(JsonField.ofNullable(sandbox)) - fun sandbox(sandbox: Optional) = sandbox(sandbox.orElse(null)) + fun sandbox(sandbox: Optional) = sandbox(sandbox.getOrNull()) fun sandbox(sandbox: JsonField) = apply { this.sandbox = sandbox } @@ -443,7 +442,7 @@ private constructor( fun customerEmail(customerEmail: String?) = apply { body.customerEmail(customerEmail) } fun customerEmail(customerEmail: Optional) = - customerEmail(customerEmail.orElse(null)) + customerEmail(customerEmail.getOrNull()) fun customerEmail(customerEmail: JsonField) = apply { body.customerEmail(customerEmail) @@ -451,7 +450,7 @@ private constructor( fun integration(integration: Integration?) = apply { body.integration(integration) } - fun integration(integration: Optional) = integration(integration.orElse(null)) + fun integration(integration: Optional) = integration(integration.getOrNull()) fun integration(integration: JsonField) = apply { body.integration(integration) @@ -461,8 +460,7 @@ private constructor( fun manual(manual: Boolean) = manual(manual as Boolean?) - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun manual(manual: Optional) = manual(manual.orElse(null) as Boolean?) + fun manual(manual: Optional) = manual(manual.getOrNull()) fun manual(manual: JsonField) = apply { body.manual(manual) } @@ -481,9 +479,8 @@ private constructor( /** * The number of minutes until the session expires (defaults to 43,200, which is 30 days) */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun minutesToExpire(minutesToExpire: Optional) = - minutesToExpire(minutesToExpire.orElse(null) as Double?) + minutesToExpire(minutesToExpire.getOrNull()) /** * The number of minutes until the session expires (defaults to 43,200, which is 30 days) @@ -494,13 +491,13 @@ private constructor( fun redirectUri(redirectUri: String?) = apply { body.redirectUri(redirectUri) } - fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.orElse(null)) + fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.getOrNull()) fun redirectUri(redirectUri: JsonField) = apply { body.redirectUri(redirectUri) } fun sandbox(sandbox: Sandbox?) = apply { body.sandbox(sandbox) } - fun sandbox(sandbox: Optional) = sandbox(sandbox.orElse(null)) + fun sandbox(sandbox: Optional) = sandbox(sandbox.getOrNull()) fun sandbox(sandbox: JsonField) = apply { body.sandbox(sandbox) } @@ -832,7 +829,7 @@ private constructor( fun authMethod(authMethod: AuthMethod?) = authMethod(JsonField.ofNullable(authMethod)) - fun authMethod(authMethod: Optional) = authMethod(authMethod.orElse(null)) + fun authMethod(authMethod: Optional) = authMethod(authMethod.getOrNull()) fun authMethod(authMethod: JsonField) = apply { this.authMethod = authMethod @@ -840,7 +837,7 @@ private constructor( fun provider(provider: String?) = provider(JsonField.ofNullable(provider)) - fun provider(provider: Optional) = provider(provider.orElse(null)) + fun provider(provider: Optional) = provider(provider.getOrNull()) fun provider(provider: JsonField) = apply { this.provider = provider } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt index 0a1d1aa0..674be9bb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt @@ -22,6 +22,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Create a new Connect session for reauthenticating an existing connection */ class ConnectSessionReauthenticateParams @@ -202,9 +203,8 @@ private constructor( * The number of minutes until the session expires (defaults to 43,200, which is 30 * days) */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun minutesToExpire(minutesToExpire: Optional) = - minutesToExpire(minutesToExpire.orElse(null) as Long?) + minutesToExpire(minutesToExpire.getOrNull()) /** * The number of minutes until the session expires (defaults to 43,200, which is 30 @@ -219,8 +219,7 @@ private constructor( products(JsonField.ofNullable(products)) /** The products to request access to (optional for reauthentication) */ - fun products(products: Optional>) = - products(products.orElse(null)) + fun products(products: Optional>) = products(products.getOrNull()) /** The products to request access to (optional for reauthentication) */ fun products(products: JsonField>) = apply { @@ -239,7 +238,7 @@ private constructor( fun redirectUri(redirectUri: String?) = redirectUri(JsonField.ofNullable(redirectUri)) /** The URI to redirect to after the Connect flow is completed */ - fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.orElse(null)) + fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.getOrNull()) /** The URI to redirect to after the Connect flow is completed */ fun redirectUri(redirectUri: JsonField) = apply { @@ -349,9 +348,8 @@ private constructor( /** * The number of minutes until the session expires (defaults to 43,200, which is 30 days) */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun minutesToExpire(minutesToExpire: Optional) = - minutesToExpire(minutesToExpire.orElse(null) as Long?) + minutesToExpire(minutesToExpire.getOrNull()) /** * The number of minutes until the session expires (defaults to 43,200, which is 30 days) @@ -364,7 +362,7 @@ private constructor( fun products(products: List?) = apply { body.products(products) } /** The products to request access to (optional for reauthentication) */ - fun products(products: Optional>) = products(products.orElse(null)) + fun products(products: Optional>) = products(products.getOrNull()) /** The products to request access to (optional for reauthentication) */ fun products(products: JsonField>) = apply { body.products(products) } @@ -376,7 +374,7 @@ private constructor( fun redirectUri(redirectUri: String?) = apply { body.redirectUri(redirectUri) } /** The URI to redirect to after the Connect flow is completed */ - fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.orElse(null)) + fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.getOrNull()) /** The URI to redirect to after the Connect flow is completed */ fun redirectUri(redirectUri: JsonField) = apply { body.redirectUri(redirectUri) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt index 48371d66..2fa19d9f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt @@ -19,6 +19,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class CreateAccessTokenResponse @@ -314,7 +315,7 @@ private constructor( * The ID of your customer you provided to Finch when a connect session was created for this * connection. */ - fun customerId(customerId: Optional) = customerId(customerId.orElse(null)) + fun customerId(customerId: Optional) = customerId(customerId.getOrNull()) /** * The ID of your customer you provided to Finch when a connect session was created for this diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt index 0f91b3f0..a029ccc0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt @@ -17,6 +17,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class DocumentResponse @@ -140,7 +141,7 @@ private constructor( * The ID of the individual associated with the document. This will be null for * employer-level documents. */ - fun individualId(individualId: Optional) = individualId(individualId.orElse(null)) + fun individualId(individualId: Optional) = individualId(individualId.getOrNull()) /** * The ID of the individual associated with the document. This will be null for @@ -175,8 +176,7 @@ private constructor( fun year(year: Double) = year(year as Double?) /** The year the document applies to, if available. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun year(year: Optional) = year(year.orElse(null) as Double?) + fun year(year: Optional) = year(year.getOrNull()) /** The year the document applies to, if available. */ fun year(year: JsonField) = apply { this.year = year } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt index 1750e349..df60c4b1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt @@ -18,6 +18,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class EmploymentData @@ -338,7 +339,7 @@ private constructor( fun classCode(classCode: String?) = classCode(JsonField.ofNullable(classCode)) /** Worker's compensation classification code for this employee */ - fun classCode(classCode: Optional) = classCode(classCode.orElse(null)) + fun classCode(classCode: Optional) = classCode(classCode.getOrNull()) /** Worker's compensation classification code for this employee */ fun classCode(classCode: JsonField) = apply { this.classCode = classCode } @@ -355,7 +356,7 @@ private constructor( * the system. */ fun customFields(customFields: Optional>) = - customFields(customFields.orElse(null)) + customFields(customFields.getOrNull()) /** * Custom fields for the individual. These are fields which are defined by the employer in @@ -380,7 +381,7 @@ private constructor( fun department(department: Department?) = department(JsonField.ofNullable(department)) /** The department object. */ - fun department(department: Optional) = department(department.orElse(null)) + fun department(department: Optional) = department(department.getOrNull()) /** The department object. */ fun department(department: JsonField) = apply { this.department = department } @@ -389,7 +390,7 @@ private constructor( fun employment(employment: Employment?) = employment(JsonField.ofNullable(employment)) /** The employment object. */ - fun employment(employment: Optional) = employment(employment.orElse(null)) + fun employment(employment: Optional) = employment(employment.getOrNull()) /** The employment object. */ fun employment(employment: JsonField) = apply { this.employment = employment } @@ -406,7 +407,7 @@ private constructor( * `deceased`, `leave`, `onboarding`, `prehire`, `retired`, `terminated`. */ fun employmentStatus(employmentStatus: Optional) = - employmentStatus(employmentStatus.orElse(null)) + employmentStatus(employmentStatus.getOrNull()) /** * The detailed employment status of the individual. Available options: `active`, @@ -418,7 +419,7 @@ private constructor( fun endDate(endDate: String?) = endDate(JsonField.ofNullable(endDate)) - fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) + fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) fun endDate(endDate: JsonField) = apply { this.endDate = endDate } @@ -426,7 +427,7 @@ private constructor( fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) /** The legal first name of the individual. */ - fun firstName(firstName: Optional) = firstName(firstName.orElse(null)) + fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) /** The legal first name of the individual. */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } @@ -443,7 +444,7 @@ private constructor( * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what * information the provider returns. */ - fun income(income: Optional) = income(income.orElse(null)) + fun income(income: Optional) = income(income.getOrNull()) /** * The employee's income as reported by the provider. This may not always be annualized @@ -458,7 +459,7 @@ private constructor( /** The array of income history. */ fun incomeHistory(incomeHistory: Optional>) = - incomeHistory(incomeHistory.orElse(null)) + incomeHistory(incomeHistory.getOrNull()) /** The array of income history. */ fun incomeHistory(incomeHistory: JsonField>) = apply { @@ -480,8 +481,7 @@ private constructor( fun isActive(isActive: Boolean) = isActive(isActive as Boolean?) /** `true` if the individual an an active employee or contractor at the company. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun isActive(isActive: Optional) = isActive(isActive.orElse(null) as Boolean?) + fun isActive(isActive: Optional) = isActive(isActive.getOrNull()) /** `true` if the individual an an active employee or contractor at the company. */ fun isActive(isActive: JsonField) = apply { this.isActive = isActive } @@ -490,7 +490,7 @@ private constructor( fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) /** The legal last name of the individual. */ - fun lastName(lastName: Optional) = lastName(lastName.orElse(null)) + fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) /** The legal last name of the individual. */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } @@ -499,7 +499,7 @@ private constructor( latestRehireDate(JsonField.ofNullable(latestRehireDate)) fun latestRehireDate(latestRehireDate: Optional) = - latestRehireDate(latestRehireDate.orElse(null)) + latestRehireDate(latestRehireDate.getOrNull()) fun latestRehireDate(latestRehireDate: JsonField) = apply { this.latestRehireDate = latestRehireDate @@ -507,7 +507,7 @@ private constructor( fun location(location: Location?) = location(JsonField.ofNullable(location)) - fun location(location: Optional) = location(location.orElse(null)) + fun location(location: Optional) = location(location.getOrNull()) fun location(location: JsonField) = apply { this.location = location } @@ -515,7 +515,7 @@ private constructor( fun manager(manager: Manager?) = manager(JsonField.ofNullable(manager)) /** The manager object representing the manager of the individual within the org. */ - fun manager(manager: Optional) = manager(manager.orElse(null)) + fun manager(manager: Optional) = manager(manager.getOrNull()) /** The manager object representing the manager of the individual within the org. */ fun manager(manager: JsonField) = apply { this.manager = manager } @@ -524,7 +524,7 @@ private constructor( fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) /** The legal middle name of the individual. */ - fun middleName(middleName: Optional) = middleName(middleName.orElse(null)) + fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) /** The legal middle name of the individual. */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } @@ -533,14 +533,14 @@ private constructor( fun sourceId(sourceId: String?) = sourceId(JsonField.ofNullable(sourceId)) /** The source system's unique employment identifier for this individual */ - fun sourceId(sourceId: Optional) = sourceId(sourceId.orElse(null)) + fun sourceId(sourceId: Optional) = sourceId(sourceId.getOrNull()) /** The source system's unique employment identifier for this individual */ fun sourceId(sourceId: JsonField) = apply { this.sourceId = sourceId } fun startDate(startDate: String?) = startDate(JsonField.ofNullable(startDate)) - fun startDate(startDate: Optional) = startDate(startDate.orElse(null)) + fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } @@ -548,7 +548,7 @@ private constructor( fun title(title: String?) = title(JsonField.ofNullable(title)) /** The current title of the individual. */ - fun title(title: Optional) = title(title.orElse(null)) + fun title(title: Optional) = title(title.getOrNull()) /** The current title of the individual. */ fun title(title: JsonField) = apply { this.title = title } @@ -557,7 +557,7 @@ private constructor( @Deprecated("deprecated") fun workId(workId: String?) = workId(JsonField.ofNullable(workId)) /** This field is deprecated in favour of `source_id` */ - @Deprecated("deprecated") fun workId(workId: Optional) = workId(workId.orElse(null)) + @Deprecated("deprecated") fun workId(workId: Optional) = workId(workId.getOrNull()) /** This field is deprecated in favour of `source_id` */ @Deprecated("deprecated") @@ -766,7 +766,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** The name of the department associated with the individual. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The name of the department associated with the individual. */ fun name(name: JsonField) = apply { this.name = name } @@ -890,7 +890,7 @@ private constructor( * The secondary employment type of the individual. Options: `full_time`, `part_time`, * `intern`, `temp`, `seasonal` and `individual_contractor`. */ - fun subtype(subtype: Optional) = subtype(subtype.orElse(null)) + fun subtype(subtype: Optional) = subtype(subtype.getOrNull()) /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, @@ -902,7 +902,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) /** The main employment type of the individual. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** The main employment type of the individual. */ fun type(type: JsonField) = apply { this.type = type } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt index 2861c8a5..b344f9c9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt @@ -18,6 +18,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class EmploymentUpdateResponse @@ -316,7 +317,7 @@ private constructor( fun classCode(classCode: String?) = classCode(JsonField.ofNullable(classCode)) /** Worker's compensation classification code for this employee */ - fun classCode(classCode: Optional) = classCode(classCode.orElse(null)) + fun classCode(classCode: Optional) = classCode(classCode.getOrNull()) /** Worker's compensation classification code for this employee */ fun classCode(classCode: JsonField) = apply { this.classCode = classCode } @@ -350,7 +351,7 @@ private constructor( fun department(department: Department?) = department(JsonField.ofNullable(department)) /** The department object. */ - fun department(department: Optional) = department(department.orElse(null)) + fun department(department: Optional) = department(department.getOrNull()) /** The department object. */ fun department(department: JsonField) = apply { this.department = department } @@ -359,7 +360,7 @@ private constructor( fun employment(employment: Employment?) = employment(JsonField.ofNullable(employment)) /** The employment object. */ - fun employment(employment: Optional) = employment(employment.orElse(null)) + fun employment(employment: Optional) = employment(employment.getOrNull()) /** The employment object. */ fun employment(employment: JsonField) = apply { this.employment = employment } @@ -370,7 +371,7 @@ private constructor( /** The detailed employment status of the individual. */ fun employmentStatus(employmentStatus: Optional) = - employmentStatus(employmentStatus.orElse(null)) + employmentStatus(employmentStatus.getOrNull()) /** The detailed employment status of the individual. */ fun employmentStatus(employmentStatus: JsonField) = apply { @@ -379,7 +380,7 @@ private constructor( fun endDate(endDate: String?) = endDate(JsonField.ofNullable(endDate)) - fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) + fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) fun endDate(endDate: JsonField) = apply { this.endDate = endDate } @@ -387,7 +388,7 @@ private constructor( fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) /** The legal first name of the individual. */ - fun firstName(firstName: Optional) = firstName(firstName.orElse(null)) + fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) /** The legal first name of the individual. */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } @@ -404,7 +405,7 @@ private constructor( * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what * information the provider returns. */ - fun income(income: Optional) = income(income.orElse(null)) + fun income(income: Optional) = income(income.getOrNull()) /** * The employee's income as reported by the provider. This may not always be annualized @@ -419,7 +420,7 @@ private constructor( /** The array of income history. */ fun incomeHistory(incomeHistory: Optional>) = - incomeHistory(incomeHistory.orElse(null)) + incomeHistory(incomeHistory.getOrNull()) /** The array of income history. */ fun incomeHistory(incomeHistory: JsonField>) = apply { @@ -441,8 +442,7 @@ private constructor( fun isActive(isActive: Boolean) = isActive(isActive as Boolean?) /** `true` if the individual an an active employee or contractor at the company. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun isActive(isActive: Optional) = isActive(isActive.orElse(null) as Boolean?) + fun isActive(isActive: Optional) = isActive(isActive.getOrNull()) /** `true` if the individual an an active employee or contractor at the company. */ fun isActive(isActive: JsonField) = apply { this.isActive = isActive } @@ -451,7 +451,7 @@ private constructor( fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) /** The legal last name of the individual. */ - fun lastName(lastName: Optional) = lastName(lastName.orElse(null)) + fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) /** The legal last name of the individual. */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } @@ -460,7 +460,7 @@ private constructor( latestRehireDate(JsonField.ofNullable(latestRehireDate)) fun latestRehireDate(latestRehireDate: Optional) = - latestRehireDate(latestRehireDate.orElse(null)) + latestRehireDate(latestRehireDate.getOrNull()) fun latestRehireDate(latestRehireDate: JsonField) = apply { this.latestRehireDate = latestRehireDate @@ -468,7 +468,7 @@ private constructor( fun location(location: Location?) = location(JsonField.ofNullable(location)) - fun location(location: Optional) = location(location.orElse(null)) + fun location(location: Optional) = location(location.getOrNull()) fun location(location: JsonField) = apply { this.location = location } @@ -476,7 +476,7 @@ private constructor( fun manager(manager: Manager?) = manager(JsonField.ofNullable(manager)) /** The manager object representing the manager of the individual within the org. */ - fun manager(manager: Optional) = manager(manager.orElse(null)) + fun manager(manager: Optional) = manager(manager.getOrNull()) /** The manager object representing the manager of the individual within the org. */ fun manager(manager: JsonField) = apply { this.manager = manager } @@ -485,7 +485,7 @@ private constructor( fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) /** The legal middle name of the individual. */ - fun middleName(middleName: Optional) = middleName(middleName.orElse(null)) + fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) /** The legal middle name of the individual. */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } @@ -498,7 +498,7 @@ private constructor( fun startDate(startDate: String?) = startDate(JsonField.ofNullable(startDate)) - fun startDate(startDate: Optional) = startDate(startDate.orElse(null)) + fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } @@ -506,7 +506,7 @@ private constructor( fun title(title: String?) = title(JsonField.ofNullable(title)) /** The current title of the individual. */ - fun title(title: Optional) = title(title.orElse(null)) + fun title(title: Optional) = title(title.getOrNull()) /** The current title of the individual. */ fun title(title: JsonField) = apply { this.title = title } @@ -612,7 +612,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) fun name(name: JsonField) = apply { this.name = name } @@ -715,7 +715,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** The name of the department associated with the individual. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The name of the department associated with the individual. */ fun name(name: JsonField) = apply { this.name = name } @@ -839,7 +839,7 @@ private constructor( * The secondary employment type of the individual. Options: `full_time`, `part_time`, * `intern`, `temp`, `seasonal` and `individual_contractor`. */ - fun subtype(subtype: Optional) = subtype(subtype.orElse(null)) + fun subtype(subtype: Optional) = subtype(subtype.getOrNull()) /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, @@ -851,7 +851,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) /** The main employment type of the individual. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** The main employment type of the individual. */ fun type(type: JsonField) = apply { this.type = type } 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 index ae6ed621..371bc9ee 100644 --- 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 @@ -208,7 +208,7 @@ private constructor( fun finchCode(finchCode: String?) = finchCode(JsonField.ofNullable(finchCode)) /** A descriptive identifier for the response */ - fun finchCode(finchCode: Optional) = finchCode(finchCode.orElse(null)) + fun finchCode(finchCode: Optional) = finchCode(finchCode.getOrNull()) /** A descriptive identifier for the response */ fun finchCode(finchCode: JsonField) = apply { this.finchCode = finchCode } @@ -217,7 +217,7 @@ private constructor( fun message(message: String?) = message(JsonField.ofNullable(message)) /** Short description in English that provides more information about the response. */ - fun message(message: Optional) = message(message.orElse(null)) + fun message(message: Optional) = message(message.getOrNull()) /** Short description in English that provides more information about the response. */ fun message(message: JsonField) = apply { this.message = message } @@ -226,7 +226,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** Identifier indicating whether the benefit was newly enrolled or updated. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** Identifier indicating whether the benefit was newly enrolled or updated. */ fun name(name: JsonField) = apply { this.name = name } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt index 62d1501a..51f000f2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt @@ -18,6 +18,7 @@ import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * Creates a new company-wide deduction or contribution. Please use the `/providers` endpoint to @@ -168,7 +169,7 @@ private constructor( fun frequency(frequency: BenefitFrequency?) = frequency(JsonField.ofNullable(frequency)) - fun frequency(frequency: Optional) = frequency(frequency.orElse(null)) + fun frequency(frequency: Optional) = frequency(frequency.getOrNull()) fun frequency(frequency: JsonField) = apply { this.frequency = frequency @@ -178,7 +179,7 @@ private constructor( fun type(type: BenefitType?) = type(JsonField.ofNullable(type)) /** Type of benefit. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** Type of benefit. */ fun type(type: JsonField) = apply { this.type = type } @@ -263,7 +264,7 @@ private constructor( fun frequency(frequency: BenefitFrequency?) = apply { body.frequency(frequency) } - fun frequency(frequency: Optional) = frequency(frequency.orElse(null)) + fun frequency(frequency: Optional) = frequency(frequency.getOrNull()) fun frequency(frequency: JsonField) = apply { body.frequency(frequency) } @@ -271,7 +272,7 @@ private constructor( fun type(type: BenefitType?) = apply { body.type(type) } /** Type of benefit. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** Type of benefit. */ fun type(type: JsonField) = apply { body.type(type) } 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 39e181ff..a5bddba3 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 @@ -18,6 +18,7 @@ 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. */ class HrisBenefitIndividualRetrieveManyBenefitsPage @@ -155,7 +156,7 @@ private constructor( while (index < page.items().size) { yield(page.items()[index++]) } - page = page.getNextPage().orElse(null) ?: break + page = page.getNextPage().getOrNull() ?: break index = 0 } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt index 05fc584b..f3e776f3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt @@ -9,6 +9,7 @@ import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Get enrollment information for the given individuals. */ class HrisBenefitIndividualRetrieveManyBenefitsParams @@ -98,7 +99,7 @@ private constructor( * individuals */ fun individualIds(individualIds: Optional) = - individualIds(individualIds.orElse(null)) + individualIds(individualIds.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() 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 index 1cd310d6..dc4d6e1e 100644 --- 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 @@ -18,6 +18,7 @@ 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 @@ -155,7 +156,7 @@ private constructor( while (index < page.items().size) { yield(page.items()[index++]) } - page = page.getNextPage().orElse(null) ?: break + page = page.getNextPage().getOrNull() ?: break index = 0 } } 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 1c735b00..e30d4a39 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 @@ -18,6 +18,7 @@ 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. */ class HrisBenefitListPage @@ -148,7 +149,7 @@ private constructor( while (index < page.items().size) { yield(page.items()[index++]) } - page = page.getNextPage().orElse(null) ?: break + page = page.getNextPage().getOrNull() ?: break index = 0 } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt index bb4827f0..8d70d671 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt @@ -18,6 +18,7 @@ import java.util.Objects import java.util.Optional import java.util.stream.Stream import java.util.stream.StreamSupport +import kotlin.jvm.optionals.getOrNull /** Get deductions metadata */ class HrisBenefitListSupportedBenefitsPage @@ -155,7 +156,7 @@ private constructor( while (index < page.items().size) { yield(page.items()[index++]) } - page = page.getNextPage().orElse(null) ?: break + page = page.getNextPage().getOrNull() ?: break index = 0 } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt index 19fd08eb..9413c2d0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt @@ -18,6 +18,7 @@ import java.util.Objects import java.util.Optional import java.util.stream.Stream import java.util.stream.StreamSupport +import kotlin.jvm.optionals.getOrNull /** Read company directory and organization structure */ @Deprecated("use `list` instead") @@ -190,7 +191,7 @@ private constructor( while (index < page.individuals().size) { yield(page.individuals()[index++]) } - page = page.getNextPage().orElse(null) ?: break + page = page.getNextPage().getOrNull() ?: break index = 0 } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt index 80de4b0e..adb8a186 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt @@ -8,6 +8,7 @@ import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Read company directory and organization structure */ @Deprecated("use `list` instead") @@ -78,8 +79,7 @@ private constructor( fun limit(limit: Long) = limit(limit as Long?) /** Number of employees to return (defaults to all) */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun limit(limit: Optional) = limit(limit.orElse(null) as Long?) + fun limit(limit: Optional) = limit(limit.getOrNull()) /** Index to start from (defaults to 0) */ fun offset(offset: Long?) = apply { this.offset = offset } @@ -88,8 +88,7 @@ private constructor( fun offset(offset: Long) = offset(offset as Long?) /** Index to start from (defaults to 0) */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun offset(offset: Optional) = offset(offset.orElse(null) as Long?) + fun offset(offset: Optional) = offset(offset.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt index e25b83b3..00326aa5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt @@ -18,6 +18,7 @@ import java.util.Objects import java.util.Optional import java.util.stream.Stream import java.util.stream.StreamSupport +import kotlin.jvm.optionals.getOrNull /** Read company directory and organization structure */ class HrisDirectoryListPage @@ -188,7 +189,7 @@ private constructor( while (index < page.individuals().size) { yield(page.individuals()[index++]) } - page = page.getNextPage().orElse(null) ?: break + page = page.getNextPage().getOrNull() ?: break index = 0 } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt index 224d277e..d02f0af3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt @@ -8,6 +8,7 @@ import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Read company directory and organization structure */ class HrisDirectoryListParams @@ -72,8 +73,7 @@ private constructor( fun limit(limit: Long) = limit(limit as Long?) /** Number of employees to return (defaults to all) */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun limit(limit: Optional) = limit(limit.orElse(null) as Long?) + fun limit(limit: Optional) = limit(limit.getOrNull()) /** Index to start from (defaults to 0) */ fun offset(offset: Long?) = apply { this.offset = offset } @@ -82,8 +82,7 @@ private constructor( fun offset(offset: Long) = offset(offset as Long?) /** Index to start from (defaults to 0) */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun offset(offset: Optional) = offset(offset.orElse(null) as Long?) + fun offset(offset: Optional) = offset(offset.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt index a9e4e08f..a997ca50 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** **Beta:** This endpoint is in beta and may change. Retrieve a list of company-wide documents. */ class HrisDocumentListParams @@ -100,7 +101,7 @@ private constructor( * individuals */ fun individualIds(individualIds: Optional>) = - individualIds(individualIds.orElse(null)) + individualIds(individualIds.getOrNull()) /** * Comma-delimited list of stable Finch uuids for each individual. If empty, defaults to all @@ -117,8 +118,7 @@ private constructor( fun limit(limit: Long) = limit(limit as Long?) /** Number of documents to return (defaults to all) */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun limit(limit: Optional) = limit(limit.orElse(null) as Long?) + fun limit(limit: Optional) = limit(limit.getOrNull()) /** Index to start from (defaults to 0) */ fun offset(offset: Long?) = apply { this.offset = offset } @@ -127,14 +127,13 @@ private constructor( fun offset(offset: Long) = offset(offset as Long?) /** Index to start from (defaults to 0) */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun offset(offset: Optional) = offset(offset.orElse(null) as Long?) + fun offset(offset: Optional) = offset(offset.getOrNull()) /** Comma-delimited list of document types to filter on. If empty, defaults to all types */ fun types(types: List?) = apply { this.types = types?.toMutableList() } /** Comma-delimited list of document types to filter on. If empty, defaults to all types */ - fun types(types: Optional>) = types(types.orElse(null)) + fun types(types: Optional>) = types(types.getOrNull()) /** Comma-delimited list of document types to filter on. If empty, defaults to all types */ fun addType(type: Type) = apply { types = (types ?: mutableListOf()).apply { add(type) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt index 7e3973cb..cb021b39 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt @@ -18,6 +18,7 @@ import java.util.Objects import java.util.Optional import java.util.stream.Stream import java.util.stream.StreamSupport +import kotlin.jvm.optionals.getOrNull /** Read individual employment and income data */ class HrisEmploymentRetrieveManyPage @@ -160,7 +161,7 @@ private constructor( while (index < page.responses().size) { yield(page.responses()[index++]) } - page = page.getNextPage().orElse(null) ?: break + page = page.getNextPage().getOrNull() ?: break index = 0 } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt index ff673c35..891ae028 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt @@ -18,6 +18,7 @@ import java.util.Objects import java.util.Optional import java.util.stream.Stream import java.util.stream.StreamSupport +import kotlin.jvm.optionals.getOrNull /** Read individual data, excluding income and employment data */ class HrisIndividualRetrieveManyPage @@ -158,7 +159,7 @@ private constructor( while (index < page.responses().size) { yield(page.responses()[index++]) } - page = page.getNextPage().orElse(null) ?: break + page = page.getNextPage().getOrNull() ?: break index = 0 } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt index 3a9feeec..430d639e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt @@ -19,6 +19,7 @@ import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Read individual data, excluding income and employment data */ class HrisIndividualRetrieveManyParams @@ -113,7 +114,7 @@ private constructor( fun options(options: Options?) = options(JsonField.ofNullable(options)) - fun options(options: Optional) = options(options.orElse(null)) + fun options(options: Optional) = options(options.getOrNull()) fun options(options: JsonField) = apply { this.options = options } @@ -207,7 +208,7 @@ private constructor( fun options(options: Options?) = apply { body.options(options) } - fun options(options: Optional) = options(options.orElse(null)) + fun options(options: Optional) = options(options.getOrNull()) fun options(options: JsonField) = apply { body.options(options) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt index ccb29181..69a33a0f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt @@ -18,6 +18,7 @@ import java.util.Objects import java.util.Optional import java.util.stream.Stream import java.util.stream.StreamSupport +import kotlin.jvm.optionals.getOrNull /** * Read detailed pay statements for each individual. @@ -163,7 +164,7 @@ private constructor( while (index < page.responses().size) { yield(page.responses()[index++]) } - page = page.getNextPage().orElse(null) ?: break + page = page.getNextPage().getOrNull() ?: break index = 0 } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt index 1a214077..c75e9263 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt @@ -18,6 +18,7 @@ import java.util.Objects import java.util.Optional import java.util.stream.Stream import java.util.stream.StreamSupport +import kotlin.jvm.optionals.getOrNull /** Read payroll and contractor related payments by the company. */ class HrisPaymentListPage @@ -147,7 +148,7 @@ private constructor( while (index < page.items().size) { yield(page.items()[index++]) } - page = page.getNextPage().orElse(null) ?: break + page = page.getNextPage().getOrNull() ?: break index = 0 } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt index ade8976c..2766cf2e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt @@ -17,6 +17,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * The employee's income as reported by the provider. This may not always be annualized income, but @@ -122,8 +123,7 @@ private constructor( fun amount(amount: Long) = amount(amount as Long?) /** The income amount in cents. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun amount(amount: Optional) = amount(amount.orElse(null) as Long?) + fun amount(amount: Optional) = amount(amount.getOrNull()) /** The income amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } @@ -132,7 +132,7 @@ private constructor( fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) /** The currency code. */ - fun currency(currency: Optional) = currency(currency.orElse(null)) + fun currency(currency: Optional) = currency(currency.getOrNull()) /** The currency code. */ fun currency(currency: JsonField) = apply { this.currency = currency } @@ -143,7 +143,7 @@ private constructor( /** The date the income amount went into effect. */ fun effectiveDate(effectiveDate: Optional) = - effectiveDate(effectiveDate.orElse(null)) + effectiveDate(effectiveDate.getOrNull()) /** The date the income amount went into effect. */ fun effectiveDate(effectiveDate: JsonField) = apply { @@ -160,7 +160,7 @@ private constructor( * The income unit of payment. Options: `yearly`, `quarterly`, `monthly`, `semi_monthly`, * `bi_weekly`, `weekly`, `daily`, `hourly`, and `fixed`. */ - fun unit(unit: Optional) = unit(unit.orElse(null)) + fun unit(unit: Optional) = unit(unit.getOrNull()) /** * The income unit of payment. Options: `yearly`, `quarterly`, `monthly`, `semi_monthly`, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt index e4a98ffa..a66b7e4b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt @@ -18,6 +18,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class Individual @@ -233,13 +234,13 @@ private constructor( fun dob(dob: String?) = dob(JsonField.ofNullable(dob)) - fun dob(dob: Optional) = dob(dob.orElse(null)) + fun dob(dob: Optional) = dob(dob.getOrNull()) fun dob(dob: JsonField) = apply { this.dob = dob } fun emails(emails: List?) = emails(JsonField.ofNullable(emails)) - fun emails(emails: Optional>) = emails(emails.orElse(null)) + fun emails(emails: Optional>) = emails(emails.getOrNull()) fun emails(emails: JsonField>) = apply { this.emails = emails.map { it.toMutableList() } @@ -264,7 +265,7 @@ private constructor( * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set * in the body. */ - fun encryptedSsn(encryptedSsn: Optional) = encryptedSsn(encryptedSsn.orElse(null)) + fun encryptedSsn(encryptedSsn: Optional) = encryptedSsn(encryptedSsn.getOrNull()) /** * Social Security Number of the individual in **encrypted** format. This field is only @@ -279,7 +280,7 @@ private constructor( fun ethnicity(ethnicity: Ethnicity?) = ethnicity(JsonField.ofNullable(ethnicity)) /** The EEOC-defined ethnicity of the individual. */ - fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.orElse(null)) + fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.getOrNull()) /** The EEOC-defined ethnicity of the individual. */ fun ethnicity(ethnicity: JsonField) = apply { this.ethnicity = ethnicity } @@ -288,7 +289,7 @@ private constructor( fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) /** The legal first name of the individual. */ - fun firstName(firstName: Optional) = firstName(firstName.orElse(null)) + fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) /** The legal first name of the individual. */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } @@ -297,7 +298,7 @@ private constructor( fun gender(gender: Gender?) = gender(JsonField.ofNullable(gender)) /** The gender of the individual. */ - fun gender(gender: Optional) = gender(gender.orElse(null)) + fun gender(gender: Optional) = gender(gender.getOrNull()) /** The gender of the individual. */ fun gender(gender: JsonField) = apply { this.gender = gender } @@ -306,7 +307,7 @@ private constructor( fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) /** The legal last name of the individual. */ - fun lastName(lastName: Optional) = lastName(lastName.orElse(null)) + fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) /** The legal last name of the individual. */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } @@ -315,7 +316,7 @@ private constructor( fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) /** The legal middle name of the individual. */ - fun middleName(middleName: Optional) = middleName(middleName.orElse(null)) + fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) /** The legal middle name of the individual. */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } @@ -324,7 +325,7 @@ private constructor( phoneNumbers(JsonField.ofNullable(phoneNumbers)) fun phoneNumbers(phoneNumbers: Optional>) = - phoneNumbers(phoneNumbers.orElse(null)) + phoneNumbers(phoneNumbers.getOrNull()) fun phoneNumbers(phoneNumbers: JsonField>) = apply { this.phoneNumbers = phoneNumbers.map { it.toMutableList() } @@ -343,7 +344,7 @@ private constructor( /** The preferred name of the individual. */ fun preferredName(preferredName: Optional) = - preferredName(preferredName.orElse(null)) + preferredName(preferredName.getOrNull()) /** The preferred name of the individual. */ fun preferredName(preferredName: JsonField) = apply { @@ -352,7 +353,7 @@ private constructor( fun residence(residence: Location?) = residence(JsonField.ofNullable(residence)) - fun residence(residence: Optional) = residence(residence.orElse(null)) + fun residence(residence: Optional) = residence(residence.getOrNull()) fun residence(residence: JsonField) = apply { this.residence = residence } @@ -368,7 +369,7 @@ private constructor( * scope enabled and the `options: { include: ['ssn'] }` param set in the body. * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). */ - fun ssn(ssn: Optional) = ssn(ssn.orElse(null)) + fun ssn(ssn: Optional) = ssn(ssn.getOrNull()) /** * Social Security Number of the individual. This field is only available with the `ssn` @@ -479,7 +480,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) fun type(type: JsonField) = apply { this.type = type } @@ -930,13 +931,13 @@ private constructor( fun data(data: String?) = data(JsonField.ofNullable(data)) - fun data(data: Optional) = data(data.orElse(null)) + fun data(data: Optional) = data(data.getOrNull()) fun data(data: JsonField) = apply { this.data = data } fun type(type: Type?) = type(JsonField.ofNullable(type)) - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) fun type(type: JsonField) = apply { this.type = type } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt index 8e4c7bc9..a5a8cd75 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt @@ -17,6 +17,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class IndividualBenefit @@ -245,9 +246,8 @@ private constructor( fun annualMaximum(annualMaximum: Long) = annualMaximum(annualMaximum as Long?) /** If the benefit supports annual maximum, the amount in cents for this individual. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun annualMaximum(annualMaximum: Optional) = - annualMaximum(annualMaximum.orElse(null) as Long?) + annualMaximum(annualMaximum.getOrNull()) /** If the benefit supports annual maximum, the amount in cents for this individual. */ fun annualMaximum(annualMaximum: JsonField) = apply { @@ -270,8 +270,7 @@ private constructor( * If the benefit supports catch up (401k, 403b, etc.), whether catch up is enabled for * this individual. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun catchUp(catchUp: Optional) = catchUp(catchUp.orElse(null) as Boolean?) + fun catchUp(catchUp: Optional) = catchUp(catchUp.getOrNull()) /** * If the benefit supports catch up (401k, 403b, etc.), whether catch up is enabled for @@ -283,7 +282,7 @@ private constructor( companyContribution(JsonField.ofNullable(companyContribution)) fun companyContribution(companyContribution: Optional) = - companyContribution(companyContribution.orElse(null)) + companyContribution(companyContribution.getOrNull()) fun companyContribution(companyContribution: JsonField) = apply { this.companyContribution = companyContribution @@ -293,7 +292,7 @@ private constructor( employeeDeduction(JsonField.ofNullable(employeeDeduction)) fun employeeDeduction(employeeDeduction: Optional) = - employeeDeduction(employeeDeduction.orElse(null)) + employeeDeduction(employeeDeduction.getOrNull()) fun employeeDeduction(employeeDeduction: JsonField) = apply { this.employeeDeduction = employeeDeduction @@ -305,7 +304,7 @@ private constructor( /** Type for HSA contribution limit if the benefit is a HSA. */ fun hsaContributionLimit(hsaContributionLimit: Optional) = - hsaContributionLimit(hsaContributionLimit.orElse(null)) + hsaContributionLimit(hsaContributionLimit.getOrNull()) /** Type for HSA contribution limit if the benefit is a HSA. */ fun hsaContributionLimit(hsaContributionLimit: JsonField) = diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt index c8047de4..35f02fff 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt @@ -15,6 +15,7 @@ import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class IndividualInDirectory @@ -150,7 +151,7 @@ private constructor( fun department(department: Department?) = department(JsonField.ofNullable(department)) /** The department object. */ - fun department(department: Optional) = department(department.orElse(null)) + fun department(department: Optional) = department(department.getOrNull()) /** The department object. */ fun department(department: JsonField) = apply { this.department = department } @@ -159,7 +160,7 @@ private constructor( fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) /** The legal first name of the individual. */ - fun firstName(firstName: Optional) = firstName(firstName.orElse(null)) + fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) /** The legal first name of the individual. */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } @@ -171,8 +172,7 @@ private constructor( fun isActive(isActive: Boolean) = isActive(isActive as Boolean?) /** `true` if the individual is an active employee or contractor at the company. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun isActive(isActive: Optional) = isActive(isActive.orElse(null) as Boolean?) + fun isActive(isActive: Optional) = isActive(isActive.getOrNull()) /** `true` if the individual is an active employee or contractor at the company. */ fun isActive(isActive: JsonField) = apply { this.isActive = isActive } @@ -181,7 +181,7 @@ private constructor( fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) /** The legal last name of the individual. */ - fun lastName(lastName: Optional) = lastName(lastName.orElse(null)) + fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) /** The legal last name of the individual. */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } @@ -190,7 +190,7 @@ private constructor( fun manager(manager: Manager?) = manager(JsonField.ofNullable(manager)) /** The manager object. */ - fun manager(manager: Optional) = manager(manager.orElse(null)) + fun manager(manager: Optional) = manager(manager.getOrNull()) /** The manager object. */ fun manager(manager: JsonField) = apply { this.manager = manager } @@ -199,7 +199,7 @@ private constructor( fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) /** The legal middle name of the individual. */ - fun middleName(middleName: Optional) = middleName(middleName.orElse(null)) + fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) /** The legal middle name of the individual. */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } @@ -293,7 +293,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** The name of the department. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The name of the department. */ fun name(name: JsonField) = apply { this.name = name } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt index 297b3014..a01dc43f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt @@ -18,6 +18,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class IndividualUpdateResponse @@ -233,13 +234,13 @@ private constructor( fun dob(dob: String?) = dob(JsonField.ofNullable(dob)) - fun dob(dob: Optional) = dob(dob.orElse(null)) + fun dob(dob: Optional) = dob(dob.getOrNull()) fun dob(dob: JsonField) = apply { this.dob = dob } fun emails(emails: List?) = emails(JsonField.ofNullable(emails)) - fun emails(emails: Optional>) = emails(emails.orElse(null)) + fun emails(emails: Optional>) = emails(emails.getOrNull()) fun emails(emails: JsonField>) = apply { this.emails = emails.map { it.toMutableList() } @@ -264,7 +265,7 @@ private constructor( * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set * in the body. */ - fun encryptedSsn(encryptedSsn: Optional) = encryptedSsn(encryptedSsn.orElse(null)) + fun encryptedSsn(encryptedSsn: Optional) = encryptedSsn(encryptedSsn.getOrNull()) /** * Social Security Number of the individual in **encrypted** format. This field is only @@ -279,7 +280,7 @@ private constructor( fun ethnicity(ethnicity: Ethnicity?) = ethnicity(JsonField.ofNullable(ethnicity)) /** The EEOC-defined ethnicity of the individual. */ - fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.orElse(null)) + fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.getOrNull()) /** The EEOC-defined ethnicity of the individual. */ fun ethnicity(ethnicity: JsonField) = apply { this.ethnicity = ethnicity } @@ -288,7 +289,7 @@ private constructor( fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) /** The legal first name of the individual. */ - fun firstName(firstName: Optional) = firstName(firstName.orElse(null)) + fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) /** The legal first name of the individual. */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } @@ -297,7 +298,7 @@ private constructor( fun gender(gender: Gender?) = gender(JsonField.ofNullable(gender)) /** The gender of the individual. */ - fun gender(gender: Optional) = gender(gender.orElse(null)) + fun gender(gender: Optional) = gender(gender.getOrNull()) /** The gender of the individual. */ fun gender(gender: JsonField) = apply { this.gender = gender } @@ -306,7 +307,7 @@ private constructor( fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) /** The legal last name of the individual. */ - fun lastName(lastName: Optional) = lastName(lastName.orElse(null)) + fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) /** The legal last name of the individual. */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } @@ -315,7 +316,7 @@ private constructor( fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) /** The legal middle name of the individual. */ - fun middleName(middleName: Optional) = middleName(middleName.orElse(null)) + fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) /** The legal middle name of the individual. */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } @@ -324,7 +325,7 @@ private constructor( phoneNumbers(JsonField.ofNullable(phoneNumbers)) fun phoneNumbers(phoneNumbers: Optional>) = - phoneNumbers(phoneNumbers.orElse(null)) + phoneNumbers(phoneNumbers.getOrNull()) fun phoneNumbers(phoneNumbers: JsonField>) = apply { this.phoneNumbers = phoneNumbers.map { it.toMutableList() } @@ -343,7 +344,7 @@ private constructor( /** The preferred name of the individual. */ fun preferredName(preferredName: Optional) = - preferredName(preferredName.orElse(null)) + preferredName(preferredName.getOrNull()) /** The preferred name of the individual. */ fun preferredName(preferredName: JsonField) = apply { @@ -352,7 +353,7 @@ private constructor( fun residence(residence: Location?) = residence(JsonField.ofNullable(residence)) - fun residence(residence: Optional) = residence(residence.orElse(null)) + fun residence(residence: Optional) = residence(residence.getOrNull()) fun residence(residence: JsonField) = apply { this.residence = residence } @@ -368,7 +369,7 @@ private constructor( * scope enabled and the `options: { include: ['ssn'] }` param set in the body. * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). */ - fun ssn(ssn: Optional) = ssn(ssn.orElse(null)) + fun ssn(ssn: Optional) = ssn(ssn.getOrNull()) /** * Social Security Number of the individual. This field is only available with the `ssn` @@ -479,7 +480,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) fun type(type: JsonField) = apply { this.type = type } @@ -934,7 +935,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) fun type(type: JsonField) = apply { this.type = type } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt index 8e0086bd..05c9a3a1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt @@ -19,6 +19,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class Introspection @@ -443,7 +444,7 @@ private constructor( * this connection. */ fun customerEmail(customerEmail: Optional) = - customerEmail(customerEmail.orElse(null)) + customerEmail(customerEmail.getOrNull()) /** * The email of your customer you provided to Finch when a connect session was created for @@ -463,7 +464,7 @@ private constructor( * The ID of your customer you provided to Finch when a connect session was created for this * connection. */ - fun customerId(customerId: Optional) = customerId(customerId.orElse(null)) + fun customerId(customerId: Optional) = customerId(customerId.getOrNull()) /** * The ID of your customer you provided to Finch when a connect session was created for this @@ -481,7 +482,7 @@ private constructor( * The name of your customer you provided to Finch when a connect session was created for * this connection. */ - fun customerName(customerName: Optional) = customerName(customerName.orElse(null)) + fun customerName(customerName: Optional) = customerName(customerName.getOrNull()) /** * The name of your customer you provided to Finch when a connect session was created for diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt index 93538c87..a93cd435 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt @@ -789,7 +789,7 @@ private constructor( fun body(body: Body?) = apply { this.body = body } - fun body(body: Optional) = body(body.orElse(null)) + fun body(body: Optional) = body(body.getOrNull()) fun body(dataSyncAll: Body.DataSyncAll) = body(Body.ofDataSyncAll(dataSyncAll)) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt index 13c755ff..eac1a561 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt @@ -18,6 +18,7 @@ import java.util.Objects import java.util.Optional import java.util.stream.Stream import java.util.stream.StreamSupport +import kotlin.jvm.optionals.getOrNull /** * Get all automated jobs. Automated jobs are completed by a machine. By default, jobs are sorted in @@ -184,7 +185,7 @@ private constructor( while (index < page.data().size) { yield(page.data()[index++]) } - page = page.getNextPage().orElse(null) ?: break + page = page.getNextPage().getOrNull() ?: break index = 0 } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt index 975b418f..02cb83f7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt @@ -8,6 +8,7 @@ import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * Get all automated jobs. Automated jobs are completed by a machine. By default, jobs are sorted in @@ -76,8 +77,7 @@ private constructor( fun limit(limit: Long) = limit(limit as Long?) /** Number of items to return */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun limit(limit: Optional) = limit(limit.orElse(null) as Long?) + fun limit(limit: Optional) = limit(limit.getOrNull()) /** Index to start from (defaults to 0) */ fun offset(offset: Long?) = apply { this.offset = offset } @@ -86,8 +86,7 @@ private constructor( fun offset(offset: Long) = offset(offset as Long?) /** Index to start from (defaults to 0) */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun offset(offset: Optional) = offset(offset.orElse(null) as Long?) + fun offset(offset: Optional) = offset(offset.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt index e8e39ab8..e1f267af 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt @@ -15,6 +15,7 @@ import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class Location @@ -141,7 +142,7 @@ private constructor( fun city(city: String?) = city(JsonField.ofNullable(city)) /** City, district, suburb, town, or village. */ - fun city(city: Optional) = city(city.orElse(null)) + fun city(city: Optional) = city(city.getOrNull()) /** City, district, suburb, town, or village. */ fun city(city: JsonField) = apply { this.city = city } @@ -150,7 +151,7 @@ private constructor( fun country(country: String?) = country(JsonField.ofNullable(country)) /** The 2-letter ISO 3166 country code. */ - fun country(country: Optional) = country(country.orElse(null)) + fun country(country: Optional) = country(country.getOrNull()) /** The 2-letter ISO 3166 country code. */ fun country(country: JsonField) = apply { this.country = country } @@ -159,7 +160,7 @@ private constructor( fun line1(line1: String?) = line1(JsonField.ofNullable(line1)) /** Street address or PO box. */ - fun line1(line1: Optional) = line1(line1.orElse(null)) + fun line1(line1: Optional) = line1(line1.getOrNull()) /** Street address or PO box. */ fun line1(line1: JsonField) = apply { this.line1 = line1 } @@ -168,14 +169,14 @@ private constructor( fun line2(line2: String?) = line2(JsonField.ofNullable(line2)) /** Apartment, suite, unit, or building. */ - fun line2(line2: Optional) = line2(line2.orElse(null)) + fun line2(line2: Optional) = line2(line2.getOrNull()) /** Apartment, suite, unit, or building. */ fun line2(line2: JsonField) = apply { this.line2 = line2 } fun name(name: String?) = name(JsonField.ofNullable(name)) - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) fun name(name: JsonField) = apply { this.name = name } @@ -183,14 +184,14 @@ private constructor( fun postalCode(postalCode: String?) = postalCode(JsonField.ofNullable(postalCode)) /** The postal code or zip code. */ - fun postalCode(postalCode: Optional) = postalCode(postalCode.orElse(null)) + fun postalCode(postalCode: Optional) = postalCode(postalCode.getOrNull()) /** The postal code or zip code. */ fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } fun sourceId(sourceId: String?) = sourceId(JsonField.ofNullable(sourceId)) - fun sourceId(sourceId: Optional) = sourceId(sourceId.orElse(null)) + fun sourceId(sourceId: Optional) = sourceId(sourceId.getOrNull()) fun sourceId(sourceId: JsonField) = apply { this.sourceId = sourceId } @@ -198,7 +199,7 @@ private constructor( fun state(state: String?) = state(JsonField.ofNullable(state)) /** The state code. */ - fun state(state: Optional) = state(state.orElse(null)) + fun state(state: Optional) = state(state.getOrNull()) /** The state code. */ fun state(state: JsonField) = apply { this.state = state } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt index c83f6d5d..189a43c3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt @@ -19,6 +19,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class ManualAsyncJob @@ -102,7 +103,7 @@ private constructor( fun body(body: List?) = body(JsonField.ofNullable(body)) /** Specific information about the job, such as individual statuses for batch jobs. */ - fun body(body: Optional>) = body(body.orElse(null)) + fun body(body: Optional>) = body(body.getOrNull()) /** Specific information about the job, such as individual statuses for batch jobs. */ fun body(body: JsonField>) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt index f834a0ec..fccf9d99 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt @@ -15,6 +15,7 @@ import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class Money @@ -82,8 +83,7 @@ private constructor( fun amount(amount: Long) = amount(amount as Long?) /** Amount for money object (in cents) */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun amount(amount: Optional) = amount(amount.orElse(null) as Long?) + fun amount(amount: Optional) = amount(amount.getOrNull()) /** Amount for money object (in cents) */ fun amount(amount: JsonField) = apply { this.amount = amount } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt index b3e5803e..2189e134 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt @@ -18,6 +18,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class PayStatement @@ -186,7 +187,7 @@ private constructor( fun earnings(earnings: List?) = earnings(JsonField.ofNullable(earnings)) /** The array of earnings objects associated with this pay statement */ - fun earnings(earnings: Optional>) = earnings(earnings.orElse(null)) + fun earnings(earnings: Optional>) = earnings(earnings.getOrNull()) /** The array of earnings objects associated with this pay statement */ fun earnings(earnings: JsonField>) = apply { @@ -207,7 +208,7 @@ private constructor( /** The array of deductions objects associated with this pay statement. */ fun employeeDeductions(employeeDeductions: Optional>) = - employeeDeductions(employeeDeductions.orElse(null)) + employeeDeductions(employeeDeductions.getOrNull()) /** The array of deductions objects associated with this pay statement. */ fun employeeDeductions(employeeDeductions: JsonField>) = apply { @@ -226,7 +227,7 @@ private constructor( employerContributions(JsonField.ofNullable(employerContributions)) fun employerContributions(employerContributions: Optional>) = - employerContributions(employerContributions.orElse(null)) + employerContributions(employerContributions.getOrNull()) fun employerContributions(employerContributions: JsonField>) = apply { @@ -242,7 +243,7 @@ private constructor( fun grossPay(grossPay: Money?) = grossPay(JsonField.ofNullable(grossPay)) - fun grossPay(grossPay: Optional) = grossPay(grossPay.orElse(null)) + fun grossPay(grossPay: Optional) = grossPay(grossPay.getOrNull()) fun grossPay(grossPay: JsonField) = apply { this.grossPay = grossPay } @@ -256,7 +257,7 @@ private constructor( fun netPay(netPay: Money?) = netPay(JsonField.ofNullable(netPay)) - fun netPay(netPay: Optional) = netPay(netPay.orElse(null)) + fun netPay(netPay: Optional) = netPay(netPay.getOrNull()) fun netPay(netPay: JsonField) = apply { this.netPay = netPay } @@ -266,7 +267,7 @@ private constructor( /** The payment method. */ fun paymentMethod(paymentMethod: Optional) = - paymentMethod(paymentMethod.orElse(null)) + paymentMethod(paymentMethod.getOrNull()) /** The payment method. */ fun paymentMethod(paymentMethod: JsonField) = apply { @@ -277,7 +278,7 @@ private constructor( fun taxes(taxes: List?) = taxes(JsonField.ofNullable(taxes)) /** The array of taxes objects associated with this pay statement. */ - fun taxes(taxes: Optional>) = taxes(taxes.orElse(null)) + fun taxes(taxes: Optional>) = taxes(taxes.getOrNull()) /** The array of taxes objects associated with this pay statement. */ fun taxes(taxes: JsonField>) = apply { @@ -297,9 +298,7 @@ private constructor( fun totalHours(totalHours: Double) = totalHours(totalHours as Double?) /** The number of hours worked for this pay period */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun totalHours(totalHours: Optional) = - totalHours(totalHours.orElse(null) as Double?) + fun totalHours(totalHours: Optional) = totalHours(totalHours.getOrNull()) /** The number of hours worked for this pay period */ fun totalHours(totalHours: JsonField) = apply { this.totalHours = totalHours } @@ -308,7 +307,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) /** The type of the payment associated with the pay statement. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** The type of the payment associated with the pay statement. */ fun type(type: JsonField) = apply { this.type = type } @@ -472,15 +471,14 @@ private constructor( fun amount(amount: Long) = amount(amount as Long?) /** The earnings amount in cents. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun amount(amount: Optional) = amount(amount.orElse(null) as Long?) + fun amount(amount: Optional) = amount(amount.getOrNull()) /** The earnings amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } fun attributes(attributes: Attributes?) = attributes(JsonField.ofNullable(attributes)) - fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + fun attributes(attributes: Optional) = attributes(attributes.getOrNull()) fun attributes(attributes: JsonField) = apply { this.attributes = attributes @@ -490,7 +488,7 @@ private constructor( fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) /** The earnings currency code. */ - fun currency(currency: Optional) = currency(currency.orElse(null)) + fun currency(currency: Optional) = currency(currency.getOrNull()) /** The earnings currency code. */ fun currency(currency: JsonField) = apply { this.currency = currency } @@ -511,8 +509,7 @@ private constructor( * The number of hours associated with this earning. (For salaried employees, this could * be hours per pay period, `0` or `null`, depending on the provider). */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun hours(hours: Optional) = hours(hours.orElse(null) as Double?) + fun hours(hours: Optional) = hours(hours.getOrNull()) /** * The number of hours associated with this earning. (For salaried employees, this could @@ -524,7 +521,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** The exact name of the deduction from the pay statement. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The exact name of the deduction from the pay statement. */ fun name(name: JsonField) = apply { this.name = name } @@ -533,7 +530,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) /** The type of earning. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** The type of earning. */ fun type(type: JsonField) = apply { this.type = type } @@ -1189,15 +1186,14 @@ private constructor( fun amount(amount: Long) = amount(amount as Long?) /** The deduction amount in cents. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun amount(amount: Optional) = amount(amount.orElse(null) as Long?) + fun amount(amount: Optional) = amount(amount.getOrNull()) /** The deduction amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } fun attributes(attributes: Attributes?) = attributes(JsonField.ofNullable(attributes)) - fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + fun attributes(attributes: Optional) = attributes(attributes.getOrNull()) fun attributes(attributes: JsonField) = apply { this.attributes = attributes @@ -1207,7 +1203,7 @@ private constructor( fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) /** The deduction currency. */ - fun currency(currency: Optional) = currency(currency.orElse(null)) + fun currency(currency: Optional) = currency(currency.getOrNull()) /** The deduction currency. */ fun currency(currency: JsonField) = apply { this.currency = currency } @@ -1216,7 +1212,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** The deduction name from the pay statement. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The deduction name from the pay statement. */ fun name(name: JsonField) = apply { this.name = name } @@ -1228,8 +1224,7 @@ private constructor( fun preTax(preTax: Boolean) = preTax(preTax as Boolean?) /** Boolean indicating if the deduction is pre-tax. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun preTax(preTax: Optional) = preTax(preTax.orElse(null) as Boolean?) + fun preTax(preTax: Optional) = preTax(preTax.getOrNull()) /** Boolean indicating if the deduction is pre-tax. */ fun preTax(preTax: JsonField) = apply { this.preTax = preTax } @@ -1238,7 +1233,7 @@ private constructor( fun type(type: BenefitType?) = type(JsonField.ofNullable(type)) /** Type of benefit. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** Type of benefit. */ fun type(type: JsonField) = apply { this.type = type } @@ -1715,15 +1710,14 @@ private constructor( fun amount(amount: Long) = amount(amount as Long?) /** The contribution amount in cents. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun amount(amount: Optional) = amount(amount.orElse(null) as Long?) + fun amount(amount: Optional) = amount(amount.getOrNull()) /** The contribution amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } fun attributes(attributes: Attributes?) = attributes(JsonField.ofNullable(attributes)) - fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + fun attributes(attributes: Optional) = attributes(attributes.getOrNull()) fun attributes(attributes: JsonField) = apply { this.attributes = attributes @@ -1733,7 +1727,7 @@ private constructor( fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) /** The contribution currency. */ - fun currency(currency: Optional) = currency(currency.orElse(null)) + fun currency(currency: Optional) = currency(currency.getOrNull()) /** The contribution currency. */ fun currency(currency: JsonField) = apply { this.currency = currency } @@ -1742,7 +1736,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** The contribution name from the pay statement. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The contribution name from the pay statement. */ fun name(name: JsonField) = apply { this.name = name } @@ -1751,7 +1745,7 @@ private constructor( fun type(type: BenefitType?) = type(JsonField.ofNullable(type)) /** Type of benefit. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** Type of benefit. */ fun type(type: JsonField) = apply { this.type = type } @@ -2339,15 +2333,14 @@ private constructor( fun amount(amount: Long) = amount(amount as Long?) /** The tax amount in cents. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun amount(amount: Optional) = amount(amount.orElse(null) as Long?) + fun amount(amount: Optional) = amount(amount.getOrNull()) /** The tax amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } fun attributes(attributes: Attributes?) = attributes(JsonField.ofNullable(attributes)) - fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + fun attributes(attributes: Optional) = attributes(attributes.getOrNull()) fun attributes(attributes: JsonField) = apply { this.attributes = attributes @@ -2357,7 +2350,7 @@ private constructor( fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) /** The currency code. */ - fun currency(currency: Optional) = currency(currency.orElse(null)) + fun currency(currency: Optional) = currency(currency.getOrNull()) /** The currency code. */ fun currency(currency: JsonField) = apply { this.currency = currency } @@ -2369,8 +2362,7 @@ private constructor( fun employer(employer: Boolean) = employer(employer as Boolean?) /** `true` if the amount is paid by the employers. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun employer(employer: Optional) = employer(employer.orElse(null) as Boolean?) + fun employer(employer: Optional) = employer(employer.getOrNull()) /** `true` if the amount is paid by the employers. */ fun employer(employer: JsonField) = apply { this.employer = employer } @@ -2379,7 +2371,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** The exact name of tax from the pay statement. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The exact name of tax from the pay statement. */ fun name(name: JsonField) = apply { this.name = name } @@ -2388,7 +2380,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) /** The type of taxes. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** The type of taxes. */ fun type(type: JsonField) = apply { this.type = type } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt index 51d74807..6ec399ef 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt @@ -18,6 +18,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class Payment @@ -212,7 +213,7 @@ private constructor( fun companyDebit(companyDebit: Money?) = companyDebit(JsonField.ofNullable(companyDebit)) - fun companyDebit(companyDebit: Optional) = companyDebit(companyDebit.orElse(null)) + fun companyDebit(companyDebit: Optional) = companyDebit(companyDebit.getOrNull()) fun companyDebit(companyDebit: JsonField) = apply { this.companyDebit = companyDebit @@ -220,15 +221,14 @@ private constructor( fun debitDate(debitDate: String?) = debitDate(JsonField.ofNullable(debitDate)) - fun debitDate(debitDate: Optional) = debitDate(debitDate.orElse(null)) + fun debitDate(debitDate: Optional) = debitDate(debitDate.getOrNull()) fun debitDate(debitDate: JsonField) = apply { this.debitDate = debitDate } fun employeeTaxes(employeeTaxes: Money?) = employeeTaxes(JsonField.ofNullable(employeeTaxes)) - fun employeeTaxes(employeeTaxes: Optional) = - employeeTaxes(employeeTaxes.orElse(null)) + fun employeeTaxes(employeeTaxes: Optional) = employeeTaxes(employeeTaxes.getOrNull()) fun employeeTaxes(employeeTaxes: JsonField) = apply { this.employeeTaxes = employeeTaxes @@ -237,8 +237,7 @@ private constructor( fun employerTaxes(employerTaxes: Money?) = employerTaxes(JsonField.ofNullable(employerTaxes)) - fun employerTaxes(employerTaxes: Optional) = - employerTaxes(employerTaxes.orElse(null)) + fun employerTaxes(employerTaxes: Optional) = employerTaxes(employerTaxes.getOrNull()) fun employerTaxes(employerTaxes: JsonField) = apply { this.employerTaxes = employerTaxes @@ -246,7 +245,7 @@ private constructor( fun grossPay(grossPay: Money?) = grossPay(JsonField.ofNullable(grossPay)) - fun grossPay(grossPay: Optional) = grossPay(grossPay.orElse(null)) + fun grossPay(grossPay: Optional) = grossPay(grossPay.getOrNull()) fun grossPay(grossPay: JsonField) = apply { this.grossPay = grossPay } @@ -256,7 +255,7 @@ private constructor( /** Array of every individual on this payment. */ fun individualIds(individualIds: Optional>) = - individualIds(individualIds.orElse(null)) + individualIds(individualIds.getOrNull()) /** Array of every individual on this payment. */ fun individualIds(individualIds: JsonField>) = apply { @@ -273,13 +272,13 @@ private constructor( fun netPay(netPay: Money?) = netPay(JsonField.ofNullable(netPay)) - fun netPay(netPay: Optional) = netPay(netPay.orElse(null)) + fun netPay(netPay: Optional) = netPay(netPay.getOrNull()) fun netPay(netPay: JsonField) = apply { this.netPay = netPay } fun payDate(payDate: String?) = payDate(JsonField.ofNullable(payDate)) - fun payDate(payDate: Optional) = payDate(payDate.orElse(null)) + fun payDate(payDate: Optional) = payDate(payDate.getOrNull()) fun payDate(payDate: JsonField) = apply { this.payDate = payDate } @@ -289,7 +288,7 @@ private constructor( /** List of pay frequencies associated with this payment. */ fun payFrequencies(payFrequencies: Optional>) = - payFrequencies(payFrequencies.orElse(null)) + payFrequencies(payFrequencies.getOrNull()) /** List of pay frequencies associated with this payment. */ fun payFrequencies(payFrequencies: JsonField>) = apply { @@ -308,7 +307,7 @@ private constructor( fun payGroupIds(payGroupIds: List?) = payGroupIds(JsonField.ofNullable(payGroupIds)) /** Array of the Finch id (uuidv4) of every pay group associated with this payment. */ - fun payGroupIds(payGroupIds: Optional>) = payGroupIds(payGroupIds.orElse(null)) + fun payGroupIds(payGroupIds: Optional>) = payGroupIds(payGroupIds.getOrNull()) /** Array of the Finch id (uuidv4) of every pay group associated with this payment. */ fun payGroupIds(payGroupIds: JsonField>) = apply { @@ -327,7 +326,7 @@ private constructor( fun payPeriod(payPeriod: PayPeriod?) = payPeriod(JsonField.ofNullable(payPeriod)) /** The pay period object. */ - fun payPeriod(payPeriod: Optional) = payPeriod(payPeriod.orElse(null)) + fun payPeriod(payPeriod: Optional) = payPeriod(payPeriod.getOrNull()) /** The pay period object. */ fun payPeriod(payPeriod: JsonField) = apply { this.payPeriod = payPeriod } @@ -574,13 +573,13 @@ private constructor( fun endDate(endDate: String?) = endDate(JsonField.ofNullable(endDate)) - fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) + fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) fun endDate(endDate: JsonField) = apply { this.endDate = endDate } fun startDate(startDate: String?) = startDate(JsonField.ofNullable(startDate)) - fun startDate(startDate: Optional) = startDate(startDate.orElse(null)) + fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt index 829f3451..367a843e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt @@ -18,6 +18,7 @@ import java.util.Objects import java.util.Optional import java.util.stream.Stream import java.util.stream.StreamSupport +import kotlin.jvm.optionals.getOrNull /** Read company pay groups and frequencies */ class PayrollPayGroupListPage @@ -154,7 +155,7 @@ private constructor( while (index < page.items().size) { yield(page.items()[index++]) } - page = page.getNextPage().orElse(null) ?: break + page = page.getNextPage().getOrNull() ?: break index = 0 } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt index 6f3e026a..326920d5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt @@ -9,6 +9,7 @@ import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Read company pay groups and frequencies */ class PayrollPayGroupListParams @@ -68,14 +69,14 @@ private constructor( fun individualId(individualId: String?) = apply { this.individualId = individualId } - fun individualId(individualId: Optional) = individualId(individualId.orElse(null)) + fun individualId(individualId: Optional) = individualId(individualId.getOrNull()) fun payFrequencies(payFrequencies: List?) = apply { this.payFrequencies = payFrequencies?.toMutableList() } fun payFrequencies(payFrequencies: Optional>) = - payFrequencies(payFrequencies.orElse(null)) + payFrequencies(payFrequencies.getOrNull()) fun addPayFrequency(payFrequency: String) = apply { payFrequencies = (payFrequencies ?: mutableListOf()).apply { add(payFrequency) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt index 3a72c5f4..7a345e2c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt @@ -19,6 +19,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class Provider @@ -416,7 +417,7 @@ private constructor( * the property will be null */ fun benefitsSupport(benefitsSupport: Optional) = - benefitsSupport(benefitsSupport.orElse(null)) + benefitsSupport(benefitsSupport.getOrNull()) /** * Each benefit type and their supported features. If the benefit type is not supported, @@ -432,7 +433,7 @@ private constructor( /** The supported data fields returned by our HR and payroll endpoints */ fun supportedFields(supportedFields: Optional) = - supportedFields(supportedFields.orElse(null)) + supportedFields(supportedFields.getOrNull()) /** The supported data fields returned by our HR and payroll endpoints */ fun supportedFields(supportedFields: JsonField) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt index 40a9266e..98c3f5a1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt @@ -18,6 +18,7 @@ import java.util.Objects import java.util.Optional import java.util.stream.Stream import java.util.stream.StreamSupport +import kotlin.jvm.optionals.getOrNull /** Return details on all available payroll and HR systems. */ class ProviderListPage @@ -147,7 +148,7 @@ private constructor( while (index < page.items().size) { yield(page.items()[index++]) } - page = page.getNextPage().orElse(null) ?: break + page = page.getNextPage().getOrNull() ?: break index = 0 } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt index bd01a332..292cc81d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt @@ -19,6 +19,7 @@ import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * The Forward API allows you to make direct requests to an employment system. If Finch’s unified @@ -251,7 +252,7 @@ private constructor( * The body for the forwarded request. This value must be specified as either a string * or a valid JSON object. */ - fun data(data: Optional) = data(data.orElse(null)) + fun data(data: Optional) = data(data.getOrNull()) /** * The body for the forwarded request. This value must be specified as either a string @@ -386,7 +387,7 @@ private constructor( * The body for the forwarded request. This value must be specified as either a string or a * valid JSON object. */ - fun data(data: Optional) = data(data.orElse(null)) + fun data(data: Optional) = data(data.getOrNull()) /** * The body for the forwarded request. This value must be specified as either a string or a diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt index 7cc9db35..23ab8bec 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt @@ -16,6 +16,7 @@ import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class RequestForwardingForwardResponse @@ -142,7 +143,7 @@ private constructor( * received from the underlying integration’s API. This field may be null in the case where * the upstream system’s response is empty. */ - fun data(data: Optional) = data(data.orElse(null)) + fun data(data: Optional) = data(data.getOrNull()) /** * A string representation of the HTTP response body of the forwarded request’s response @@ -344,7 +345,7 @@ private constructor( * in the original request, this value will be returned as null ; otherwise, this value * will always be returned as a string. */ - fun data(data: Optional) = data(data.orElse(null)) + fun data(data: Optional) = data(data.getOrNull()) /** * The body that was specified for the forwarded request. If a value was not specified diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt index b3deed8b..2d83b36e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt @@ -22,6 +22,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Update a sandbox company's data */ class SandboxCompanyUpdateParams @@ -254,7 +255,7 @@ private constructor( fun accounts(accounts: List?) = accounts(JsonField.ofNullable(accounts)) /** An array of bank account objects associated with the payroll/HRIS system. */ - fun accounts(accounts: Optional>) = accounts(accounts.orElse(null)) + fun accounts(accounts: Optional>) = accounts(accounts.getOrNull()) /** An array of bank account objects associated with the payroll/HRIS system. */ fun accounts(accounts: JsonField>) = apply { @@ -275,7 +276,7 @@ private constructor( /** The array of company departments. */ fun departments(departments: Optional>) = - departments(departments.orElse(null)) + departments(departments.getOrNull()) /** The array of company departments. */ fun departments(departments: JsonField>) = apply { @@ -294,7 +295,7 @@ private constructor( fun ein(ein: String?) = ein(JsonField.ofNullable(ein)) /** The employer identification number. */ - fun ein(ein: Optional) = ein(ein.orElse(null)) + fun ein(ein: Optional) = ein(ein.getOrNull()) /** The employer identification number. */ fun ein(ein: JsonField) = apply { this.ein = ein } @@ -303,7 +304,7 @@ private constructor( fun entity(entity: Entity?) = entity(JsonField.ofNullable(entity)) /** The entity type object. */ - fun entity(entity: Optional) = entity(entity.orElse(null)) + fun entity(entity: Optional) = entity(entity.getOrNull()) /** The entity type object. */ fun entity(entity: JsonField) = apply { this.entity = entity } @@ -312,14 +313,14 @@ private constructor( fun legalName(legalName: String?) = legalName(JsonField.ofNullable(legalName)) /** The legal name of the company. */ - fun legalName(legalName: Optional) = legalName(legalName.orElse(null)) + fun legalName(legalName: Optional) = legalName(legalName.getOrNull()) /** The legal name of the company. */ fun legalName(legalName: JsonField) = apply { this.legalName = legalName } fun locations(locations: List?) = locations(JsonField.ofNullable(locations)) - fun locations(locations: Optional>) = locations(locations.orElse(null)) + fun locations(locations: Optional>) = locations(locations.getOrNull()) fun locations(locations: JsonField>) = apply { this.locations = locations.map { it.toMutableList() } @@ -338,7 +339,7 @@ private constructor( /** The email of the main administrator on the account. */ fun primaryEmail(primaryEmail: Optional) = - primaryEmail(primaryEmail.orElse(null)) + primaryEmail(primaryEmail.getOrNull()) /** The email of the main administrator on the account. */ fun primaryEmail(primaryEmail: JsonField) = apply { @@ -351,7 +352,7 @@ private constructor( /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ fun primaryPhoneNumber(primaryPhoneNumber: Optional) = - primaryPhoneNumber(primaryPhoneNumber.orElse(null)) + primaryPhoneNumber(primaryPhoneNumber.getOrNull()) /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ fun primaryPhoneNumber(primaryPhoneNumber: JsonField) = apply { @@ -450,7 +451,7 @@ private constructor( fun accounts(accounts: List?) = apply { body.accounts(accounts) } /** An array of bank account objects associated with the payroll/HRIS system. */ - fun accounts(accounts: Optional>) = accounts(accounts.orElse(null)) + fun accounts(accounts: Optional>) = accounts(accounts.getOrNull()) /** An array of bank account objects associated with the payroll/HRIS system. */ fun accounts(accounts: JsonField>) = apply { body.accounts(accounts) } @@ -463,7 +464,7 @@ private constructor( /** The array of company departments. */ fun departments(departments: Optional>) = - departments(departments.orElse(null)) + departments(departments.getOrNull()) /** The array of company departments. */ fun departments(departments: JsonField>) = apply { @@ -477,7 +478,7 @@ private constructor( fun ein(ein: String?) = apply { body.ein(ein) } /** The employer identification number. */ - fun ein(ein: Optional) = ein(ein.orElse(null)) + fun ein(ein: Optional) = ein(ein.getOrNull()) /** The employer identification number. */ fun ein(ein: JsonField) = apply { body.ein(ein) } @@ -486,7 +487,7 @@ private constructor( fun entity(entity: Entity?) = apply { body.entity(entity) } /** The entity type object. */ - fun entity(entity: Optional) = entity(entity.orElse(null)) + fun entity(entity: Optional) = entity(entity.getOrNull()) /** The entity type object. */ fun entity(entity: JsonField) = apply { body.entity(entity) } @@ -495,14 +496,14 @@ private constructor( fun legalName(legalName: String?) = apply { body.legalName(legalName) } /** The legal name of the company. */ - fun legalName(legalName: Optional) = legalName(legalName.orElse(null)) + fun legalName(legalName: Optional) = legalName(legalName.getOrNull()) /** The legal name of the company. */ fun legalName(legalName: JsonField) = apply { body.legalName(legalName) } fun locations(locations: List?) = apply { body.locations(locations) } - fun locations(locations: Optional>) = locations(locations.orElse(null)) + fun locations(locations: Optional>) = locations(locations.getOrNull()) fun locations(locations: JsonField>) = apply { body.locations(locations) } @@ -512,7 +513,7 @@ private constructor( fun primaryEmail(primaryEmail: String?) = apply { body.primaryEmail(primaryEmail) } /** The email of the main administrator on the account. */ - fun primaryEmail(primaryEmail: Optional) = primaryEmail(primaryEmail.orElse(null)) + fun primaryEmail(primaryEmail: Optional) = primaryEmail(primaryEmail.getOrNull()) /** The email of the main administrator on the account. */ fun primaryEmail(primaryEmail: JsonField) = apply { @@ -526,7 +527,7 @@ private constructor( /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ fun primaryPhoneNumber(primaryPhoneNumber: Optional) = - primaryPhoneNumber(primaryPhoneNumber.orElse(null)) + primaryPhoneNumber(primaryPhoneNumber.getOrNull()) /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ fun primaryPhoneNumber(primaryPhoneNumber: JsonField) = apply { @@ -781,7 +782,7 @@ private constructor( fun accountName(accountName: String?) = accountName(JsonField.ofNullable(accountName)) /** The name of the bank associated in the payroll/HRIS system. */ - fun accountName(accountName: Optional) = accountName(accountName.orElse(null)) + fun accountName(accountName: Optional) = accountName(accountName.getOrNull()) /** The name of the bank associated in the payroll/HRIS system. */ fun accountName(accountName: JsonField) = apply { @@ -794,7 +795,7 @@ private constructor( /** 10-12 digit number to specify the bank account */ fun accountNumber(accountNumber: Optional) = - accountNumber(accountNumber.orElse(null)) + accountNumber(accountNumber.getOrNull()) /** 10-12 digit number to specify the bank account */ fun accountNumber(accountNumber: JsonField) = apply { @@ -807,7 +808,7 @@ private constructor( /** The type of bank account. */ fun accountType(accountType: Optional) = - accountType(accountType.orElse(null)) + accountType(accountType.getOrNull()) /** The type of bank account. */ fun accountType(accountType: JsonField) = apply { @@ -820,7 +821,7 @@ private constructor( /** Name of the banking institution. */ fun institutionName(institutionName: Optional) = - institutionName(institutionName.orElse(null)) + institutionName(institutionName.getOrNull()) /** Name of the banking institution. */ fun institutionName(institutionName: JsonField) = apply { @@ -839,7 +840,7 @@ private constructor( * opened. */ fun routingNumber(routingNumber: Optional) = - routingNumber(routingNumber.orElse(null)) + routingNumber(routingNumber.getOrNull()) /** * A nine-digit code that's based on the U.S. Bank location where your account was @@ -1070,7 +1071,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** The department name. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The department name. */ fun name(name: JsonField) = apply { this.name = name } @@ -1079,7 +1080,7 @@ private constructor( fun parent(parent: Parent?) = parent(JsonField.ofNullable(parent)) /** The parent department, if present. */ - fun parent(parent: Optional) = parent(parent.orElse(null)) + fun parent(parent: Optional) = parent(parent.getOrNull()) /** The parent department, if present. */ fun parent(parent: JsonField) = apply { this.parent = parent } @@ -1163,7 +1164,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** The parent department's name. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The parent department's name. */ fun name(name: JsonField) = apply { this.name = name } @@ -1296,7 +1297,7 @@ private constructor( fun subtype(subtype: Subtype?) = subtype(JsonField.ofNullable(subtype)) /** The tax payer subtype of the company. */ - fun subtype(subtype: Optional) = subtype(subtype.orElse(null)) + fun subtype(subtype: Optional) = subtype(subtype.getOrNull()) /** The tax payer subtype of the company. */ fun subtype(subtype: JsonField) = apply { this.subtype = subtype } @@ -1305,7 +1306,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) /** The tax payer type of the company. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** The tax payer type of the company. */ fun type(type: JsonField) = apply { this.type = type } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt index d33536ec..26835152 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt @@ -21,6 +21,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Add new individuals to a sandbox company */ class SandboxDirectoryCreateParams @@ -453,7 +454,7 @@ private constructor( fun classCode(classCode: String?) = classCode(JsonField.ofNullable(classCode)) /** Worker's compensation classification code for this employee */ - fun classCode(classCode: Optional) = classCode(classCode.orElse(null)) + fun classCode(classCode: Optional) = classCode(classCode.getOrNull()) /** Worker's compensation classification code for this employee */ fun classCode(classCode: JsonField) = apply { this.classCode = classCode } @@ -488,7 +489,7 @@ private constructor( fun department(department: Department?) = department(JsonField.ofNullable(department)) /** The department object. */ - fun department(department: Optional) = department(department.orElse(null)) + fun department(department: Optional) = department(department.getOrNull()) /** The department object. */ fun department(department: JsonField) = apply { @@ -497,13 +498,13 @@ private constructor( fun dob(dob: String?) = dob(JsonField.ofNullable(dob)) - fun dob(dob: Optional) = dob(dob.orElse(null)) + fun dob(dob: Optional) = dob(dob.getOrNull()) fun dob(dob: JsonField) = apply { this.dob = dob } fun emails(emails: List?) = emails(JsonField.ofNullable(emails)) - fun emails(emails: Optional>) = emails(emails.orElse(null)) + fun emails(emails: Optional>) = emails(emails.getOrNull()) fun emails(emails: JsonField>) = apply { this.emails = emails.map { it.toMutableList() } @@ -520,7 +521,7 @@ private constructor( fun employment(employment: Employment?) = employment(JsonField.ofNullable(employment)) /** The employment object. */ - fun employment(employment: Optional) = employment(employment.orElse(null)) + fun employment(employment: Optional) = employment(employment.getOrNull()) /** The employment object. */ fun employment(employment: JsonField) = apply { @@ -533,7 +534,7 @@ private constructor( /** The detailed employment status of the individual. */ fun employmentStatus(employmentStatus: Optional) = - employmentStatus(employmentStatus.orElse(null)) + employmentStatus(employmentStatus.getOrNull()) /** The detailed employment status of the individual. */ fun employmentStatus(employmentStatus: JsonField) = apply { @@ -554,7 +555,7 @@ private constructor( * set in the body. */ fun encryptedSsn(encryptedSsn: Optional) = - encryptedSsn(encryptedSsn.orElse(null)) + encryptedSsn(encryptedSsn.getOrNull()) /** * Social Security Number of the individual in **encrypted** format. This field is only @@ -567,7 +568,7 @@ private constructor( fun endDate(endDate: String?) = endDate(JsonField.ofNullable(endDate)) - fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) + fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) fun endDate(endDate: JsonField) = apply { this.endDate = endDate } @@ -575,7 +576,7 @@ private constructor( fun ethnicity(ethnicity: Ethnicity?) = ethnicity(JsonField.ofNullable(ethnicity)) /** The EEOC-defined ethnicity of the individual. */ - fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.orElse(null)) + fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.getOrNull()) /** The EEOC-defined ethnicity of the individual. */ fun ethnicity(ethnicity: JsonField) = apply { this.ethnicity = ethnicity } @@ -584,7 +585,7 @@ private constructor( fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) /** The legal first name of the individual. */ - fun firstName(firstName: Optional) = firstName(firstName.orElse(null)) + fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) /** The legal first name of the individual. */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } @@ -593,7 +594,7 @@ private constructor( fun gender(gender: Gender?) = gender(JsonField.ofNullable(gender)) /** The gender of the individual. */ - fun gender(gender: Optional) = gender(gender.orElse(null)) + fun gender(gender: Optional) = gender(gender.getOrNull()) /** The gender of the individual. */ fun gender(gender: JsonField) = apply { this.gender = gender } @@ -610,7 +611,7 @@ private constructor( * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what * information the provider returns. */ - fun income(income: Optional) = income(income.orElse(null)) + fun income(income: Optional) = income(income.getOrNull()) /** * The employee's income as reported by the provider. This may not always be annualized @@ -625,7 +626,7 @@ private constructor( /** The array of income history. */ fun incomeHistory(incomeHistory: Optional>) = - incomeHistory(incomeHistory.orElse(null)) + incomeHistory(incomeHistory.getOrNull()) /** The array of income history. */ fun incomeHistory(incomeHistory: JsonField>) = apply { @@ -647,8 +648,7 @@ private constructor( fun isActive(isActive: Boolean) = isActive(isActive as Boolean?) /** `true` if the individual an an active employee or contractor at the company. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun isActive(isActive: Optional) = isActive(isActive.orElse(null) as Boolean?) + fun isActive(isActive: Optional) = isActive(isActive.getOrNull()) /** `true` if the individual an an active employee or contractor at the company. */ fun isActive(isActive: JsonField) = apply { this.isActive = isActive } @@ -657,7 +657,7 @@ private constructor( fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) /** The legal last name of the individual. */ - fun lastName(lastName: Optional) = lastName(lastName.orElse(null)) + fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) /** The legal last name of the individual. */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } @@ -666,7 +666,7 @@ private constructor( latestRehireDate(JsonField.ofNullable(latestRehireDate)) fun latestRehireDate(latestRehireDate: Optional) = - latestRehireDate(latestRehireDate.orElse(null)) + latestRehireDate(latestRehireDate.getOrNull()) fun latestRehireDate(latestRehireDate: JsonField) = apply { this.latestRehireDate = latestRehireDate @@ -674,7 +674,7 @@ private constructor( fun location(location: Location?) = location(JsonField.ofNullable(location)) - fun location(location: Optional) = location(location.orElse(null)) + fun location(location: Optional) = location(location.getOrNull()) fun location(location: JsonField) = apply { this.location = location } @@ -682,7 +682,7 @@ private constructor( fun manager(manager: Manager?) = manager(JsonField.ofNullable(manager)) /** The manager object representing the manager of the individual within the org. */ - fun manager(manager: Optional) = manager(manager.orElse(null)) + fun manager(manager: Optional) = manager(manager.getOrNull()) /** The manager object representing the manager of the individual within the org. */ fun manager(manager: JsonField) = apply { this.manager = manager } @@ -691,7 +691,7 @@ private constructor( fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) /** The legal middle name of the individual. */ - fun middleName(middleName: Optional) = middleName(middleName.orElse(null)) + fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) /** The legal middle name of the individual. */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } @@ -700,7 +700,7 @@ private constructor( phoneNumbers(JsonField.ofNullable(phoneNumbers)) fun phoneNumbers(phoneNumbers: Optional>) = - phoneNumbers(phoneNumbers.orElse(null)) + phoneNumbers(phoneNumbers.getOrNull()) fun phoneNumbers(phoneNumbers: JsonField>) = apply { this.phoneNumbers = phoneNumbers.map { it.toMutableList() } @@ -719,7 +719,7 @@ private constructor( /** The preferred name of the individual. */ fun preferredName(preferredName: Optional) = - preferredName(preferredName.orElse(null)) + preferredName(preferredName.getOrNull()) /** The preferred name of the individual. */ fun preferredName(preferredName: JsonField) = apply { @@ -728,7 +728,7 @@ private constructor( fun residence(residence: Location?) = residence(JsonField.ofNullable(residence)) - fun residence(residence: Optional) = residence(residence.orElse(null)) + fun residence(residence: Optional) = residence(residence.getOrNull()) fun residence(residence: JsonField) = apply { this.residence = residence } @@ -750,7 +750,7 @@ private constructor( * scope enabled and the `options: { include: ['ssn'] }` param set in the body. * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). */ - fun ssn(ssn: Optional) = ssn(ssn.orElse(null)) + fun ssn(ssn: Optional) = ssn(ssn.getOrNull()) /** * Social Security Number of the individual. This field is only available with the `ssn` @@ -761,7 +761,7 @@ private constructor( fun startDate(startDate: String?) = startDate(JsonField.ofNullable(startDate)) - fun startDate(startDate: Optional) = startDate(startDate.orElse(null)) + fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } @@ -769,7 +769,7 @@ private constructor( fun title(title: String?) = title(JsonField.ofNullable(title)) /** The current title of the individual. */ - fun title(title: Optional) = title(title.orElse(null)) + fun title(title: Optional) = title(title.getOrNull()) /** The current title of the individual. */ fun title(title: JsonField) = apply { this.title = title } @@ -863,7 +863,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) fun name(name: JsonField) = apply { this.name = name } @@ -970,7 +970,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** The name of the department associated with the individual. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The name of the department associated with the individual. */ fun name(name: JsonField) = apply { this.name = name } @@ -1084,7 +1084,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) fun type(type: JsonField) = apply { this.type = type } @@ -1315,7 +1315,7 @@ private constructor( * The secondary employment type of the individual. Options: `full_time`, * `part_time`, `intern`, `temp`, `seasonal` and `individual_contractor`. */ - fun subtype(subtype: Optional) = subtype(subtype.orElse(null)) + fun subtype(subtype: Optional) = subtype(subtype.getOrNull()) /** * The secondary employment type of the individual. Options: `full_time`, @@ -1327,7 +1327,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) /** The main employment type of the individual. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** The main employment type of the individual. */ fun type(type: JsonField) = apply { this.type = type } @@ -2174,7 +2174,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) fun type(type: JsonField) = apply { this.type = type } @@ -2380,7 +2380,7 @@ private constructor( * Array of individuals to create. Takes all combined fields from `/individual` and * `/employment` endpoints. All fields are optional. */ - fun body(body: Optional>) = body(body.orElse(null)) + fun body(body: Optional>) = body(body.getOrNull()) /** * Array of individuals to create. Takes all combined fields from `/individual` and diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt index 3202a4d9..fb614e3f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt @@ -22,6 +22,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Update sandbox employment */ class SandboxEmploymentUpdateParams @@ -454,7 +455,7 @@ private constructor( fun classCode(classCode: String?) = classCode(JsonField.ofNullable(classCode)) /** Worker's compensation classification code for this employee */ - fun classCode(classCode: Optional) = classCode(classCode.orElse(null)) + fun classCode(classCode: Optional) = classCode(classCode.getOrNull()) /** Worker's compensation classification code for this employee */ fun classCode(classCode: JsonField) = apply { this.classCode = classCode } @@ -489,7 +490,7 @@ private constructor( fun department(department: Department?) = department(JsonField.ofNullable(department)) /** The department object. */ - fun department(department: Optional) = department(department.orElse(null)) + fun department(department: Optional) = department(department.getOrNull()) /** The department object. */ fun department(department: JsonField) = apply { @@ -500,7 +501,7 @@ private constructor( fun employment(employment: Employment?) = employment(JsonField.ofNullable(employment)) /** The employment object. */ - fun employment(employment: Optional) = employment(employment.orElse(null)) + fun employment(employment: Optional) = employment(employment.getOrNull()) /** The employment object. */ fun employment(employment: JsonField) = apply { @@ -513,7 +514,7 @@ private constructor( /** The detailed employment status of the individual. */ fun employmentStatus(employmentStatus: Optional) = - employmentStatus(employmentStatus.orElse(null)) + employmentStatus(employmentStatus.getOrNull()) /** The detailed employment status of the individual. */ fun employmentStatus(employmentStatus: JsonField) = apply { @@ -522,7 +523,7 @@ private constructor( fun endDate(endDate: String?) = endDate(JsonField.ofNullable(endDate)) - fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) + fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) fun endDate(endDate: JsonField) = apply { this.endDate = endDate } @@ -530,7 +531,7 @@ private constructor( fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) /** The legal first name of the individual. */ - fun firstName(firstName: Optional) = firstName(firstName.orElse(null)) + fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) /** The legal first name of the individual. */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } @@ -547,7 +548,7 @@ private constructor( * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what * information the provider returns. */ - fun income(income: Optional) = income(income.orElse(null)) + fun income(income: Optional) = income(income.getOrNull()) /** * The employee's income as reported by the provider. This may not always be annualized @@ -562,7 +563,7 @@ private constructor( /** The array of income history. */ fun incomeHistory(incomeHistory: Optional>) = - incomeHistory(incomeHistory.orElse(null)) + incomeHistory(incomeHistory.getOrNull()) /** The array of income history. */ fun incomeHistory(incomeHistory: JsonField>) = apply { @@ -584,8 +585,7 @@ private constructor( fun isActive(isActive: Boolean) = isActive(isActive as Boolean?) /** `true` if the individual an an active employee or contractor at the company. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun isActive(isActive: Optional) = isActive(isActive.orElse(null) as Boolean?) + fun isActive(isActive: Optional) = isActive(isActive.getOrNull()) /** `true` if the individual an an active employee or contractor at the company. */ fun isActive(isActive: JsonField) = apply { this.isActive = isActive } @@ -594,7 +594,7 @@ private constructor( fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) /** The legal last name of the individual. */ - fun lastName(lastName: Optional) = lastName(lastName.orElse(null)) + fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) /** The legal last name of the individual. */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } @@ -603,7 +603,7 @@ private constructor( latestRehireDate(JsonField.ofNullable(latestRehireDate)) fun latestRehireDate(latestRehireDate: Optional) = - latestRehireDate(latestRehireDate.orElse(null)) + latestRehireDate(latestRehireDate.getOrNull()) fun latestRehireDate(latestRehireDate: JsonField) = apply { this.latestRehireDate = latestRehireDate @@ -611,7 +611,7 @@ private constructor( fun location(location: Location?) = location(JsonField.ofNullable(location)) - fun location(location: Optional) = location(location.orElse(null)) + fun location(location: Optional) = location(location.getOrNull()) fun location(location: JsonField) = apply { this.location = location } @@ -619,7 +619,7 @@ private constructor( fun manager(manager: Manager?) = manager(JsonField.ofNullable(manager)) /** The manager object representing the manager of the individual within the org. */ - fun manager(manager: Optional) = manager(manager.orElse(null)) + fun manager(manager: Optional) = manager(manager.getOrNull()) /** The manager object representing the manager of the individual within the org. */ fun manager(manager: JsonField) = apply { this.manager = manager } @@ -628,7 +628,7 @@ private constructor( fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) /** The legal middle name of the individual. */ - fun middleName(middleName: Optional) = middleName(middleName.orElse(null)) + fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) /** The legal middle name of the individual. */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } @@ -641,7 +641,7 @@ private constructor( fun startDate(startDate: String?) = startDate(JsonField.ofNullable(startDate)) - fun startDate(startDate: Optional) = startDate(startDate.orElse(null)) + fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } @@ -649,7 +649,7 @@ private constructor( fun title(title: String?) = title(JsonField.ofNullable(title)) /** The current title of the individual. */ - fun title(title: Optional) = title(title.orElse(null)) + fun title(title: Optional) = title(title.getOrNull()) /** The current title of the individual. */ fun title(title: JsonField) = apply { this.title = title } @@ -754,7 +754,7 @@ private constructor( fun classCode(classCode: String?) = apply { body.classCode(classCode) } /** Worker's compensation classification code for this employee */ - fun classCode(classCode: Optional) = classCode(classCode.orElse(null)) + fun classCode(classCode: Optional) = classCode(classCode.getOrNull()) /** Worker's compensation classification code for this employee */ fun classCode(classCode: JsonField) = apply { body.classCode(classCode) } @@ -785,7 +785,7 @@ private constructor( fun department(department: Department?) = apply { body.department(department) } /** The department object. */ - fun department(department: Optional) = department(department.orElse(null)) + fun department(department: Optional) = department(department.getOrNull()) /** The department object. */ fun department(department: JsonField) = apply { body.department(department) } @@ -794,7 +794,7 @@ private constructor( fun employment(employment: Employment?) = apply { body.employment(employment) } /** The employment object. */ - fun employment(employment: Optional) = employment(employment.orElse(null)) + fun employment(employment: Optional) = employment(employment.getOrNull()) /** The employment object. */ fun employment(employment: JsonField) = apply { body.employment(employment) } @@ -806,7 +806,7 @@ private constructor( /** The detailed employment status of the individual. */ fun employmentStatus(employmentStatus: Optional) = - employmentStatus(employmentStatus.orElse(null)) + employmentStatus(employmentStatus.getOrNull()) /** The detailed employment status of the individual. */ fun employmentStatus(employmentStatus: JsonField) = apply { @@ -815,7 +815,7 @@ private constructor( fun endDate(endDate: String?) = apply { body.endDate(endDate) } - fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) + fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) fun endDate(endDate: JsonField) = apply { body.endDate(endDate) } @@ -823,7 +823,7 @@ private constructor( fun firstName(firstName: String?) = apply { body.firstName(firstName) } /** The legal first name of the individual. */ - fun firstName(firstName: Optional) = firstName(firstName.orElse(null)) + fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) /** The legal first name of the individual. */ fun firstName(firstName: JsonField) = apply { body.firstName(firstName) } @@ -840,7 +840,7 @@ private constructor( * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what * information the provider returns. */ - fun income(income: Optional) = income(income.orElse(null)) + fun income(income: Optional) = income(income.getOrNull()) /** * The employee's income as reported by the provider. This may not always be annualized @@ -856,7 +856,7 @@ private constructor( /** The array of income history. */ fun incomeHistory(incomeHistory: Optional>) = - incomeHistory(incomeHistory.orElse(null)) + incomeHistory(incomeHistory.getOrNull()) /** The array of income history. */ fun incomeHistory(incomeHistory: JsonField>) = apply { @@ -873,8 +873,7 @@ private constructor( fun isActive(isActive: Boolean) = isActive(isActive as Boolean?) /** `true` if the individual an an active employee or contractor at the company. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun isActive(isActive: Optional) = isActive(isActive.orElse(null) as Boolean?) + fun isActive(isActive: Optional) = isActive(isActive.getOrNull()) /** `true` if the individual an an active employee or contractor at the company. */ fun isActive(isActive: JsonField) = apply { body.isActive(isActive) } @@ -883,7 +882,7 @@ private constructor( fun lastName(lastName: String?) = apply { body.lastName(lastName) } /** The legal last name of the individual. */ - fun lastName(lastName: Optional) = lastName(lastName.orElse(null)) + fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) /** The legal last name of the individual. */ fun lastName(lastName: JsonField) = apply { body.lastName(lastName) } @@ -893,7 +892,7 @@ private constructor( } fun latestRehireDate(latestRehireDate: Optional) = - latestRehireDate(latestRehireDate.orElse(null)) + latestRehireDate(latestRehireDate.getOrNull()) fun latestRehireDate(latestRehireDate: JsonField) = apply { body.latestRehireDate(latestRehireDate) @@ -901,7 +900,7 @@ private constructor( fun location(location: Location?) = apply { body.location(location) } - fun location(location: Optional) = location(location.orElse(null)) + fun location(location: Optional) = location(location.getOrNull()) fun location(location: JsonField) = apply { body.location(location) } @@ -909,7 +908,7 @@ private constructor( fun manager(manager: Manager?) = apply { body.manager(manager) } /** The manager object representing the manager of the individual within the org. */ - fun manager(manager: Optional) = manager(manager.orElse(null)) + fun manager(manager: Optional) = manager(manager.getOrNull()) /** The manager object representing the manager of the individual within the org. */ fun manager(manager: JsonField) = apply { body.manager(manager) } @@ -918,7 +917,7 @@ private constructor( fun middleName(middleName: String?) = apply { body.middleName(middleName) } /** The legal middle name of the individual. */ - fun middleName(middleName: Optional) = middleName(middleName.orElse(null)) + fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) /** The legal middle name of the individual. */ fun middleName(middleName: JsonField) = apply { body.middleName(middleName) } @@ -931,7 +930,7 @@ private constructor( fun startDate(startDate: String?) = apply { body.startDate(startDate) } - fun startDate(startDate: Optional) = startDate(startDate.orElse(null)) + fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) fun startDate(startDate: JsonField) = apply { body.startDate(startDate) } @@ -939,7 +938,7 @@ private constructor( fun title(title: String?) = apply { body.title(title) } /** The current title of the individual. */ - fun title(title: Optional) = title(title.orElse(null)) + fun title(title: Optional) = title(title.getOrNull()) /** The current title of the individual. */ fun title(title: JsonField) = apply { body.title(title) } @@ -1127,7 +1126,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) fun name(name: JsonField) = apply { this.name = name } @@ -1230,7 +1229,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** The name of the department associated with the individual. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The name of the department associated with the individual. */ fun name(name: JsonField) = apply { this.name = name } @@ -1354,7 +1353,7 @@ private constructor( * The secondary employment type of the individual. Options: `full_time`, `part_time`, * `intern`, `temp`, `seasonal` and `individual_contractor`. */ - fun subtype(subtype: Optional) = subtype(subtype.orElse(null)) + fun subtype(subtype: Optional) = subtype(subtype.getOrNull()) /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, @@ -1366,7 +1365,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) /** The main employment type of the individual. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** The main employment type of the individual. */ fun type(type: JsonField) = apply { this.type = type } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt index 77d8b6c4..b113b362 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt @@ -22,6 +22,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Update sandbox individual */ class SandboxIndividualUpdateParams @@ -339,13 +340,13 @@ private constructor( fun dob(dob: String?) = dob(JsonField.ofNullable(dob)) - fun dob(dob: Optional) = dob(dob.orElse(null)) + fun dob(dob: Optional) = dob(dob.getOrNull()) fun dob(dob: JsonField) = apply { this.dob = dob } fun emails(emails: List?) = emails(JsonField.ofNullable(emails)) - fun emails(emails: Optional>) = emails(emails.orElse(null)) + fun emails(emails: Optional>) = emails(emails.getOrNull()) fun emails(emails: JsonField>) = apply { this.emails = emails.map { it.toMutableList() } @@ -372,7 +373,7 @@ private constructor( * set in the body. */ fun encryptedSsn(encryptedSsn: Optional) = - encryptedSsn(encryptedSsn.orElse(null)) + encryptedSsn(encryptedSsn.getOrNull()) /** * Social Security Number of the individual in **encrypted** format. This field is only @@ -387,7 +388,7 @@ private constructor( fun ethnicity(ethnicity: Ethnicity?) = ethnicity(JsonField.ofNullable(ethnicity)) /** The EEOC-defined ethnicity of the individual. */ - fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.orElse(null)) + fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.getOrNull()) /** The EEOC-defined ethnicity of the individual. */ fun ethnicity(ethnicity: JsonField) = apply { this.ethnicity = ethnicity } @@ -396,7 +397,7 @@ private constructor( fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) /** The legal first name of the individual. */ - fun firstName(firstName: Optional) = firstName(firstName.orElse(null)) + fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) /** The legal first name of the individual. */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } @@ -405,7 +406,7 @@ private constructor( fun gender(gender: Gender?) = gender(JsonField.ofNullable(gender)) /** The gender of the individual. */ - fun gender(gender: Optional) = gender(gender.orElse(null)) + fun gender(gender: Optional) = gender(gender.getOrNull()) /** The gender of the individual. */ fun gender(gender: JsonField) = apply { this.gender = gender } @@ -414,7 +415,7 @@ private constructor( fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) /** The legal last name of the individual. */ - fun lastName(lastName: Optional) = lastName(lastName.orElse(null)) + fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) /** The legal last name of the individual. */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } @@ -423,7 +424,7 @@ private constructor( fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) /** The legal middle name of the individual. */ - fun middleName(middleName: Optional) = middleName(middleName.orElse(null)) + fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) /** The legal middle name of the individual. */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } @@ -432,7 +433,7 @@ private constructor( phoneNumbers(JsonField.ofNullable(phoneNumbers)) fun phoneNumbers(phoneNumbers: Optional>) = - phoneNumbers(phoneNumbers.orElse(null)) + phoneNumbers(phoneNumbers.getOrNull()) fun phoneNumbers(phoneNumbers: JsonField>) = apply { this.phoneNumbers = phoneNumbers.map { it.toMutableList() } @@ -451,7 +452,7 @@ private constructor( /** The preferred name of the individual. */ fun preferredName(preferredName: Optional) = - preferredName(preferredName.orElse(null)) + preferredName(preferredName.getOrNull()) /** The preferred name of the individual. */ fun preferredName(preferredName: JsonField) = apply { @@ -460,7 +461,7 @@ private constructor( fun residence(residence: Location?) = residence(JsonField.ofNullable(residence)) - fun residence(residence: Optional) = residence(residence.orElse(null)) + fun residence(residence: Optional) = residence(residence.getOrNull()) fun residence(residence: JsonField) = apply { this.residence = residence } @@ -476,7 +477,7 @@ private constructor( * scope enabled and the `options: { include: ['ssn'] }` param set in the body. * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). */ - fun ssn(ssn: Optional) = ssn(ssn.orElse(null)) + fun ssn(ssn: Optional) = ssn(ssn.getOrNull()) /** * Social Security Number of the individual. This field is only available with the `ssn` @@ -577,13 +578,13 @@ private constructor( fun dob(dob: String?) = apply { body.dob(dob) } - fun dob(dob: Optional) = dob(dob.orElse(null)) + fun dob(dob: Optional) = dob(dob.getOrNull()) fun dob(dob: JsonField) = apply { body.dob(dob) } fun emails(emails: List?) = apply { body.emails(emails) } - fun emails(emails: Optional>) = emails(emails.orElse(null)) + fun emails(emails: Optional>) = emails(emails.getOrNull()) fun emails(emails: JsonField>) = apply { body.emails(emails) } @@ -601,7 +602,7 @@ private constructor( * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set * in the body. */ - fun encryptedSsn(encryptedSsn: Optional) = encryptedSsn(encryptedSsn.orElse(null)) + fun encryptedSsn(encryptedSsn: Optional) = encryptedSsn(encryptedSsn.getOrNull()) /** * Social Security Number of the individual in **encrypted** format. This field is only @@ -616,7 +617,7 @@ private constructor( fun ethnicity(ethnicity: Ethnicity?) = apply { body.ethnicity(ethnicity) } /** The EEOC-defined ethnicity of the individual. */ - fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.orElse(null)) + fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.getOrNull()) /** The EEOC-defined ethnicity of the individual. */ fun ethnicity(ethnicity: JsonField) = apply { body.ethnicity(ethnicity) } @@ -625,7 +626,7 @@ private constructor( fun firstName(firstName: String?) = apply { body.firstName(firstName) } /** The legal first name of the individual. */ - fun firstName(firstName: Optional) = firstName(firstName.orElse(null)) + fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) /** The legal first name of the individual. */ fun firstName(firstName: JsonField) = apply { body.firstName(firstName) } @@ -634,7 +635,7 @@ private constructor( fun gender(gender: Gender?) = apply { body.gender(gender) } /** The gender of the individual. */ - fun gender(gender: Optional) = gender(gender.orElse(null)) + fun gender(gender: Optional) = gender(gender.getOrNull()) /** The gender of the individual. */ fun gender(gender: JsonField) = apply { body.gender(gender) } @@ -643,7 +644,7 @@ private constructor( fun lastName(lastName: String?) = apply { body.lastName(lastName) } /** The legal last name of the individual. */ - fun lastName(lastName: Optional) = lastName(lastName.orElse(null)) + fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) /** The legal last name of the individual. */ fun lastName(lastName: JsonField) = apply { body.lastName(lastName) } @@ -652,7 +653,7 @@ private constructor( fun middleName(middleName: String?) = apply { body.middleName(middleName) } /** The legal middle name of the individual. */ - fun middleName(middleName: Optional) = middleName(middleName.orElse(null)) + fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) /** The legal middle name of the individual. */ fun middleName(middleName: JsonField) = apply { body.middleName(middleName) } @@ -662,7 +663,7 @@ private constructor( } fun phoneNumbers(phoneNumbers: Optional>) = - phoneNumbers(phoneNumbers.orElse(null)) + phoneNumbers(phoneNumbers.getOrNull()) fun phoneNumbers(phoneNumbers: JsonField>) = apply { body.phoneNumbers(phoneNumbers) @@ -675,7 +676,7 @@ private constructor( /** The preferred name of the individual. */ fun preferredName(preferredName: Optional) = - preferredName(preferredName.orElse(null)) + preferredName(preferredName.getOrNull()) /** The preferred name of the individual. */ fun preferredName(preferredName: JsonField) = apply { @@ -684,7 +685,7 @@ private constructor( fun residence(residence: Location?) = apply { body.residence(residence) } - fun residence(residence: Optional) = residence(residence.orElse(null)) + fun residence(residence: Optional) = residence(residence.getOrNull()) fun residence(residence: JsonField) = apply { body.residence(residence) } @@ -700,7 +701,7 @@ private constructor( * scope enabled and the `options: { include: ['ssn'] }` param set in the body. * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). */ - fun ssn(ssn: Optional) = ssn(ssn.orElse(null)) + fun ssn(ssn: Optional) = ssn(ssn.getOrNull()) /** * Social Security Number of the individual. This field is only available with the `ssn` @@ -899,7 +900,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) fun type(type: JsonField) = apply { this.type = type } @@ -1354,7 +1355,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) fun type(type: JsonField) = apply { this.type = type } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt index 799d5cd7..c7f61bfb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt @@ -21,6 +21,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Add a new sandbox payment */ class SandboxPaymentCreateParams @@ -547,7 +548,7 @@ private constructor( fun earnings(earnings: List?) = earnings(JsonField.ofNullable(earnings)) /** The array of earnings objects associated with this pay statement */ - fun earnings(earnings: Optional>) = earnings(earnings.orElse(null)) + fun earnings(earnings: Optional>) = earnings(earnings.getOrNull()) /** The array of earnings objects associated with this pay statement */ fun earnings(earnings: JsonField>) = apply { @@ -568,7 +569,7 @@ private constructor( /** The array of deductions objects associated with this pay statement. */ fun employeeDeductions(employeeDeductions: Optional>) = - employeeDeductions(employeeDeductions.orElse(null)) + employeeDeductions(employeeDeductions.getOrNull()) /** The array of deductions objects associated with this pay statement. */ fun employeeDeductions(employeeDeductions: JsonField>) = @@ -589,7 +590,7 @@ private constructor( fun employerContributions( employerContributions: Optional> - ) = employerContributions(employerContributions.orElse(null)) + ) = employerContributions(employerContributions.getOrNull()) fun employerContributions( employerContributions: JsonField> @@ -606,7 +607,7 @@ private constructor( fun grossPay(grossPay: Money?) = grossPay(JsonField.ofNullable(grossPay)) - fun grossPay(grossPay: Optional) = grossPay(grossPay.orElse(null)) + fun grossPay(grossPay: Optional) = grossPay(grossPay.getOrNull()) fun grossPay(grossPay: JsonField) = apply { this.grossPay = grossPay } @@ -620,7 +621,7 @@ private constructor( fun netPay(netPay: Money?) = netPay(JsonField.ofNullable(netPay)) - fun netPay(netPay: Optional) = netPay(netPay.orElse(null)) + fun netPay(netPay: Optional) = netPay(netPay.getOrNull()) fun netPay(netPay: JsonField) = apply { this.netPay = netPay } @@ -630,7 +631,7 @@ private constructor( /** The payment method. */ fun paymentMethod(paymentMethod: Optional) = - paymentMethod(paymentMethod.orElse(null)) + paymentMethod(paymentMethod.getOrNull()) /** The payment method. */ fun paymentMethod(paymentMethod: JsonField) = apply { @@ -641,7 +642,7 @@ private constructor( fun taxes(taxes: List?) = taxes(JsonField.ofNullable(taxes)) /** The array of taxes objects associated with this pay statement. */ - fun taxes(taxes: Optional>) = taxes(taxes.orElse(null)) + fun taxes(taxes: Optional>) = taxes(taxes.getOrNull()) /** The array of taxes objects associated with this pay statement. */ fun taxes(taxes: JsonField>) = apply { @@ -663,9 +664,7 @@ private constructor( fun totalHours(totalHours: Double) = totalHours(totalHours as Double?) /** The number of hours worked for this pay period */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun totalHours(totalHours: Optional) = - totalHours(totalHours.orElse(null) as Double?) + fun totalHours(totalHours: Optional) = totalHours(totalHours.getOrNull()) /** The number of hours worked for this pay period */ fun totalHours(totalHours: JsonField) = apply { this.totalHours = totalHours } @@ -674,7 +673,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) /** The type of the payment associated with the pay statement. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** The type of the payment associated with the pay statement. */ fun type(type: JsonField) = apply { this.type = type } @@ -840,8 +839,7 @@ private constructor( fun amount(amount: Long) = amount(amount as Long?) /** The earnings amount in cents. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun amount(amount: Optional) = amount(amount.orElse(null) as Long?) + fun amount(amount: Optional) = amount(amount.getOrNull()) /** The earnings amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } @@ -850,7 +848,7 @@ private constructor( attributes(JsonField.ofNullable(attributes)) fun attributes(attributes: Optional) = - attributes(attributes.orElse(null)) + attributes(attributes.getOrNull()) fun attributes(attributes: JsonField) = apply { this.attributes = attributes @@ -860,7 +858,7 @@ private constructor( fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) /** The earnings currency code. */ - fun currency(currency: Optional) = currency(currency.orElse(null)) + fun currency(currency: Optional) = currency(currency.getOrNull()) /** The earnings currency code. */ fun currency(currency: JsonField) = apply { this.currency = currency } @@ -881,8 +879,7 @@ private constructor( * The number of hours associated with this earning. (For salaried employees, this * could be hours per pay period, `0` or `null`, depending on the provider). */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun hours(hours: Optional) = hours(hours.orElse(null) as Double?) + fun hours(hours: Optional) = hours(hours.getOrNull()) /** * The number of hours associated with this earning. (For salaried employees, this @@ -894,7 +891,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** The exact name of the deduction from the pay statement. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The exact name of the deduction from the pay statement. */ fun name(name: JsonField) = apply { this.name = name } @@ -903,7 +900,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) /** The type of earning. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** The type of earning. */ fun type(type: JsonField) = apply { this.type = type } @@ -1572,8 +1569,7 @@ private constructor( fun amount(amount: Long) = amount(amount as Long?) /** The deduction amount in cents. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun amount(amount: Optional) = amount(amount.orElse(null) as Long?) + fun amount(amount: Optional) = amount(amount.getOrNull()) /** The deduction amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } @@ -1582,7 +1578,7 @@ private constructor( attributes(JsonField.ofNullable(attributes)) fun attributes(attributes: Optional) = - attributes(attributes.orElse(null)) + attributes(attributes.getOrNull()) fun attributes(attributes: JsonField) = apply { this.attributes = attributes @@ -1592,7 +1588,7 @@ private constructor( fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) /** The deduction currency. */ - fun currency(currency: Optional) = currency(currency.orElse(null)) + fun currency(currency: Optional) = currency(currency.getOrNull()) /** The deduction currency. */ fun currency(currency: JsonField) = apply { this.currency = currency } @@ -1601,7 +1597,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** The deduction name from the pay statement. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The deduction name from the pay statement. */ fun name(name: JsonField) = apply { this.name = name } @@ -1613,8 +1609,7 @@ private constructor( fun preTax(preTax: Boolean) = preTax(preTax as Boolean?) /** Boolean indicating if the deduction is pre-tax. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun preTax(preTax: Optional) = preTax(preTax.orElse(null) as Boolean?) + fun preTax(preTax: Optional) = preTax(preTax.getOrNull()) /** Boolean indicating if the deduction is pre-tax. */ fun preTax(preTax: JsonField) = apply { this.preTax = preTax } @@ -1623,7 +1618,7 @@ private constructor( fun type(type: BenefitType?) = type(JsonField.ofNullable(type)) /** Type of benefit. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** Type of benefit. */ fun type(type: JsonField) = apply { this.type = type } @@ -2110,8 +2105,7 @@ private constructor( fun amount(amount: Long) = amount(amount as Long?) /** The contribution amount in cents. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun amount(amount: Optional) = amount(amount.orElse(null) as Long?) + fun amount(amount: Optional) = amount(amount.getOrNull()) /** The contribution amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } @@ -2120,7 +2114,7 @@ private constructor( attributes(JsonField.ofNullable(attributes)) fun attributes(attributes: Optional) = - attributes(attributes.orElse(null)) + attributes(attributes.getOrNull()) fun attributes(attributes: JsonField) = apply { this.attributes = attributes @@ -2130,7 +2124,7 @@ private constructor( fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) /** The contribution currency. */ - fun currency(currency: Optional) = currency(currency.orElse(null)) + fun currency(currency: Optional) = currency(currency.getOrNull()) /** The contribution currency. */ fun currency(currency: JsonField) = apply { this.currency = currency } @@ -2139,7 +2133,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** The contribution name from the pay statement. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The contribution name from the pay statement. */ fun name(name: JsonField) = apply { this.name = name } @@ -2148,7 +2142,7 @@ private constructor( fun type(type: BenefitType?) = type(JsonField.ofNullable(type)) /** Type of benefit. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** Type of benefit. */ fun type(type: JsonField) = apply { this.type = type } @@ -2750,8 +2744,7 @@ private constructor( fun amount(amount: Long) = amount(amount as Long?) /** The tax amount in cents. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun amount(amount: Optional) = amount(amount.orElse(null) as Long?) + fun amount(amount: Optional) = amount(amount.getOrNull()) /** The tax amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } @@ -2760,7 +2753,7 @@ private constructor( attributes(JsonField.ofNullable(attributes)) fun attributes(attributes: Optional) = - attributes(attributes.orElse(null)) + attributes(attributes.getOrNull()) fun attributes(attributes: JsonField) = apply { this.attributes = attributes @@ -2770,7 +2763,7 @@ private constructor( fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) /** The currency code. */ - fun currency(currency: Optional) = currency(currency.orElse(null)) + fun currency(currency: Optional) = currency(currency.getOrNull()) /** The currency code. */ fun currency(currency: JsonField) = apply { this.currency = currency } @@ -2782,9 +2775,7 @@ private constructor( fun employer(employer: Boolean) = employer(employer as Boolean?) /** `true` if the amount is paid by the employers. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun employer(employer: Optional) = - employer(employer.orElse(null) as Boolean?) + fun employer(employer: Optional) = employer(employer.getOrNull()) /** `true` if the amount is paid by the employers. */ fun employer(employer: JsonField) = apply { this.employer = employer } @@ -2793,7 +2784,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** The exact name of tax from the pay statement. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** The exact name of tax from the pay statement. */ fun name(name: JsonField) = apply { this.name = name } @@ -2802,7 +2793,7 @@ private constructor( fun type(type: Type?) = type(JsonField.ofNullable(type)) /** The type of taxes. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** The type of taxes. */ fun type(type: JsonField) = apply { this.type = type } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt index 696e8c2e..9798d88b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt @@ -18,6 +18,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class SupportedBenefit @@ -188,9 +189,8 @@ private constructor( fun annualMaximum(annualMaximum: Boolean) = annualMaximum(annualMaximum as Boolean?) /** Whether the provider supports an annual maximum for this benefit. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun annualMaximum(annualMaximum: Optional) = - annualMaximum(annualMaximum.orElse(null) as Boolean?) + annualMaximum(annualMaximum.getOrNull()) /** Whether the provider supports an annual maximum for this benefit. */ fun annualMaximum(annualMaximum: JsonField) = apply { @@ -213,8 +213,7 @@ private constructor( * Whether the provider supports catch up for this benefit. This field will only be true for * retirement benefits. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun catchUp(catchUp: Optional) = catchUp(catchUp.orElse(null) as Boolean?) + fun catchUp(catchUp: Optional) = catchUp(catchUp.getOrNull()) /** * Whether the provider supports catch up for this benefit. This field will only be true for @@ -232,7 +231,7 @@ private constructor( * Supported contribution types. An empty array indicates contributions are not supported. */ fun companyContribution(companyContribution: Optional>) = - companyContribution(companyContribution.orElse(null)) + companyContribution(companyContribution.getOrNull()) /** * Supported contribution types. An empty array indicates contributions are not supported. @@ -254,7 +253,7 @@ private constructor( fun description(description: String?) = description(JsonField.ofNullable(description)) - fun description(description: Optional) = description(description.orElse(null)) + fun description(description: Optional) = description(description.getOrNull()) fun description(description: JsonField) = apply { this.description = description } @@ -264,7 +263,7 @@ private constructor( /** Supported deduction types. An empty array indicates deductions are not supported. */ fun employeeDeduction(employeeDeduction: Optional>) = - employeeDeduction(employeeDeduction.orElse(null)) + employeeDeduction(employeeDeduction.getOrNull()) /** Supported deduction types. An empty array indicates deductions are not supported. */ fun employeeDeduction(employeeDeduction: JsonField>) = apply { @@ -308,7 +307,7 @@ private constructor( * supported for the benefit. This array only has values for HSA benefits. */ fun hsaContributionLimit(hsaContributionLimit: Optional>) = - hsaContributionLimit(hsaContributionLimit.orElse(null)) + hsaContributionLimit(hsaContributionLimit.getOrNull()) /** * Whether the provider supports HSA contribution limits. Empty if this feature is not @@ -334,7 +333,7 @@ private constructor( fun type(type: BenefitType?) = type(JsonField.ofNullable(type)) /** Type of benefit. */ - fun type(type: Optional) = type(type.orElse(null)) + fun type(type: Optional) = type(type.getOrNull()) /** Type of benefit. */ fun type(type: JsonField) = apply { this.type = type } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt index 2ff55d27..4429a738 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt @@ -15,6 +15,7 @@ import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class UnenrolledIndividual @@ -205,7 +206,7 @@ private constructor( fun finchCode(finchCode: String?) = finchCode(JsonField.ofNullable(finchCode)) /** A descriptive identifier for the response. */ - fun finchCode(finchCode: Optional) = finchCode(finchCode.orElse(null)) + fun finchCode(finchCode: Optional) = finchCode(finchCode.getOrNull()) /** A descriptive identifier for the response. */ fun finchCode(finchCode: JsonField) = apply { this.finchCode = finchCode } @@ -214,7 +215,7 @@ private constructor( fun message(message: String?) = message(JsonField.ofNullable(message)) /** Short description in English that provides more information about the response. */ - fun message(message: Optional) = message(message.orElse(null)) + fun message(message: Optional) = message(message.getOrNull()) /** Short description in English that provides more information about the response. */ fun message(message: JsonField) = apply { this.message = message } @@ -223,7 +224,7 @@ private constructor( fun name(name: String?) = name(JsonField.ofNullable(name)) /** Identifier indicating whether the benefit was newly enrolled or updated. */ - fun name(name: Optional) = name(name.orElse(null)) + fun name(name: Optional) = name(name.getOrNull()) /** Identifier indicating whether the benefit was newly enrolled or updated. */ fun name(name: JsonField) = apply { this.name = name } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt index 34cb72de..9b7be7d7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt @@ -17,6 +17,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * A 2005 version of the W-4 tax form containing information on an individual's filing status, @@ -110,8 +111,7 @@ private constructor( fun year(year: Double) = year(year as Double?) /** The tax year this W4 document applies to. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun year(year: Optional) = year(year.orElse(null) as Double?) + fun year(year: Optional) = year(year.getOrNull()) /** The tax year this W4 document applies to. */ fun year(year: JsonField) = apply { this.year = year } @@ -263,9 +263,8 @@ private constructor( additionalWithholding(additionalWithholding as Long?) /** Additional withholding amount (in cents). */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun additionalWithholding(additionalWithholding: Optional) = - additionalWithholding(additionalWithholding.orElse(null) as Long?) + additionalWithholding(additionalWithholding.getOrNull()) /** Additional withholding amount (in cents). */ fun additionalWithholding(additionalWithholding: JsonField) = apply { @@ -303,9 +302,8 @@ private constructor( totalNumberOfAllowances(totalNumberOfAllowances as Long?) /** Total number of allowances claimed (in cents). */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun totalNumberOfAllowances(totalNumberOfAllowances: Optional) = - totalNumberOfAllowances(totalNumberOfAllowances.orElse(null) as Long?) + totalNumberOfAllowances(totalNumberOfAllowances.getOrNull()) /** Total number of allowances claimed (in cents). */ fun totalNumberOfAllowances(totalNumberOfAllowances: JsonField) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt index 24d59d3d..53555e9e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt @@ -17,6 +17,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * A 2020 version of the W-4 tax form containing information on an individual's filing status, @@ -110,8 +111,7 @@ private constructor( fun year(year: Double) = year(year as Double?) /** The tax year this W4 document applies to. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun year(year: Optional) = year(year.orElse(null) as Double?) + fun year(year: Optional) = year(year.getOrNull()) /** The tax year this W4 document applies to. */ fun year(year: JsonField) = apply { this.year = year } @@ -315,9 +315,8 @@ private constructor( amountForOtherDependents(amountForOtherDependents as Long?) /** Amount claimed for dependents other than qualifying children under 17 (in cents). */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun amountForOtherDependents(amountForOtherDependents: Optional) = - amountForOtherDependents(amountForOtherDependents.orElse(null) as Long?) + amountForOtherDependents(amountForOtherDependents.getOrNull()) /** Amount claimed for dependents other than qualifying children under 17 (in cents). */ fun amountForOtherDependents(amountForOtherDependents: JsonField) = apply { @@ -335,13 +334,9 @@ private constructor( amountForQualifyingChildrenUnder17(amountForQualifyingChildrenUnder17 as Long?) /** Amount claimed for dependents under 17 years old (in cents). */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun amountForQualifyingChildrenUnder17( amountForQualifyingChildrenUnder17: Optional - ) = - amountForQualifyingChildrenUnder17( - amountForQualifyingChildrenUnder17.orElse(null) as Long? - ) + ) = amountForQualifyingChildrenUnder17(amountForQualifyingChildrenUnder17.getOrNull()) /** Amount claimed for dependents under 17 years old (in cents). */ fun amountForQualifyingChildrenUnder17( @@ -357,9 +352,7 @@ private constructor( fun deductions(deductions: Long) = deductions(deductions as Long?) /** Deductible expenses (in cents). */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun deductions(deductions: Optional) = - deductions(deductions.orElse(null) as Long?) + fun deductions(deductions: Optional) = deductions(deductions.getOrNull()) /** Deductible expenses (in cents). */ fun deductions(deductions: JsonField) = apply { this.deductions = deductions } @@ -373,9 +366,8 @@ private constructor( extraWithholding(extraWithholding as Long?) /** Additional withholding amount (in cents). */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun extraWithholding(extraWithholding: Optional) = - extraWithholding(extraWithholding.orElse(null) as Long?) + extraWithholding(extraWithholding.getOrNull()) /** Additional withholding amount (in cents). */ fun extraWithholding(extraWithholding: JsonField) = apply { @@ -388,7 +380,7 @@ private constructor( /** The individual's filing status for tax purposes. */ fun filingStatus(filingStatus: Optional) = - filingStatus(filingStatus.orElse(null)) + filingStatus(filingStatus.getOrNull()) /** The individual's filing status for tax purposes. */ fun filingStatus(filingStatus: JsonField) = apply { @@ -410,9 +402,7 @@ private constructor( fun otherIncome(otherIncome: Long) = otherIncome(otherIncome as Long?) /** Additional income from sources outside of primary employment (in cents). */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun otherIncome(otherIncome: Optional) = - otherIncome(otherIncome.orElse(null) as Long?) + fun otherIncome(otherIncome: Optional) = otherIncome(otherIncome.getOrNull()) /** Additional income from sources outside of primary employment (in cents). */ fun otherIncome(otherIncome: JsonField) = apply { this.otherIncome = otherIncome } @@ -428,13 +418,9 @@ private constructor( totalClaimDependentAndOtherCredits(totalClaimDependentAndOtherCredits as Long?) /** Total amount claimed for dependents and other credits (in cents). */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun totalClaimDependentAndOtherCredits( totalClaimDependentAndOtherCredits: Optional - ) = - totalClaimDependentAndOtherCredits( - totalClaimDependentAndOtherCredits.orElse(null) as Long? - ) + ) = totalClaimDependentAndOtherCredits(totalClaimDependentAndOtherCredits.getOrNull()) /** Total amount claimed for dependents and other credits (in cents). */ fun totalClaimDependentAndOtherCredits( From 0d387447276d8cbe1dad8c4ab69fc6d72e5b36d6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 7 Mar 2025 23:02:05 +0000 Subject: [PATCH 18/65] chore(internal): reenable warnings as errors (#485) chore(internal): don't use `JvmOverloads` in interfaces --- .../src/main/kotlin/finch.kotlin.gradle.kts | 9 +- .../com/tryfinch/api/core/http/HttpClient.kt | 9 +- .../services/async/AccessTokenServiceAsync.kt | 15 ++- .../api/services/async/AccountServiceAsync.kt | 61 ++++++--- .../services/async/ProviderServiceAsync.kt | 31 +++-- .../async/RequestForwardingServiceAsync.kt | 16 ++- .../async/connect/SessionServiceAsync.kt | 30 ++++- .../async/hris/BenefitServiceAsync.kt | 124 +++++++++++++----- .../async/hris/CompanyServiceAsync.kt | 30 +++-- .../async/hris/DirectoryServiceAsync.kt | 67 +++++++--- .../async/hris/DirectoryServiceAsyncImpl.kt | 2 + .../async/hris/DocumentServiceAsync.kt | 46 +++++-- .../async/hris/EmploymentServiceAsync.kt | 17 ++- .../async/hris/IndividualServiceAsync.kt | 34 +++-- .../async/hris/PayStatementServiceAsync.kt | 17 ++- .../async/hris/PaymentServiceAsync.kt | 15 ++- .../hris/benefits/IndividualServiceAsync.kt | 46 +++++-- .../async/jobs/AutomatedServiceAsync.kt | 92 ++++++++----- .../services/async/jobs/ManualServiceAsync.kt | 15 ++- .../async/payroll/PayGroupServiceAsync.kt | 46 +++++-- .../async/sandbox/CompanyServiceAsync.kt | 15 ++- .../async/sandbox/ConnectionServiceAsync.kt | 15 ++- .../async/sandbox/DirectoryServiceAsync.kt | 31 +++-- .../async/sandbox/EmploymentServiceAsync.kt | 15 ++- .../async/sandbox/IndividualServiceAsync.kt | 15 ++- .../services/async/sandbox/JobServiceAsync.kt | 15 ++- .../async/sandbox/PaymentServiceAsync.kt | 32 +++-- .../connections/AccountServiceAsync.kt | 50 +++++-- .../sandbox/jobs/ConfigurationServiceAsync.kt | 47 +++++-- .../services/blocking/AccessTokenService.kt | 13 +- .../api/services/blocking/AccountService.kt | 58 +++++--- .../api/services/blocking/ProviderService.kt | 28 ++-- .../blocking/RequestForwardingService.kt | 15 ++- .../blocking/connect/SessionService.kt | 26 +++- .../services/blocking/hris/BenefitService.kt | 113 +++++++++++----- .../services/blocking/hris/CompanyService.kt | 28 ++-- .../blocking/hris/DirectoryService.kt | 63 ++++++--- .../blocking/hris/DirectoryServiceImpl.kt | 2 + .../services/blocking/hris/DocumentService.kt | 42 ++++-- .../blocking/hris/EmploymentService.kt | 15 ++- .../blocking/hris/IndividualService.kt | 32 +++-- .../blocking/hris/PayStatementService.kt | 15 ++- .../services/blocking/hris/PaymentService.kt | 13 +- .../hris/benefits/IndividualService.kt | 44 +++++-- .../blocking/jobs/AutomatedService.kt | 85 +++++++----- .../services/blocking/jobs/ManualService.kt | 13 +- .../blocking/payroll/PayGroupService.kt | 42 ++++-- .../blocking/sandbox/CompanyService.kt | 13 +- .../blocking/sandbox/ConnectionService.kt | 14 +- .../blocking/sandbox/DirectoryService.kt | 29 ++-- .../blocking/sandbox/EmploymentService.kt | 14 +- .../blocking/sandbox/IndividualService.kt | 14 +- .../services/blocking/sandbox/JobService.kt | 13 +- .../blocking/sandbox/PaymentService.kt | 30 +++-- .../sandbox/connections/AccountService.kt | 46 +++++-- .../sandbox/jobs/ConfigurationService.kt | 44 +++++-- 56 files changed, 1313 insertions(+), 508 deletions(-) diff --git a/buildSrc/src/main/kotlin/finch.kotlin.gradle.kts b/buildSrc/src/main/kotlin/finch.kotlin.gradle.kts index 9bdebacd..515205ec 100644 --- a/buildSrc/src/main/kotlin/finch.kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/finch.kotlin.gradle.kts @@ -22,11 +22,12 @@ configure { tasks.withType().configureEach { compilerOptions { + allWarningsAsErrors = true freeCompilerArgs = listOf( - "-Xjvm-default=all", - "-Xjdk-release=1.8", - // Suppress deprecation warnings because we may still reference and test deprecated members. - "-Xsuppress-warning=DEPRECATION" + "-Xjvm-default=all", + "-Xjdk-release=1.8", + // Suppress deprecation warnings because we may still reference and test deprecated members. + "-Xsuppress-warning=DEPRECATION" ) jvmTarget.set(JvmTarget.JVM_1_8) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpClient.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpClient.kt index 293114df..c92fc53a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpClient.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpClient.kt @@ -1,5 +1,3 @@ -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.core.http import com.tryfinch.api.core.RequestOptions @@ -8,18 +6,21 @@ import java.util.concurrent.CompletableFuture interface HttpClient : AutoCloseable { - @JvmOverloads fun execute( request: HttpRequest, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponse - @JvmOverloads + fun execute(request: HttpRequest): HttpResponse = execute(request, RequestOptions.none()) + fun executeAsync( request: HttpRequest, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + fun executeAsync(request: HttpRequest): CompletableFuture = + executeAsync(request, RequestOptions.none()) + /** Overridden from [AutoCloseable] to not have a checked exception in its signature. */ override fun close() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsync.kt index c512c630..7dd0db87 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async import com.google.errorprone.annotations.MustBeClosed @@ -19,7 +17,10 @@ interface AccessTokenServiceAsync { fun withRawResponse(): WithRawResponse /** Exchange the authorization code for an access token */ - @JvmOverloads + fun create(params: AccessTokenCreateParams): CompletableFuture = + create(params, RequestOptions.none()) + + /** @see [create] */ fun create( params: AccessTokenCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -35,7 +36,13 @@ interface AccessTokenServiceAsync { * Returns a raw HTTP response for `post /auth/token`, but is otherwise the same as * [AccessTokenServiceAsync.create]. */ - @JvmOverloads + @MustBeClosed + fun create( + params: AccessTokenCreateParams + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see [create] */ @MustBeClosed fun create( params: AccessTokenCreateParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsync.kt index 9daab298..787a514b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async import com.google.errorprone.annotations.MustBeClosed @@ -21,24 +19,39 @@ interface AccountServiceAsync { fun withRawResponse(): WithRawResponse /** Disconnect one or more `access_token`s from your application. */ - @JvmOverloads + fun disconnect(): CompletableFuture = + disconnect(AccountDisconnectParams.none()) + + /** @see [disconnect] */ fun disconnect( params: AccountDisconnectParams = AccountDisconnectParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Disconnect one or more `access_token`s from your application. */ + /** @see [disconnect] */ + fun disconnect( + params: AccountDisconnectParams = AccountDisconnectParams.none() + ): CompletableFuture = disconnect(params, RequestOptions.none()) + + /** @see [disconnect] */ fun disconnect(requestOptions: RequestOptions): CompletableFuture = disconnect(AccountDisconnectParams.none(), requestOptions) /** Read account information associated with an `access_token` */ - @JvmOverloads + fun introspect(): CompletableFuture = introspect(AccountIntrospectParams.none()) + + /** @see [introspect] */ fun introspect( params: AccountIntrospectParams = AccountIntrospectParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Read account information associated with an `access_token` */ + /** @see [introspect] */ + fun introspect( + params: AccountIntrospectParams = AccountIntrospectParams.none() + ): CompletableFuture = introspect(params, RequestOptions.none()) + + /** @see [introspect] */ fun introspect(requestOptions: RequestOptions): CompletableFuture = introspect(AccountIntrospectParams.none(), requestOptions) @@ -51,17 +64,25 @@ interface AccountServiceAsync { * Returns a raw HTTP response for `post /disconnect`, but is otherwise the same as * [AccountServiceAsync.disconnect]. */ - @JvmOverloads + @MustBeClosed + fun disconnect(): CompletableFuture> = + disconnect(AccountDisconnectParams.none()) + + /** @see [disconnect] */ @MustBeClosed fun disconnect( params: AccountDisconnectParams = AccountDisconnectParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> - /** - * Returns a raw HTTP response for `post /disconnect`, but is otherwise the same as - * [AccountServiceAsync.disconnect]. - */ + /** @see [disconnect] */ + @MustBeClosed + fun disconnect( + params: AccountDisconnectParams = AccountDisconnectParams.none() + ): CompletableFuture> = + disconnect(params, RequestOptions.none()) + + /** @see [disconnect] */ @MustBeClosed fun disconnect( requestOptions: RequestOptions @@ -72,17 +93,25 @@ interface AccountServiceAsync { * Returns a raw HTTP response for `get /introspect`, but is otherwise the same as * [AccountServiceAsync.introspect]. */ - @JvmOverloads + @MustBeClosed + fun introspect(): CompletableFuture> = + introspect(AccountIntrospectParams.none()) + + /** @see [introspect] */ @MustBeClosed fun introspect( params: AccountIntrospectParams = AccountIntrospectParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> - /** - * Returns a raw HTTP response for `get /introspect`, but is otherwise the same as - * [AccountServiceAsync.introspect]. - */ + /** @see [introspect] */ + @MustBeClosed + fun introspect( + params: AccountIntrospectParams = AccountIntrospectParams.none() + ): CompletableFuture> = + introspect(params, RequestOptions.none()) + + /** @see [introspect] */ @MustBeClosed fun introspect( requestOptions: RequestOptions diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsync.kt index 1aeedeb4..4f112fda 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async import com.google.errorprone.annotations.MustBeClosed @@ -19,13 +17,20 @@ interface ProviderServiceAsync { fun withRawResponse(): WithRawResponse /** Return details on all available payroll and HR systems. */ - @JvmOverloads + fun list(): CompletableFuture = list(ProviderListParams.none()) + + /** @see [list] */ fun list( params: ProviderListParams = ProviderListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Return details on all available payroll and HR systems. */ + /** @see [list] */ + fun list( + params: ProviderListParams = ProviderListParams.none() + ): CompletableFuture = list(params, RequestOptions.none()) + + /** @see [list] */ fun list(requestOptions: RequestOptions): CompletableFuture = list(ProviderListParams.none(), requestOptions) @@ -38,17 +43,25 @@ interface ProviderServiceAsync { * Returns a raw HTTP response for `get /providers`, but is otherwise the same as * [ProviderServiceAsync.list]. */ - @JvmOverloads + @MustBeClosed + fun list(): CompletableFuture> = + list(ProviderListParams.none()) + + /** @see [list] */ @MustBeClosed fun list( params: ProviderListParams = ProviderListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> - /** - * Returns a raw HTTP response for `get /providers`, but is otherwise the same as - * [ProviderServiceAsync.list]. - */ + /** @see [list] */ + @MustBeClosed + fun list( + params: ProviderListParams = ProviderListParams.none() + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ @MustBeClosed fun list( requestOptions: RequestOptions diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsync.kt index e23f3e6f..323e5566 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async import com.google.errorprone.annotations.MustBeClosed @@ -23,7 +21,11 @@ interface RequestForwardingServiceAsync { * unified API doesn’t have a data model that cleanly fits your needs, then Forward allows you * to push or pull data models directly against an integration’s API. */ - @JvmOverloads + fun forward( + params: RequestForwardingForwardParams + ): CompletableFuture = forward(params, RequestOptions.none()) + + /** @see [forward] */ fun forward( params: RequestForwardingForwardParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -39,7 +41,13 @@ interface RequestForwardingServiceAsync { * Returns a raw HTTP response for `post /forward`, but is otherwise the same as * [RequestForwardingServiceAsync.forward]. */ - @JvmOverloads + @MustBeClosed + fun forward( + params: RequestForwardingForwardParams + ): CompletableFuture> = + forward(params, RequestOptions.none()) + + /** @see [forward] */ @MustBeClosed fun forward( params: RequestForwardingForwardParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsync.kt index c9034fb8..3b1e18cb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.connect import com.google.errorprone.annotations.MustBeClosed @@ -21,14 +19,22 @@ interface SessionServiceAsync { fun withRawResponse(): WithRawResponse /** Create a new connect session for an employer */ - @JvmOverloads + fun new_(params: ConnectSessionNewParams): CompletableFuture = + new_(params, RequestOptions.none()) + + /** @see [new_] */ fun new_( params: ConnectSessionNewParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Create a new Connect session for reauthenticating an existing connection */ - @JvmOverloads + fun reauthenticate( + params: ConnectSessionReauthenticateParams + ): CompletableFuture = + reauthenticate(params, RequestOptions.none()) + + /** @see [reauthenticate] */ fun reauthenticate( params: ConnectSessionReauthenticateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -43,7 +49,13 @@ interface SessionServiceAsync { * Returns a raw HTTP response for `post /connect/sessions`, but is otherwise the same as * [SessionServiceAsync.new_]. */ - @JvmOverloads + @MustBeClosed + fun new_( + params: ConnectSessionNewParams + ): CompletableFuture> = + new_(params, RequestOptions.none()) + + /** @see [new_] */ @MustBeClosed fun new_( params: ConnectSessionNewParams, @@ -54,7 +66,13 @@ interface SessionServiceAsync { * Returns a raw HTTP response for `post /connect/sessions/reauthenticate`, but is otherwise * the same as [SessionServiceAsync.reauthenticate]. */ - @JvmOverloads + @MustBeClosed + fun reauthenticate( + params: ConnectSessionReauthenticateParams + ): CompletableFuture> = + reauthenticate(params, RequestOptions.none()) + + /** @see [reauthenticate] */ @MustBeClosed fun reauthenticate( params: ConnectSessionReauthenticateParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsync.kt index 93601924..0ebd8f70 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.hris import com.google.errorprone.annotations.MustBeClosed @@ -33,53 +31,81 @@ interface BenefitServiceAsync { * Creates a new company-wide deduction or contribution. Please use the `/providers` endpoint to * view available types for each provider. */ - @JvmOverloads + fun create(): CompletableFuture = + create(HrisBenefitCreateParams.none()) + + /** @see [create] */ fun create( params: HrisBenefitCreateParams = HrisBenefitCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** - * Creates a new company-wide deduction or contribution. Please use the `/providers` endpoint to - * view available types for each provider. - */ + /** @see [create] */ + fun create( + params: HrisBenefitCreateParams = HrisBenefitCreateParams.none() + ): CompletableFuture = create(params, RequestOptions.none()) + + /** @see [create] */ fun create(requestOptions: RequestOptions): CompletableFuture = create(HrisBenefitCreateParams.none(), requestOptions) /** Lists deductions and contributions information for a given item */ - @JvmOverloads + fun retrieve(params: HrisBenefitRetrieveParams): CompletableFuture = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ fun retrieve( params: HrisBenefitRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Updates an existing company-wide deduction or contribution */ - @JvmOverloads + fun update(params: HrisBenefitUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see [update] */ fun update( params: HrisBenefitUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** List all company-wide deductions and contributions. */ - @JvmOverloads + fun list(): CompletableFuture = list(HrisBenefitListParams.none()) + + /** @see [list] */ fun list( params: HrisBenefitListParams = HrisBenefitListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** List all company-wide deductions and contributions. */ + /** @see [list] */ + fun list( + params: HrisBenefitListParams = HrisBenefitListParams.none() + ): CompletableFuture = list(params, RequestOptions.none()) + + /** @see [list] */ fun list(requestOptions: RequestOptions): CompletableFuture = list(HrisBenefitListParams.none(), requestOptions) /** Get deductions metadata */ - @JvmOverloads + fun listSupportedBenefits(): CompletableFuture = + listSupportedBenefits(HrisBenefitListSupportedBenefitsParams.none()) + + /** @see [listSupportedBenefits] */ fun listSupportedBenefits( params: HrisBenefitListSupportedBenefitsParams = HrisBenefitListSupportedBenefitsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Get deductions metadata */ + /** @see [listSupportedBenefits] */ + fun listSupportedBenefits( + params: HrisBenefitListSupportedBenefitsParams = + HrisBenefitListSupportedBenefitsParams.none() + ): CompletableFuture = + listSupportedBenefits(params, RequestOptions.none()) + + /** @see [listSupportedBenefits] */ fun listSupportedBenefits( requestOptions: RequestOptions ): CompletableFuture = @@ -96,17 +122,25 @@ interface BenefitServiceAsync { * Returns a raw HTTP response for `post /employer/benefits`, but is otherwise the same as * [BenefitServiceAsync.create]. */ - @JvmOverloads + @MustBeClosed + fun create(): CompletableFuture> = + create(HrisBenefitCreateParams.none()) + + /** @see [create] */ @MustBeClosed fun create( params: HrisBenefitCreateParams = HrisBenefitCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> - /** - * Returns a raw HTTP response for `post /employer/benefits`, but is otherwise the same as - * [BenefitServiceAsync.create]. - */ + /** @see [create] */ + @MustBeClosed + fun create( + params: HrisBenefitCreateParams = HrisBenefitCreateParams.none() + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see [create] */ @MustBeClosed fun create( requestOptions: RequestOptions @@ -117,7 +151,13 @@ interface BenefitServiceAsync { * Returns a raw HTTP response for `get /employer/benefits/{benefit_id}`, but is otherwise * the same as [BenefitServiceAsync.retrieve]. */ - @JvmOverloads + @MustBeClosed + fun retrieve( + params: HrisBenefitRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ @MustBeClosed fun retrieve( params: HrisBenefitRetrieveParams, @@ -128,7 +168,13 @@ interface BenefitServiceAsync { * Returns a raw HTTP response for `post /employer/benefits/{benefit_id}`, but is otherwise * the same as [BenefitServiceAsync.update]. */ - @JvmOverloads + @MustBeClosed + fun update( + params: HrisBenefitUpdateParams + ): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see [update] */ @MustBeClosed fun update( params: HrisBenefitUpdateParams, @@ -139,17 +185,25 @@ interface BenefitServiceAsync { * Returns a raw HTTP response for `get /employer/benefits`, but is otherwise the same as * [BenefitServiceAsync.list]. */ - @JvmOverloads + @MustBeClosed + fun list(): CompletableFuture> = + list(HrisBenefitListParams.none()) + + /** @see [list] */ @MustBeClosed fun list( params: HrisBenefitListParams = HrisBenefitListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> - /** - * Returns a raw HTTP response for `get /employer/benefits`, but is otherwise the same as - * [BenefitServiceAsync.list]. - */ + /** @see [list] */ + @MustBeClosed + fun list( + params: HrisBenefitListParams = HrisBenefitListParams.none() + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ @MustBeClosed fun list( requestOptions: RequestOptions @@ -160,7 +214,12 @@ interface BenefitServiceAsync { * Returns a raw HTTP response for `get /employer/benefits/meta`, but is otherwise the same * as [BenefitServiceAsync.listSupportedBenefits]. */ - @JvmOverloads + @MustBeClosed + fun listSupportedBenefits(): + CompletableFuture> = + listSupportedBenefits(HrisBenefitListSupportedBenefitsParams.none()) + + /** @see [listSupportedBenefits] */ @MustBeClosed fun listSupportedBenefits( params: HrisBenefitListSupportedBenefitsParams = @@ -168,10 +227,15 @@ interface BenefitServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> - /** - * Returns a raw HTTP response for `get /employer/benefits/meta`, but is otherwise the same - * as [BenefitServiceAsync.listSupportedBenefits]. - */ + /** @see [listSupportedBenefits] */ + @MustBeClosed + fun listSupportedBenefits( + params: HrisBenefitListSupportedBenefitsParams = + HrisBenefitListSupportedBenefitsParams.none() + ): CompletableFuture> = + listSupportedBenefits(params, RequestOptions.none()) + + /** @see [listSupportedBenefits] */ @MustBeClosed fun listSupportedBenefits( requestOptions: RequestOptions diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt index 73fe1bc4..b1cd877e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.hris import com.google.errorprone.annotations.MustBeClosed @@ -19,13 +17,20 @@ interface CompanyServiceAsync { fun withRawResponse(): WithRawResponse /** Read basic company data */ - @JvmOverloads + fun retrieve(): CompletableFuture = retrieve(HrisCompanyRetrieveParams.none()) + + /** @see [retrieve] */ fun retrieve( params: HrisCompanyRetrieveParams = HrisCompanyRetrieveParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Read basic company data */ + /** @see [retrieve] */ + fun retrieve( + params: HrisCompanyRetrieveParams = HrisCompanyRetrieveParams.none() + ): CompletableFuture = retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ fun retrieve(requestOptions: RequestOptions): CompletableFuture = retrieve(HrisCompanyRetrieveParams.none(), requestOptions) @@ -38,17 +43,24 @@ interface CompanyServiceAsync { * Returns a raw HTTP response for `get /employer/company`, but is otherwise the same as * [CompanyServiceAsync.retrieve]. */ - @JvmOverloads + @MustBeClosed + fun retrieve(): CompletableFuture> = + retrieve(HrisCompanyRetrieveParams.none()) + + /** @see [retrieve] */ @MustBeClosed fun retrieve( params: HrisCompanyRetrieveParams = HrisCompanyRetrieveParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> - /** - * Returns a raw HTTP response for `get /employer/company`, but is otherwise the same as - * [CompanyServiceAsync.retrieve]. - */ + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + params: HrisCompanyRetrieveParams = HrisCompanyRetrieveParams.none() + ): CompletableFuture> = retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ @MustBeClosed fun retrieve(requestOptions: RequestOptions): CompletableFuture> = retrieve(HrisCompanyRetrieveParams.none(), requestOptions) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsync.kt index e409643d..83b5b834 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.hris import com.google.errorprone.annotations.MustBeClosed @@ -21,25 +19,43 @@ interface DirectoryServiceAsync { fun withRawResponse(): WithRawResponse /** Read company directory and organization structure */ - @JvmOverloads + fun list(): CompletableFuture = list(HrisDirectoryListParams.none()) + + /** @see [list] */ fun list( params: HrisDirectoryListParams = HrisDirectoryListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Read company directory and organization structure */ + /** @see [list] */ + fun list( + params: HrisDirectoryListParams = HrisDirectoryListParams.none() + ): CompletableFuture = list(params, RequestOptions.none()) + + /** @see [list] */ fun list(requestOptions: RequestOptions): CompletableFuture = list(HrisDirectoryListParams.none(), requestOptions) /** Read company directory and organization structure */ @Deprecated("use `list` instead") - @JvmOverloads + fun listIndividuals(): CompletableFuture = + listIndividuals(HrisDirectoryListIndividualsParams.none()) + + /** @see [listIndividuals] */ + @Deprecated("use `list` instead") fun listIndividuals( params: HrisDirectoryListIndividualsParams = HrisDirectoryListIndividualsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Read company directory and organization structure */ + /** @see [listIndividuals] */ + @Deprecated("use `list` instead") + fun listIndividuals( + params: HrisDirectoryListIndividualsParams = HrisDirectoryListIndividualsParams.none() + ): CompletableFuture = + listIndividuals(params, RequestOptions.none()) + + /** @see [listIndividuals] */ @Deprecated("use `list` instead") fun listIndividuals( requestOptions: RequestOptions @@ -55,17 +71,25 @@ interface DirectoryServiceAsync { * Returns a raw HTTP response for `get /employer/directory`, but is otherwise the same as * [DirectoryServiceAsync.list]. */ - @JvmOverloads + @MustBeClosed + fun list(): CompletableFuture> = + list(HrisDirectoryListParams.none()) + + /** @see [list] */ @MustBeClosed fun list( params: HrisDirectoryListParams = HrisDirectoryListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> - /** - * Returns a raw HTTP response for `get /employer/directory`, but is otherwise the same as - * [DirectoryServiceAsync.list]. - */ + /** @see [list] */ + @MustBeClosed + fun list( + params: HrisDirectoryListParams = HrisDirectoryListParams.none() + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ @MustBeClosed fun list( requestOptions: RequestOptions @@ -77,17 +101,28 @@ interface DirectoryServiceAsync { * [DirectoryServiceAsync.listIndividuals]. */ @Deprecated("use `list` instead") - @JvmOverloads + @MustBeClosed + fun listIndividuals(): + CompletableFuture> = + listIndividuals(HrisDirectoryListIndividualsParams.none()) + + /** @see [listIndividuals] */ + @Deprecated("use `list` instead") @MustBeClosed fun listIndividuals( params: HrisDirectoryListIndividualsParams = HrisDirectoryListIndividualsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> - /** - * Returns a raw HTTP response for `get /employer/directory`, but is otherwise the same as - * [DirectoryServiceAsync.listIndividuals]. - */ + /** @see [listIndividuals] */ + @Deprecated("use `list` instead") + @MustBeClosed + fun listIndividuals( + params: HrisDirectoryListIndividualsParams = HrisDirectoryListIndividualsParams.none() + ): CompletableFuture> = + listIndividuals(params, RequestOptions.none()) + + /** @see [listIndividuals] */ @Deprecated("use `list` instead") @MustBeClosed fun listIndividuals( diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt index 979b49f7..14b26db3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt @@ -36,6 +36,7 @@ class DirectoryServiceAsyncImpl internal constructor(private val clientOptions: // get /employer/directory withRawResponse().list(params, requestOptions).thenApply { it.parse() } + @Deprecated("use `list` instead") override fun listIndividuals( params: HrisDirectoryListIndividualsParams, requestOptions: RequestOptions, @@ -90,6 +91,7 @@ class DirectoryServiceAsyncImpl internal constructor(private val clientOptions: jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) + @Deprecated("use `list` instead") override fun listIndividuals( params: HrisDirectoryListIndividualsParams, requestOptions: RequestOptions, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsync.kt index 67b9bb33..a25175a1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.hris import com.google.errorprone.annotations.MustBeClosed @@ -23,15 +21,20 @@ interface DocumentServiceAsync { /** * **Beta:** This endpoint is in beta and may change. Retrieve a list of company-wide documents. */ - @JvmOverloads + fun list(): CompletableFuture = list(HrisDocumentListParams.none()) + + /** @see [list] */ fun list( params: HrisDocumentListParams = HrisDocumentListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** - * **Beta:** This endpoint is in beta and may change. Retrieve a list of company-wide documents. - */ + /** @see [list] */ + fun list( + params: HrisDocumentListParams = HrisDocumentListParams.none() + ): CompletableFuture = list(params, RequestOptions.none()) + + /** @see [list] */ fun list(requestOptions: RequestOptions): CompletableFuture = list(HrisDocumentListParams.none(), requestOptions) @@ -39,7 +42,10 @@ interface DocumentServiceAsync { * **Beta:** This endpoint is in beta and may change. Retrieve details of a specific document by * its ID. */ - @JvmOverloads + fun retreive(params: HrisDocumentRetreiveParams): CompletableFuture = + retreive(params, RequestOptions.none()) + + /** @see [retreive] */ fun retreive( params: HrisDocumentRetreiveParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -54,17 +60,25 @@ interface DocumentServiceAsync { * Returns a raw HTTP response for `get /employer/documents`, but is otherwise the same as * [DocumentServiceAsync.list]. */ - @JvmOverloads + @MustBeClosed + fun list(): CompletableFuture> = + list(HrisDocumentListParams.none()) + + /** @see [list] */ @MustBeClosed fun list( params: HrisDocumentListParams = HrisDocumentListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> - /** - * Returns a raw HTTP response for `get /employer/documents`, but is otherwise the same as - * [DocumentServiceAsync.list]. - */ + /** @see [list] */ + @MustBeClosed + fun list( + params: HrisDocumentListParams = HrisDocumentListParams.none() + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ @MustBeClosed fun list( requestOptions: RequestOptions @@ -75,7 +89,13 @@ interface DocumentServiceAsync { * Returns a raw HTTP response for `get /employer/documents/{document_id}`, but is otherwise * the same as [DocumentServiceAsync.retreive]. */ - @JvmOverloads + @MustBeClosed + fun retreive( + params: HrisDocumentRetreiveParams + ): CompletableFuture> = + retreive(params, RequestOptions.none()) + + /** @see [retreive] */ @MustBeClosed fun retreive( params: HrisDocumentRetreiveParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsync.kt index e9efd10e..9b0987cd 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.hris import com.google.errorprone.annotations.MustBeClosed @@ -19,7 +17,12 @@ interface EmploymentServiceAsync { fun withRawResponse(): WithRawResponse /** Read individual employment and income data */ - @JvmOverloads + fun retrieveMany( + params: HrisEmploymentRetrieveManyParams + ): CompletableFuture = + retrieveMany(params, RequestOptions.none()) + + /** @see [retrieveMany] */ fun retrieveMany( params: HrisEmploymentRetrieveManyParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -35,7 +38,13 @@ interface EmploymentServiceAsync { * Returns a raw HTTP response for `post /employer/employment`, but is otherwise the same as * [EmploymentServiceAsync.retrieveMany]. */ - @JvmOverloads + @MustBeClosed + fun retrieveMany( + params: HrisEmploymentRetrieveManyParams + ): CompletableFuture> = + retrieveMany(params, RequestOptions.none()) + + /** @see [retrieveMany] */ @MustBeClosed fun retrieveMany( params: HrisEmploymentRetrieveManyParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt index 305edae8..e51cd00b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.hris import com.google.errorprone.annotations.MustBeClosed @@ -19,13 +17,22 @@ interface IndividualServiceAsync { fun withRawResponse(): WithRawResponse /** Read individual data, excluding income and employment data */ - @JvmOverloads + fun retrieveMany(): CompletableFuture = + retrieveMany(HrisIndividualRetrieveManyParams.none()) + + /** @see [retrieveMany] */ fun retrieveMany( params: HrisIndividualRetrieveManyParams = HrisIndividualRetrieveManyParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Read individual data, excluding income and employment data */ + /** @see [retrieveMany] */ + fun retrieveMany( + params: HrisIndividualRetrieveManyParams = HrisIndividualRetrieveManyParams.none() + ): CompletableFuture = + retrieveMany(params, RequestOptions.none()) + + /** @see [retrieveMany] */ fun retrieveMany( requestOptions: RequestOptions ): CompletableFuture = @@ -41,17 +48,26 @@ interface IndividualServiceAsync { * Returns a raw HTTP response for `post /employer/individual`, but is otherwise the same as * [IndividualServiceAsync.retrieveMany]. */ - @JvmOverloads + @MustBeClosed + fun retrieveMany(): + CompletableFuture> = + retrieveMany(HrisIndividualRetrieveManyParams.none()) + + /** @see [retrieveMany] */ @MustBeClosed fun retrieveMany( params: HrisIndividualRetrieveManyParams = HrisIndividualRetrieveManyParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> - /** - * Returns a raw HTTP response for `post /employer/individual`, but is otherwise the same as - * [IndividualServiceAsync.retrieveMany]. - */ + /** @see [retrieveMany] */ + @MustBeClosed + fun retrieveMany( + params: HrisIndividualRetrieveManyParams = HrisIndividualRetrieveManyParams.none() + ): CompletableFuture> = + retrieveMany(params, RequestOptions.none()) + + /** @see [retrieveMany] */ @MustBeClosed fun retrieveMany( requestOptions: RequestOptions diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsync.kt index eeaf46e2..79077b3a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.hris import com.google.errorprone.annotations.MustBeClosed @@ -23,7 +21,12 @@ interface PayStatementServiceAsync { * * Deduction and contribution types are supported by the payroll systems that supports Benefits. */ - @JvmOverloads + fun retrieveMany( + params: HrisPayStatementRetrieveManyParams + ): CompletableFuture = + retrieveMany(params, RequestOptions.none()) + + /** @see [retrieveMany] */ fun retrieveMany( params: HrisPayStatementRetrieveManyParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -39,7 +42,13 @@ interface PayStatementServiceAsync { * Returns a raw HTTP response for `post /employer/pay-statement`, but is otherwise the same * as [PayStatementServiceAsync.retrieveMany]. */ - @JvmOverloads + @MustBeClosed + fun retrieveMany( + params: HrisPayStatementRetrieveManyParams + ): CompletableFuture> = + retrieveMany(params, RequestOptions.none()) + + /** @see [retrieveMany] */ @MustBeClosed fun retrieveMany( params: HrisPayStatementRetrieveManyParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsync.kt index fb8e00b1..f0d25be6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.hris import com.google.errorprone.annotations.MustBeClosed @@ -19,7 +17,10 @@ interface PaymentServiceAsync { fun withRawResponse(): WithRawResponse /** Read payroll and contractor related payments by the company. */ - @JvmOverloads + fun list(params: HrisPaymentListParams): CompletableFuture = + list(params, RequestOptions.none()) + + /** @see [list] */ fun list( params: HrisPaymentListParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -34,7 +35,13 @@ interface PaymentServiceAsync { * Returns a raw HTTP response for `get /employer/payment`, but is otherwise the same as * [PaymentServiceAsync.list]. */ - @JvmOverloads + @MustBeClosed + fun list( + params: HrisPaymentListParams + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ @MustBeClosed fun list( params: HrisPaymentListParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsync.kt index b9b32319..989961fa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.hris.benefits import com.google.errorprone.annotations.MustBeClosed @@ -23,21 +21,35 @@ interface IndividualServiceAsync { fun withRawResponse(): WithRawResponse /** Lists individuals currently enrolled in a given deduction. */ - @JvmOverloads + fun enrolledIds( + params: HrisBenefitIndividualEnrolledIdsParams + ): CompletableFuture = enrolledIds(params, RequestOptions.none()) + + /** @see [enrolledIds] */ fun enrolledIds( params: HrisBenefitIndividualEnrolledIdsParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Get enrollment information for the given individuals. */ - @JvmOverloads + fun retrieveManyBenefits( + params: HrisBenefitIndividualRetrieveManyBenefitsParams + ): CompletableFuture = + retrieveManyBenefits(params, RequestOptions.none()) + + /** @see [retrieveManyBenefits] */ fun retrieveManyBenefits( params: HrisBenefitIndividualRetrieveManyBenefitsParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Unenroll individuals from a deduction or contribution */ - @JvmOverloads + fun unenrollMany( + params: HrisBenefitIndividualUnenrollManyParams + ): CompletableFuture = + unenrollMany(params, RequestOptions.none()) + + /** @see [unenrollMany] */ fun unenrollMany( params: HrisBenefitIndividualUnenrollManyParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -53,7 +65,13 @@ interface IndividualServiceAsync { * Returns a raw HTTP response for `get /employer/benefits/{benefit_id}/enrolled`, but is * otherwise the same as [IndividualServiceAsync.enrolledIds]. */ - @JvmOverloads + @MustBeClosed + fun enrolledIds( + params: HrisBenefitIndividualEnrolledIdsParams + ): CompletableFuture> = + enrolledIds(params, RequestOptions.none()) + + /** @see [enrolledIds] */ @MustBeClosed fun enrolledIds( params: HrisBenefitIndividualEnrolledIdsParams, @@ -64,7 +82,13 @@ interface IndividualServiceAsync { * Returns a raw HTTP response for `get /employer/benefits/{benefit_id}/individuals`, but is * otherwise the same as [IndividualServiceAsync.retrieveManyBenefits]. */ - @JvmOverloads + @MustBeClosed + fun retrieveManyBenefits( + params: HrisBenefitIndividualRetrieveManyBenefitsParams + ): CompletableFuture> = + retrieveManyBenefits(params, RequestOptions.none()) + + /** @see [retrieveManyBenefits] */ @MustBeClosed fun retrieveManyBenefits( params: HrisBenefitIndividualRetrieveManyBenefitsParams, @@ -75,7 +99,13 @@ interface IndividualServiceAsync { * Returns a raw HTTP response for `delete /employer/benefits/{benefit_id}/individuals`, but * is otherwise the same as [IndividualServiceAsync.unenrollMany]. */ - @JvmOverloads + @MustBeClosed + fun unenrollMany( + params: HrisBenefitIndividualUnenrollManyParams + ): CompletableFuture> = + unenrollMany(params, RequestOptions.none()) + + /** @see [unenrollMany] */ @MustBeClosed fun unenrollMany( params: HrisBenefitIndividualUnenrollManyParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsync.kt index 0638cb5d..87106c02 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.jobs import com.google.errorprone.annotations.MustBeClosed @@ -37,32 +35,29 @@ interface AutomatedServiceAsync { * This endpoint is available for _Scale_ tier customers as an add-on. To request access to this * endpoint, please contact your Finch account manager. */ - @JvmOverloads + fun create(): CompletableFuture = + create(JobAutomatedCreateParams.none()) + + /** @see [create] */ fun create( params: JobAutomatedCreateParams = JobAutomatedCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** - * Enqueue an automated job. - * - * `data_sync_all`: Enqueue a job to re-sync all data for a connection. `data_sync_all` has a - * concurrency limit of 1 job at a time per connection. This means that if this endpoint is - * called while a job is already in progress for this connection, Finch will return the `job_id` - * of the job that is currently in progress. Finch allows a fixed window rate limit of 1 forced - * refresh per hour per connection. - * - * `w4_form_employee_sync`: Enqueues a job for sync W-4 data for a particular individual, - * identified by `individual_id`. This feature is currently in beta. - * - * This endpoint is available for _Scale_ tier customers as an add-on. To request access to this - * endpoint, please contact your Finch account manager. - */ + /** @see [create] */ + fun create( + params: JobAutomatedCreateParams = JobAutomatedCreateParams.none() + ): CompletableFuture = create(params, RequestOptions.none()) + + /** @see [create] */ fun create(requestOptions: RequestOptions): CompletableFuture = create(JobAutomatedCreateParams.none(), requestOptions) /** Get an automated job by `job_id`. */ - @JvmOverloads + fun retrieve(params: JobAutomatedRetrieveParams): CompletableFuture = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ fun retrieve( params: JobAutomatedRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -73,17 +68,20 @@ interface AutomatedServiceAsync { * sorted in descending order by submission time. For scheduled jobs such as data syncs, only * the next scheduled job is shown. */ - @JvmOverloads + fun list(): CompletableFuture = list(JobAutomatedListParams.none()) + + /** @see [list] */ fun list( params: JobAutomatedListParams = JobAutomatedListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** - * Get all automated jobs. Automated jobs are completed by a machine. By default, jobs are - * sorted in descending order by submission time. For scheduled jobs such as data syncs, only - * the next scheduled job is shown. - */ + /** @see [list] */ + fun list( + params: JobAutomatedListParams = JobAutomatedListParams.none() + ): CompletableFuture = list(params, RequestOptions.none()) + + /** @see [list] */ fun list(requestOptions: RequestOptions): CompletableFuture = list(JobAutomatedListParams.none(), requestOptions) @@ -96,17 +94,25 @@ interface AutomatedServiceAsync { * Returns a raw HTTP response for `post /jobs/automated`, but is otherwise the same as * [AutomatedServiceAsync.create]. */ - @JvmOverloads + @MustBeClosed + fun create(): CompletableFuture> = + create(JobAutomatedCreateParams.none()) + + /** @see [create] */ @MustBeClosed fun create( params: JobAutomatedCreateParams = JobAutomatedCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> - /** - * Returns a raw HTTP response for `post /jobs/automated`, but is otherwise the same as - * [AutomatedServiceAsync.create]. - */ + /** @see [create] */ + @MustBeClosed + fun create( + params: JobAutomatedCreateParams = JobAutomatedCreateParams.none() + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see [create] */ @MustBeClosed fun create( requestOptions: RequestOptions @@ -117,7 +123,13 @@ interface AutomatedServiceAsync { * Returns a raw HTTP response for `get /jobs/automated/{job_id}`, but is otherwise the same * as [AutomatedServiceAsync.retrieve]. */ - @JvmOverloads + @MustBeClosed + fun retrieve( + params: JobAutomatedRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ @MustBeClosed fun retrieve( params: JobAutomatedRetrieveParams, @@ -128,17 +140,25 @@ interface AutomatedServiceAsync { * Returns a raw HTTP response for `get /jobs/automated`, but is otherwise the same as * [AutomatedServiceAsync.list]. */ - @JvmOverloads + @MustBeClosed + fun list(): CompletableFuture> = + list(JobAutomatedListParams.none()) + + /** @see [list] */ @MustBeClosed fun list( params: JobAutomatedListParams = JobAutomatedListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> - /** - * Returns a raw HTTP response for `get /jobs/automated`, but is otherwise the same as - * [AutomatedServiceAsync.list]. - */ + /** @see [list] */ + @MustBeClosed + fun list( + params: JobAutomatedListParams = JobAutomatedListParams.none() + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ @MustBeClosed fun list( requestOptions: RequestOptions diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsync.kt index 172baec1..0d51c731 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.jobs import com.google.errorprone.annotations.MustBeClosed @@ -22,7 +20,10 @@ interface ManualServiceAsync { * Get a manual job by `job_id`. Manual jobs are completed by a human and include Assisted * Benefits jobs. */ - @JvmOverloads + fun retrieve(params: JobManualRetrieveParams): CompletableFuture = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ fun retrieve( params: JobManualRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -37,7 +38,13 @@ interface ManualServiceAsync { * Returns a raw HTTP response for `get /jobs/manual/{job_id}`, but is otherwise the same as * [ManualServiceAsync.retrieve]. */ - @JvmOverloads + @MustBeClosed + fun retrieve( + params: JobManualRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ @MustBeClosed fun retrieve( params: JobManualRetrieveParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsync.kt index 1a955daa..837276f5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.payroll import com.google.errorprone.annotations.MustBeClosed @@ -21,20 +19,32 @@ interface PayGroupServiceAsync { fun withRawResponse(): WithRawResponse /** Read information from a single pay group */ - @JvmOverloads + fun retrieve( + params: PayrollPayGroupRetrieveParams + ): CompletableFuture = retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ fun retrieve( params: PayrollPayGroupRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Read company pay groups and frequencies */ - @JvmOverloads + fun list(): CompletableFuture = + list(PayrollPayGroupListParams.none()) + + /** @see [list] */ fun list( params: PayrollPayGroupListParams = PayrollPayGroupListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Read company pay groups and frequencies */ + /** @see [list] */ + fun list( + params: PayrollPayGroupListParams = PayrollPayGroupListParams.none() + ): CompletableFuture = list(params, RequestOptions.none()) + + /** @see [list] */ fun list(requestOptions: RequestOptions): CompletableFuture = list(PayrollPayGroupListParams.none(), requestOptions) @@ -47,7 +57,13 @@ interface PayGroupServiceAsync { * Returns a raw HTTP response for `get /employer/pay-groups/{pay_group_id}`, but is * otherwise the same as [PayGroupServiceAsync.retrieve]. */ - @JvmOverloads + @MustBeClosed + fun retrieve( + params: PayrollPayGroupRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ @MustBeClosed fun retrieve( params: PayrollPayGroupRetrieveParams, @@ -58,17 +74,25 @@ interface PayGroupServiceAsync { * Returns a raw HTTP response for `get /employer/pay-groups`, but is otherwise the same as * [PayGroupServiceAsync.list]. */ - @JvmOverloads + @MustBeClosed + fun list(): CompletableFuture> = + list(PayrollPayGroupListParams.none()) + + /** @see [list] */ @MustBeClosed fun list( params: PayrollPayGroupListParams = PayrollPayGroupListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> - /** - * Returns a raw HTTP response for `get /employer/pay-groups`, but is otherwise the same as - * [PayGroupServiceAsync.list]. - */ + /** @see [list] */ + @MustBeClosed + fun list( + params: PayrollPayGroupListParams = PayrollPayGroupListParams.none() + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ @MustBeClosed fun list( requestOptions: RequestOptions diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsync.kt index 8e415cc1..5b946b43 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.sandbox import com.google.errorprone.annotations.MustBeClosed @@ -19,7 +17,10 @@ interface CompanyServiceAsync { fun withRawResponse(): WithRawResponse /** Update a sandbox company's data */ - @JvmOverloads + fun update(params: SandboxCompanyUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see [update] */ fun update( params: SandboxCompanyUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -34,7 +35,13 @@ interface CompanyServiceAsync { * Returns a raw HTTP response for `put /sandbox/company`, but is otherwise the same as * [CompanyServiceAsync.update]. */ - @JvmOverloads + @MustBeClosed + fun update( + params: SandboxCompanyUpdateParams + ): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see [update] */ @MustBeClosed fun update( params: SandboxCompanyUpdateParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsync.kt index f899f084..77f7287e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.sandbox import com.google.errorprone.annotations.MustBeClosed @@ -22,7 +20,10 @@ interface ConnectionServiceAsync { fun accounts(): AccountServiceAsync /** Create a new connection (new company/provider pair) with a new account */ - @JvmOverloads + fun create(params: SandboxConnectionCreateParams): CompletableFuture = + create(params, RequestOptions.none()) + + /** @see [create] */ fun create( params: SandboxConnectionCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -40,7 +41,13 @@ interface ConnectionServiceAsync { * Returns a raw HTTP response for `post /sandbox/connections`, but is otherwise the same as * [ConnectionServiceAsync.create]. */ - @JvmOverloads + @MustBeClosed + fun create( + params: SandboxConnectionCreateParams + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see [create] */ @MustBeClosed fun create( params: SandboxConnectionCreateParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt index 8bc5dc1c..a4fdb411 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.sandbox import com.google.errorprone.annotations.MustBeClosed @@ -19,13 +17,20 @@ interface DirectoryServiceAsync { fun withRawResponse(): WithRawResponse /** Add new individuals to a sandbox company */ - @JvmOverloads + fun create(): CompletableFuture> = create(SandboxDirectoryCreateParams.none()) + + /** @see [create] */ fun create( params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> - /** Add new individuals to a sandbox company */ + /** @see [create] */ + fun create( + params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none() + ): CompletableFuture> = create(params, RequestOptions.none()) + + /** @see [create] */ fun create(requestOptions: RequestOptions): CompletableFuture> = create(SandboxDirectoryCreateParams.none(), requestOptions) @@ -38,17 +43,25 @@ interface DirectoryServiceAsync { * Returns a raw HTTP response for `post /sandbox/directory`, but is otherwise the same as * [DirectoryServiceAsync.create]. */ - @JvmOverloads + @MustBeClosed + fun create(): CompletableFuture>> = + create(SandboxDirectoryCreateParams.none()) + + /** @see [create] */ @MustBeClosed fun create( params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture>> - /** - * Returns a raw HTTP response for `post /sandbox/directory`, but is otherwise the same as - * [DirectoryServiceAsync.create]. - */ + /** @see [create] */ + @MustBeClosed + fun create( + params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none() + ): CompletableFuture>> = + create(params, RequestOptions.none()) + + /** @see [create] */ @MustBeClosed fun create( requestOptions: RequestOptions diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsync.kt index d77a28d2..ad8fabfa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.sandbox import com.google.errorprone.annotations.MustBeClosed @@ -19,7 +17,10 @@ interface EmploymentServiceAsync { fun withRawResponse(): WithRawResponse /** Update sandbox employment */ - @JvmOverloads + fun update(params: SandboxEmploymentUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see [update] */ fun update( params: SandboxEmploymentUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -35,7 +36,13 @@ interface EmploymentServiceAsync { * Returns a raw HTTP response for `put /sandbox/employment/{individual_id}`, but is * otherwise the same as [EmploymentServiceAsync.update]. */ - @JvmOverloads + @MustBeClosed + fun update( + params: SandboxEmploymentUpdateParams + ): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see [update] */ @MustBeClosed fun update( params: SandboxEmploymentUpdateParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsync.kt index 39a7b71d..47d38c4e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.sandbox import com.google.errorprone.annotations.MustBeClosed @@ -19,7 +17,10 @@ interface IndividualServiceAsync { fun withRawResponse(): WithRawResponse /** Update sandbox individual */ - @JvmOverloads + fun update(params: SandboxIndividualUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see [update] */ fun update( params: SandboxIndividualUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -35,7 +36,13 @@ interface IndividualServiceAsync { * Returns a raw HTTP response for `put /sandbox/individual/{individual_id}`, but is * otherwise the same as [IndividualServiceAsync.update]. */ - @JvmOverloads + @MustBeClosed + fun update( + params: SandboxIndividualUpdateParams + ): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see [update] */ @MustBeClosed fun update( params: SandboxIndividualUpdateParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsync.kt index 97bd0191..e5cb1480 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.sandbox import com.google.errorprone.annotations.MustBeClosed @@ -22,7 +20,10 @@ interface JobServiceAsync { fun configuration(): ConfigurationServiceAsync /** Enqueue a new sandbox job */ - @JvmOverloads + fun create(params: SandboxJobCreateParams): CompletableFuture = + create(params, RequestOptions.none()) + + /** @see [create] */ fun create( params: SandboxJobCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -37,7 +38,13 @@ interface JobServiceAsync { * Returns a raw HTTP response for `post /sandbox/jobs`, but is otherwise the same as * [JobServiceAsync.create]. */ - @JvmOverloads + @MustBeClosed + fun create( + params: SandboxJobCreateParams + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see [create] */ @MustBeClosed fun create( params: SandboxJobCreateParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsync.kt index 6f92bca6..57cf34ff 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.sandbox import com.google.errorprone.annotations.MustBeClosed @@ -19,13 +17,21 @@ interface PaymentServiceAsync { fun withRawResponse(): WithRawResponse /** Add a new sandbox payment */ - @JvmOverloads + fun create(): CompletableFuture = + create(SandboxPaymentCreateParams.none()) + + /** @see [create] */ fun create( params: SandboxPaymentCreateParams = SandboxPaymentCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Add a new sandbox payment */ + /** @see [create] */ + fun create( + params: SandboxPaymentCreateParams = SandboxPaymentCreateParams.none() + ): CompletableFuture = create(params, RequestOptions.none()) + + /** @see [create] */ fun create(requestOptions: RequestOptions): CompletableFuture = create(SandboxPaymentCreateParams.none(), requestOptions) @@ -38,17 +44,25 @@ interface PaymentServiceAsync { * Returns a raw HTTP response for `post /sandbox/payment`, but is otherwise the same as * [PaymentServiceAsync.create]. */ - @JvmOverloads + @MustBeClosed + fun create(): CompletableFuture> = + create(SandboxPaymentCreateParams.none()) + + /** @see [create] */ @MustBeClosed fun create( params: SandboxPaymentCreateParams = SandboxPaymentCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> - /** - * Returns a raw HTTP response for `post /sandbox/payment`, but is otherwise the same as - * [PaymentServiceAsync.create]. - */ + /** @see [create] */ + @MustBeClosed + fun create( + params: SandboxPaymentCreateParams = SandboxPaymentCreateParams.none() + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see [create] */ @MustBeClosed fun create( requestOptions: RequestOptions diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsync.kt index 96ad2913..600917c9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.sandbox.connections import com.google.errorprone.annotations.MustBeClosed @@ -21,7 +19,11 @@ interface AccountServiceAsync { fun withRawResponse(): WithRawResponse /** Create a new account for an existing connection (company/provider pair) */ - @JvmOverloads + fun create( + params: SandboxConnectionAccountCreateParams + ): CompletableFuture = create(params, RequestOptions.none()) + + /** @see [create] */ fun create( params: SandboxConnectionAccountCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -31,16 +33,21 @@ interface AccountServiceAsync { * Update an existing sandbox account. Change the connection status to understand how the Finch * API responds. */ - @JvmOverloads + fun update(): CompletableFuture = + update(SandboxConnectionAccountUpdateParams.none()) + + /** @see [update] */ fun update( params: SandboxConnectionAccountUpdateParams = SandboxConnectionAccountUpdateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** - * Update an existing sandbox account. Change the connection status to understand how the Finch - * API responds. - */ + /** @see [update] */ + fun update( + params: SandboxConnectionAccountUpdateParams = SandboxConnectionAccountUpdateParams.none() + ): CompletableFuture = update(params, RequestOptions.none()) + + /** @see [update] */ fun update(requestOptions: RequestOptions): CompletableFuture = update(SandboxConnectionAccountUpdateParams.none(), requestOptions) @@ -53,7 +60,13 @@ interface AccountServiceAsync { * Returns a raw HTTP response for `post /sandbox/connections/accounts`, but is otherwise * the same as [AccountServiceAsync.create]. */ - @JvmOverloads + @MustBeClosed + fun create( + params: SandboxConnectionAccountCreateParams + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see [create] */ @MustBeClosed fun create( params: SandboxConnectionAccountCreateParams, @@ -64,7 +77,11 @@ interface AccountServiceAsync { * Returns a raw HTTP response for `put /sandbox/connections/accounts`, but is otherwise the * same as [AccountServiceAsync.update]. */ - @JvmOverloads + @MustBeClosed + fun update(): CompletableFuture> = + update(SandboxConnectionAccountUpdateParams.none()) + + /** @see [update] */ @MustBeClosed fun update( params: SandboxConnectionAccountUpdateParams = @@ -72,10 +89,15 @@ interface AccountServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> - /** - * Returns a raw HTTP response for `put /sandbox/connections/accounts`, but is otherwise the - * same as [AccountServiceAsync.update]. - */ + /** @see [update] */ + @MustBeClosed + fun update( + params: SandboxConnectionAccountUpdateParams = + SandboxConnectionAccountUpdateParams.none() + ): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see [update] */ @MustBeClosed fun update( requestOptions: RequestOptions diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsync.kt index 3e26990e..683e02e8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsync.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.async.sandbox.jobs import com.google.errorprone.annotations.MustBeClosed @@ -20,19 +18,31 @@ interface ConfigurationServiceAsync { fun withRawResponse(): WithRawResponse /** Get configurations for sandbox jobs */ - @JvmOverloads + fun retrieve(): CompletableFuture> = + retrieve(SandboxJobConfigurationRetrieveParams.none()) + + /** @see [retrieve] */ fun retrieve( params: SandboxJobConfigurationRetrieveParams = SandboxJobConfigurationRetrieveParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> - /** Get configurations for sandbox jobs */ + /** @see [retrieve] */ + fun retrieve( + params: SandboxJobConfigurationRetrieveParams = SandboxJobConfigurationRetrieveParams.none() + ): CompletableFuture> = retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ fun retrieve(requestOptions: RequestOptions): CompletableFuture> = retrieve(SandboxJobConfigurationRetrieveParams.none(), requestOptions) /** Update configurations for sandbox jobs */ - @JvmOverloads + fun update( + params: SandboxJobConfigurationUpdateParams + ): CompletableFuture = update(params, RequestOptions.none()) + + /** @see [update] */ fun update( params: SandboxJobConfigurationUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -48,7 +58,11 @@ interface ConfigurationServiceAsync { * Returns a raw HTTP response for `get /sandbox/jobs/configuration`, but is otherwise the * same as [ConfigurationServiceAsync.retrieve]. */ - @JvmOverloads + @MustBeClosed + fun retrieve(): CompletableFuture>> = + retrieve(SandboxJobConfigurationRetrieveParams.none()) + + /** @see [retrieve] */ @MustBeClosed fun retrieve( params: SandboxJobConfigurationRetrieveParams = @@ -56,10 +70,15 @@ interface ConfigurationServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture>> - /** - * Returns a raw HTTP response for `get /sandbox/jobs/configuration`, but is otherwise the - * same as [ConfigurationServiceAsync.retrieve]. - */ + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + params: SandboxJobConfigurationRetrieveParams = + SandboxJobConfigurationRetrieveParams.none() + ): CompletableFuture>> = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ @MustBeClosed fun retrieve( requestOptions: RequestOptions @@ -70,7 +89,13 @@ interface ConfigurationServiceAsync { * Returns a raw HTTP response for `put /sandbox/jobs/configuration`, but is otherwise the * same as [ConfigurationServiceAsync.update]. */ - @JvmOverloads + @MustBeClosed + fun update( + params: SandboxJobConfigurationUpdateParams + ): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see [update] */ @MustBeClosed fun update( params: SandboxJobConfigurationUpdateParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenService.kt index f7129051..0a0b9cf5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking import com.google.errorprone.annotations.MustBeClosed @@ -18,7 +16,10 @@ interface AccessTokenService { fun withRawResponse(): WithRawResponse /** Exchange the authorization code for an access token */ - @JvmOverloads + fun create(params: AccessTokenCreateParams): CreateAccessTokenResponse = + create(params, RequestOptions.none()) + + /** @see [create] */ fun create( params: AccessTokenCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -33,7 +34,11 @@ interface AccessTokenService { * Returns a raw HTTP response for `post /auth/token`, but is otherwise the same as * [AccessTokenService.create]. */ - @JvmOverloads + @MustBeClosed + fun create(params: AccessTokenCreateParams): HttpResponseFor = + create(params, RequestOptions.none()) + + /** @see [create] */ @MustBeClosed fun create( params: AccessTokenCreateParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountService.kt index 8fe2d5fe..9247468f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking import com.google.errorprone.annotations.MustBeClosed @@ -20,24 +18,38 @@ interface AccountService { fun withRawResponse(): WithRawResponse /** Disconnect one or more `access_token`s from your application. */ - @JvmOverloads + fun disconnect(): DisconnectResponse = disconnect(AccountDisconnectParams.none()) + + /** @see [disconnect] */ fun disconnect( params: AccountDisconnectParams = AccountDisconnectParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): DisconnectResponse - /** Disconnect one or more `access_token`s from your application. */ + /** @see [disconnect] */ + fun disconnect( + params: AccountDisconnectParams = AccountDisconnectParams.none() + ): DisconnectResponse = disconnect(params, RequestOptions.none()) + + /** @see [disconnect] */ fun disconnect(requestOptions: RequestOptions): DisconnectResponse = disconnect(AccountDisconnectParams.none(), requestOptions) /** Read account information associated with an `access_token` */ - @JvmOverloads + fun introspect(): Introspection = introspect(AccountIntrospectParams.none()) + + /** @see [introspect] */ fun introspect( params: AccountIntrospectParams = AccountIntrospectParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): Introspection - /** Read account information associated with an `access_token` */ + /** @see [introspect] */ + fun introspect( + params: AccountIntrospectParams = AccountIntrospectParams.none() + ): Introspection = introspect(params, RequestOptions.none()) + + /** @see [introspect] */ fun introspect(requestOptions: RequestOptions): Introspection = introspect(AccountIntrospectParams.none(), requestOptions) @@ -48,17 +60,24 @@ interface AccountService { * Returns a raw HTTP response for `post /disconnect`, but is otherwise the same as * [AccountService.disconnect]. */ - @JvmOverloads + @MustBeClosed + fun disconnect(): HttpResponseFor = + disconnect(AccountDisconnectParams.none()) + + /** @see [disconnect] */ @MustBeClosed fun disconnect( params: AccountDisconnectParams = AccountDisconnectParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor - /** - * Returns a raw HTTP response for `post /disconnect`, but is otherwise the same as - * [AccountService.disconnect]. - */ + /** @see [disconnect] */ + @MustBeClosed + fun disconnect( + params: AccountDisconnectParams = AccountDisconnectParams.none() + ): HttpResponseFor = disconnect(params, RequestOptions.none()) + + /** @see [disconnect] */ @MustBeClosed fun disconnect(requestOptions: RequestOptions): HttpResponseFor = disconnect(AccountDisconnectParams.none(), requestOptions) @@ -67,17 +86,24 @@ interface AccountService { * Returns a raw HTTP response for `get /introspect`, but is otherwise the same as * [AccountService.introspect]. */ - @JvmOverloads + @MustBeClosed + fun introspect(): HttpResponseFor = + introspect(AccountIntrospectParams.none()) + + /** @see [introspect] */ @MustBeClosed fun introspect( params: AccountIntrospectParams = AccountIntrospectParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor - /** - * Returns a raw HTTP response for `get /introspect`, but is otherwise the same as - * [AccountService.introspect]. - */ + /** @see [introspect] */ + @MustBeClosed + fun introspect( + params: AccountIntrospectParams = AccountIntrospectParams.none() + ): HttpResponseFor = introspect(params, RequestOptions.none()) + + /** @see [introspect] */ @MustBeClosed fun introspect(requestOptions: RequestOptions): HttpResponseFor = introspect(AccountIntrospectParams.none(), requestOptions) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderService.kt index f30b29ef..92ef210e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking import com.google.errorprone.annotations.MustBeClosed @@ -18,13 +16,19 @@ interface ProviderService { fun withRawResponse(): WithRawResponse /** Return details on all available payroll and HR systems. */ - @JvmOverloads + fun list(): ProviderListPage = list(ProviderListParams.none()) + + /** @see [list] */ fun list( params: ProviderListParams = ProviderListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): ProviderListPage - /** Return details on all available payroll and HR systems. */ + /** @see [list] */ + fun list(params: ProviderListParams = ProviderListParams.none()): ProviderListPage = + list(params, RequestOptions.none()) + + /** @see [list] */ fun list(requestOptions: RequestOptions): ProviderListPage = list(ProviderListParams.none(), requestOptions) @@ -35,17 +39,23 @@ interface ProviderService { * Returns a raw HTTP response for `get /providers`, but is otherwise the same as * [ProviderService.list]. */ - @JvmOverloads + @MustBeClosed + fun list(): HttpResponseFor = list(ProviderListParams.none()) + + /** @see [list] */ @MustBeClosed fun list( params: ProviderListParams = ProviderListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor - /** - * Returns a raw HTTP response for `get /providers`, but is otherwise the same as - * [ProviderService.list]. - */ + /** @see [list] */ + @MustBeClosed + fun list( + params: ProviderListParams = ProviderListParams.none() + ): HttpResponseFor = list(params, RequestOptions.none()) + + /** @see [list] */ @MustBeClosed fun list(requestOptions: RequestOptions): HttpResponseFor = list(ProviderListParams.none(), requestOptions) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingService.kt index acae431f..2d29034b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking import com.google.errorprone.annotations.MustBeClosed @@ -22,7 +20,10 @@ interface RequestForwardingService { * unified API doesn’t have a data model that cleanly fits your needs, then Forward allows you * to push or pull data models directly against an integration’s API. */ - @JvmOverloads + fun forward(params: RequestForwardingForwardParams): RequestForwardingForwardResponse = + forward(params, RequestOptions.none()) + + /** @see [forward] */ fun forward( params: RequestForwardingForwardParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -38,7 +39,13 @@ interface RequestForwardingService { * Returns a raw HTTP response for `post /forward`, but is otherwise the same as * [RequestForwardingService.forward]. */ - @JvmOverloads + @MustBeClosed + fun forward( + params: RequestForwardingForwardParams + ): HttpResponseFor = + forward(params, RequestOptions.none()) + + /** @see [forward] */ @MustBeClosed fun forward( params: RequestForwardingForwardParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionService.kt index 4971debd..ba280313 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.connect import com.google.errorprone.annotations.MustBeClosed @@ -20,14 +18,20 @@ interface SessionService { fun withRawResponse(): WithRawResponse /** Create a new connect session for an employer */ - @JvmOverloads + fun new_(params: ConnectSessionNewParams): SessionNewResponse = + new_(params, RequestOptions.none()) + + /** @see [new_] */ fun new_( params: ConnectSessionNewParams, requestOptions: RequestOptions = RequestOptions.none(), ): SessionNewResponse /** Create a new Connect session for reauthenticating an existing connection */ - @JvmOverloads + fun reauthenticate(params: ConnectSessionReauthenticateParams): SessionReauthenticateResponse = + reauthenticate(params, RequestOptions.none()) + + /** @see [reauthenticate] */ fun reauthenticate( params: ConnectSessionReauthenticateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -40,7 +44,11 @@ interface SessionService { * Returns a raw HTTP response for `post /connect/sessions`, but is otherwise the same as * [SessionService.new_]. */ - @JvmOverloads + @MustBeClosed + fun new_(params: ConnectSessionNewParams): HttpResponseFor = + new_(params, RequestOptions.none()) + + /** @see [new_] */ @MustBeClosed fun new_( params: ConnectSessionNewParams, @@ -51,7 +59,13 @@ interface SessionService { * Returns a raw HTTP response for `post /connect/sessions/reauthenticate`, but is otherwise * the same as [SessionService.reauthenticate]. */ - @JvmOverloads + @MustBeClosed + fun reauthenticate( + params: ConnectSessionReauthenticateParams + ): HttpResponseFor = + reauthenticate(params, RequestOptions.none()) + + /** @see [reauthenticate] */ @MustBeClosed fun reauthenticate( params: ConnectSessionReauthenticateParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitService.kt index f091e9b4..0625d51a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.hris import com.google.errorprone.annotations.MustBeClosed @@ -32,53 +30,78 @@ interface BenefitService { * Creates a new company-wide deduction or contribution. Please use the `/providers` endpoint to * view available types for each provider. */ - @JvmOverloads + fun create(): CreateCompanyBenefitsResponse = create(HrisBenefitCreateParams.none()) + + /** @see [create] */ fun create( params: HrisBenefitCreateParams = HrisBenefitCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CreateCompanyBenefitsResponse - /** - * Creates a new company-wide deduction or contribution. Please use the `/providers` endpoint to - * view available types for each provider. - */ + /** @see [create] */ + fun create( + params: HrisBenefitCreateParams = HrisBenefitCreateParams.none() + ): CreateCompanyBenefitsResponse = create(params, RequestOptions.none()) + + /** @see [create] */ fun create(requestOptions: RequestOptions): CreateCompanyBenefitsResponse = create(HrisBenefitCreateParams.none(), requestOptions) /** Lists deductions and contributions information for a given item */ - @JvmOverloads + fun retrieve(params: HrisBenefitRetrieveParams): CompanyBenefit = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ fun retrieve( params: HrisBenefitRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompanyBenefit /** Updates an existing company-wide deduction or contribution */ - @JvmOverloads + fun update(params: HrisBenefitUpdateParams): UpdateCompanyBenefitResponse = + update(params, RequestOptions.none()) + + /** @see [update] */ fun update( params: HrisBenefitUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): UpdateCompanyBenefitResponse /** List all company-wide deductions and contributions. */ - @JvmOverloads + fun list(): HrisBenefitListPage = list(HrisBenefitListParams.none()) + + /** @see [list] */ fun list( params: HrisBenefitListParams = HrisBenefitListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HrisBenefitListPage - /** List all company-wide deductions and contributions. */ + /** @see [list] */ + fun list(params: HrisBenefitListParams = HrisBenefitListParams.none()): HrisBenefitListPage = + list(params, RequestOptions.none()) + + /** @see [list] */ fun list(requestOptions: RequestOptions): HrisBenefitListPage = list(HrisBenefitListParams.none(), requestOptions) /** Get deductions metadata */ - @JvmOverloads + fun listSupportedBenefits(): HrisBenefitListSupportedBenefitsPage = + listSupportedBenefits(HrisBenefitListSupportedBenefitsParams.none()) + + /** @see [listSupportedBenefits] */ fun listSupportedBenefits( params: HrisBenefitListSupportedBenefitsParams = HrisBenefitListSupportedBenefitsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HrisBenefitListSupportedBenefitsPage - /** Get deductions metadata */ + /** @see [listSupportedBenefits] */ + fun listSupportedBenefits( + params: HrisBenefitListSupportedBenefitsParams = + HrisBenefitListSupportedBenefitsParams.none() + ): HrisBenefitListSupportedBenefitsPage = listSupportedBenefits(params, RequestOptions.none()) + + /** @see [listSupportedBenefits] */ fun listSupportedBenefits( requestOptions: RequestOptions ): HrisBenefitListSupportedBenefitsPage = @@ -93,17 +116,24 @@ interface BenefitService { * Returns a raw HTTP response for `post /employer/benefits`, but is otherwise the same as * [BenefitService.create]. */ - @JvmOverloads + @MustBeClosed + fun create(): HttpResponseFor = + create(HrisBenefitCreateParams.none()) + + /** @see [create] */ @MustBeClosed fun create( params: HrisBenefitCreateParams = HrisBenefitCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor - /** - * Returns a raw HTTP response for `post /employer/benefits`, but is otherwise the same as - * [BenefitService.create]. - */ + /** @see [create] */ + @MustBeClosed + fun create( + params: HrisBenefitCreateParams = HrisBenefitCreateParams.none() + ): HttpResponseFor = create(params, RequestOptions.none()) + + /** @see [create] */ @MustBeClosed fun create(requestOptions: RequestOptions): HttpResponseFor = create(HrisBenefitCreateParams.none(), requestOptions) @@ -112,7 +142,11 @@ interface BenefitService { * Returns a raw HTTP response for `get /employer/benefits/{benefit_id}`, but is otherwise * the same as [BenefitService.retrieve]. */ - @JvmOverloads + @MustBeClosed + fun retrieve(params: HrisBenefitRetrieveParams): HttpResponseFor = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ @MustBeClosed fun retrieve( params: HrisBenefitRetrieveParams, @@ -123,7 +157,11 @@ interface BenefitService { * Returns a raw HTTP response for `post /employer/benefits/{benefit_id}`, but is otherwise * the same as [BenefitService.update]. */ - @JvmOverloads + @MustBeClosed + fun update(params: HrisBenefitUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** @see [update] */ @MustBeClosed fun update( params: HrisBenefitUpdateParams, @@ -134,17 +172,23 @@ interface BenefitService { * Returns a raw HTTP response for `get /employer/benefits`, but is otherwise the same as * [BenefitService.list]. */ - @JvmOverloads + @MustBeClosed + fun list(): HttpResponseFor = list(HrisBenefitListParams.none()) + + /** @see [list] */ @MustBeClosed fun list( params: HrisBenefitListParams = HrisBenefitListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor - /** - * Returns a raw HTTP response for `get /employer/benefits`, but is otherwise the same as - * [BenefitService.list]. - */ + /** @see [list] */ + @MustBeClosed + fun list( + params: HrisBenefitListParams = HrisBenefitListParams.none() + ): HttpResponseFor = list(params, RequestOptions.none()) + + /** @see [list] */ @MustBeClosed fun list(requestOptions: RequestOptions): HttpResponseFor = list(HrisBenefitListParams.none(), requestOptions) @@ -153,7 +197,11 @@ interface BenefitService { * Returns a raw HTTP response for `get /employer/benefits/meta`, but is otherwise the same * as [BenefitService.listSupportedBenefits]. */ - @JvmOverloads + @MustBeClosed + fun listSupportedBenefits(): HttpResponseFor = + listSupportedBenefits(HrisBenefitListSupportedBenefitsParams.none()) + + /** @see [listSupportedBenefits] */ @MustBeClosed fun listSupportedBenefits( params: HrisBenefitListSupportedBenefitsParams = @@ -161,10 +209,15 @@ interface BenefitService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor - /** - * Returns a raw HTTP response for `get /employer/benefits/meta`, but is otherwise the same - * as [BenefitService.listSupportedBenefits]. - */ + /** @see [listSupportedBenefits] */ + @MustBeClosed + fun listSupportedBenefits( + params: HrisBenefitListSupportedBenefitsParams = + HrisBenefitListSupportedBenefitsParams.none() + ): HttpResponseFor = + listSupportedBenefits(params, RequestOptions.none()) + + /** @see [listSupportedBenefits] */ @MustBeClosed fun listSupportedBenefits( requestOptions: RequestOptions diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt index c5e38566..d8c248da 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.hris import com.google.errorprone.annotations.MustBeClosed @@ -18,13 +16,19 @@ interface CompanyService { fun withRawResponse(): WithRawResponse /** Read basic company data */ - @JvmOverloads + fun retrieve(): Company = retrieve(HrisCompanyRetrieveParams.none()) + + /** @see [retrieve] */ fun retrieve( params: HrisCompanyRetrieveParams = HrisCompanyRetrieveParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): Company - /** Read basic company data */ + /** @see [retrieve] */ + fun retrieve(params: HrisCompanyRetrieveParams = HrisCompanyRetrieveParams.none()): Company = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ fun retrieve(requestOptions: RequestOptions): Company = retrieve(HrisCompanyRetrieveParams.none(), requestOptions) @@ -35,17 +39,23 @@ interface CompanyService { * Returns a raw HTTP response for `get /employer/company`, but is otherwise the same as * [CompanyService.retrieve]. */ - @JvmOverloads + @MustBeClosed + fun retrieve(): HttpResponseFor = retrieve(HrisCompanyRetrieveParams.none()) + + /** @see [retrieve] */ @MustBeClosed fun retrieve( params: HrisCompanyRetrieveParams = HrisCompanyRetrieveParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor - /** - * Returns a raw HTTP response for `get /employer/company`, but is otherwise the same as - * [CompanyService.retrieve]. - */ + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + params: HrisCompanyRetrieveParams = HrisCompanyRetrieveParams.none() + ): HttpResponseFor = retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ @MustBeClosed fun retrieve(requestOptions: RequestOptions): HttpResponseFor = retrieve(HrisCompanyRetrieveParams.none(), requestOptions) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryService.kt index 3e182d97..dc9adbd0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.hris import com.google.errorprone.annotations.MustBeClosed @@ -20,25 +18,42 @@ interface DirectoryService { fun withRawResponse(): WithRawResponse /** Read company directory and organization structure */ - @JvmOverloads + fun list(): HrisDirectoryListPage = list(HrisDirectoryListParams.none()) + + /** @see [list] */ fun list( params: HrisDirectoryListParams = HrisDirectoryListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HrisDirectoryListPage - /** Read company directory and organization structure */ + /** @see [list] */ + fun list( + params: HrisDirectoryListParams = HrisDirectoryListParams.none() + ): HrisDirectoryListPage = list(params, RequestOptions.none()) + + /** @see [list] */ fun list(requestOptions: RequestOptions): HrisDirectoryListPage = list(HrisDirectoryListParams.none(), requestOptions) /** Read company directory and organization structure */ @Deprecated("use `list` instead") - @JvmOverloads + fun listIndividuals(): HrisDirectoryListIndividualsPage = + listIndividuals(HrisDirectoryListIndividualsParams.none()) + + /** @see [listIndividuals] */ + @Deprecated("use `list` instead") fun listIndividuals( params: HrisDirectoryListIndividualsParams = HrisDirectoryListIndividualsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HrisDirectoryListIndividualsPage - /** Read company directory and organization structure */ + /** @see [listIndividuals] */ + @Deprecated("use `list` instead") + fun listIndividuals( + params: HrisDirectoryListIndividualsParams = HrisDirectoryListIndividualsParams.none() + ): HrisDirectoryListIndividualsPage = listIndividuals(params, RequestOptions.none()) + + /** @see [listIndividuals] */ @Deprecated("use `list` instead") fun listIndividuals(requestOptions: RequestOptions): HrisDirectoryListIndividualsPage = listIndividuals(HrisDirectoryListIndividualsParams.none(), requestOptions) @@ -50,17 +65,23 @@ interface DirectoryService { * Returns a raw HTTP response for `get /employer/directory`, but is otherwise the same as * [DirectoryService.list]. */ - @JvmOverloads + @MustBeClosed + fun list(): HttpResponseFor = list(HrisDirectoryListParams.none()) + + /** @see [list] */ @MustBeClosed fun list( params: HrisDirectoryListParams = HrisDirectoryListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor - /** - * Returns a raw HTTP response for `get /employer/directory`, but is otherwise the same as - * [DirectoryService.list]. - */ + /** @see [list] */ + @MustBeClosed + fun list( + params: HrisDirectoryListParams = HrisDirectoryListParams.none() + ): HttpResponseFor = list(params, RequestOptions.none()) + + /** @see [list] */ @MustBeClosed fun list(requestOptions: RequestOptions): HttpResponseFor = list(HrisDirectoryListParams.none(), requestOptions) @@ -70,17 +91,27 @@ interface DirectoryService { * [DirectoryService.listIndividuals]. */ @Deprecated("use `list` instead") - @JvmOverloads + @MustBeClosed + fun listIndividuals(): HttpResponseFor = + listIndividuals(HrisDirectoryListIndividualsParams.none()) + + /** @see [listIndividuals] */ + @Deprecated("use `list` instead") @MustBeClosed fun listIndividuals( params: HrisDirectoryListIndividualsParams = HrisDirectoryListIndividualsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor - /** - * Returns a raw HTTP response for `get /employer/directory`, but is otherwise the same as - * [DirectoryService.listIndividuals]. - */ + /** @see [listIndividuals] */ + @Deprecated("use `list` instead") + @MustBeClosed + fun listIndividuals( + params: HrisDirectoryListIndividualsParams = HrisDirectoryListIndividualsParams.none() + ): HttpResponseFor = + listIndividuals(params, RequestOptions.none()) + + /** @see [listIndividuals] */ @Deprecated("use `list` instead") @MustBeClosed fun listIndividuals( diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt index 9e4c9c80..aefa05c7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt @@ -35,6 +35,7 @@ class DirectoryServiceImpl internal constructor(private val clientOptions: Clien // get /employer/directory withRawResponse().list(params, requestOptions).parse() + @Deprecated("use `list` instead") override fun listIndividuals( params: HrisDirectoryListIndividualsParams, requestOptions: RequestOptions, @@ -81,6 +82,7 @@ class DirectoryServiceImpl internal constructor(private val clientOptions: Clien jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) + @Deprecated("use `list` instead") override fun listIndividuals( params: HrisDirectoryListIndividualsParams, requestOptions: RequestOptions, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentService.kt index 24e8a405..2688fe07 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.hris import com.google.errorprone.annotations.MustBeClosed @@ -22,15 +20,19 @@ interface DocumentService { /** * **Beta:** This endpoint is in beta and may change. Retrieve a list of company-wide documents. */ - @JvmOverloads + fun list(): DocumentListResponse = list(HrisDocumentListParams.none()) + + /** @see [list] */ fun list( params: HrisDocumentListParams = HrisDocumentListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): DocumentListResponse - /** - * **Beta:** This endpoint is in beta and may change. Retrieve a list of company-wide documents. - */ + /** @see [list] */ + fun list(params: HrisDocumentListParams = HrisDocumentListParams.none()): DocumentListResponse = + list(params, RequestOptions.none()) + + /** @see [list] */ fun list(requestOptions: RequestOptions): DocumentListResponse = list(HrisDocumentListParams.none(), requestOptions) @@ -38,7 +40,10 @@ interface DocumentService { * **Beta:** This endpoint is in beta and may change. Retrieve details of a specific document by * its ID. */ - @JvmOverloads + fun retreive(params: HrisDocumentRetreiveParams): DocumentRetreiveResponse = + retreive(params, RequestOptions.none()) + + /** @see [retreive] */ fun retreive( params: HrisDocumentRetreiveParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -51,17 +56,23 @@ interface DocumentService { * Returns a raw HTTP response for `get /employer/documents`, but is otherwise the same as * [DocumentService.list]. */ - @JvmOverloads + @MustBeClosed + fun list(): HttpResponseFor = list(HrisDocumentListParams.none()) + + /** @see [list] */ @MustBeClosed fun list( params: HrisDocumentListParams = HrisDocumentListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor - /** - * Returns a raw HTTP response for `get /employer/documents`, but is otherwise the same as - * [DocumentService.list]. - */ + /** @see [list] */ + @MustBeClosed + fun list( + params: HrisDocumentListParams = HrisDocumentListParams.none() + ): HttpResponseFor = list(params, RequestOptions.none()) + + /** @see [list] */ @MustBeClosed fun list(requestOptions: RequestOptions): HttpResponseFor = list(HrisDocumentListParams.none(), requestOptions) @@ -70,7 +81,12 @@ interface DocumentService { * Returns a raw HTTP response for `get /employer/documents/{document_id}`, but is otherwise * the same as [DocumentService.retreive]. */ - @JvmOverloads + @MustBeClosed + fun retreive( + params: HrisDocumentRetreiveParams + ): HttpResponseFor = retreive(params, RequestOptions.none()) + + /** @see [retreive] */ @MustBeClosed fun retreive( params: HrisDocumentRetreiveParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentService.kt index d426d63d..e2d11244 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.hris import com.google.errorprone.annotations.MustBeClosed @@ -18,7 +16,10 @@ interface EmploymentService { fun withRawResponse(): WithRawResponse /** Read individual employment and income data */ - @JvmOverloads + fun retrieveMany(params: HrisEmploymentRetrieveManyParams): HrisEmploymentRetrieveManyPage = + retrieveMany(params, RequestOptions.none()) + + /** @see [retrieveMany] */ fun retrieveMany( params: HrisEmploymentRetrieveManyParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -31,7 +32,13 @@ interface EmploymentService { * Returns a raw HTTP response for `post /employer/employment`, but is otherwise the same as * [EmploymentService.retrieveMany]. */ - @JvmOverloads + @MustBeClosed + fun retrieveMany( + params: HrisEmploymentRetrieveManyParams + ): HttpResponseFor = + retrieveMany(params, RequestOptions.none()) + + /** @see [retrieveMany] */ @MustBeClosed fun retrieveMany( params: HrisEmploymentRetrieveManyParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt index c08de1f8..fa435bf7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.hris import com.google.errorprone.annotations.MustBeClosed @@ -18,13 +16,21 @@ interface IndividualService { fun withRawResponse(): WithRawResponse /** Read individual data, excluding income and employment data */ - @JvmOverloads + fun retrieveMany(): HrisIndividualRetrieveManyPage = + retrieveMany(HrisIndividualRetrieveManyParams.none()) + + /** @see [retrieveMany] */ fun retrieveMany( params: HrisIndividualRetrieveManyParams = HrisIndividualRetrieveManyParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HrisIndividualRetrieveManyPage - /** Read individual data, excluding income and employment data */ + /** @see [retrieveMany] */ + fun retrieveMany( + params: HrisIndividualRetrieveManyParams = HrisIndividualRetrieveManyParams.none() + ): HrisIndividualRetrieveManyPage = retrieveMany(params, RequestOptions.none()) + + /** @see [retrieveMany] */ fun retrieveMany(requestOptions: RequestOptions): HrisIndividualRetrieveManyPage = retrieveMany(HrisIndividualRetrieveManyParams.none(), requestOptions) @@ -35,17 +41,25 @@ interface IndividualService { * Returns a raw HTTP response for `post /employer/individual`, but is otherwise the same as * [IndividualService.retrieveMany]. */ - @JvmOverloads + @MustBeClosed + fun retrieveMany(): HttpResponseFor = + retrieveMany(HrisIndividualRetrieveManyParams.none()) + + /** @see [retrieveMany] */ @MustBeClosed fun retrieveMany( params: HrisIndividualRetrieveManyParams = HrisIndividualRetrieveManyParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor - /** - * Returns a raw HTTP response for `post /employer/individual`, but is otherwise the same as - * [IndividualService.retrieveMany]. - */ + /** @see [retrieveMany] */ + @MustBeClosed + fun retrieveMany( + params: HrisIndividualRetrieveManyParams = HrisIndividualRetrieveManyParams.none() + ): HttpResponseFor = + retrieveMany(params, RequestOptions.none()) + + /** @see [retrieveMany] */ @MustBeClosed fun retrieveMany( requestOptions: RequestOptions diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementService.kt index d634fc29..de869d8c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.hris import com.google.errorprone.annotations.MustBeClosed @@ -22,7 +20,10 @@ interface PayStatementService { * * Deduction and contribution types are supported by the payroll systems that supports Benefits. */ - @JvmOverloads + fun retrieveMany(params: HrisPayStatementRetrieveManyParams): HrisPayStatementRetrieveManyPage = + retrieveMany(params, RequestOptions.none()) + + /** @see [retrieveMany] */ fun retrieveMany( params: HrisPayStatementRetrieveManyParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -37,7 +38,13 @@ interface PayStatementService { * Returns a raw HTTP response for `post /employer/pay-statement`, but is otherwise the same * as [PayStatementService.retrieveMany]. */ - @JvmOverloads + @MustBeClosed + fun retrieveMany( + params: HrisPayStatementRetrieveManyParams + ): HttpResponseFor = + retrieveMany(params, RequestOptions.none()) + + /** @see [retrieveMany] */ @MustBeClosed fun retrieveMany( params: HrisPayStatementRetrieveManyParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentService.kt index 6a60094c..f62d1061 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.hris import com.google.errorprone.annotations.MustBeClosed @@ -18,7 +16,10 @@ interface PaymentService { fun withRawResponse(): WithRawResponse /** Read payroll and contractor related payments by the company. */ - @JvmOverloads + fun list(params: HrisPaymentListParams): HrisPaymentListPage = + list(params, RequestOptions.none()) + + /** @see [list] */ fun list( params: HrisPaymentListParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -31,7 +32,11 @@ interface PaymentService { * Returns a raw HTTP response for `get /employer/payment`, but is otherwise the same as * [PaymentService.list]. */ - @JvmOverloads + @MustBeClosed + fun list(params: HrisPaymentListParams): HttpResponseFor = + list(params, RequestOptions.none()) + + /** @see [list] */ @MustBeClosed fun list( params: HrisPaymentListParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualService.kt index da7c3402..f0f36e43 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.hris.benefits import com.google.errorprone.annotations.MustBeClosed @@ -22,21 +20,33 @@ interface IndividualService { fun withRawResponse(): WithRawResponse /** Lists individuals currently enrolled in a given deduction. */ - @JvmOverloads + fun enrolledIds(params: HrisBenefitIndividualEnrolledIdsParams): IndividualEnrolledIdsResponse = + enrolledIds(params, RequestOptions.none()) + + /** @see [enrolledIds] */ fun enrolledIds( params: HrisBenefitIndividualEnrolledIdsParams, requestOptions: RequestOptions = RequestOptions.none(), ): IndividualEnrolledIdsResponse /** Get enrollment information for the given individuals. */ - @JvmOverloads + fun retrieveManyBenefits( + params: HrisBenefitIndividualRetrieveManyBenefitsParams + ): HrisBenefitIndividualRetrieveManyBenefitsPage = + retrieveManyBenefits(params, RequestOptions.none()) + + /** @see [retrieveManyBenefits] */ fun retrieveManyBenefits( params: HrisBenefitIndividualRetrieveManyBenefitsParams, requestOptions: RequestOptions = RequestOptions.none(), ): HrisBenefitIndividualRetrieveManyBenefitsPage /** Unenroll individuals from a deduction or contribution */ - @JvmOverloads + fun unenrollMany( + params: HrisBenefitIndividualUnenrollManyParams + ): HrisBenefitIndividualUnenrollManyPage = unenrollMany(params, RequestOptions.none()) + + /** @see [unenrollMany] */ fun unenrollMany( params: HrisBenefitIndividualUnenrollManyParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -49,7 +59,13 @@ interface IndividualService { * Returns a raw HTTP response for `get /employer/benefits/{benefit_id}/enrolled`, but is * otherwise the same as [IndividualService.enrolledIds]. */ - @JvmOverloads + @MustBeClosed + fun enrolledIds( + params: HrisBenefitIndividualEnrolledIdsParams + ): HttpResponseFor = + enrolledIds(params, RequestOptions.none()) + + /** @see [enrolledIds] */ @MustBeClosed fun enrolledIds( params: HrisBenefitIndividualEnrolledIdsParams, @@ -60,7 +76,13 @@ interface IndividualService { * Returns a raw HTTP response for `get /employer/benefits/{benefit_id}/individuals`, but is * otherwise the same as [IndividualService.retrieveManyBenefits]. */ - @JvmOverloads + @MustBeClosed + fun retrieveManyBenefits( + params: HrisBenefitIndividualRetrieveManyBenefitsParams + ): HttpResponseFor = + retrieveManyBenefits(params, RequestOptions.none()) + + /** @see [retrieveManyBenefits] */ @MustBeClosed fun retrieveManyBenefits( params: HrisBenefitIndividualRetrieveManyBenefitsParams, @@ -71,7 +93,13 @@ interface IndividualService { * Returns a raw HTTP response for `delete /employer/benefits/{benefit_id}/individuals`, but * is otherwise the same as [IndividualService.unenrollMany]. */ - @JvmOverloads + @MustBeClosed + fun unenrollMany( + params: HrisBenefitIndividualUnenrollManyParams + ): HttpResponseFor = + unenrollMany(params, RequestOptions.none()) + + /** @see [unenrollMany] */ @MustBeClosed fun unenrollMany( params: HrisBenefitIndividualUnenrollManyParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt index 3b0674d3..521e2e09 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.jobs import com.google.errorprone.annotations.MustBeClosed @@ -36,32 +34,28 @@ interface AutomatedService { * This endpoint is available for _Scale_ tier customers as an add-on. To request access to this * endpoint, please contact your Finch account manager. */ - @JvmOverloads + fun create(): AutomatedCreateResponse = create(JobAutomatedCreateParams.none()) + + /** @see [create] */ fun create( params: JobAutomatedCreateParams = JobAutomatedCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): AutomatedCreateResponse - /** - * Enqueue an automated job. - * - * `data_sync_all`: Enqueue a job to re-sync all data for a connection. `data_sync_all` has a - * concurrency limit of 1 job at a time per connection. This means that if this endpoint is - * called while a job is already in progress for this connection, Finch will return the `job_id` - * of the job that is currently in progress. Finch allows a fixed window rate limit of 1 forced - * refresh per hour per connection. - * - * `w4_form_employee_sync`: Enqueues a job for sync W-4 data for a particular individual, - * identified by `individual_id`. This feature is currently in beta. - * - * This endpoint is available for _Scale_ tier customers as an add-on. To request access to this - * endpoint, please contact your Finch account manager. - */ + /** @see [create] */ + fun create( + params: JobAutomatedCreateParams = JobAutomatedCreateParams.none() + ): AutomatedCreateResponse = create(params, RequestOptions.none()) + + /** @see [create] */ fun create(requestOptions: RequestOptions): AutomatedCreateResponse = create(JobAutomatedCreateParams.none(), requestOptions) /** Get an automated job by `job_id`. */ - @JvmOverloads + fun retrieve(params: JobAutomatedRetrieveParams): AutomatedAsyncJob = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ fun retrieve( params: JobAutomatedRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -72,17 +66,19 @@ interface AutomatedService { * sorted in descending order by submission time. For scheduled jobs such as data syncs, only * the next scheduled job is shown. */ - @JvmOverloads + fun list(): JobAutomatedListPage = list(JobAutomatedListParams.none()) + + /** @see [list] */ fun list( params: JobAutomatedListParams = JobAutomatedListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): JobAutomatedListPage - /** - * Get all automated jobs. Automated jobs are completed by a machine. By default, jobs are - * sorted in descending order by submission time. For scheduled jobs such as data syncs, only - * the next scheduled job is shown. - */ + /** @see [list] */ + fun list(params: JobAutomatedListParams = JobAutomatedListParams.none()): JobAutomatedListPage = + list(params, RequestOptions.none()) + + /** @see [list] */ fun list(requestOptions: RequestOptions): JobAutomatedListPage = list(JobAutomatedListParams.none(), requestOptions) @@ -93,17 +89,24 @@ interface AutomatedService { * Returns a raw HTTP response for `post /jobs/automated`, but is otherwise the same as * [AutomatedService.create]. */ - @JvmOverloads + @MustBeClosed + fun create(): HttpResponseFor = + create(JobAutomatedCreateParams.none()) + + /** @see [create] */ @MustBeClosed fun create( params: JobAutomatedCreateParams = JobAutomatedCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor - /** - * Returns a raw HTTP response for `post /jobs/automated`, but is otherwise the same as - * [AutomatedService.create]. - */ + /** @see [create] */ + @MustBeClosed + fun create( + params: JobAutomatedCreateParams = JobAutomatedCreateParams.none() + ): HttpResponseFor = create(params, RequestOptions.none()) + + /** @see [create] */ @MustBeClosed fun create(requestOptions: RequestOptions): HttpResponseFor = create(JobAutomatedCreateParams.none(), requestOptions) @@ -112,7 +115,11 @@ interface AutomatedService { * Returns a raw HTTP response for `get /jobs/automated/{job_id}`, but is otherwise the same * as [AutomatedService.retrieve]. */ - @JvmOverloads + @MustBeClosed + fun retrieve(params: JobAutomatedRetrieveParams): HttpResponseFor = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ @MustBeClosed fun retrieve( params: JobAutomatedRetrieveParams, @@ -123,17 +130,23 @@ interface AutomatedService { * Returns a raw HTTP response for `get /jobs/automated`, but is otherwise the same as * [AutomatedService.list]. */ - @JvmOverloads + @MustBeClosed + fun list(): HttpResponseFor = list(JobAutomatedListParams.none()) + + /** @see [list] */ @MustBeClosed fun list( params: JobAutomatedListParams = JobAutomatedListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor - /** - * Returns a raw HTTP response for `get /jobs/automated`, but is otherwise the same as - * [AutomatedService.list]. - */ + /** @see [list] */ + @MustBeClosed + fun list( + params: JobAutomatedListParams = JobAutomatedListParams.none() + ): HttpResponseFor = list(params, RequestOptions.none()) + + /** @see [list] */ @MustBeClosed fun list(requestOptions: RequestOptions): HttpResponseFor = list(JobAutomatedListParams.none(), requestOptions) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualService.kt index a5dc8a12..66de50ae 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.jobs import com.google.errorprone.annotations.MustBeClosed @@ -21,7 +19,10 @@ interface ManualService { * Get a manual job by `job_id`. Manual jobs are completed by a human and include Assisted * Benefits jobs. */ - @JvmOverloads + fun retrieve(params: JobManualRetrieveParams): ManualAsyncJob = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ fun retrieve( params: JobManualRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -34,7 +35,11 @@ interface ManualService { * Returns a raw HTTP response for `get /jobs/manual/{job_id}`, but is otherwise the same as * [ManualService.retrieve]. */ - @JvmOverloads + @MustBeClosed + fun retrieve(params: JobManualRetrieveParams): HttpResponseFor = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ @MustBeClosed fun retrieve( params: JobManualRetrieveParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupService.kt index 1d048242..dfbd5bb3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.payroll import com.google.errorprone.annotations.MustBeClosed @@ -20,20 +18,30 @@ interface PayGroupService { fun withRawResponse(): WithRawResponse /** Read information from a single pay group */ - @JvmOverloads + fun retrieve(params: PayrollPayGroupRetrieveParams): PayGroupRetrieveResponse = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ fun retrieve( params: PayrollPayGroupRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): PayGroupRetrieveResponse /** Read company pay groups and frequencies */ - @JvmOverloads + fun list(): PayrollPayGroupListPage = list(PayrollPayGroupListParams.none()) + + /** @see [list] */ fun list( params: PayrollPayGroupListParams = PayrollPayGroupListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): PayrollPayGroupListPage - /** Read company pay groups and frequencies */ + /** @see [list] */ + fun list( + params: PayrollPayGroupListParams = PayrollPayGroupListParams.none() + ): PayrollPayGroupListPage = list(params, RequestOptions.none()) + + /** @see [list] */ fun list(requestOptions: RequestOptions): PayrollPayGroupListPage = list(PayrollPayGroupListParams.none(), requestOptions) @@ -44,7 +52,12 @@ interface PayGroupService { * Returns a raw HTTP response for `get /employer/pay-groups/{pay_group_id}`, but is * otherwise the same as [PayGroupService.retrieve]. */ - @JvmOverloads + @MustBeClosed + fun retrieve( + params: PayrollPayGroupRetrieveParams + ): HttpResponseFor = retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ @MustBeClosed fun retrieve( params: PayrollPayGroupRetrieveParams, @@ -55,17 +68,24 @@ interface PayGroupService { * Returns a raw HTTP response for `get /employer/pay-groups`, but is otherwise the same as * [PayGroupService.list]. */ - @JvmOverloads + @MustBeClosed + fun list(): HttpResponseFor = + list(PayrollPayGroupListParams.none()) + + /** @see [list] */ @MustBeClosed fun list( params: PayrollPayGroupListParams = PayrollPayGroupListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor - /** - * Returns a raw HTTP response for `get /employer/pay-groups`, but is otherwise the same as - * [PayGroupService.list]. - */ + /** @see [list] */ + @MustBeClosed + fun list( + params: PayrollPayGroupListParams = PayrollPayGroupListParams.none() + ): HttpResponseFor = list(params, RequestOptions.none()) + + /** @see [list] */ @MustBeClosed fun list(requestOptions: RequestOptions): HttpResponseFor = list(PayrollPayGroupListParams.none(), requestOptions) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyService.kt index a5ed0378..c2f4eaf2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.sandbox import com.google.errorprone.annotations.MustBeClosed @@ -18,7 +16,10 @@ interface CompanyService { fun withRawResponse(): WithRawResponse /** Update a sandbox company's data */ - @JvmOverloads + fun update(params: SandboxCompanyUpdateParams): CompanyUpdateResponse = + update(params, RequestOptions.none()) + + /** @see [update] */ fun update( params: SandboxCompanyUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -31,7 +32,11 @@ interface CompanyService { * Returns a raw HTTP response for `put /sandbox/company`, but is otherwise the same as * [CompanyService.update]. */ - @JvmOverloads + @MustBeClosed + fun update(params: SandboxCompanyUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** @see [update] */ @MustBeClosed fun update( params: SandboxCompanyUpdateParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionService.kt index d568e6ab..7d3ce2c5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.sandbox import com.google.errorprone.annotations.MustBeClosed @@ -21,7 +19,10 @@ interface ConnectionService { fun accounts(): AccountService /** Create a new connection (new company/provider pair) with a new account */ - @JvmOverloads + fun create(params: SandboxConnectionCreateParams): ConnectionCreateResponse = + create(params, RequestOptions.none()) + + /** @see [create] */ fun create( params: SandboxConnectionCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -36,7 +37,12 @@ interface ConnectionService { * Returns a raw HTTP response for `post /sandbox/connections`, but is otherwise the same as * [ConnectionService.create]. */ - @JvmOverloads + @MustBeClosed + fun create( + params: SandboxConnectionCreateParams + ): HttpResponseFor = create(params, RequestOptions.none()) + + /** @see [create] */ @MustBeClosed fun create( params: SandboxConnectionCreateParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt index ee539194..c020fa21 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.sandbox import com.google.errorprone.annotations.MustBeClosed @@ -18,13 +16,20 @@ interface DirectoryService { fun withRawResponse(): WithRawResponse /** Add new individuals to a sandbox company */ - @JvmOverloads + fun create(): List = create(SandboxDirectoryCreateParams.none()) + + /** @see [create] */ fun create( params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): List - /** Add new individuals to a sandbox company */ + /** @see [create] */ + fun create( + params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none() + ): List = create(params, RequestOptions.none()) + + /** @see [create] */ fun create(requestOptions: RequestOptions): List = create(SandboxDirectoryCreateParams.none(), requestOptions) @@ -35,17 +40,23 @@ interface DirectoryService { * Returns a raw HTTP response for `post /sandbox/directory`, but is otherwise the same as * [DirectoryService.create]. */ - @JvmOverloads + @MustBeClosed + fun create(): HttpResponseFor> = create(SandboxDirectoryCreateParams.none()) + + /** @see [create] */ @MustBeClosed fun create( params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor> - /** - * Returns a raw HTTP response for `post /sandbox/directory`, but is otherwise the same as - * [DirectoryService.create]. - */ + /** @see [create] */ + @MustBeClosed + fun create( + params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none() + ): HttpResponseFor> = create(params, RequestOptions.none()) + + /** @see [create] */ @MustBeClosed fun create(requestOptions: RequestOptions): HttpResponseFor> = create(SandboxDirectoryCreateParams.none(), requestOptions) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentService.kt index 1b0509c1..d1af16fb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.sandbox import com.google.errorprone.annotations.MustBeClosed @@ -18,7 +16,10 @@ interface EmploymentService { fun withRawResponse(): WithRawResponse /** Update sandbox employment */ - @JvmOverloads + fun update(params: SandboxEmploymentUpdateParams): EmploymentUpdateResponse = + update(params, RequestOptions.none()) + + /** @see [update] */ fun update( params: SandboxEmploymentUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -31,7 +32,12 @@ interface EmploymentService { * Returns a raw HTTP response for `put /sandbox/employment/{individual_id}`, but is * otherwise the same as [EmploymentService.update]. */ - @JvmOverloads + @MustBeClosed + fun update( + params: SandboxEmploymentUpdateParams + ): HttpResponseFor = update(params, RequestOptions.none()) + + /** @see [update] */ @MustBeClosed fun update( params: SandboxEmploymentUpdateParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualService.kt index 5c1670b6..8be711cb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.sandbox import com.google.errorprone.annotations.MustBeClosed @@ -18,7 +16,10 @@ interface IndividualService { fun withRawResponse(): WithRawResponse /** Update sandbox individual */ - @JvmOverloads + fun update(params: SandboxIndividualUpdateParams): IndividualUpdateResponse = + update(params, RequestOptions.none()) + + /** @see [update] */ fun update( params: SandboxIndividualUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -31,7 +32,12 @@ interface IndividualService { * Returns a raw HTTP response for `put /sandbox/individual/{individual_id}`, but is * otherwise the same as [IndividualService.update]. */ - @JvmOverloads + @MustBeClosed + fun update( + params: SandboxIndividualUpdateParams + ): HttpResponseFor = update(params, RequestOptions.none()) + + /** @see [update] */ @MustBeClosed fun update( params: SandboxIndividualUpdateParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobService.kt index 868a6622..cbff8247 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.sandbox import com.google.errorprone.annotations.MustBeClosed @@ -21,7 +19,10 @@ interface JobService { fun configuration(): ConfigurationService /** Enqueue a new sandbox job */ - @JvmOverloads + fun create(params: SandboxJobCreateParams): JobCreateResponse = + create(params, RequestOptions.none()) + + /** @see [create] */ fun create( params: SandboxJobCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -36,7 +37,11 @@ interface JobService { * Returns a raw HTTP response for `post /sandbox/jobs`, but is otherwise the same as * [JobService.create]. */ - @JvmOverloads + @MustBeClosed + fun create(params: SandboxJobCreateParams): HttpResponseFor = + create(params, RequestOptions.none()) + + /** @see [create] */ @MustBeClosed fun create( params: SandboxJobCreateParams, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentService.kt index c0bd3867..5f78f493 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.sandbox import com.google.errorprone.annotations.MustBeClosed @@ -18,13 +16,20 @@ interface PaymentService { fun withRawResponse(): WithRawResponse /** Add a new sandbox payment */ - @JvmOverloads + fun create(): PaymentCreateResponse = create(SandboxPaymentCreateParams.none()) + + /** @see [create] */ fun create( params: SandboxPaymentCreateParams = SandboxPaymentCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): PaymentCreateResponse - /** Add a new sandbox payment */ + /** @see [create] */ + fun create( + params: SandboxPaymentCreateParams = SandboxPaymentCreateParams.none() + ): PaymentCreateResponse = create(params, RequestOptions.none()) + + /** @see [create] */ fun create(requestOptions: RequestOptions): PaymentCreateResponse = create(SandboxPaymentCreateParams.none(), requestOptions) @@ -35,17 +40,24 @@ interface PaymentService { * Returns a raw HTTP response for `post /sandbox/payment`, but is otherwise the same as * [PaymentService.create]. */ - @JvmOverloads + @MustBeClosed + fun create(): HttpResponseFor = + create(SandboxPaymentCreateParams.none()) + + /** @see [create] */ @MustBeClosed fun create( params: SandboxPaymentCreateParams = SandboxPaymentCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor - /** - * Returns a raw HTTP response for `post /sandbox/payment`, but is otherwise the same as - * [PaymentService.create]. - */ + /** @see [create] */ + @MustBeClosed + fun create( + params: SandboxPaymentCreateParams = SandboxPaymentCreateParams.none() + ): HttpResponseFor = create(params, RequestOptions.none()) + + /** @see [create] */ @MustBeClosed fun create(requestOptions: RequestOptions): HttpResponseFor = create(SandboxPaymentCreateParams.none(), requestOptions) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountService.kt index a1ca85ba..205880de 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.sandbox.connections import com.google.errorprone.annotations.MustBeClosed @@ -20,7 +18,10 @@ interface AccountService { fun withRawResponse(): WithRawResponse /** Create a new account for an existing connection (company/provider pair) */ - @JvmOverloads + fun create(params: SandboxConnectionAccountCreateParams): AccountCreateResponse = + create(params, RequestOptions.none()) + + /** @see [create] */ fun create( params: SandboxConnectionAccountCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -30,16 +31,20 @@ interface AccountService { * Update an existing sandbox account. Change the connection status to understand how the Finch * API responds. */ - @JvmOverloads + fun update(): AccountUpdateResponse = update(SandboxConnectionAccountUpdateParams.none()) + + /** @see [update] */ fun update( params: SandboxConnectionAccountUpdateParams = SandboxConnectionAccountUpdateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): AccountUpdateResponse - /** - * Update an existing sandbox account. Change the connection status to understand how the Finch - * API responds. - */ + /** @see [update] */ + fun update( + params: SandboxConnectionAccountUpdateParams = SandboxConnectionAccountUpdateParams.none() + ): AccountUpdateResponse = update(params, RequestOptions.none()) + + /** @see [update] */ fun update(requestOptions: RequestOptions): AccountUpdateResponse = update(SandboxConnectionAccountUpdateParams.none(), requestOptions) @@ -50,7 +55,12 @@ interface AccountService { * Returns a raw HTTP response for `post /sandbox/connections/accounts`, but is otherwise * the same as [AccountService.create]. */ - @JvmOverloads + @MustBeClosed + fun create( + params: SandboxConnectionAccountCreateParams + ): HttpResponseFor = create(params, RequestOptions.none()) + + /** @see [create] */ @MustBeClosed fun create( params: SandboxConnectionAccountCreateParams, @@ -61,7 +71,11 @@ interface AccountService { * Returns a raw HTTP response for `put /sandbox/connections/accounts`, but is otherwise the * same as [AccountService.update]. */ - @JvmOverloads + @MustBeClosed + fun update(): HttpResponseFor = + update(SandboxConnectionAccountUpdateParams.none()) + + /** @see [update] */ @MustBeClosed fun update( params: SandboxConnectionAccountUpdateParams = @@ -69,10 +83,14 @@ interface AccountService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor - /** - * Returns a raw HTTP response for `put /sandbox/connections/accounts`, but is otherwise the - * same as [AccountService.update]. - */ + /** @see [update] */ + @MustBeClosed + fun update( + params: SandboxConnectionAccountUpdateParams = + SandboxConnectionAccountUpdateParams.none() + ): HttpResponseFor = update(params, RequestOptions.none()) + + /** @see [update] */ @MustBeClosed fun update(requestOptions: RequestOptions): HttpResponseFor = update(SandboxConnectionAccountUpdateParams.none(), requestOptions) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationService.kt index b0bd512d..d9fa6264 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationService.kt @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.tryfinch.api.services.blocking.sandbox.jobs import com.google.errorprone.annotations.MustBeClosed @@ -19,19 +17,30 @@ interface ConfigurationService { fun withRawResponse(): WithRawResponse /** Get configurations for sandbox jobs */ - @JvmOverloads + fun retrieve(): List = + retrieve(SandboxJobConfigurationRetrieveParams.none()) + + /** @see [retrieve] */ fun retrieve( params: SandboxJobConfigurationRetrieveParams = SandboxJobConfigurationRetrieveParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): List - /** Get configurations for sandbox jobs */ + /** @see [retrieve] */ + fun retrieve( + params: SandboxJobConfigurationRetrieveParams = SandboxJobConfigurationRetrieveParams.none() + ): List = retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ fun retrieve(requestOptions: RequestOptions): List = retrieve(SandboxJobConfigurationRetrieveParams.none(), requestOptions) /** Update configurations for sandbox jobs */ - @JvmOverloads + fun update(params: SandboxJobConfigurationUpdateParams): SandboxJobConfiguration = + update(params, RequestOptions.none()) + + /** @see [update] */ fun update( params: SandboxJobConfigurationUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -46,7 +55,11 @@ interface ConfigurationService { * Returns a raw HTTP response for `get /sandbox/jobs/configuration`, but is otherwise the * same as [ConfigurationService.retrieve]. */ - @JvmOverloads + @MustBeClosed + fun retrieve(): HttpResponseFor> = + retrieve(SandboxJobConfigurationRetrieveParams.none()) + + /** @see [retrieve] */ @MustBeClosed fun retrieve( params: SandboxJobConfigurationRetrieveParams = @@ -54,10 +67,14 @@ interface ConfigurationService { requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor> - /** - * Returns a raw HTTP response for `get /sandbox/jobs/configuration`, but is otherwise the - * same as [ConfigurationService.retrieve]. - */ + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + params: SandboxJobConfigurationRetrieveParams = + SandboxJobConfigurationRetrieveParams.none() + ): HttpResponseFor> = retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ @MustBeClosed fun retrieve( requestOptions: RequestOptions @@ -68,7 +85,12 @@ interface ConfigurationService { * Returns a raw HTTP response for `put /sandbox/jobs/configuration`, but is otherwise the * same as [ConfigurationService.update]. */ - @JvmOverloads + @MustBeClosed + fun update( + params: SandboxJobConfigurationUpdateParams + ): HttpResponseFor = update(params, RequestOptions.none()) + + /** @see [update] */ @MustBeClosed fun update( params: SandboxJobConfigurationUpdateParams, From 3682e62316dcbac48b8c2a7e3b1df8f19ae5d96e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 9 Mar 2025 21:41:05 +0000 Subject: [PATCH 19/65] docs: revise readme docs about nested params (#486) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 33c168dc..3d7dbcad 100644 --- a/README.md +++ b/README.md @@ -386,7 +386,7 @@ HrisDirectoryListParams params = HrisDirectoryListParams.builder() .build(); ``` -These can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods. You can also set undocumented parameters on nested headers, query params, or body classes using the `putAdditionalProperty` method. These properties can be accessed on the built object later using the `_additionalProperties()` method. +These can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods. To set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](finch-java-core/src/main/kotlin/com/tryfinch/api/core/JsonValue.kt) object to its setter: From e790ad57e21491a0edcada3ae2d544f3ae7eb35e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 9 Mar 2025 22:18:14 +0000 Subject: [PATCH 20/65] docs: document `JsonValue` construction in readme (#487) --- README.md | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3d7dbcad..3b0a3a46 100644 --- a/README.md +++ b/README.md @@ -388,7 +388,7 @@ HrisDirectoryListParams params = HrisDirectoryListParams.builder() These can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods. -To set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](finch-java-core/src/main/kotlin/com/tryfinch/api/core/JsonValue.kt) object to its setter: +To set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt) object to its setter: ```java import com.tryfinch.api.models.HrisDirectoryListParams; @@ -396,6 +396,45 @@ import com.tryfinch.api.models.HrisDirectoryListParams; HrisDirectoryListParams params = HrisDirectoryListParams.builder().build(); ``` +The most straightforward way to create a [`JsonValue`](finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt) is using its `from(...)` method: + +```java +import com.tryfinch.api.core.JsonValue; +import java.util.List; +import java.util.Map; + +// Create primitive JSON values +JsonValue nullValue = JsonValue.from(null); +JsonValue booleanValue = JsonValue.from(true); +JsonValue numberValue = JsonValue.from(42); +JsonValue stringValue = JsonValue.from("Hello World!"); + +// Create a JSON array value equivalent to `["Hello", "World"]` +JsonValue arrayValue = JsonValue.from(List.of( + "Hello", "World" +)); + +// Create a JSON object value equivalent to `{ "a": 1, "b": 2 }` +JsonValue objectValue = JsonValue.from(Map.of( + "a", 1, + "b", 2 +)); + +// Create an arbitrarily nested JSON equivalent to: +// { +// "a": [1, 2], +// "b": [3, 4] +// } +JsonValue complexValue = JsonValue.from(Map.of( + "a", List.of( + 1, 2 + ), + "b", List.of( + 3, 4 + ) +)); +``` + ### Response properties To access undocumented response properties, call the `_additionalProperties()` method: From 5742de269c36314324b0fb8f4214efb87af09dff Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 10 Mar 2025 17:02:50 +0000 Subject: [PATCH 21/65] chore(internal): codegen related update (#488) --- .../com/tryfinch/api/models/WebhookEvent.kt | 56 ++++++++++--------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/WebhookEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/WebhookEvent.kt index fd604b72..15918c73 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/WebhookEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/WebhookEvent.kt @@ -21,9 +21,9 @@ import java.util.Optional @JsonSerialize(using = WebhookEvent.Serializer::class) class WebhookEvent private constructor( - private val accountUpdate: AccountUpdateEvent? = null, + private val accountUpdated: AccountUpdateEvent? = null, private val jobCompletion: JobCompletionEvent? = null, - private val company: CompanyEvent? = null, + private val companyUpdated: CompanyEvent? = null, private val directory: DirectoryEvent? = null, private val employment: EmploymentEvent? = null, private val individual: IndividualEvent? = null, @@ -32,11 +32,11 @@ private constructor( private val _json: JsonValue? = null, ) { - fun accountUpdate(): Optional = Optional.ofNullable(accountUpdate) + fun accountUpdated(): Optional = Optional.ofNullable(accountUpdated) fun jobCompletion(): Optional = Optional.ofNullable(jobCompletion) - fun company(): Optional = Optional.ofNullable(company) + fun companyUpdated(): Optional = Optional.ofNullable(companyUpdated) fun directory(): Optional = Optional.ofNullable(directory) @@ -48,11 +48,11 @@ private constructor( fun payStatement(): Optional = Optional.ofNullable(payStatement) - fun isAccountUpdate(): Boolean = accountUpdate != null + fun isAccountUpdated(): Boolean = accountUpdated != null fun isJobCompletion(): Boolean = jobCompletion != null - fun isCompany(): Boolean = company != null + fun isCompanyUpdated(): Boolean = companyUpdated != null fun isDirectory(): Boolean = directory != null @@ -64,11 +64,11 @@ private constructor( fun isPayStatement(): Boolean = payStatement != null - fun asAccountUpdate(): AccountUpdateEvent = accountUpdate.getOrThrow("accountUpdate") + fun asAccountUpdated(): AccountUpdateEvent = accountUpdated.getOrThrow("accountUpdated") fun asJobCompletion(): JobCompletionEvent = jobCompletion.getOrThrow("jobCompletion") - fun asCompany(): CompanyEvent = company.getOrThrow("company") + fun asCompanyUpdated(): CompanyEvent = companyUpdated.getOrThrow("companyUpdated") fun asDirectory(): DirectoryEvent = directory.getOrThrow("directory") @@ -84,9 +84,9 @@ private constructor( fun accept(visitor: Visitor): T { return when { - accountUpdate != null -> visitor.visitAccountUpdate(accountUpdate) + accountUpdated != null -> visitor.visitAccountUpdated(accountUpdated) jobCompletion != null -> visitor.visitJobCompletion(jobCompletion) - company != null -> visitor.visitCompany(company) + companyUpdated != null -> visitor.visitCompanyUpdated(companyUpdated) directory != null -> visitor.visitDirectory(directory) employment != null -> visitor.visitEmployment(employment) individual != null -> visitor.visitIndividual(individual) @@ -105,16 +105,16 @@ private constructor( accept( object : Visitor { - override fun visitAccountUpdate(accountUpdate: AccountUpdateEvent) { - accountUpdate.validate() + override fun visitAccountUpdated(accountUpdated: AccountUpdateEvent) { + accountUpdated.validate() } override fun visitJobCompletion(jobCompletion: JobCompletionEvent) { jobCompletion.validate() } - override fun visitCompany(company: CompanyEvent) { - company.validate() + override fun visitCompanyUpdated(companyUpdated: CompanyEvent) { + companyUpdated.validate() } override fun visitDirectory(directory: DirectoryEvent) { @@ -146,16 +146,16 @@ private constructor( return true } - return /* spotless:off */ other is WebhookEvent && accountUpdate == other.accountUpdate && jobCompletion == other.jobCompletion && company == other.company && directory == other.directory && employment == other.employment && individual == other.individual && payment == other.payment && payStatement == other.payStatement /* spotless:on */ + return /* spotless:off */ other is WebhookEvent && accountUpdated == other.accountUpdated && jobCompletion == other.jobCompletion && companyUpdated == other.companyUpdated && directory == other.directory && employment == other.employment && individual == other.individual && payment == other.payment && payStatement == other.payStatement /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(accountUpdate, jobCompletion, company, directory, employment, individual, payment, payStatement) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(accountUpdated, jobCompletion, companyUpdated, directory, employment, individual, payment, payStatement) /* spotless:on */ override fun toString(): String = when { - accountUpdate != null -> "WebhookEvent{accountUpdate=$accountUpdate}" + accountUpdated != null -> "WebhookEvent{accountUpdated=$accountUpdated}" jobCompletion != null -> "WebhookEvent{jobCompletion=$jobCompletion}" - company != null -> "WebhookEvent{company=$company}" + companyUpdated != null -> "WebhookEvent{companyUpdated=$companyUpdated}" directory != null -> "WebhookEvent{directory=$directory}" employment != null -> "WebhookEvent{employment=$employment}" individual != null -> "WebhookEvent{individual=$individual}" @@ -168,14 +168,16 @@ private constructor( companion object { @JvmStatic - fun ofAccountUpdate(accountUpdate: AccountUpdateEvent) = - WebhookEvent(accountUpdate = accountUpdate) + fun ofAccountUpdated(accountUpdated: AccountUpdateEvent) = + WebhookEvent(accountUpdated = accountUpdated) @JvmStatic fun ofJobCompletion(jobCompletion: JobCompletionEvent) = WebhookEvent(jobCompletion = jobCompletion) - @JvmStatic fun ofCompany(company: CompanyEvent) = WebhookEvent(company = company) + @JvmStatic + fun ofCompanyUpdated(companyUpdated: CompanyEvent) = + WebhookEvent(companyUpdated = companyUpdated) @JvmStatic fun ofDirectory(directory: DirectoryEvent) = WebhookEvent(directory = directory) @@ -197,11 +199,11 @@ private constructor( */ interface Visitor { - fun visitAccountUpdate(accountUpdate: AccountUpdateEvent): T + fun visitAccountUpdated(accountUpdated: AccountUpdateEvent): T fun visitJobCompletion(jobCompletion: JobCompletionEvent): T - fun visitCompany(company: CompanyEvent): T + fun visitCompanyUpdated(companyUpdated: CompanyEvent): T fun visitDirectory(directory: DirectoryEvent): T @@ -234,7 +236,7 @@ private constructor( tryDeserialize(node, jacksonTypeRef()) { it.validate() } ?.let { - return WebhookEvent(accountUpdate = it, _json = json) + return WebhookEvent(accountUpdated = it, _json = json) } tryDeserialize(node, jacksonTypeRef()) { it.validate() } ?.let { @@ -242,7 +244,7 @@ private constructor( } tryDeserialize(node, jacksonTypeRef()) { it.validate() } ?.let { - return WebhookEvent(company = it, _json = json) + return WebhookEvent(companyUpdated = it, _json = json) } tryDeserialize(node, jacksonTypeRef()) { it.validate() } ?.let { @@ -277,9 +279,9 @@ private constructor( provider: SerializerProvider, ) { when { - value.accountUpdate != null -> generator.writeObject(value.accountUpdate) + value.accountUpdated != null -> generator.writeObject(value.accountUpdated) value.jobCompletion != null -> generator.writeObject(value.jobCompletion) - value.company != null -> generator.writeObject(value.company) + value.companyUpdated != null -> generator.writeObject(value.companyUpdated) value.directory != null -> generator.writeObject(value.directory) value.employment != null -> generator.writeObject(value.employment) value.individual != null -> generator.writeObject(value.individual) From 60e5c131ff4b41265efd39bff4c29a6c1a4df442 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 13 Mar 2025 21:28:54 -0400 Subject: [PATCH 22/65] chore(internal): codegen related update --- .github/workflows/ci.yml | 1 - .stats.yml | 2 +- .../api/models/AutomatedListResponse.kt | 494 ++++++++++++++++++ .../api/models/JobAutomatedListPage.kt | 197 ------- .../api/models/JobAutomatedListPageAsync.kt | 212 -------- .../async/jobs/AutomatedServiceAsync.kt | 18 +- .../async/jobs/AutomatedServiceAsyncImpl.kt | 17 +- .../blocking/jobs/AutomatedService.kt | 21 +- .../blocking/jobs/AutomatedServiceImpl.kt | 13 +- .../api/models/AutomatedListResponseTest.kt | 78 +++ .../async/jobs/AutomatedServiceAsyncTest.kt | 10 +- .../blocking/jobs/AutomatedServiceTest.kt | 6 +- 12 files changed, 614 insertions(+), 455 deletions(-) create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt delete mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt delete mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPageAsync.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedListResponseTest.kt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 121ace97..94046873 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,4 +52,3 @@ jobs: - name: Run tests run: ./scripts/test - diff --git a/.stats.yml b/.stats.yml index 7e688f99..42d351e3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-777eedfd80c3e04a8739959418783d1c976180f4f09d7a883f7de5c2b6cda5a6.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-f1779210fbedfc6099076412405288b489f727cbb0b3a85e7b7c12fabb37ef47.yml diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt new file mode 100644 index 00000000..ee18fbbf --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt @@ -0,0 +1,494 @@ +// 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.NoAutoDetect +import com.tryfinch.api.core.checkKnown +import com.tryfinch.api.core.checkRequired +import com.tryfinch.api.core.immutableEmptyMap +import com.tryfinch.api.core.toImmutable +import java.util.Objects +import java.util.Optional + +@NoAutoDetect +class AutomatedListResponse +@JsonCreator +private constructor( + @JsonProperty("data") + @ExcludeMissing + private val data: JsonField> = JsonMissing.of(), + @JsonProperty("meta") @ExcludeMissing private val meta: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), +) { + + fun data(): List = data.getRequired("data") + + fun meta(): Meta = meta.getRequired("meta") + + @JsonProperty("data") @ExcludeMissing fun _data(): JsonField> = data + + @JsonProperty("meta") @ExcludeMissing fun _meta(): JsonField = meta + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): AutomatedListResponse = apply { + if (validated) { + return@apply + } + + data().forEach { it.validate() } + meta().validate() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [AutomatedListResponse]. + * + * The following fields are required: + * ```java + * .data() + * .meta() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AutomatedListResponse]. */ + class Builder internal constructor() { + + private var data: JsonField>? = null + private var meta: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(automatedListResponse: AutomatedListResponse) = apply { + data = automatedListResponse.data.map { it.toMutableList() } + meta = automatedListResponse.meta + additionalProperties = automatedListResponse.additionalProperties.toMutableMap() + } + + fun data(data: List) = data(JsonField.of(data)) + + fun data(data: JsonField>) = apply { + this.data = data.map { it.toMutableList() } + } + + fun addData(data: AutomatedAsyncJob) = apply { + this.data = + (this.data ?: JsonField.of(mutableListOf())).also { + checkKnown("data", it).add(data) + } + } + + fun meta(meta: Meta) = meta(JsonField.of(meta)) + + fun meta(meta: JsonField) = apply { this.meta = meta } + + 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) + } + + fun build(): AutomatedListResponse = + AutomatedListResponse( + checkRequired("data", data).map { it.toImmutable() }, + checkRequired("meta", meta), + additionalProperties.toImmutable(), + ) + } + + @NoAutoDetect + class Meta + @JsonCreator + private constructor( + @JsonProperty("quotas") + @ExcludeMissing + private val quotas: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** + * Information about remaining quotas for this connection. Only applicable for customers + * opted in to use Finch's Data Sync Refresh endpoint (`POST /jobs/automated`). Please + * contact a Finch representative for more details. + */ + fun quotas(): Optional = Optional.ofNullable(quotas.getNullable("quotas")) + + /** + * Information about remaining quotas for this connection. Only applicable for customers + * opted in to use Finch's Data Sync Refresh endpoint (`POST /jobs/automated`). Please + * contact a Finch representative for more details. + */ + @JsonProperty("quotas") @ExcludeMissing fun _quotas(): JsonField = quotas + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Meta = apply { + if (validated) { + return@apply + } + + quotas().ifPresent { it.validate() } + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Meta]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Meta]. */ + class Builder internal constructor() { + + private var quotas: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(meta: Meta) = apply { + quotas = meta.quotas + additionalProperties = meta.additionalProperties.toMutableMap() + } + + /** + * Information about remaining quotas for this connection. Only applicable for customers + * opted in to use Finch's Data Sync Refresh endpoint (`POST /jobs/automated`). Please + * contact a Finch representative for more details. + */ + fun quotas(quotas: Quotas) = quotas(JsonField.of(quotas)) + + /** + * Information about remaining quotas for this connection. Only applicable for customers + * opted in to use Finch's Data Sync Refresh endpoint (`POST /jobs/automated`). Please + * contact a Finch representative for more details. + */ + fun quotas(quotas: JsonField) = apply { this.quotas = quotas } + + 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) + } + + fun build(): Meta = Meta(quotas, additionalProperties.toImmutable()) + } + + /** + * Information about remaining quotas for this connection. Only applicable for customers + * opted in to use Finch's Data Sync Refresh endpoint (`POST /jobs/automated`). Please + * contact a Finch representative for more details. + */ + @NoAutoDetect + class Quotas + @JsonCreator + private constructor( + @JsonProperty("data_sync_all") + @ExcludeMissing + private val dataSyncAll: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + fun dataSyncAll(): Optional = + Optional.ofNullable(dataSyncAll.getNullable("data_sync_all")) + + @JsonProperty("data_sync_all") + @ExcludeMissing + fun _dataSyncAll(): JsonField = dataSyncAll + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Quotas = apply { + if (validated) { + return@apply + } + + dataSyncAll().ifPresent { it.validate() } + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Quotas]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Quotas]. */ + class Builder internal constructor() { + + private var dataSyncAll: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(quotas: Quotas) = apply { + dataSyncAll = quotas.dataSyncAll + additionalProperties = quotas.additionalProperties.toMutableMap() + } + + fun dataSyncAll(dataSyncAll: DataSyncAll) = dataSyncAll(JsonField.of(dataSyncAll)) + + fun dataSyncAll(dataSyncAll: JsonField) = apply { + this.dataSyncAll = dataSyncAll + } + + 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) + } + + fun build(): Quotas = Quotas(dataSyncAll, additionalProperties.toImmutable()) + } + + @NoAutoDetect + class DataSyncAll + @JsonCreator + private constructor( + @JsonProperty("allowed_refreshes") + @ExcludeMissing + private val allowedRefreshes: JsonField = JsonMissing.of(), + @JsonProperty("remaining_refreshes") + @ExcludeMissing + private val remainingRefreshes: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + fun allowedRefreshes(): Optional = + Optional.ofNullable(allowedRefreshes.getNullable("allowed_refreshes")) + + fun remainingRefreshes(): Optional = + Optional.ofNullable(remainingRefreshes.getNullable("remaining_refreshes")) + + @JsonProperty("allowed_refreshes") + @ExcludeMissing + fun _allowedRefreshes(): JsonField = allowedRefreshes + + @JsonProperty("remaining_refreshes") + @ExcludeMissing + fun _remainingRefreshes(): JsonField = remainingRefreshes + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): DataSyncAll = apply { + if (validated) { + return@apply + } + + allowedRefreshes() + remainingRefreshes() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [DataSyncAll]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DataSyncAll]. */ + class Builder internal constructor() { + + private var allowedRefreshes: JsonField = JsonMissing.of() + private var remainingRefreshes: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(dataSyncAll: DataSyncAll) = apply { + allowedRefreshes = dataSyncAll.allowedRefreshes + remainingRefreshes = dataSyncAll.remainingRefreshes + additionalProperties = dataSyncAll.additionalProperties.toMutableMap() + } + + fun allowedRefreshes(allowedRefreshes: Long) = + allowedRefreshes(JsonField.of(allowedRefreshes)) + + fun allowedRefreshes(allowedRefreshes: JsonField) = apply { + this.allowedRefreshes = allowedRefreshes + } + + fun remainingRefreshes(remainingRefreshes: Long) = + remainingRefreshes(JsonField.of(remainingRefreshes)) + + fun remainingRefreshes(remainingRefreshes: JsonField) = apply { + this.remainingRefreshes = remainingRefreshes + } + + 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) + } + + fun build(): DataSyncAll = + DataSyncAll( + allowedRefreshes, + remainingRefreshes, + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DataSyncAll && allowedRefreshes == other.allowedRefreshes && remainingRefreshes == other.remainingRefreshes && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(allowedRefreshes, remainingRefreshes, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DataSyncAll{allowedRefreshes=$allowedRefreshes, remainingRefreshes=$remainingRefreshes, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Quotas && dataSyncAll == other.dataSyncAll && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(dataSyncAll, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Quotas{dataSyncAll=$dataSyncAll, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Meta && quotas == other.quotas && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(quotas, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Meta{quotas=$quotas, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is AutomatedListResponse && data == other.data && meta == other.meta && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(data, meta, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "AutomatedListResponse{data=$data, meta=$meta, additionalProperties=$additionalProperties}" +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt deleted file mode 100644 index eac1a561..00000000 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt +++ /dev/null @@ -1,197 +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.core.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable -import com.tryfinch.api.services.blocking.jobs.AutomatedService -import java.util.Objects -import java.util.Optional -import java.util.stream.Stream -import java.util.stream.StreamSupport -import kotlin.jvm.optionals.getOrNull - -/** - * Get all automated jobs. Automated jobs are completed by a machine. By default, jobs are sorted in - * descending order by submission time. For scheduled jobs such as data syncs, only the next - * scheduled job is shown. - */ -class JobAutomatedListPage -private constructor( - private val automatedService: AutomatedService, - private val params: JobAutomatedListParams, - private val response: Response, -) { - - fun response(): Response = response - - fun data(): List = response().data() - - fun paging(): Optional = response().paging() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is JobAutomatedListPage && automatedService == other.automatedService && params == other.params && response == other.response /* spotless:on */ - } - - override fun hashCode(): Int = /* spotless:off */ Objects.hash(automatedService, params, response) /* spotless:on */ - - override fun toString() = - "JobAutomatedListPage{automatedService=$automatedService, params=$params, response=$response}" - - fun hasNextPage(): Boolean { - if (data().isEmpty()) { - return false - } - - return paging().flatMap { it.offset() }.orElse(0) + data().count() < - paging().flatMap { it.count() }.orElse(Long.MAX_VALUE) - } - - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } - - return Optional.of( - JobAutomatedListParams.builder() - .from(params) - .offset(paging().flatMap { it.offset() }.orElse(0) + data().count()) - .build() - ) - } - - fun getNextPage(): Optional { - return getNextPageParams().map { automatedService.list(it) } - } - - fun autoPager(): AutoPager = AutoPager(this) - - companion object { - - @JvmStatic - fun of( - automatedService: AutomatedService, - params: JobAutomatedListParams, - response: Response, - ) = JobAutomatedListPage(automatedService, params, response) - } - - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("data") - private val data: JsonField> = JsonMissing.of(), - @JsonProperty("paging") private val paging: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - fun data(): List = data.getNullable("data") ?: listOf() - - fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) - - @JsonProperty("data") - fun _data(): Optional>> = Optional.ofNullable(data) - - @JsonProperty("paging") - fun _paging(): Optional> = Optional.ofNullable(paging) - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Response = apply { - if (validated) { - return@apply - } - - data().map { it.validate() } - paging().ifPresent { it.validate() } - validated = true - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Response && data == other.data && paging == other.paging && additionalProperties == other.additionalProperties /* spotless:on */ - } - - override fun hashCode(): Int = /* spotless:off */ Objects.hash(data, paging, additionalProperties) /* spotless:on */ - - override fun toString() = - "Response{data=$data, paging=$paging, additionalProperties=$additionalProperties}" - - companion object { - - /** Returns a mutable builder for constructing an instance of [JobAutomatedListPage]. */ - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var data: JsonField> = JsonMissing.of() - private var paging: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(page: Response) = apply { - this.data = page.data - this.paging = page.paging - this.additionalProperties.putAll(page.additionalProperties) - } - - fun data(data: List) = data(JsonField.of(data)) - - fun data(data: JsonField>) = apply { this.data = data } - - fun paging(paging: Paging) = paging(JsonField.of(paging)) - - fun paging(paging: JsonField) = apply { this.paging = paging } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun build() = Response(data, paging, additionalProperties.toImmutable()) - } - } - - class AutoPager(private val firstPage: JobAutomatedListPage) : Iterable { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[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/JobAutomatedListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPageAsync.kt deleted file mode 100644 index 50ec8c79..00000000 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPageAsync.kt +++ /dev/null @@ -1,212 +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.core.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable -import com.tryfinch.api.services.async.jobs.AutomatedServiceAsync -import java.util.Objects -import java.util.Optional -import java.util.concurrent.CompletableFuture -import java.util.concurrent.Executor -import java.util.function.Predicate - -/** - * Get all automated jobs. Automated jobs are completed by a machine. By default, jobs are sorted in - * descending order by submission time. For scheduled jobs such as data syncs, only the next - * scheduled job is shown. - */ -class JobAutomatedListPageAsync -private constructor( - private val automatedService: AutomatedServiceAsync, - private val params: JobAutomatedListParams, - private val response: Response, -) { - - fun response(): Response = response - - fun data(): List = response().data() - - fun paging(): Optional = response().paging() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is JobAutomatedListPageAsync && automatedService == other.automatedService && params == other.params && response == other.response /* spotless:on */ - } - - override fun hashCode(): Int = /* spotless:off */ Objects.hash(automatedService, params, response) /* spotless:on */ - - override fun toString() = - "JobAutomatedListPageAsync{automatedService=$automatedService, params=$params, response=$response}" - - fun hasNextPage(): Boolean { - if (data().isEmpty()) { - return false - } - - return paging().flatMap { it.offset() }.orElse(0) + data().count() < - paging().flatMap { it.count() }.orElse(Long.MAX_VALUE) - } - - fun getNextPageParams(): Optional { - if (!hasNextPage()) { - return Optional.empty() - } - - return Optional.of( - JobAutomatedListParams.builder() - .from(params) - .offset(paging().flatMap { it.offset() }.orElse(0) + data().count()) - .build() - ) - } - - fun getNextPage(): CompletableFuture> { - return getNextPageParams() - .map { automatedService.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } - } - - fun autoPager(): AutoPager = AutoPager(this) - - companion object { - - @JvmStatic - fun of( - automatedService: AutomatedServiceAsync, - params: JobAutomatedListParams, - response: Response, - ) = JobAutomatedListPageAsync(automatedService, params, response) - } - - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("data") - private val data: JsonField> = JsonMissing.of(), - @JsonProperty("paging") private val paging: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - fun data(): List = data.getNullable("data") ?: listOf() - - fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) - - @JsonProperty("data") - fun _data(): Optional>> = Optional.ofNullable(data) - - @JsonProperty("paging") - fun _paging(): Optional> = Optional.ofNullable(paging) - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Response = apply { - if (validated) { - return@apply - } - - data().map { it.validate() } - paging().ifPresent { it.validate() } - validated = true - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Response && data == other.data && paging == other.paging && additionalProperties == other.additionalProperties /* spotless:on */ - } - - override fun hashCode(): Int = /* spotless:off */ Objects.hash(data, paging, additionalProperties) /* spotless:on */ - - override fun toString() = - "Response{data=$data, paging=$paging, additionalProperties=$additionalProperties}" - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [JobAutomatedListPageAsync]. - */ - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var data: JsonField> = JsonMissing.of() - private var paging: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(page: Response) = apply { - this.data = page.data - this.paging = page.paging - this.additionalProperties.putAll(page.additionalProperties) - } - - fun data(data: List) = data(JsonField.of(data)) - - fun data(data: JsonField>) = apply { this.data = data } - - fun paging(paging: Paging) = paging(JsonField.of(paging)) - - fun paging(paging: JsonField) = apply { this.paging = paging } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun build() = Response(data, paging, additionalProperties.toImmutable()) - } - } - - class AutoPager(private val firstPage: JobAutomatedListPageAsync) { - - fun forEach( - action: Predicate, - executor: Executor, - ): CompletableFuture { - fun CompletableFuture>.forEach( - action: (AutomatedAsyncJob) -> Boolean, - executor: Executor, - ): CompletableFuture = - thenComposeAsync( - { page -> - page - .filter { it.data().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/services/async/jobs/AutomatedServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsync.kt index 87106c02..374f8672 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsync.kt @@ -7,8 +7,8 @@ import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.AutomatedAsyncJob import com.tryfinch.api.models.AutomatedCreateResponse +import com.tryfinch.api.models.AutomatedListResponse import com.tryfinch.api.models.JobAutomatedCreateParams -import com.tryfinch.api.models.JobAutomatedListPageAsync import com.tryfinch.api.models.JobAutomatedListParams import com.tryfinch.api.models.JobAutomatedRetrieveParams import java.util.concurrent.CompletableFuture @@ -68,21 +68,21 @@ interface AutomatedServiceAsync { * sorted in descending order by submission time. For scheduled jobs such as data syncs, only * the next scheduled job is shown. */ - fun list(): CompletableFuture = list(JobAutomatedListParams.none()) + fun list(): CompletableFuture = list(JobAutomatedListParams.none()) /** @see [list] */ fun list( params: JobAutomatedListParams = JobAutomatedListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** @see [list] */ fun list( params: JobAutomatedListParams = JobAutomatedListParams.none() - ): CompletableFuture = list(params, RequestOptions.none()) + ): CompletableFuture = list(params, RequestOptions.none()) /** @see [list] */ - fun list(requestOptions: RequestOptions): CompletableFuture = + fun list(requestOptions: RequestOptions): CompletableFuture = list(JobAutomatedListParams.none(), requestOptions) /** @@ -141,7 +141,7 @@ interface AutomatedServiceAsync { * [AutomatedServiceAsync.list]. */ @MustBeClosed - fun list(): CompletableFuture> = + fun list(): CompletableFuture> = list(JobAutomatedListParams.none()) /** @see [list] */ @@ -149,20 +149,20 @@ interface AutomatedServiceAsync { fun list( params: JobAutomatedListParams = JobAutomatedListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** @see [list] */ @MustBeClosed fun list( params: JobAutomatedListParams = JobAutomatedListParams.none() - ): CompletableFuture> = + ): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ @MustBeClosed fun list( requestOptions: RequestOptions - ): CompletableFuture> = + ): CompletableFuture> = list(JobAutomatedListParams.none(), requestOptions) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt index 8c0e34ad..c2ef8bf5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt @@ -17,8 +17,8 @@ import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.AutomatedAsyncJob import com.tryfinch.api.models.AutomatedCreateResponse +import com.tryfinch.api.models.AutomatedListResponse import com.tryfinch.api.models.JobAutomatedCreateParams -import com.tryfinch.api.models.JobAutomatedListPageAsync import com.tryfinch.api.models.JobAutomatedListParams import com.tryfinch.api.models.JobAutomatedRetrieveParams import java.util.concurrent.CompletableFuture @@ -49,7 +49,7 @@ class AutomatedServiceAsyncImpl internal constructor(private val clientOptions: override fun list( params: JobAutomatedListParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // get /jobs/automated withRawResponse().list(params, requestOptions).thenApply { it.parse() } @@ -118,14 +118,14 @@ class AutomatedServiceAsyncImpl internal constructor(private val clientOptions: } } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) override fun list( params: JobAutomatedListParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -144,13 +144,6 @@ class AutomatedServiceAsyncImpl internal constructor(private val clientOptions: it.validate() } } - .let { - JobAutomatedListPageAsync.of( - AutomatedServiceAsyncImpl(clientOptions), - params, - it, - ) - } } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt index 521e2e09..fafcfff9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt @@ -7,8 +7,8 @@ import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.AutomatedAsyncJob import com.tryfinch.api.models.AutomatedCreateResponse +import com.tryfinch.api.models.AutomatedListResponse import com.tryfinch.api.models.JobAutomatedCreateParams -import com.tryfinch.api.models.JobAutomatedListPage import com.tryfinch.api.models.JobAutomatedListParams import com.tryfinch.api.models.JobAutomatedRetrieveParams @@ -66,20 +66,21 @@ interface AutomatedService { * sorted in descending order by submission time. For scheduled jobs such as data syncs, only * the next scheduled job is shown. */ - fun list(): JobAutomatedListPage = list(JobAutomatedListParams.none()) + fun list(): AutomatedListResponse = list(JobAutomatedListParams.none()) /** @see [list] */ fun list( params: JobAutomatedListParams = JobAutomatedListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): JobAutomatedListPage + ): AutomatedListResponse /** @see [list] */ - fun list(params: JobAutomatedListParams = JobAutomatedListParams.none()): JobAutomatedListPage = - list(params, RequestOptions.none()) + fun list( + params: JobAutomatedListParams = JobAutomatedListParams.none() + ): AutomatedListResponse = list(params, RequestOptions.none()) /** @see [list] */ - fun list(requestOptions: RequestOptions): JobAutomatedListPage = + fun list(requestOptions: RequestOptions): AutomatedListResponse = list(JobAutomatedListParams.none(), requestOptions) /** A view of [AutomatedService] that provides access to raw HTTP responses for each method. */ @@ -131,24 +132,24 @@ interface AutomatedService { * [AutomatedService.list]. */ @MustBeClosed - fun list(): HttpResponseFor = list(JobAutomatedListParams.none()) + fun list(): HttpResponseFor = list(JobAutomatedListParams.none()) /** @see [list] */ @MustBeClosed fun list( params: JobAutomatedListParams = JobAutomatedListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor /** @see [list] */ @MustBeClosed fun list( params: JobAutomatedListParams = JobAutomatedListParams.none() - ): HttpResponseFor = list(params, RequestOptions.none()) + ): HttpResponseFor = list(params, RequestOptions.none()) /** @see [list] */ @MustBeClosed - fun list(requestOptions: RequestOptions): HttpResponseFor = + fun list(requestOptions: RequestOptions): HttpResponseFor = list(JobAutomatedListParams.none(), requestOptions) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt index e72e2a74..94dc24f1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt @@ -17,8 +17,8 @@ import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.AutomatedAsyncJob import com.tryfinch.api.models.AutomatedCreateResponse +import com.tryfinch.api.models.AutomatedListResponse import com.tryfinch.api.models.JobAutomatedCreateParams -import com.tryfinch.api.models.JobAutomatedListPage import com.tryfinch.api.models.JobAutomatedListParams import com.tryfinch.api.models.JobAutomatedRetrieveParams @@ -48,7 +48,7 @@ class AutomatedServiceImpl internal constructor(private val clientOptions: Clien override fun list( params: JobAutomatedListParams, requestOptions: RequestOptions, - ): JobAutomatedListPage = + ): AutomatedListResponse = // get /jobs/automated withRawResponse().list(params, requestOptions).parse() @@ -111,14 +111,14 @@ class AutomatedServiceImpl internal constructor(private val clientOptions: Clien } } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) override fun list( params: JobAutomatedListParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -135,9 +135,6 @@ class AutomatedServiceImpl internal constructor(private val clientOptions: Clien it.validate() } } - .let { - JobAutomatedListPage.of(AutomatedServiceImpl(clientOptions), params, it) - } } } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedListResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedListResponseTest.kt new file mode 100644 index 00000000..4eafc3a8 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedListResponseTest.kt @@ -0,0 +1,78 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class AutomatedListResponseTest { + + @Test + fun createAutomatedListResponse() { + val automatedListResponse = + AutomatedListResponse.builder() + .addData( + AutomatedAsyncJob.builder() + .completedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .jobId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .jobUrl("job_url") + .params( + AutomatedAsyncJob.Params.builder().individualId("individual_id").build() + ) + .scheduledAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .startedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .status(AutomatedAsyncJob.Status.PENDING) + .type(AutomatedAsyncJob.Type.DATA_SYNC_ALL) + .build() + ) + .meta( + AutomatedListResponse.Meta.builder() + .quotas( + AutomatedListResponse.Meta.Quotas.builder() + .dataSyncAll( + AutomatedListResponse.Meta.Quotas.DataSyncAll.builder() + .allowedRefreshes(0L) + .remainingRefreshes(0L) + .build() + ) + .build() + ) + .build() + ) + .build() + assertThat(automatedListResponse).isNotNull + assertThat(automatedListResponse.data()) + .containsExactly( + AutomatedAsyncJob.builder() + .completedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .jobId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .jobUrl("job_url") + .params( + AutomatedAsyncJob.Params.builder().individualId("individual_id").build() + ) + .scheduledAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .startedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .status(AutomatedAsyncJob.Status.PENDING) + .type(AutomatedAsyncJob.Type.DATA_SYNC_ALL) + .build() + ) + assertThat(automatedListResponse.meta()) + .isEqualTo( + AutomatedListResponse.Meta.builder() + .quotas( + AutomatedListResponse.Meta.Quotas.builder() + .dataSyncAll( + AutomatedListResponse.Meta.Quotas.DataSyncAll.builder() + .allowedRefreshes(0L) + .remainingRefreshes(0L) + .build() + ) + .build() + ) + .build() + ) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncTest.kt index 305e344f..f8e599de 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncTest.kt @@ -5,6 +5,7 @@ package com.tryfinch.api.services.async.jobs import com.tryfinch.api.TestServerExtension import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync import com.tryfinch.api.models.JobAutomatedCreateParams +import com.tryfinch.api.models.JobAutomatedListParams import com.tryfinch.api.models.JobAutomatedRetrieveParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -63,9 +64,12 @@ class AutomatedServiceAsyncTest { .build() val automatedServiceAsync = client.jobs().automated() - val pageFuture = automatedServiceAsync.list() + val automatedFuture = + automatedServiceAsync.list( + JobAutomatedListParams.builder().limit(0L).offset(0L).build() + ) - val page = pageFuture.get() - page.response().validate() + val automated = automatedFuture.get() + automated.validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt index 087d29b4..c4d92f41 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt @@ -5,6 +5,7 @@ package com.tryfinch.api.services.blocking.jobs import com.tryfinch.api.TestServerExtension import com.tryfinch.api.client.okhttp.FinchOkHttpClient import com.tryfinch.api.models.JobAutomatedCreateParams +import com.tryfinch.api.models.JobAutomatedListParams import com.tryfinch.api.models.JobAutomatedRetrieveParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -59,8 +60,9 @@ class AutomatedServiceTest { .build() val automatedService = client.jobs().automated() - val page = automatedService.list() + val automated = + automatedService.list(JobAutomatedListParams.builder().limit(0L).offset(0L).build()) - page.response().validate() + automated.validate() } } From 651b10e981e1c1e182fce79205176e637930473b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 15 Mar 2025 00:05:40 +0000 Subject: [PATCH 23/65] docs: deduplicate and refine comments (#494) --- .../api/client/okhttp/FinchOkHttpClient.kt | 4 + .../client/okhttp/FinchOkHttpClientAsync.kt | 4 + .../com/tryfinch/api/core/ClientOptions.kt | 4 + .../kotlin/com/tryfinch/api/core/Timeout.kt | 35 +- .../api/models/AccessTokenCreateParams.kt | 128 + .../api/models/AccountCreateResponse.kt | 138 +- .../tryfinch/api/models/AccountUpdateEvent.kt | 2671 +++++++++++++++- .../api/models/AccountUpdateResponse.kt | 122 +- .../tryfinch/api/models/AutomatedAsyncJob.kt | 203 +- .../api/models/AutomatedCreateResponse.kt | 85 +- .../api/models/AutomatedListResponse.kt | 105 +- .../tryfinch/api/models/BaseWebhookEvent.kt | 52 +- .../api/models/BenefitContribution.kt | 50 +- .../models/BenefitFeaturesAndOperations.kt | 214 +- .../tryfinch/api/models/BenefitsSupport.kt | 206 ++ .../kotlin/com/tryfinch/api/models/Company.kt | 445 ++- .../com/tryfinch/api/models/CompanyBenefit.kt | 74 +- .../com/tryfinch/api/models/CompanyEvent.kt | 83 +- .../api/models/CompanyUpdateResponse.kt | 425 ++- .../api/models/ConnectSessionNewParams.kt | 372 ++- .../ConnectSessionReauthenticateParams.kt | 199 +- .../api/models/ConnectionCreateResponse.kt | 154 +- .../api/models/CreateAccessTokenResponse.kt | 207 +- .../models/CreateCompanyBenefitsResponse.kt | 17 + .../com/tryfinch/api/models/DirectoryEvent.kt | 104 +- .../tryfinch/api/models/DisconnectResponse.kt | 21 +- .../api/models/DocumentListResponse.kt | 37 + .../tryfinch/api/models/DocumentResponse.kt | 102 +- .../com/tryfinch/api/models/EmploymentData.kt | 542 +++- .../api/models/EmploymentDataResponse.kt | 48 + .../tryfinch/api/models/EmploymentEvent.kt | 104 +- .../api/models/EmploymentUpdateResponse.kt | 517 +++- .../tryfinch/api/models/EnrolledIndividual.kt | 120 +- .../api/models/HrisBenefitCreateParams.kt | 112 +- ...fitIndividualRetrieveManyBenefitsParams.kt | 5 +- ...HrisBenefitIndividualUnenrollManyParams.kt | 56 +- .../api/models/HrisBenefitUpdateParams.kt | 43 +- .../HrisDirectoryListIndividualsParams.kt | 16 +- .../api/models/HrisDirectoryListParams.kt | 16 +- .../api/models/HrisDocumentListParams.kt | 34 +- .../HrisEmploymentRetrieveManyParams.kt | 73 +- .../HrisIndividualRetrieveManyParams.kt | 114 + .../HrisPayStatementRetrieveManyParams.kt | 118 +- .../kotlin/com/tryfinch/api/models/Income.kt | 92 +- .../com/tryfinch/api/models/Individual.kt | 345 ++- .../tryfinch/api/models/IndividualBenefit.kt | 169 +- .../models/IndividualEnrolledIdsResponse.kt | 38 + .../tryfinch/api/models/IndividualEvent.kt | 104 +- .../api/models/IndividualInDirectory.kt | 207 +- .../tryfinch/api/models/IndividualResponse.kt | 47 + .../api/models/IndividualUpdateResponse.kt | 344 +- .../com/tryfinch/api/models/Introspection.kt | 434 ++- .../api/models/JobAutomatedCreateParams.kt | 96 +- .../api/models/JobAutomatedListParams.kt | 16 +- .../tryfinch/api/models/JobCompletionEvent.kt | 124 +- .../tryfinch/api/models/JobCreateResponse.kt | 85 +- .../com/tryfinch/api/models/Location.kt | 166 +- .../com/tryfinch/api/models/ManualAsyncJob.kt | 59 +- .../kotlin/com/tryfinch/api/models/Money.kt | 44 +- .../api/models/OperationSupportMatrix.kt | 101 +- .../kotlin/com/tryfinch/api/models/Paging.kt | 41 +- .../api/models/PayGroupListResponse.kt | 67 +- .../api/models/PayGroupRetrieveResponse.kt | 88 +- .../com/tryfinch/api/models/PayStatement.kt | 926 +++++- .../tryfinch/api/models/PayStatementEvent.kt | 125 +- .../api/models/PayStatementResponse.kt | 48 + .../api/models/PayStatementResponseBody.kt | 43 +- .../kotlin/com/tryfinch/api/models/Payment.kt | 280 +- .../api/models/PaymentCreateResponse.kt | 42 +- .../com/tryfinch/api/models/PaymentEvent.kt | 125 +- .../api/models/PayrollPayGroupListParams.kt | 7 + .../com/tryfinch/api/models/Provider.kt | 2754 ++++++++++++++++- .../models/RequestForwardingForwardParams.kt | 99 +- .../RequestForwardingForwardResponse.kt | 109 +- .../api/models/SandboxCompanyUpdateParams.kt | 625 +++- .../SandboxConnectionAccountCreateParams.kt | 148 +- .../SandboxConnectionAccountUpdateParams.kt | 35 + .../models/SandboxConnectionCreateParams.kt | 153 +- .../models/SandboxDirectoryCreateParams.kt | 781 ++++- .../models/SandboxEmploymentUpdateParams.kt | 902 +++++- .../models/SandboxIndividualUpdateParams.kt | 589 +++- .../api/models/SandboxJobConfiguration.kt | 32 + .../api/models/SandboxJobCreateParams.kt | 41 +- .../api/models/SandboxPaymentCreateParams.kt | 1047 ++++++- .../tryfinch/api/models/SessionNewResponse.kt | 43 +- .../models/SessionReauthenticateResponse.kt | 43 +- .../api/models/SupportPerBenefitType.kt | 34 + .../tryfinch/api/models/SupportedBenefit.kt | 201 +- .../api/models/UnenrolledIndividual.kt | 121 +- .../models/UpdateCompanyBenefitResponse.kt | 17 + .../kotlin/com/tryfinch/api/models/W42005.kt | 199 +- .../kotlin/com/tryfinch/api/models/W42020.kt | 303 +- 92 files changed, 18360 insertions(+), 2358 deletions(-) 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 aeed980f..9a28cea2 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 @@ -146,20 +146,24 @@ class FinchOkHttpClient private constructor() { fun accessToken(accessToken: String?) = apply { clientOptions.accessToken(accessToken) } + /** Alias for calling [Builder.accessToken] with `accessToken.orElse(null)`. */ fun accessToken(accessToken: Optional) = accessToken(accessToken.getOrNull()) fun clientId(clientId: String?) = apply { clientOptions.clientId(clientId) } + /** Alias for calling [Builder.clientId] with `clientId.orElse(null)`. */ fun clientId(clientId: Optional) = clientId(clientId.getOrNull()) fun clientSecret(clientSecret: String?) = apply { clientOptions.clientSecret(clientSecret) } + /** Alias for calling [Builder.clientSecret] with `clientSecret.orElse(null)`. */ fun clientSecret(clientSecret: Optional) = clientSecret(clientSecret.getOrNull()) fun webhookSecret(webhookSecret: String?) = apply { clientOptions.webhookSecret(webhookSecret) } + /** Alias for calling [Builder.webhookSecret] with `webhookSecret.orElse(null)`. */ fun webhookSecret(webhookSecret: Optional) = webhookSecret(webhookSecret.getOrNull()) 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 6f744be2..c194befb 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 @@ -146,20 +146,24 @@ class FinchOkHttpClientAsync private constructor() { fun accessToken(accessToken: String?) = apply { clientOptions.accessToken(accessToken) } + /** Alias for calling [Builder.accessToken] with `accessToken.orElse(null)`. */ fun accessToken(accessToken: Optional) = accessToken(accessToken.getOrNull()) fun clientId(clientId: String?) = apply { clientOptions.clientId(clientId) } + /** Alias for calling [Builder.clientId] with `clientId.orElse(null)`. */ fun clientId(clientId: Optional) = clientId(clientId.getOrNull()) fun clientSecret(clientSecret: String?) = apply { clientOptions.clientSecret(clientSecret) } + /** Alias for calling [Builder.clientSecret] with `clientSecret.orElse(null)`. */ fun clientSecret(clientSecret: Optional) = clientSecret(clientSecret.getOrNull()) fun webhookSecret(webhookSecret: String?) = apply { clientOptions.webhookSecret(webhookSecret) } + /** Alias for calling [Builder.webhookSecret] with `webhookSecret.orElse(null)`. */ fun webhookSecret(webhookSecret: Optional) = webhookSecret(webhookSecret.getOrNull()) 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 9e700942..f452cccc 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 @@ -110,18 +110,22 @@ private constructor( fun accessToken(accessToken: String?) = apply { this.accessToken = accessToken } + /** Alias for calling [Builder.accessToken] with `accessToken.orElse(null)`. */ fun accessToken(accessToken: Optional) = accessToken(accessToken.getOrNull()) fun clientId(clientId: String?) = apply { this.clientId = clientId } + /** Alias for calling [Builder.clientId] with `clientId.orElse(null)`. */ fun clientId(clientId: Optional) = clientId(clientId.getOrNull()) fun clientSecret(clientSecret: String?) = apply { this.clientSecret = clientSecret } + /** Alias for calling [Builder.clientSecret] with `clientSecret.orElse(null)`. */ fun clientSecret(clientSecret: Optional) = clientSecret(clientSecret.getOrNull()) fun webhookSecret(webhookSecret: String?) = apply { this.webhookSecret = webhookSecret } + /** Alias for calling [Builder.webhookSecret] with `webhookSecret.orElse(null)`. */ fun webhookSecret(webhookSecret: Optional) = webhookSecret(webhookSecret.getOrNull()) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt index fc7d859e..6f5a0f7c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt @@ -90,13 +90,7 @@ private constructor( */ fun connect(connect: Duration?) = apply { this.connect = connect } - /** - * The maximum time allowed to establish a connection with a host. - * - * A value of [Duration.ZERO] means there's no timeout. - * - * Defaults to `Duration.ofMinutes(1)`. - */ + /** Alias for calling [Builder.connect] with `connect.orElse(null)`. */ fun connect(connect: Optional) = connect(connect.getOrNull()) /** @@ -108,13 +102,7 @@ private constructor( */ fun read(read: Duration?) = apply { this.read = read } - /** - * The maximum time allowed between two data packets when waiting for the server’s response. - * - * A value of [Duration.ZERO] means there's no timeout. - * - * Defaults to `request()`. - */ + /** Alias for calling [Builder.read] with `read.orElse(null)`. */ fun read(read: Optional) = read(read.getOrNull()) /** @@ -126,13 +114,7 @@ private constructor( */ fun write(write: Duration?) = apply { this.write = write } - /** - * The maximum time allowed between two data packets when sending the request to the server. - * - * A value of [Duration.ZERO] means there's no timeout. - * - * Defaults to `request()`. - */ + /** Alias for calling [Builder.write] with `write.orElse(null)`. */ fun write(write: Optional) = write(write.getOrNull()) /** @@ -147,16 +129,7 @@ private constructor( */ fun request(request: Duration?) = apply { this.request = request } - /** - * The maximum time allowed for a complete HTTP call, not including retries. - * - * This includes resolving DNS, connecting, writing the request body, server processing, as - * well as reading the response body. - * - * A value of [Duration.ZERO] means there's no timeout. - * - * Defaults to `Duration.ofMinutes(1)`. - */ + /** Alias for calling [Builder.request] with `request.orElse(null)`. */ fun request(request: Optional) = request(request.getOrNull()) fun build(): Timeout = Timeout(connect, read, write, request) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt index 06c2adcc..a799e724 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt @@ -17,6 +17,7 @@ import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional @@ -28,20 +29,56 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { + /** + * @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 code(): String = body.code() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun clientId(): Optional = body.clientId() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun clientSecret(): Optional = body.clientSecret() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun redirectUri(): Optional = body.redirectUri() + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an unexpected type. + */ fun _code(): JsonField = body._code() + /** + * Returns the raw JSON value of [clientId]. + * + * Unlike [clientId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _clientId(): JsonField = body._clientId() + /** + * Returns the raw JSON value of [clientSecret]. + * + * Unlike [clientSecret], this method doesn't throw if the JSON field has an unexpected type. + */ fun _clientSecret(): JsonField = body._clientSecret() + /** + * Returns the raw JSON value of [redirectUri]. + * + * Unlike [redirectUri], this method doesn't throw if the JSON field has an unexpected type. + */ fun _redirectUri(): JsonField = body._redirectUri() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -76,24 +113,61 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @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 code(): String = code.getRequired("code") + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun clientId(): Optional = Optional.ofNullable(clientId.getNullable("client_id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun clientSecret(): Optional = Optional.ofNullable(clientSecret.getNullable("client_secret")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun redirectUri(): Optional = Optional.ofNullable(redirectUri.getNullable("redirect_uri")) + /** + * 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 [clientId]. + * + * Unlike [clientId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("client_id") @ExcludeMissing fun _clientId(): JsonField = clientId + /** + * Returns the raw JSON value of [clientSecret]. + * + * Unlike [clientSecret], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("client_secret") @ExcludeMissing fun _clientSecret(): JsonField = clientSecret + /** + * Returns the raw JSON value of [redirectUri]. + * + * Unlike [redirectUri], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("redirect_uri") @ExcludeMissing fun _redirectUri(): JsonField = redirectUri @@ -151,20 +225,48 @@ private constructor( fun code(code: String) = code(JsonField.of(code)) + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [String] 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 clientId(clientId: String) = clientId(JsonField.of(clientId)) + /** + * Sets [Builder.clientId] to an arbitrary JSON value. + * + * You should usually call [Builder.clientId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun clientId(clientId: JsonField) = apply { this.clientId = clientId } fun clientSecret(clientSecret: String) = clientSecret(JsonField.of(clientSecret)) + /** + * Sets [Builder.clientSecret] to an arbitrary JSON value. + * + * You should usually call [Builder.clientSecret] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun clientSecret(clientSecret: JsonField) = apply { this.clientSecret = clientSecret } fun redirectUri(redirectUri: String) = redirectUri(JsonField.of(redirectUri)) + /** + * Sets [Builder.redirectUri] to an arbitrary JSON value. + * + * You should usually call [Builder.redirectUri] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun redirectUri(redirectUri: JsonField) = apply { this.redirectUri = redirectUri } @@ -248,20 +350,46 @@ private constructor( fun code(code: String) = apply { body.code(code) } + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun code(code: JsonField) = apply { body.code(code) } fun clientId(clientId: String) = apply { body.clientId(clientId) } + /** + * Sets [Builder.clientId] to an arbitrary JSON value. + * + * You should usually call [Builder.clientId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun clientId(clientId: JsonField) = apply { body.clientId(clientId) } fun clientSecret(clientSecret: String) = apply { body.clientSecret(clientSecret) } + /** + * Sets [Builder.clientSecret] to an arbitrary JSON value. + * + * You should usually call [Builder.clientSecret] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun clientSecret(clientSecret: JsonField) = apply { body.clientSecret(clientSecret) } fun redirectUri(redirectUri: String) = apply { body.redirectUri(redirectUri) } + /** + * Sets [Builder.redirectUri] to an arbitrary JSON value. + * + * You should usually call [Builder.redirectUri] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun redirectUri(redirectUri: JsonField) = apply { body.redirectUri(redirectUri) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt index 322dbf3e..9e3f277f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt @@ -47,53 +47,117 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @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 accessToken(): String = accessToken.getRequired("access_token") - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + /** + * [DEPRECATED] Use `connection_id` to associate a connection with an access token + * + * @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). + */ @Deprecated("deprecated") fun accountId(): String = accountId.getRequired("account_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 authenticationType(): AuthenticationType = authenticationType.getRequired("authentication_type") - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + /** + * [DEPRECATED] Use `connection_id` to associate a connection with an access token + * + * @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). + */ @Deprecated("deprecated") fun companyId(): String = companyId.getRequired("company_id") - /** The ID of the new connection */ + /** + * The ID of the new connection + * + * @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 connectionId(): String = connectionId.getRequired("connection_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 products(): List = products.getRequired("products") - /** The ID of the provider associated with the `access_token` */ + /** + * The ID of the provider associated with the `access_token` + * + * @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 providerId(): String = providerId.getRequired("provider_id") + /** + * Returns the raw JSON value of [accessToken]. + * + * Unlike [accessToken], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("access_token") @ExcludeMissing fun _accessToken(): JsonField = accessToken - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + /** + * Returns the raw JSON value of [accountId]. + * + * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. + */ @Deprecated("deprecated") @JsonProperty("account_id") @ExcludeMissing fun _accountId(): JsonField = accountId + /** + * Returns the raw JSON value of [authenticationType]. + * + * Unlike [authenticationType], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("authentication_type") @ExcludeMissing fun _authenticationType(): JsonField = authenticationType - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + /** + * Returns the raw JSON value of [companyId]. + * + * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected type. + */ @Deprecated("deprecated") @JsonProperty("company_id") @ExcludeMissing fun _companyId(): JsonField = companyId - /** The ID of the new connection */ + /** + * Returns the raw JSON value of [connectionId]. + * + * Unlike [connectionId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("connection_id") @ExcludeMissing fun _connectionId(): JsonField = connectionId + /** + * Returns the raw JSON value of [products]. + * + * Unlike [products], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("products") @ExcludeMissing fun _products(): JsonField> = products - /** The ID of the provider associated with the `access_token` */ + /** + * Returns the raw JSON value of [providerId]. + * + * Unlike [providerId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("provider_id") @ExcludeMissing fun _providerId(): JsonField = providerId @JsonAnyGetter @@ -164,19 +228,39 @@ private constructor( fun accessToken(accessToken: String) = accessToken(JsonField.of(accessToken)) + /** + * Sets [Builder.accessToken] to an arbitrary JSON value. + * + * You should usually call [Builder.accessToken] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun accessToken(accessToken: JsonField) = apply { this.accessToken = accessToken } /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ @Deprecated("deprecated") fun accountId(accountId: String) = accountId(JsonField.of(accountId)) - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + /** + * Sets [Builder.accountId] to an arbitrary JSON value. + * + * You should usually call [Builder.accountId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ @Deprecated("deprecated") fun accountId(accountId: JsonField) = apply { this.accountId = accountId } fun authenticationType(authenticationType: AuthenticationType) = authenticationType(JsonField.of(authenticationType)) + /** + * Sets [Builder.authenticationType] to an arbitrary JSON value. + * + * You should usually call [Builder.authenticationType] with a well-typed + * [AuthenticationType] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun authenticationType(authenticationType: JsonField) = apply { this.authenticationType = authenticationType } @@ -185,24 +269,48 @@ private constructor( @Deprecated("deprecated") fun companyId(companyId: String) = companyId(JsonField.of(companyId)) - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + /** + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ @Deprecated("deprecated") fun companyId(companyId: JsonField) = apply { this.companyId = companyId } /** The ID of the new connection */ fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - /** The ID of the new connection */ + /** + * Sets [Builder.connectionId] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun connectionId(connectionId: JsonField) = apply { this.connectionId = connectionId } fun products(products: List) = products(JsonField.of(products)) + /** + * Sets [Builder.products] to an arbitrary JSON value. + * + * You should usually call [Builder.products] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun products(products: JsonField>) = apply { this.products = products.map { it.toMutableList() } } + /** + * Adds a single [String] to [products]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addProduct(product: String) = apply { products = (products ?: JsonField.of(mutableListOf())).also { @@ -213,7 +321,13 @@ private constructor( /** The ID of the provider associated with the `access_token` */ fun providerId(providerId: String) = providerId(JsonField.of(providerId)) - /** The ID of the provider associated with the `access_token` */ + /** + * Sets [Builder.providerId] to an arbitrary JSON value. + * + * You should usually call [Builder.providerId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun providerId(providerId: JsonField) = apply { this.providerId = providerId } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt index e6218257..ebe12c87 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt @@ -43,26 +43,46 @@ private constructor( /** * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. + * + * @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). */ @Deprecated("deprecated") fun accountId(): String = accountId.getRequired("account_id") /** * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. + * + * @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). */ @Deprecated("deprecated") fun companyId(): String = companyId.getRequired("company_id") - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Unique Finch ID of the connection associated with the webhook event. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun connectionId(): Optional = Optional.ofNullable(connectionId.getNullable("connection_id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use - * `connection_id` instead to identify the connection associated with this event. + * Returns the raw JSON value of [accountId]. + * + * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("account_id") @@ -70,21 +90,36 @@ private constructor( fun _accountId(): JsonField = accountId /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use - * `connection_id` instead to identify the connection associated with this event. + * Returns the raw JSON value of [companyId]. + * + * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("company_id") @ExcludeMissing fun _companyId(): JsonField = companyId - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Returns the raw JSON value of [connectionId]. + * + * Unlike [connectionId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("connection_id") @ExcludeMissing fun _connectionId(): JsonField = connectionId + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [eventType]. + * + * Unlike [eventType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType @JsonAnyGetter @@ -157,8 +192,11 @@ private constructor( fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use - * `connection_id` instead to identify the connection associated with this event. + * Sets [Builder.accountId] to an arbitrary JSON value. + * + * You should usually call [Builder.accountId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun accountId(accountId: JsonField) = apply { this.accountId = accountId } @@ -171,8 +209,11 @@ private constructor( fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use - * `connection_id` instead to identify the connection associated with this event. + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun companyId(companyId: JsonField) = apply { this.companyId = companyId } @@ -180,17 +221,36 @@ private constructor( /** Unique Finch ID of the connection associated with the webhook event. */ fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Sets [Builder.connectionId] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun connectionId(connectionId: JsonField) = apply { this.connectionId = connectionId } fun data(data: Data) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Data] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun data(data: JsonField) = apply { this.data = data } fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + /** + * Sets [Builder.eventType] to an arbitrary JSON value. + * + * You should usually call [Builder.eventType] with a well-typed [EventType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun eventType(eventType: JsonField) = apply { this.eventType = eventType } fun additionalProperties(additionalProperties: Map) = apply { @@ -237,15 +297,34 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @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 authenticationMethod(): AuthenticationMethod = authenticationMethod.getRequired("authentication_method") + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ fun status(): ConnectionStatusType = status.getRequired("status") + /** + * Returns the raw JSON value of [authenticationMethod]. + * + * Unlike [authenticationMethod], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("authentication_method") @ExcludeMissing fun _authenticationMethod(): JsonField = authenticationMethod + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status @@ -299,6 +378,13 @@ private constructor( fun authenticationMethod(authenticationMethod: AuthenticationMethod) = authenticationMethod(JsonField.of(authenticationMethod)) + /** + * Sets [Builder.authenticationMethod] to an arbitrary JSON value. + * + * You should usually call [Builder.authenticationMethod] with a well-typed + * [AuthenticationMethod] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun authenticationMethod(authenticationMethod: JsonField) = apply { this.authenticationMethod = authenticationMethod @@ -306,6 +392,13 @@ private constructor( fun status(status: ConnectionStatusType) = status(JsonField.of(status)) + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [ConnectionStatusType] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun status(status: JsonField) = apply { this.status = status } fun additionalProperties(additionalProperties: Map) = apply { @@ -355,31 +448,55 @@ private constructor( /** * Each benefit type and their supported features. If the benefit type is not supported, * the property will be null + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun benefitsSupport(): Optional = Optional.ofNullable(benefitsSupport.getNullable("benefits_support")) - /** The supported data fields returned by our HR and payroll endpoints */ + /** + * The supported data fields returned by our HR and payroll endpoints + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun supportedFields(): Optional = Optional.ofNullable(supportedFields.getNullable("supported_fields")) - /** The type of authentication method. */ + /** + * The type of authentication method. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) /** - * Each benefit type and their supported features. If the benefit type is not supported, - * the property will be null + * Returns the raw JSON value of [benefitsSupport]. + * + * Unlike [benefitsSupport], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("benefits_support") @ExcludeMissing fun _benefitsSupport(): JsonField = benefitsSupport - /** The supported data fields returned by our HR and payroll endpoints */ + /** + * Returns the raw JSON value of [supportedFields]. + * + * Unlike [supportedFields], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("supported_fields") @ExcludeMissing fun _supportedFields(): JsonField = supportedFields - /** The type of authentication method. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -433,15 +550,17 @@ private constructor( benefitsSupport(JsonField.ofNullable(benefitsSupport)) /** - * Each benefit type and their supported features. If the benefit type is not - * supported, the property will be null + * Alias for calling [Builder.benefitsSupport] with `benefitsSupport.orElse(null)`. */ fun benefitsSupport(benefitsSupport: Optional) = benefitsSupport(benefitsSupport.getOrNull()) /** - * Each benefit type and their supported features. If the benefit type is not - * supported, the property will be null + * Sets [Builder.benefitsSupport] to an arbitrary JSON value. + * + * You should usually call [Builder.benefitsSupport] with a well-typed + * [BenefitsSupport] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. */ fun benefitsSupport(benefitsSupport: JsonField) = apply { this.benefitsSupport = benefitsSupport @@ -451,11 +570,19 @@ private constructor( fun supportedFields(supportedFields: SupportedFields?) = supportedFields(JsonField.ofNullable(supportedFields)) - /** The supported data fields returned by our HR and payroll endpoints */ + /** + * Alias for calling [Builder.supportedFields] with `supportedFields.orElse(null)`. + */ fun supportedFields(supportedFields: Optional) = supportedFields(supportedFields.getOrNull()) - /** The supported data fields returned by our HR and payroll endpoints */ + /** + * Sets [Builder.supportedFields] to an arbitrary JSON value. + * + * You should usually call [Builder.supportedFields] with a well-typed + * [SupportedFields] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun supportedFields(supportedFields: JsonField) = apply { this.supportedFields = supportedFields } @@ -463,7 +590,13 @@ private constructor( /** The type of authentication method. */ fun type(type: Type) = type(JsonField.of(type)) - /** The type of authentication method. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -527,51 +660,121 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun company(): Optional = Optional.ofNullable(company.getNullable("company")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun directory(): Optional = Optional.ofNullable(directory.getNullable("directory")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun employment(): Optional = Optional.ofNullable(employment.getNullable("employment")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun individual(): Optional = Optional.ofNullable(individual.getNullable("individual")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun payGroup(): Optional = Optional.ofNullable(payGroup.getNullable("pay_group")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun payStatement(): Optional = Optional.ofNullable(payStatement.getNullable("pay_statement")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun payment(): Optional = Optional.ofNullable(payment.getNullable("payment")) + /** + * Returns the raw JSON value of [company]. + * + * Unlike [company], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("company") @ExcludeMissing fun _company(): JsonField = company + /** + * Returns the raw JSON value of [directory]. + * + * Unlike [directory], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("directory") @ExcludeMissing fun _directory(): JsonField = directory + /** + * Returns the raw JSON value of [employment]. + * + * Unlike [employment], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("employment") @ExcludeMissing fun _employment(): JsonField = employment + /** + * Returns the raw JSON value of [individual]. + * + * Unlike [individual], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("individual") @ExcludeMissing fun _individual(): JsonField = individual + /** + * Returns the raw JSON value of [payGroup]. + * + * Unlike [payGroup], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("pay_group") @ExcludeMissing fun _payGroup(): JsonField = payGroup + /** + * Returns the raw JSON value of [payStatement]. + * + * Unlike [payStatement], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("pay_statement") @ExcludeMissing fun _payStatement(): JsonField = payStatement + /** + * Returns the raw JSON value of [payment]. + * + * Unlike [payment], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("payment") @ExcludeMissing fun _payment(): JsonField = payment @@ -634,6 +837,13 @@ private constructor( fun company(company: SupportedCompanyFields) = company(JsonField.of(company)) + /** + * Sets [Builder.company] to an arbitrary JSON value. + * + * You should usually call [Builder.company] with a well-typed + * [SupportedCompanyFields] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ fun company(company: JsonField) = apply { this.company = company } @@ -641,6 +851,13 @@ private constructor( fun directory(directory: SupportedDirectoryFields) = directory(JsonField.of(directory)) + /** + * Sets [Builder.directory] to an arbitrary JSON value. + * + * You should usually call [Builder.directory] with a well-typed + * [SupportedDirectoryFields] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ fun directory(directory: JsonField) = apply { this.directory = directory } @@ -648,6 +865,13 @@ private constructor( fun employment(employment: SupportedEmploymentFields) = employment(JsonField.of(employment)) + /** + * Sets [Builder.employment] to an arbitrary JSON value. + * + * You should usually call [Builder.employment] with a well-typed + * [SupportedEmploymentFields] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ fun employment(employment: JsonField) = apply { this.employment = employment } @@ -655,6 +879,13 @@ private constructor( fun individual(individual: SupportedIndividualFields) = individual(JsonField.of(individual)) + /** + * Sets [Builder.individual] to an arbitrary JSON value. + * + * You should usually call [Builder.individual] with a well-typed + * [SupportedIndividualFields] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ fun individual(individual: JsonField) = apply { this.individual = individual } @@ -662,6 +893,13 @@ private constructor( fun payGroup(payGroup: SupportedPayGroupFields) = payGroup(JsonField.of(payGroup)) + /** + * Sets [Builder.payGroup] to an arbitrary JSON value. + * + * You should usually call [Builder.payGroup] with a well-typed + * [SupportedPayGroupFields] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ fun payGroup(payGroup: JsonField) = apply { this.payGroup = payGroup } @@ -669,12 +907,26 @@ private constructor( fun payStatement(payStatement: SupportedPayStatementFields) = payStatement(JsonField.of(payStatement)) + /** + * Sets [Builder.payStatement] to an arbitrary JSON value. + * + * You should usually call [Builder.payStatement] with a well-typed + * [SupportedPayStatementFields] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ fun payStatement(payStatement: JsonField) = apply { this.payStatement = payStatement } fun payment(payment: SupportedPaymentFields) = payment(JsonField.of(payment)) + /** + * Sets [Builder.payment] to an arbitrary JSON value. + * + * You should usually call [Builder.payment] with a well-typed + * [SupportedPaymentFields] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ fun payment(payment: JsonField) = apply { this.payment = payment } @@ -749,59 +1001,149 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun accounts(): Optional = Optional.ofNullable(accounts.getNullable("accounts")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun departments(): Optional = Optional.ofNullable(departments.getNullable("departments")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun ein(): Optional = Optional.ofNullable(ein.getNullable("ein")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun entity(): Optional = Optional.ofNullable(entity.getNullable("entity")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun legalName(): Optional = Optional.ofNullable(legalName.getNullable("legal_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun locations(): Optional = Optional.ofNullable(locations.getNullable("locations")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun primaryEmail(): Optional = Optional.ofNullable(primaryEmail.getNullable("primary_email")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun primaryPhoneNumber(): Optional = Optional.ofNullable(primaryPhoneNumber.getNullable("primary_phone_number")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [accounts]. + * + * Unlike [accounts], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("accounts") @ExcludeMissing fun _accounts(): JsonField = accounts + /** + * Returns the raw JSON value of [departments]. + * + * Unlike [departments], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("departments") @ExcludeMissing fun _departments(): JsonField = departments + /** + * Returns the raw JSON value of [ein]. + * + * Unlike [ein], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("ein") @ExcludeMissing fun _ein(): JsonField = ein + /** + * Returns the raw JSON value of [entity]. + * + * Unlike [entity], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("entity") @ExcludeMissing fun _entity(): JsonField = entity + /** + * Returns the raw JSON value of [legalName]. + * + * Unlike [legalName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("legal_name") @ExcludeMissing fun _legalName(): JsonField = legalName + /** + * Returns the raw JSON value of [locations]. + * + * Unlike [locations], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("locations") @ExcludeMissing fun _locations(): JsonField = locations + /** + * Returns the raw JSON value of [primaryEmail]. + * + * Unlike [primaryEmail], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("primary_email") @ExcludeMissing fun _primaryEmail(): JsonField = primaryEmail + /** + * Returns the raw JSON value of [primaryPhoneNumber]. + * + * Unlike [primaryPhoneNumber], this method doesn't throw if the JSON field has + * an unexpected type. + */ @JsonProperty("primary_phone_number") @ExcludeMissing fun _primaryPhoneNumber(): JsonField = primaryPhoneNumber @@ -872,10 +1214,24 @@ private constructor( fun id(id: Boolean) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun accounts(accounts: Accounts) = accounts(JsonField.of(accounts)) + /** + * Sets [Builder.accounts] to an arbitrary JSON value. + * + * You should usually call [Builder.accounts] with a well-typed [Accounts] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun accounts(accounts: JsonField) = apply { this.accounts = accounts } @@ -883,26 +1239,61 @@ private constructor( fun departments(departments: Departments) = departments(JsonField.of(departments)) + /** + * Sets [Builder.departments] to an arbitrary JSON value. + * + * You should usually call [Builder.departments] with a well-typed + * [Departments] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun departments(departments: JsonField) = apply { this.departments = departments } fun ein(ein: Boolean) = ein(JsonField.of(ein)) + /** + * Sets [Builder.ein] to an arbitrary JSON value. + * + * You should usually call [Builder.ein] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun ein(ein: JsonField) = apply { this.ein = ein } fun entity(entity: Entity) = entity(JsonField.of(entity)) + /** + * Sets [Builder.entity] to an arbitrary JSON value. + * + * You should usually call [Builder.entity] with a well-typed [Entity] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun entity(entity: JsonField) = apply { this.entity = entity } fun legalName(legalName: Boolean) = legalName(JsonField.of(legalName)) + /** + * Sets [Builder.legalName] to an arbitrary JSON value. + * + * You should usually call [Builder.legalName] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun legalName(legalName: JsonField) = apply { this.legalName = legalName } fun locations(locations: Locations) = locations(JsonField.of(locations)) + /** + * Sets [Builder.locations] to an arbitrary JSON value. + * + * You should usually call [Builder.locations] with a well-typed [Locations] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun locations(locations: JsonField) = apply { this.locations = locations } @@ -910,6 +1301,13 @@ private constructor( fun primaryEmail(primaryEmail: Boolean) = primaryEmail(JsonField.of(primaryEmail)) + /** + * Sets [Builder.primaryEmail] to an arbitrary JSON value. + * + * You should usually call [Builder.primaryEmail] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun primaryEmail(primaryEmail: JsonField) = apply { this.primaryEmail = primaryEmail } @@ -917,6 +1315,13 @@ private constructor( fun primaryPhoneNumber(primaryPhoneNumber: Boolean) = primaryPhoneNumber(JsonField.of(primaryPhoneNumber)) + /** + * Sets [Builder.primaryPhoneNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.primaryPhoneNumber] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun primaryPhoneNumber(primaryPhoneNumber: JsonField) = apply { this.primaryPhoneNumber = primaryPhoneNumber } @@ -982,37 +1387,87 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun accountName(): Optional = Optional.ofNullable(accountName.getNullable("account_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun accountNumber(): Optional = Optional.ofNullable(accountNumber.getNullable("account_number")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun accountType(): Optional = Optional.ofNullable(accountType.getNullable("account_type")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun institutionName(): Optional = Optional.ofNullable(institutionName.getNullable("institution_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun routingNumber(): Optional = Optional.ofNullable(routingNumber.getNullable("routing_number")) + /** + * Returns the raw JSON value of [accountName]. + * + * Unlike [accountName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("account_name") @ExcludeMissing fun _accountName(): JsonField = accountName + /** + * Returns the raw JSON value of [accountNumber]. + * + * Unlike [accountNumber], this method doesn't throw if the JSON field has + * an unexpected type. + */ @JsonProperty("account_number") @ExcludeMissing fun _accountNumber(): JsonField = accountNumber + /** + * Returns the raw JSON value of [accountType]. + * + * Unlike [accountType], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("account_type") @ExcludeMissing fun _accountType(): JsonField = accountType + /** + * Returns the raw JSON value of [institutionName]. + * + * Unlike [institutionName], this method doesn't throw if the JSON field has + * an unexpected type. + */ @JsonProperty("institution_name") @ExcludeMissing fun _institutionName(): JsonField = institutionName + /** + * Returns the raw JSON value of [routingNumber]. + * + * Unlike [routingNumber], this method doesn't throw if the JSON field has + * an unexpected type. + */ @JsonProperty("routing_number") @ExcludeMissing fun _routingNumber(): JsonField = routingNumber @@ -1070,6 +1525,13 @@ private constructor( fun accountName(accountName: Boolean) = accountName(JsonField.of(accountName)) + /** + * Sets [Builder.accountName] to an arbitrary JSON value. + * + * You should usually call [Builder.accountName] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun accountName(accountName: JsonField) = apply { this.accountName = accountName } @@ -1077,6 +1539,13 @@ private constructor( fun accountNumber(accountNumber: Boolean) = accountNumber(JsonField.of(accountNumber)) + /** + * Sets [Builder.accountNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.accountNumber] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun accountNumber(accountNumber: JsonField) = apply { this.accountNumber = accountNumber } @@ -1084,6 +1553,13 @@ private constructor( fun accountType(accountType: Boolean) = accountType(JsonField.of(accountType)) + /** + * Sets [Builder.accountType] to an arbitrary JSON value. + * + * You should usually call [Builder.accountType] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun accountType(accountType: JsonField) = apply { this.accountType = accountType } @@ -1091,6 +1567,13 @@ private constructor( fun institutionName(institutionName: Boolean) = institutionName(JsonField.of(institutionName)) + /** + * Sets [Builder.institutionName] to an arbitrary JSON value. + * + * You should usually call [Builder.institutionName] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun institutionName(institutionName: JsonField) = apply { this.institutionName = institutionName } @@ -1098,6 +1581,13 @@ private constructor( fun routingNumber(routingNumber: Boolean) = routingNumber(JsonField.of(routingNumber)) + /** + * Sets [Builder.routingNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.routingNumber] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun routingNumber(routingNumber: JsonField) = apply { this.routingNumber = routingNumber } @@ -1168,14 +1658,34 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun parent(): Optional = Optional.ofNullable(parent.getNullable("parent")) + /** + * 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 + /** + * Returns the raw JSON value of [parent]. + * + * Unlike [parent], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("parent") @ExcludeMissing fun _parent(): JsonField = parent @@ -1225,10 +1735,24 @@ private constructor( fun name(name: Boolean) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [Boolean] + * 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 parent(parent: Parent) = parent(JsonField.of(parent)) + /** + * Sets [Builder.parent] to an arbitrary JSON value. + * + * You should usually call [Builder.parent] with a well-typed [Parent] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun parent(parent: JsonField) = apply { this.parent = parent } fun additionalProperties(additionalProperties: Map) = @@ -1269,9 +1793,19 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * 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 @@ -1319,6 +1853,13 @@ private constructor( fun name(name: Boolean) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed + * [Boolean] 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( @@ -1399,16 +1940,36 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [subtype]. + * + * Unlike [subtype], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1454,14 +2015,28 @@ private constructor( fun subtype(subtype: Boolean) = subtype(JsonField.of(subtype)) + /** + * Sets [Builder.subtype] to an arbitrary JSON value. + * + * You should usually call [Builder.subtype] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun subtype(subtype: JsonField) = apply { this.subtype = subtype } fun type(type: Boolean) = type(JsonField.of(type)) - fun type(type: JsonField) = apply { this.type = type } - + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1533,42 +2108,102 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun postalCode(): Optional = Optional.ofNullable(postalCode.getNullable("postal_code")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun state(): Optional = Optional.ofNullable(state.getNullable("state")) + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city + /** + * Returns the raw JSON value of [country]. + * + * Unlike [country], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country + /** + * Returns the raw JSON value of [line1]. + * + * Unlike [line1], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("line1") @ExcludeMissing fun _line1(): JsonField = line1 + /** + * Returns the raw JSON value of [line2]. + * + * Unlike [line2], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("line2") @ExcludeMissing fun _line2(): JsonField = line2 + /** + * Returns the raw JSON value of [postalCode]. + * + * Unlike [postalCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("postal_code") @ExcludeMissing fun _postalCode(): JsonField = postalCode + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state @@ -1629,31 +2264,73 @@ private constructor( fun city(city: Boolean) = city(JsonField.of(city)) + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun city(city: JsonField) = apply { this.city = city } fun country(country: Boolean) = country(JsonField.of(country)) + /** + * Sets [Builder.country] to an arbitrary JSON value. + * + * You should usually call [Builder.country] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun country(country: JsonField) = apply { this.country = country } fun line1(line1: Boolean) = line1(JsonField.of(line1)) + /** + * Sets [Builder.line1] to an arbitrary JSON value. + * + * You should usually call [Builder.line1] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun line1(line1: JsonField) = apply { this.line1 = line1 } fun line2(line2: Boolean) = line2(JsonField.of(line2)) + /** + * Sets [Builder.line2] to an arbitrary JSON value. + * + * You should usually call [Builder.line2] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun line2(line2: JsonField) = apply { this.line2 = line2 } fun postalCode(postalCode: Boolean) = postalCode(JsonField.of(postalCode)) + /** + * Sets [Builder.postalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.postalCode] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } fun state(state: Boolean) = state(JsonField.of(state)) + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun state(state: JsonField) = apply { this.state = state } fun additionalProperties(additionalProperties: Map) = @@ -1740,16 +2417,36 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun individuals(): Optional = Optional.ofNullable(individuals.getNullable("individuals")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) + /** + * Returns the raw JSON value of [individuals]. + * + * Unlike [individuals], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("individuals") @ExcludeMissing fun _individuals(): JsonField = individuals + /** + * Returns the raw JSON value of [paging]. + * + * Unlike [paging], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("paging") @ExcludeMissing fun _paging(): JsonField = paging @@ -1801,12 +2498,26 @@ private constructor( fun individuals(individuals: Individuals) = individuals(JsonField.of(individuals)) + /** + * Sets [Builder.individuals] to an arbitrary JSON value. + * + * You should usually call [Builder.individuals] with a well-typed + * [Individuals] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun individuals(individuals: JsonField) = apply { this.individuals = individuals } fun paging(paging: Paging) = paging(JsonField.of(paging)) + /** + * Sets [Builder.paging] to an arbitrary JSON value. + * + * You should usually call [Builder.paging] with a well-typed [Paging] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun paging(paging: JsonField) = apply { this.paging = paging } fun additionalProperties(additionalProperties: Map) = @@ -1869,48 +2580,118 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun department(): Optional = Optional.ofNullable(department.getNullable("department")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [department]. + * + * Unlike [department], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("department") @ExcludeMissing fun _department(): JsonField = department + /** + * Returns the raw JSON value of [firstName]. + * + * Unlike [firstName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName + /** + * Returns the raw JSON value of [isActive]. + * + * Unlike [isActive], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("is_active") @ExcludeMissing fun _isActive(): JsonField = isActive + /** + * Returns the raw JSON value of [lastName]. + * + * Unlike [lastName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName + /** + * Returns the raw JSON value of [manager]. + * + * Unlike [manager], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("manager") @ExcludeMissing fun _manager(): JsonField = manager + /** + * Returns the raw JSON value of [middleName]. + * + * Unlike [middleName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("middle_name") @ExcludeMissing fun _middleName(): JsonField = middleName @@ -1975,35 +2756,77 @@ private constructor( fun id(id: Boolean) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun department(department: Boolean) = department(JsonField.of(department)) + /** + * Sets [Builder.department] to an arbitrary JSON value. + * + * You should usually call [Builder.department] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun department(department: JsonField) = apply { this.department = department } fun firstName(firstName: Boolean) = firstName(JsonField.of(firstName)) + /** + * Sets [Builder.firstName] to an arbitrary JSON value. + * + * You should usually call [Builder.firstName] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) + /** + * Sets [Builder.isActive] to an arbitrary JSON value. + * + * You should usually call [Builder.isActive] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun isActive(isActive: JsonField) = apply { this.isActive = isActive } fun lastName(lastName: Boolean) = lastName(JsonField.of(lastName)) + /** + * Sets [Builder.lastName] to an arbitrary JSON value. + * + * You should usually call [Builder.lastName] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } fun manager(manager: Manager) = manager(JsonField.of(manager)) + /** + * Sets [Builder.manager] to an arbitrary JSON value. + * + * You should usually call [Builder.manager] with a well-typed [Manager] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun manager(manager: JsonField) = apply { this.manager = manager } @@ -2011,6 +2834,13 @@ private constructor( fun middleName(middleName: Boolean) = middleName(JsonField.of(middleName)) + /** + * Sets [Builder.middleName] to an arbitrary JSON value. + * + * You should usually call [Builder.middleName] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } @@ -2062,8 +2892,18 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id @JsonAnyGetter @@ -2109,6 +2949,13 @@ private constructor( fun id(id: Boolean) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun additionalProperties( @@ -2189,16 +3036,36 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun count(): Optional = Optional.ofNullable(count.getNullable("count")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun offset(): Optional = Optional.ofNullable(offset.getNullable("offset")) + /** + * Returns the raw JSON value of [count]. + * + * Unlike [count], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("count") @ExcludeMissing fun _count(): JsonField = count + /** + * Returns the raw JSON value of [offset]. + * + * Unlike [offset], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("offset") @ExcludeMissing fun _offset(): JsonField = offset @@ -2246,10 +3113,24 @@ private constructor( fun count(count: Boolean) = count(JsonField.of(count)) + /** + * Sets [Builder.count] to an arbitrary JSON value. + * + * You should usually call [Builder.count] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun count(count: JsonField) = apply { this.count = count } fun offset(offset: Boolean) = offset(JsonField.of(offset)) + /** + * Sets [Builder.offset] to an arbitrary JSON value. + * + * You should usually call [Builder.offset] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun offset(offset: JsonField) = apply { this.offset = offset } fun additionalProperties(additionalProperties: Map) = @@ -2373,117 +3254,287 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun classCode(): Optional = Optional.ofNullable(classCode.getNullable("class_code")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun customFields(): Optional = Optional.ofNullable(customFields.getNullable("custom_fields")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun department(): Optional = Optional.ofNullable(department.getNullable("department")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun employment(): Optional = Optional.ofNullable(employment.getNullable("employment")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun employmentStatus(): Optional = Optional.ofNullable(employmentStatus.getNullable("employment_status")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun income(): Optional = Optional.ofNullable(income.getNullable("income")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun incomeHistory(): Optional = Optional.ofNullable(incomeHistory.getNullable("income_history")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun location(): Optional = Optional.ofNullable(location.getNullable("location")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun title(): Optional = Optional.ofNullable(title.getNullable("title")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [classCode]. + * + * Unlike [classCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("class_code") @ExcludeMissing fun _classCode(): JsonField = classCode + /** + * Returns the raw JSON value of [customFields]. + * + * Unlike [customFields], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("custom_fields") @ExcludeMissing fun _customFields(): JsonField = customFields + /** + * Returns the raw JSON value of [department]. + * + * Unlike [department], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("department") @ExcludeMissing fun _department(): JsonField = department + /** + * Returns the raw JSON value of [employment]. + * + * Unlike [employment], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("employment") @ExcludeMissing fun _employment(): JsonField = employment + /** + * Returns the raw JSON value of [employmentStatus]. + * + * Unlike [employmentStatus], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("employment_status") @ExcludeMissing fun _employmentStatus(): JsonField = employmentStatus + /** + * Returns the raw JSON value of [endDate]. + * + * Unlike [endDate], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("end_date") @ExcludeMissing fun _endDate(): JsonField = endDate + /** + * Returns the raw JSON value of [firstName]. + * + * Unlike [firstName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName + /** + * Returns the raw JSON value of [income]. + * + * Unlike [income], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("income") @ExcludeMissing fun _income(): JsonField = income + /** + * Returns the raw JSON value of [incomeHistory]. + * + * Unlike [incomeHistory], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("income_history") @ExcludeMissing fun _incomeHistory(): JsonField = incomeHistory + /** + * Returns the raw JSON value of [isActive]. + * + * Unlike [isActive], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("is_active") @ExcludeMissing fun _isActive(): JsonField = isActive + /** + * Returns the raw JSON value of [lastName]. + * + * Unlike [lastName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName + /** + * Returns the raw JSON value of [location]. + * + * Unlike [location], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("location") @ExcludeMissing fun _location(): JsonField = location + /** + * Returns the raw JSON value of [manager]. + * + * Unlike [manager], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("manager") @ExcludeMissing fun _manager(): JsonField = manager + /** + * Returns the raw JSON value of [middleName]. + * + * Unlike [middleName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("middle_name") @ExcludeMissing fun _middleName(): JsonField = middleName + /** + * Returns the raw JSON value of [startDate]. + * + * Unlike [startDate], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("start_date") @ExcludeMissing fun _startDate(): JsonField = startDate + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title @JsonAnyGetter @@ -2577,10 +3628,24 @@ private constructor( fun id(id: Boolean) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun classCode(classCode: Boolean) = classCode(JsonField.of(classCode)) + /** + * Sets [Builder.classCode] to an arbitrary JSON value. + * + * You should usually call [Builder.classCode] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun classCode(classCode: JsonField) = apply { this.classCode = classCode } @@ -2588,6 +3653,13 @@ private constructor( fun customFields(customFields: Boolean) = customFields(JsonField.of(customFields)) + /** + * Sets [Builder.customFields] to an arbitrary JSON value. + * + * You should usually call [Builder.customFields] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun customFields(customFields: JsonField) = apply { this.customFields = customFields } @@ -2595,6 +3667,13 @@ private constructor( fun department(department: Department) = department(JsonField.of(department)) + /** + * Sets [Builder.department] to an arbitrary JSON value. + * + * You should usually call [Builder.department] with a well-typed + * [Department] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun department(department: JsonField) = apply { this.department = department } @@ -2602,6 +3681,13 @@ private constructor( fun employment(employment: Employment) = employment(JsonField.of(employment)) + /** + * Sets [Builder.employment] to an arbitrary JSON value. + * + * You should usually call [Builder.employment] with a well-typed + * [Employment] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun employment(employment: JsonField) = apply { this.employment = employment } @@ -2609,67 +3695,151 @@ private constructor( fun employmentStatus(employmentStatus: Boolean) = employmentStatus(JsonField.of(employmentStatus)) + /** + * Sets [Builder.employmentStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.employmentStatus] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun employmentStatus(employmentStatus: JsonField) = apply { this.employmentStatus = employmentStatus } fun endDate(endDate: Boolean) = endDate(JsonField.of(endDate)) + /** + * Sets [Builder.endDate] to an arbitrary JSON value. + * + * You should usually call [Builder.endDate] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } fun firstName(firstName: Boolean) = firstName(JsonField.of(firstName)) + /** + * Sets [Builder.firstName] to an arbitrary JSON value. + * + * You should usually call [Builder.firstName] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } fun income(income: Income) = income(JsonField.of(income)) + /** + * Sets [Builder.income] to an arbitrary JSON value. + * + * You should usually call [Builder.income] with a well-typed [Income] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun income(income: JsonField) = apply { this.income = income } fun incomeHistory(incomeHistory: Boolean) = incomeHistory(JsonField.of(incomeHistory)) + /** + * Sets [Builder.incomeHistory] to an arbitrary JSON value. + * + * You should usually call [Builder.incomeHistory] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun incomeHistory(incomeHistory: JsonField) = apply { this.incomeHistory = incomeHistory } fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) + /** + * Sets [Builder.isActive] to an arbitrary JSON value. + * + * You should usually call [Builder.isActive] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun isActive(isActive: JsonField) = apply { this.isActive = isActive } fun lastName(lastName: Boolean) = lastName(JsonField.of(lastName)) + /** + * Sets [Builder.lastName] to an arbitrary JSON value. + * + * You should usually call [Builder.lastName] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } fun location(location: Location) = location(JsonField.of(location)) + /** + * Sets [Builder.location] to an arbitrary JSON value. + * + * You should usually call [Builder.location] with a well-typed [Location] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun location(location: JsonField) = apply { this.location = location } fun manager(manager: Manager) = manager(JsonField.of(manager)) + /** + * Sets [Builder.manager] to an arbitrary JSON value. + * + * You should usually call [Builder.manager] with a well-typed [Manager] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun manager(manager: JsonField) = apply { this.manager = manager } fun middleName(middleName: Boolean) = middleName(JsonField.of(middleName)) + /** + * Sets [Builder.middleName] to an arbitrary JSON value. + * + * You should usually call [Builder.middleName] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } fun startDate(startDate: Boolean) = startDate(JsonField.of(startDate)) + /** + * Sets [Builder.startDate] to an arbitrary JSON value. + * + * You should usually call [Builder.startDate] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun startDate(startDate: JsonField) = apply { this.startDate = startDate } fun title(title: Boolean) = title(JsonField.of(title)) + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun title(title: JsonField) = apply { this.title = title } fun additionalProperties(additionalProperties: Map) = @@ -2729,9 +3899,19 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * 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 @JsonAnyGetter @@ -2776,6 +3956,13 @@ private constructor( fun name(name: Boolean) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [Boolean] + * 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) = @@ -2837,16 +4024,36 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [subtype]. + * + * Unlike [subtype], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -2894,12 +4101,26 @@ private constructor( fun subtype(subtype: Boolean) = subtype(JsonField.of(subtype)) + /** + * Sets [Builder.subtype] to an arbitrary JSON value. + * + * You should usually call [Builder.subtype] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun subtype(subtype: JsonField) = apply { this.subtype = subtype } fun type(type: Boolean) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -2964,23 +4185,53 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun unit(): Optional = Optional.ofNullable(unit.getNullable("unit")) + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + /** + * Returns the raw JSON value of [unit]. + * + * Unlike [unit], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("unit") @ExcludeMissing fun _unit(): JsonField = unit @JsonAnyGetter @@ -3029,16 +4280,37 @@ private constructor( fun amount(amount: Boolean) = amount(JsonField.of(amount)) + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } fun currency(currency: Boolean) = currency(JsonField.of(currency)) + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } fun unit(unit: Boolean) = unit(JsonField.of(unit)) + /** + * Sets [Builder.unit] to an arbitrary JSON value. + * + * You should usually call [Builder.unit] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun unit(unit: JsonField) = apply { this.unit = unit } fun additionalProperties(additionalProperties: Map) = @@ -3112,42 +4384,102 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun postalCode(): Optional = Optional.ofNullable(postalCode.getNullable("postal_code")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun state(): Optional = Optional.ofNullable(state.getNullable("state")) + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city + /** + * Returns the raw JSON value of [country]. + * + * Unlike [country], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country + /** + * Returns the raw JSON value of [line1]. + * + * Unlike [line1], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("line1") @ExcludeMissing fun _line1(): JsonField = line1 + /** + * Returns the raw JSON value of [line2]. + * + * Unlike [line2], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("line2") @ExcludeMissing fun _line2(): JsonField = line2 + /** + * Returns the raw JSON value of [postalCode]. + * + * Unlike [postalCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("postal_code") @ExcludeMissing fun _postalCode(): JsonField = postalCode + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state @@ -3207,31 +4539,73 @@ private constructor( fun city(city: Boolean) = city(JsonField.of(city)) + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun city(city: JsonField) = apply { this.city = city } fun country(country: Boolean) = country(JsonField.of(country)) + /** + * Sets [Builder.country] to an arbitrary JSON value. + * + * You should usually call [Builder.country] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun country(country: JsonField) = apply { this.country = country } fun line1(line1: Boolean) = line1(JsonField.of(line1)) + /** + * Sets [Builder.line1] to an arbitrary JSON value. + * + * You should usually call [Builder.line1] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun line1(line1: JsonField) = apply { this.line1 = line1 } fun line2(line2: Boolean) = line2(JsonField.of(line2)) + /** + * Sets [Builder.line2] to an arbitrary JSON value. + * + * You should usually call [Builder.line2] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun line2(line2: JsonField) = apply { this.line2 = line2 } fun postalCode(postalCode: Boolean) = postalCode(JsonField.of(postalCode)) + /** + * Sets [Builder.postalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.postalCode] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } fun state(state: Boolean) = state(JsonField.of(state)) + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun state(state: JsonField) = apply { this.state = state } fun additionalProperties(additionalProperties: Map) = @@ -3298,8 +4672,18 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id @JsonAnyGetter @@ -3342,6 +4726,13 @@ private constructor( fun id(id: Boolean) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun additionalProperties(additionalProperties: Map) = @@ -3452,86 +4843,216 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun emails(): Optional = Optional.ofNullable(emails.getNullable("emails")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun encryptedSsn(): Optional = Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun ethnicity(): Optional = Optional.ofNullable(ethnicity.getNullable("ethnicity")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun gender(): Optional = Optional.ofNullable(gender.getNullable("gender")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun phoneNumbers(): Optional = Optional.ofNullable(phoneNumbers.getNullable("phone_numbers")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun preferredName(): Optional = Optional.ofNullable(preferredName.getNullable("preferred_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun residence(): Optional = Optional.ofNullable(residence.getNullable("residence")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [dob]. + * + * Unlike [dob], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("dob") @ExcludeMissing fun _dob(): JsonField = dob + /** + * Returns the raw JSON value of [emails]. + * + * Unlike [emails], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("emails") @ExcludeMissing fun _emails(): JsonField = emails + /** + * Returns the raw JSON value of [encryptedSsn]. + * + * Unlike [encryptedSsn], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("encrypted_ssn") @ExcludeMissing fun _encryptedSsn(): JsonField = encryptedSsn + /** + * Returns the raw JSON value of [ethnicity]. + * + * Unlike [ethnicity], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("ethnicity") @ExcludeMissing fun _ethnicity(): JsonField = ethnicity + /** + * Returns the raw JSON value of [firstName]. + * + * Unlike [firstName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName + /** + * Returns the raw JSON value of [gender]. + * + * Unlike [gender], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("gender") @ExcludeMissing fun _gender(): JsonField = gender + /** + * Returns the raw JSON value of [lastName]. + * + * Unlike [lastName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName + /** + * Returns the raw JSON value of [middleName]. + * + * Unlike [middleName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("middle_name") @ExcludeMissing fun _middleName(): JsonField = middleName + /** + * Returns the raw JSON value of [phoneNumbers]. + * + * Unlike [phoneNumbers], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("phone_numbers") @ExcludeMissing fun _phoneNumbers(): JsonField = phoneNumbers + /** + * Returns the raw JSON value of [preferredName]. + * + * Unlike [preferredName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("preferred_name") @ExcludeMissing fun _preferredName(): JsonField = preferredName + /** + * Returns the raw JSON value of [residence]. + * + * Unlike [residence], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("residence") @ExcludeMissing fun _residence(): JsonField = residence + /** + * Returns the raw JSON value of [ssn]. + * + * Unlike [ssn], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("ssn") @ExcludeMissing fun _ssn(): JsonField = ssn @JsonAnyGetter @@ -3613,47 +5134,110 @@ private constructor( fun id(id: Boolean) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun dob(dob: Boolean) = dob(JsonField.of(dob)) + /** + * Sets [Builder.dob] to an arbitrary JSON value. + * + * You should usually call [Builder.dob] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun dob(dob: JsonField) = apply { this.dob = dob } fun emails(emails: Emails) = emails(JsonField.of(emails)) + /** + * Sets [Builder.emails] to an arbitrary JSON value. + * + * You should usually call [Builder.emails] with a well-typed [Emails] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun emails(emails: JsonField) = apply { this.emails = emails } fun encryptedSsn(encryptedSsn: Boolean) = encryptedSsn(JsonField.of(encryptedSsn)) + /** + * Sets [Builder.encryptedSsn] to an arbitrary JSON value. + * + * You should usually call [Builder.encryptedSsn] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun encryptedSsn(encryptedSsn: JsonField) = apply { this.encryptedSsn = encryptedSsn } fun ethnicity(ethnicity: Boolean) = ethnicity(JsonField.of(ethnicity)) + /** + * Sets [Builder.ethnicity] to an arbitrary JSON value. + * + * You should usually call [Builder.ethnicity] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun ethnicity(ethnicity: JsonField) = apply { this.ethnicity = ethnicity } fun firstName(firstName: Boolean) = firstName(JsonField.of(firstName)) + /** + * Sets [Builder.firstName] to an arbitrary JSON value. + * + * You should usually call [Builder.firstName] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } fun gender(gender: Boolean) = gender(JsonField.of(gender)) + /** + * Sets [Builder.gender] to an arbitrary JSON value. + * + * You should usually call [Builder.gender] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun gender(gender: JsonField) = apply { this.gender = gender } fun lastName(lastName: Boolean) = lastName(JsonField.of(lastName)) + /** + * Sets [Builder.lastName] to an arbitrary JSON value. + * + * You should usually call [Builder.lastName] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } fun middleName(middleName: Boolean) = middleName(JsonField.of(middleName)) + /** + * Sets [Builder.middleName] to an arbitrary JSON value. + * + * You should usually call [Builder.middleName] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } @@ -3661,6 +5245,13 @@ private constructor( fun phoneNumbers(phoneNumbers: PhoneNumbers) = phoneNumbers(JsonField.of(phoneNumbers)) + /** + * Sets [Builder.phoneNumbers] to an arbitrary JSON value. + * + * You should usually call [Builder.phoneNumbers] with a well-typed + * [PhoneNumbers] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun phoneNumbers(phoneNumbers: JsonField) = apply { this.phoneNumbers = phoneNumbers } @@ -3668,18 +5259,39 @@ private constructor( fun preferredName(preferredName: Boolean) = preferredName(JsonField.of(preferredName)) + /** + * Sets [Builder.preferredName] to an arbitrary JSON value. + * + * You should usually call [Builder.preferredName] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun preferredName(preferredName: JsonField) = apply { this.preferredName = preferredName } fun residence(residence: Residence) = residence(JsonField.of(residence)) + /** + * Sets [Builder.residence] to an arbitrary JSON value. + * + * You should usually call [Builder.residence] with a well-typed [Residence] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun residence(residence: JsonField) = apply { this.residence = residence } fun ssn(ssn: Boolean) = ssn(JsonField.of(ssn)) + /** + * Sets [Builder.ssn] to an arbitrary JSON value. + * + * You should usually call [Builder.ssn] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun ssn(ssn: JsonField) = apply { this.ssn = ssn } fun additionalProperties(additionalProperties: Map) = @@ -3738,14 +5350,34 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -3791,10 +5423,24 @@ private constructor( fun data(data: Boolean) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun data(data: JsonField) = apply { this.data = data } fun type(type: Boolean) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -3856,14 +5502,34 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -3911,10 +5577,24 @@ private constructor( fun data(data: Boolean) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun data(data: JsonField) = apply { this.data = data } fun type(type: Boolean) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -3988,42 +5668,102 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun postalCode(): Optional = Optional.ofNullable(postalCode.getNullable("postal_code")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun state(): Optional = Optional.ofNullable(state.getNullable("state")) + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city + /** + * Returns the raw JSON value of [country]. + * + * Unlike [country], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country + /** + * Returns the raw JSON value of [line1]. + * + * Unlike [line1], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("line1") @ExcludeMissing fun _line1(): JsonField = line1 + /** + * Returns the raw JSON value of [line2]. + * + * Unlike [line2], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("line2") @ExcludeMissing fun _line2(): JsonField = line2 + /** + * Returns the raw JSON value of [postalCode]. + * + * Unlike [postalCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("postal_code") @ExcludeMissing fun _postalCode(): JsonField = postalCode + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state @@ -4084,31 +5824,73 @@ private constructor( fun city(city: Boolean) = city(JsonField.of(city)) + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun city(city: JsonField) = apply { this.city = city } fun country(country: Boolean) = country(JsonField.of(country)) + /** + * Sets [Builder.country] to an arbitrary JSON value. + * + * You should usually call [Builder.country] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun country(country: JsonField) = apply { this.country = country } fun line1(line1: Boolean) = line1(JsonField.of(line1)) + /** + * Sets [Builder.line1] to an arbitrary JSON value. + * + * You should usually call [Builder.line1] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun line1(line1: JsonField) = apply { this.line1 = line1 } fun line2(line2: Boolean) = line2(JsonField.of(line2)) + /** + * Sets [Builder.line2] to an arbitrary JSON value. + * + * You should usually call [Builder.line2] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun line2(line2: JsonField) = apply { this.line2 = line2 } fun postalCode(postalCode: Boolean) = postalCode(JsonField.of(postalCode)) + /** + * Sets [Builder.postalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.postalCode] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } fun state(state: Boolean) = state(JsonField.of(state)) + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun state(state: JsonField) = apply { this.state = state } fun additionalProperties(additionalProperties: Map) = @@ -4201,24 +5983,64 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun individualIds(): Optional = Optional.ofNullable(individualIds.getNullable("individual_ids")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun payFrequencies(): Optional = Optional.ofNullable(payFrequencies.getNullable("pay_frequencies")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [individualIds]. + * + * Unlike [individualIds], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("individual_ids") @ExcludeMissing fun _individualIds(): JsonField = individualIds + /** + * 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 + /** + * Returns the raw JSON value of [payFrequencies]. + * + * Unlike [payFrequencies], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("pay_frequencies") @ExcludeMissing fun _payFrequencies(): JsonField = payFrequencies @@ -4275,22 +6097,50 @@ private constructor( fun id(id: Boolean) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun individualIds(individualIds: Boolean) = individualIds(JsonField.of(individualIds)) + /** + * Sets [Builder.individualIds] to an arbitrary JSON value. + * + * You should usually call [Builder.individualIds] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun individualIds(individualIds: JsonField) = apply { this.individualIds = individualIds } fun name(name: Boolean) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [Boolean] 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 payFrequencies(payFrequencies: Boolean) = payFrequencies(JsonField.of(payFrequencies)) + /** + * Sets [Builder.payFrequencies] to an arbitrary JSON value. + * + * You should usually call [Builder.payFrequencies] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun payFrequencies(payFrequencies: JsonField) = apply { this.payFrequencies = payFrequencies } @@ -4359,16 +6209,36 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun payStatements(): Optional = Optional.ofNullable(payStatements.getNullable("pay_statements")) + /** + * Returns the raw JSON value of [paging]. + * + * Unlike [paging], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("paging") @ExcludeMissing fun _paging(): JsonField = paging + /** + * Returns the raw JSON value of [payStatements]. + * + * Unlike [payStatements], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("pay_statements") @ExcludeMissing fun _payStatements(): JsonField = payStatements @@ -4420,11 +6290,25 @@ private constructor( fun paging(paging: Paging) = paging(JsonField.of(paging)) + /** + * Sets [Builder.paging] to an arbitrary JSON value. + * + * You should usually call [Builder.paging] with a well-typed [Paging] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun paging(paging: JsonField) = apply { this.paging = paging } fun payStatements(payStatements: PayStatements) = payStatements(JsonField.of(payStatements)) + /** + * Sets [Builder.payStatements] to an arbitrary JSON value. + * + * You should usually call [Builder.payStatements] with a well-typed + * [PayStatements] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun payStatements(payStatements: JsonField) = apply { this.payStatements = payStatements } @@ -4474,14 +6358,36 @@ private constructor( immutableEmptyMap(), ) { + /** + * @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 count(): Boolean = count.getRequired("count") + /** + * @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 offset(): Boolean = offset.getRequired("offset") + /** + * Returns the raw JSON value of [count]. + * + * Unlike [count], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("count") @ExcludeMissing fun _count(): JsonField = count + /** + * Returns the raw JSON value of [offset]. + * + * Unlike [offset], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("offset") @ExcludeMissing fun _offset(): JsonField = offset @@ -4535,10 +6441,24 @@ private constructor( fun count(count: Boolean) = count(JsonField.of(count)) + /** + * Sets [Builder.count] to an arbitrary JSON value. + * + * You should usually call [Builder.count] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun count(count: JsonField) = apply { this.count = count } fun offset(offset: Boolean) = offset(JsonField.of(offset)) + /** + * Sets [Builder.offset] to an arbitrary JSON value. + * + * You should usually call [Builder.offset] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun offset(offset: JsonField) = apply { this.offset = offset } fun additionalProperties(additionalProperties: Map) = @@ -4630,78 +6550,178 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun earnings(): Optional = Optional.ofNullable(earnings.getNullable("earnings")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun employeeDeductions(): Optional = Optional.ofNullable( employeeDeductions.getNullable("employee_deductions") ) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun employerContributions(): Optional = Optional.ofNullable( employerContributions.getNullable("employer_contributions") ) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun grossPay(): Optional = Optional.ofNullable(grossPay.getNullable("gross_pay")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("individual_id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun netPay(): Optional = Optional.ofNullable(netPay.getNullable("net_pay")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun paymentMethod(): Optional = Optional.ofNullable(paymentMethod.getNullable("payment_method")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun taxes(): Optional = Optional.ofNullable(taxes.getNullable("taxes")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun totalHours(): Optional = Optional.ofNullable(totalHours.getNullable("total_hours")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [earnings]. + * + * Unlike [earnings], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("earnings") @ExcludeMissing fun _earnings(): JsonField = earnings + /** + * Returns the raw JSON value of [employeeDeductions]. + * + * Unlike [employeeDeductions], this method doesn't throw if the JSON field + * has an unexpected type. + */ @JsonProperty("employee_deductions") @ExcludeMissing fun _employeeDeductions(): JsonField = employeeDeductions + /** + * Returns the raw JSON value of [employerContributions]. + * + * Unlike [employerContributions], this method doesn't throw if the JSON + * field has an unexpected type. + */ @JsonProperty("employer_contributions") @ExcludeMissing fun _employerContributions(): JsonField = employerContributions + /** + * Returns the raw JSON value of [grossPay]. + * + * Unlike [grossPay], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("gross_pay") @ExcludeMissing fun _grossPay(): JsonField = grossPay + /** + * 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 + /** + * Returns the raw JSON value of [netPay]. + * + * Unlike [netPay], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("net_pay") @ExcludeMissing fun _netPay(): JsonField = netPay + /** + * Returns the raw JSON value of [paymentMethod]. + * + * Unlike [paymentMethod], this method doesn't throw if the JSON field has + * an unexpected type. + */ @JsonProperty("payment_method") @ExcludeMissing fun _paymentMethod(): JsonField = paymentMethod + /** + * Returns the raw JSON value of [taxes]. + * + * Unlike [taxes], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("taxes") @ExcludeMissing fun _taxes(): JsonField = taxes + /** + * Returns the raw JSON value of [totalHours]. + * + * Unlike [totalHours], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("total_hours") @ExcludeMissing fun _totalHours(): JsonField = totalHours + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -4775,6 +6795,13 @@ private constructor( fun earnings(earnings: Earnings) = earnings(JsonField.of(earnings)) + /** + * Sets [Builder.earnings] to an arbitrary JSON value. + * + * You should usually call [Builder.earnings] with a well-typed + * [Earnings] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun earnings(earnings: JsonField) = apply { this.earnings = earnings } @@ -4782,6 +6809,14 @@ private constructor( fun employeeDeductions(employeeDeductions: EmployeeDeductions) = employeeDeductions(JsonField.of(employeeDeductions)) + /** + * Sets [Builder.employeeDeductions] to an arbitrary JSON value. + * + * You should usually call [Builder.employeeDeductions] with a + * well-typed [EmployeeDeductions] value instead. This method is + * primarily for setting the field to an undocumented or not yet + * supported value. + */ fun employeeDeductions( employeeDeductions: JsonField ) = apply { this.employeeDeductions = employeeDeductions } @@ -4790,12 +6825,27 @@ private constructor( employerContributions: EmployerContributions ) = employerContributions(JsonField.of(employerContributions)) + /** + * Sets [Builder.employerContributions] to an arbitrary JSON value. + * + * You should usually call [Builder.employerContributions] with a + * well-typed [EmployerContributions] value instead. This method is + * primarily for setting the field to an undocumented or not yet + * supported value. + */ fun employerContributions( employerContributions: JsonField ) = apply { this.employerContributions = employerContributions } fun grossPay(grossPay: Boolean) = grossPay(JsonField.of(grossPay)) + /** + * Sets [Builder.grossPay] to an arbitrary JSON value. + * + * You should usually call [Builder.grossPay] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun grossPay(grossPay: JsonField) = apply { this.grossPay = grossPay } @@ -4803,34 +6853,76 @@ private constructor( fun individualId(individualId: Boolean) = individualId(JsonField.of(individualId)) + /** + * Sets [Builder.individualId] to an arbitrary JSON value. + * + * You should usually call [Builder.individualId] with a well-typed + * [Boolean] 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 netPay(netPay: Boolean) = netPay(JsonField.of(netPay)) + /** + * Sets [Builder.netPay] to an arbitrary JSON value. + * + * You should usually call [Builder.netPay] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun netPay(netPay: JsonField) = apply { this.netPay = netPay } fun paymentMethod(paymentMethod: Boolean) = paymentMethod(JsonField.of(paymentMethod)) + /** + * Sets [Builder.paymentMethod] to an arbitrary JSON value. + * + * You should usually call [Builder.paymentMethod] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun paymentMethod(paymentMethod: JsonField) = apply { this.paymentMethod = paymentMethod } fun taxes(taxes: Taxes) = taxes(JsonField.of(taxes)) + /** + * Sets [Builder.taxes] to an arbitrary JSON value. + * + * You should usually call [Builder.taxes] with a well-typed [Taxes] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun taxes(taxes: JsonField) = apply { this.taxes = taxes } fun totalHours(totalHours: Boolean) = totalHours(JsonField.of(totalHours)) + /** + * Sets [Builder.totalHours] to an arbitrary JSON value. + * + * You should usually call [Builder.totalHours] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun totalHours(totalHours: JsonField) = apply { this.totalHours = totalHours } fun type(type: Boolean) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -4892,30 +6984,70 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @@ -4972,22 +7104,50 @@ private constructor( fun amount(amount: Boolean) = amount(JsonField.of(amount)) + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } fun currency(currency: Boolean) = currency(JsonField.of(currency)) + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } fun name(name: Boolean) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed + * [Boolean] 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 type(type: Boolean) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties( @@ -5065,37 +7225,87 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun preTax(): Optional = Optional.ofNullable(preTax.getNullable("pre_tax")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [preTax]. + * + * Unlike [preTax], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("pre_tax") @ExcludeMissing fun _preTax(): JsonField = preTax + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @@ -5155,28 +7365,63 @@ private constructor( fun amount(amount: Boolean) = amount(JsonField.of(amount)) + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } fun currency(currency: Boolean) = currency(JsonField.of(currency)) + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } fun name(name: Boolean) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed + * [Boolean] 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 preTax(preTax: Boolean) = preTax(JsonField.of(preTax)) + /** + * Sets [Builder.preTax] to an arbitrary JSON value. + * + * You should usually call [Builder.preTax] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun preTax(preTax: JsonField) = apply { this.preTax = preTax } fun type(type: Boolean) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties( @@ -5249,23 +7494,53 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name @@ -5321,18 +7596,39 @@ private constructor( fun amount(amount: Boolean) = amount(JsonField.of(amount)) + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } fun currency(currency: Boolean) = currency(JsonField.of(currency)) + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } fun name(name: Boolean) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed + * [Boolean] 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( @@ -5409,37 +7705,87 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun employer(): Optional = Optional.ofNullable(employer.getNullable("employer")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + /** + * Returns the raw JSON value of [employer]. + * + * Unlike [employer], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("employer") @ExcludeMissing fun _employer(): JsonField = employer + /** + * 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 + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @@ -5498,28 +7844,63 @@ private constructor( fun amount(amount: Boolean) = amount(JsonField.of(amount)) + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } fun currency(currency: Boolean) = currency(JsonField.of(currency)) + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } fun employer(employer: Boolean) = employer(JsonField.of(employer)) + /** + * Sets [Builder.employer] to an arbitrary JSON value. + * + * You should usually call [Builder.employer] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun employer(employer: JsonField) = apply { this.employer = employer } fun name(name: Boolean) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed + * [Boolean] 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 type(type: Boolean) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties( @@ -5654,83 +8035,203 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun companyDebit(): Optional = Optional.ofNullable(companyDebit.getNullable("company_debit")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun debitDate(): Optional = Optional.ofNullable(debitDate.getNullable("debit_date")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun employeeTaxes(): Optional = Optional.ofNullable(employeeTaxes.getNullable("employee_taxes")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun employerTaxes(): Optional = Optional.ofNullable(employerTaxes.getNullable("employer_taxes")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun grossPay(): Optional = Optional.ofNullable(grossPay.getNullable("gross_pay")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun individualIds(): Optional = Optional.ofNullable(individualIds.getNullable("individual_ids")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun netPay(): Optional = Optional.ofNullable(netPay.getNullable("net_pay")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun payDate(): Optional = Optional.ofNullable(payDate.getNullable("pay_date")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun payFrequencies(): Optional = Optional.ofNullable(payFrequencies.getNullable("pay_frequencies")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun payGroupIds(): Optional = Optional.ofNullable(payGroupIds.getNullable("pay_group_ids")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun payPeriod(): Optional = Optional.ofNullable(payPeriod.getNullable("pay_period")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [companyDebit]. + * + * Unlike [companyDebit], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("company_debit") @ExcludeMissing fun _companyDebit(): JsonField = companyDebit + /** + * Returns the raw JSON value of [debitDate]. + * + * Unlike [debitDate], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("debit_date") @ExcludeMissing fun _debitDate(): JsonField = debitDate + /** + * Returns the raw JSON value of [employeeTaxes]. + * + * Unlike [employeeTaxes], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("employee_taxes") @ExcludeMissing fun _employeeTaxes(): JsonField = employeeTaxes + /** + * Returns the raw JSON value of [employerTaxes]. + * + * Unlike [employerTaxes], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("employer_taxes") @ExcludeMissing fun _employerTaxes(): JsonField = employerTaxes + /** + * Returns the raw JSON value of [grossPay]. + * + * Unlike [grossPay], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("gross_pay") @ExcludeMissing fun _grossPay(): JsonField = grossPay + /** + * Returns the raw JSON value of [individualIds]. + * + * Unlike [individualIds], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("individual_ids") @ExcludeMissing fun _individualIds(): JsonField = individualIds + /** + * Returns the raw JSON value of [netPay]. + * + * Unlike [netPay], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("net_pay") @ExcludeMissing fun _netPay(): JsonField = netPay + /** + * Returns the raw JSON value of [payDate]. + * + * Unlike [payDate], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("pay_date") @ExcludeMissing fun _payDate(): JsonField = payDate + /** + * Returns the raw JSON value of [payFrequencies]. + * + * Unlike [payFrequencies], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("pay_frequencies") @ExcludeMissing fun _payFrequencies(): JsonField = payFrequencies + /** + * Returns the raw JSON value of [payGroupIds]. + * + * Unlike [payGroupIds], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("pay_group_ids") @ExcludeMissing fun _payGroupIds(): JsonField = payGroupIds + /** + * Returns the raw JSON value of [payPeriod]. + * + * Unlike [payPeriod], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("pay_period") @ExcludeMissing fun _payPeriod(): JsonField = payPeriod @@ -5810,17 +8311,38 @@ private constructor( fun id(id: Boolean) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun companyDebit(companyDebit: Boolean) = companyDebit(JsonField.of(companyDebit)) + /** + * Sets [Builder.companyDebit] to an arbitrary JSON value. + * + * You should usually call [Builder.companyDebit] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun companyDebit(companyDebit: JsonField) = apply { this.companyDebit = companyDebit } fun debitDate(debitDate: Boolean) = debitDate(JsonField.of(debitDate)) + /** + * Sets [Builder.debitDate] to an arbitrary JSON value. + * + * You should usually call [Builder.debitDate] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun debitDate(debitDate: JsonField) = apply { this.debitDate = debitDate } @@ -5828,6 +8350,13 @@ private constructor( fun employeeTaxes(employeeTaxes: Boolean) = employeeTaxes(JsonField.of(employeeTaxes)) + /** + * Sets [Builder.employeeTaxes] to an arbitrary JSON value. + * + * You should usually call [Builder.employeeTaxes] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun employeeTaxes(employeeTaxes: JsonField) = apply { this.employeeTaxes = employeeTaxes } @@ -5835,12 +8364,26 @@ private constructor( fun employerTaxes(employerTaxes: Boolean) = employerTaxes(JsonField.of(employerTaxes)) + /** + * Sets [Builder.employerTaxes] to an arbitrary JSON value. + * + * You should usually call [Builder.employerTaxes] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun employerTaxes(employerTaxes: JsonField) = apply { this.employerTaxes = employerTaxes } fun grossPay(grossPay: Boolean) = grossPay(JsonField.of(grossPay)) + /** + * Sets [Builder.grossPay] to an arbitrary JSON value. + * + * You should usually call [Builder.grossPay] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun grossPay(grossPay: JsonField) = apply { this.grossPay = grossPay } @@ -5848,21 +8391,49 @@ private constructor( fun individualIds(individualIds: Boolean) = individualIds(JsonField.of(individualIds)) + /** + * Sets [Builder.individualIds] to an arbitrary JSON value. + * + * You should usually call [Builder.individualIds] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun individualIds(individualIds: JsonField) = apply { this.individualIds = individualIds } fun netPay(netPay: Boolean) = netPay(JsonField.of(netPay)) + /** + * Sets [Builder.netPay] to an arbitrary JSON value. + * + * You should usually call [Builder.netPay] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun netPay(netPay: JsonField) = apply { this.netPay = netPay } fun payDate(payDate: Boolean) = payDate(JsonField.of(payDate)) + /** + * Sets [Builder.payDate] to an arbitrary JSON value. + * + * You should usually call [Builder.payDate] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun payDate(payDate: JsonField) = apply { this.payDate = payDate } fun payFrequencies(payFrequencies: Boolean) = payFrequencies(JsonField.of(payFrequencies)) + /** + * Sets [Builder.payFrequencies] to an arbitrary JSON value. + * + * You should usually call [Builder.payFrequencies] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun payFrequencies(payFrequencies: JsonField) = apply { this.payFrequencies = payFrequencies } @@ -5870,12 +8441,26 @@ private constructor( fun payGroupIds(payGroupIds: Boolean) = payGroupIds(JsonField.of(payGroupIds)) + /** + * Sets [Builder.payGroupIds] to an arbitrary JSON value. + * + * You should usually call [Builder.payGroupIds] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun payGroupIds(payGroupIds: JsonField) = apply { this.payGroupIds = payGroupIds } fun payPeriod(payPeriod: PayPeriod) = payPeriod(JsonField.of(payPeriod)) + /** + * Sets [Builder.payPeriod] to an arbitrary JSON value. + * + * You should usually call [Builder.payPeriod] with a well-typed [PayPeriod] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun payPeriod(payPeriod: JsonField) = apply { this.payPeriod = payPeriod } @@ -5935,16 +8520,36 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) + /** + * Returns the raw JSON value of [endDate]. + * + * Unlike [endDate], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("end_date") @ExcludeMissing fun _endDate(): JsonField = endDate + /** + * Returns the raw JSON value of [startDate]. + * + * Unlike [startDate], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("start_date") @ExcludeMissing fun _startDate(): JsonField = startDate @@ -5993,12 +8598,26 @@ private constructor( fun endDate(endDate: Boolean) = endDate(JsonField.of(endDate)) + /** + * Sets [Builder.endDate] to an arbitrary JSON value. + * + * You should usually call [Builder.endDate] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } fun startDate(startDate: Boolean) = startDate(JsonField.of(startDate)) + /** + * Sets [Builder.startDate] to an arbitrary JSON value. + * + * You should usually call [Builder.startDate] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun startDate(startDate: JsonField) = apply { this.startDate = startDate } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt index bb19c19a..b1f3a0a2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt @@ -45,46 +45,101 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + /** + * [DEPRECATED] Use `connection_id` to associate a connection with an access token + * + * @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). + */ @Deprecated("deprecated") fun accountId(): String = accountId.getRequired("account_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 authenticationType(): AuthenticationType = authenticationType.getRequired("authentication_type") - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + /** + * [DEPRECATED] Use `connection_id` to associate a connection with an access token + * + * @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). + */ @Deprecated("deprecated") fun companyId(): String = companyId.getRequired("company_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 products(): List = products.getRequired("products") - /** The ID of the provider associated with the `access_token` */ + /** + * The ID of the provider associated with the `access_token` + * + * @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 providerId(): String = providerId.getRequired("provider_id") - /** The ID of the new connection */ + /** + * The ID of the new connection + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun connectionId(): Optional = Optional.ofNullable(connectionId.getNullable("connection_id")) - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + /** + * Returns the raw JSON value of [accountId]. + * + * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. + */ @Deprecated("deprecated") @JsonProperty("account_id") @ExcludeMissing fun _accountId(): JsonField = accountId + /** + * Returns the raw JSON value of [authenticationType]. + * + * Unlike [authenticationType], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("authentication_type") @ExcludeMissing fun _authenticationType(): JsonField = authenticationType - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + /** + * Returns the raw JSON value of [companyId]. + * + * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected type. + */ @Deprecated("deprecated") @JsonProperty("company_id") @ExcludeMissing fun _companyId(): JsonField = companyId + /** + * Returns the raw JSON value of [products]. + * + * Unlike [products], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("products") @ExcludeMissing fun _products(): JsonField> = products - /** The ID of the provider associated with the `access_token` */ + /** + * Returns the raw JSON value of [providerId]. + * + * Unlike [providerId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("provider_id") @ExcludeMissing fun _providerId(): JsonField = providerId - /** The ID of the new connection */ + /** + * Returns the raw JSON value of [connectionId]. + * + * Unlike [connectionId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("connection_id") @ExcludeMissing fun _connectionId(): JsonField = connectionId @@ -154,13 +209,26 @@ private constructor( @Deprecated("deprecated") fun accountId(accountId: String) = accountId(JsonField.of(accountId)) - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + /** + * Sets [Builder.accountId] to an arbitrary JSON value. + * + * You should usually call [Builder.accountId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ @Deprecated("deprecated") fun accountId(accountId: JsonField) = apply { this.accountId = accountId } fun authenticationType(authenticationType: AuthenticationType) = authenticationType(JsonField.of(authenticationType)) + /** + * Sets [Builder.authenticationType] to an arbitrary JSON value. + * + * You should usually call [Builder.authenticationType] with a well-typed + * [AuthenticationType] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun authenticationType(authenticationType: JsonField) = apply { this.authenticationType = authenticationType } @@ -169,16 +237,34 @@ private constructor( @Deprecated("deprecated") fun companyId(companyId: String) = companyId(JsonField.of(companyId)) - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + /** + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ @Deprecated("deprecated") fun companyId(companyId: JsonField) = apply { this.companyId = companyId } fun products(products: List) = products(JsonField.of(products)) + /** + * Sets [Builder.products] to an arbitrary JSON value. + * + * You should usually call [Builder.products] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun products(products: JsonField>) = apply { this.products = products.map { it.toMutableList() } } + /** + * Adds a single [String] to [products]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addProduct(product: String) = apply { products = (products ?: JsonField.of(mutableListOf())).also { @@ -189,13 +275,25 @@ private constructor( /** The ID of the provider associated with the `access_token` */ fun providerId(providerId: String) = providerId(JsonField.of(providerId)) - /** The ID of the provider associated with the `access_token` */ + /** + * Sets [Builder.providerId] to an arbitrary JSON value. + * + * You should usually call [Builder.providerId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun providerId(providerId: JsonField) = apply { this.providerId = providerId } /** The ID of the new connection */ fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - /** The ID of the new connection */ + /** + * Sets [Builder.connectionId] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun connectionId(connectionId: JsonField) = apply { this.connectionId = connectionId } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt index 03b3230b..8bfc5dfd 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt @@ -51,79 +51,150 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The datetime the job completed. */ + /** + * The datetime the job completed. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun completedAt(): Optional = Optional.ofNullable(completedAt.getNullable("completed_at")) /** * The datetime when the job was created. for scheduled jobs, this will be the initial * connection time. For ad-hoc jobs, this will be the time the creation request was received. + * + * @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 createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - /** The id of the job that has been created. */ + /** + * The id of the job that has been created. + * + * @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") - /** The url that can be used to retrieve the job status */ + /** + * The url that can be used to retrieve the job status + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly + * missing or null (e.g. if the server responded with an unexpected value). + */ fun jobUrl(): String = jobUrl.getRequired("job_url") - /** The input parameters for the job. */ + /** + * The input parameters for the job. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun params(): Optional = Optional.ofNullable(params.getNullable("params")) /** * The datetime a job is scheduled to be run. For scheduled jobs, this datetime can be in the * future if the job has not yet been enqueued. For ad-hoc jobs, this field will be null. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun scheduledAt(): Optional = Optional.ofNullable(scheduledAt.getNullable("scheduled_at")) - /** The datetime a job entered into the job queue. */ + /** + * The datetime a job entered into the job queue. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun startedAt(): Optional = Optional.ofNullable(startedAt.getNullable("started_at")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly + * missing or null (e.g. if the server responded with an unexpected value). + */ fun status(): Status = status.getRequired("status") - /** The type of automated job */ + /** + * The type of automated job + * + * @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 type(): Type = type.getRequired("type") - /** The datetime the job completed. */ + /** + * Returns the raw JSON value of [completedAt]. + * + * Unlike [completedAt], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("completed_at") @ExcludeMissing fun _completedAt(): JsonField = completedAt /** - * The datetime when the job was created. for scheduled jobs, this will be the initial - * connection time. For ad-hoc jobs, this will be the time the creation request was received. + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("created_at") @ExcludeMissing fun _createdAt(): JsonField = createdAt - /** The id of the job that has been created. */ + /** + * 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 - /** The url that can be used to retrieve the job status */ + /** + * Returns the raw JSON value of [jobUrl]. + * + * Unlike [jobUrl], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("job_url") @ExcludeMissing fun _jobUrl(): JsonField = jobUrl - /** The input parameters for the job. */ + /** + * Returns the raw JSON value of [params]. + * + * Unlike [params], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("params") @ExcludeMissing fun _params(): JsonField = params /** - * The datetime a job is scheduled to be run. For scheduled jobs, this datetime can be in the - * future if the job has not yet been enqueued. For ad-hoc jobs, this field will be null. + * Returns the raw JSON value of [scheduledAt]. + * + * Unlike [scheduledAt], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("scheduled_at") @ExcludeMissing fun _scheduledAt(): JsonField = scheduledAt - /** The datetime a job entered into the job queue. */ + /** + * Returns the raw JSON value of [startedAt]. + * + * Unlike [startedAt], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("started_at") @ExcludeMissing fun _startedAt(): JsonField = startedAt + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - /** The type of automated job */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -204,11 +275,17 @@ private constructor( fun completedAt(completedAt: OffsetDateTime?) = completedAt(JsonField.ofNullable(completedAt)) - /** The datetime the job completed. */ + /** Alias for calling [Builder.completedAt] with `completedAt.orElse(null)`. */ fun completedAt(completedAt: Optional) = completedAt(completedAt.getOrNull()) - /** The datetime the job completed. */ + /** + * Sets [Builder.completedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.completedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun completedAt(completedAt: JsonField) = apply { this.completedAt = completedAt } @@ -221,31 +298,48 @@ private constructor( fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) /** - * The datetime when the job was created. for scheduled jobs, this will be the initial - * connection time. For ad-hoc jobs, this will be the time the creation request was - * received. + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } /** The id of the job that has been created. */ fun jobId(jobId: String) = jobId(JsonField.of(jobId)) - /** The id of the job that has been created. */ + /** + * 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 } /** The url that can be used to retrieve the job status */ fun jobUrl(jobUrl: String) = jobUrl(JsonField.of(jobUrl)) - /** The url that can be used to retrieve the job status */ + /** + * Sets [Builder.jobUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.jobUrl] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun jobUrl(jobUrl: JsonField) = apply { this.jobUrl = jobUrl } /** The input parameters for the job. */ fun params(params: Params?) = params(JsonField.ofNullable(params)) - /** The input parameters for the job. */ + /** Alias for calling [Builder.params] with `params.orElse(null)`. */ fun params(params: Optional) = params(params.getOrNull()) - /** The input parameters for the job. */ + /** + * Sets [Builder.params] to an arbitrary JSON value. + * + * You should usually call [Builder.params] with a well-typed [Params] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun params(params: JsonField) = apply { this.params = params } /** @@ -256,18 +350,16 @@ private constructor( fun scheduledAt(scheduledAt: OffsetDateTime?) = scheduledAt(JsonField.ofNullable(scheduledAt)) - /** - * The datetime a job is scheduled to be run. For scheduled jobs, this datetime can be in - * the future if the job has not yet been enqueued. For ad-hoc jobs, this field will - * be null. - */ + /** Alias for calling [Builder.scheduledAt] with `scheduledAt.orElse(null)`. */ fun scheduledAt(scheduledAt: Optional) = scheduledAt(scheduledAt.getOrNull()) /** - * The datetime a job is scheduled to be run. For scheduled jobs, this datetime can be in - * the future if the job has not yet been enqueued. For ad-hoc jobs, this field will - * be null. + * Sets [Builder.scheduledAt] to an arbitrary JSON value. + * + * You should usually call [Builder.scheduledAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun scheduledAt(scheduledAt: JsonField) = apply { this.scheduledAt = scheduledAt @@ -276,20 +368,37 @@ private constructor( /** The datetime a job entered into the job queue. */ fun startedAt(startedAt: OffsetDateTime?) = startedAt(JsonField.ofNullable(startedAt)) - /** The datetime a job entered into the job queue. */ + /** Alias for calling [Builder.startedAt] with `startedAt.orElse(null)`. */ fun startedAt(startedAt: Optional) = startedAt(startedAt.getOrNull()) - /** The datetime a job entered into the job queue. */ + /** + * Sets [Builder.startedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.startedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun startedAt(startedAt: JsonField) = apply { this.startedAt = startedAt } fun status(status: Status) = status(JsonField.of(status)) + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun status(status: JsonField) = apply { this.status = status } /** The type of automated job */ fun type(type: Type) = type(JsonField.of(type)) - /** The type of automated job */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -338,11 +447,21 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The ID of the individual that the job was completed for. */ + /** + * The ID of the individual that the job was completed for. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("individual_id")) - /** The ID of the individual that the job was completed for. */ + /** + * 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 @@ -385,7 +504,13 @@ private constructor( /** The ID of the individual that the job was completed for. */ fun individualId(individualId: String) = individualId(JsonField.of(individualId)) - /** The ID of the individual that the job was completed for. */ + /** + * 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 } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt index 50ee28d7..b469d6c3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt @@ -14,6 +14,7 @@ import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @NoAutoDetect @@ -33,30 +34,68 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The number of allowed refreshes per hour (per hour, fixed window) */ + /** + * The number of allowed refreshes per hour (per hour, fixed window) + * + * @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 allowedRefreshes(): Long = allowedRefreshes.getRequired("allowed_refreshes") - /** The id of the job that has been created. */ + /** + * The id of the job that has been created. + * + * @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") - /** The url that can be used to retrieve the job status */ + /** + * The url that can be used to retrieve the job status + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly + * missing or null (e.g. if the server responded with an unexpected value). + */ fun jobUrl(): String = jobUrl.getRequired("job_url") - /** The number of remaining refreshes available (per hour, fixed window) */ + /** + * The number of remaining refreshes available (per hour, fixed window) + * + * @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 remainingRefreshes(): Long = remainingRefreshes.getRequired("remaining_refreshes") - /** The number of allowed refreshes per hour (per hour, fixed window) */ + /** + * Returns the raw JSON value of [allowedRefreshes]. + * + * Unlike [allowedRefreshes], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("allowed_refreshes") @ExcludeMissing fun _allowedRefreshes(): JsonField = allowedRefreshes - /** The id of the job that has been created. */ + /** + * 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 - /** The url that can be used to retrieve the job status */ + /** + * Returns the raw JSON value of [jobUrl]. + * + * Unlike [jobUrl], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("job_url") @ExcludeMissing fun _jobUrl(): JsonField = jobUrl - /** The number of remaining refreshes available (per hour, fixed window) */ + /** + * Returns the raw JSON value of [remainingRefreshes]. + * + * Unlike [remainingRefreshes], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("remaining_refreshes") @ExcludeMissing fun _remainingRefreshes(): JsonField = remainingRefreshes @@ -119,7 +158,13 @@ private constructor( fun allowedRefreshes(allowedRefreshes: Long) = allowedRefreshes(JsonField.of(allowedRefreshes)) - /** The number of allowed refreshes per hour (per hour, fixed window) */ + /** + * Sets [Builder.allowedRefreshes] to an arbitrary JSON value. + * + * You should usually call [Builder.allowedRefreshes] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun allowedRefreshes(allowedRefreshes: JsonField) = apply { this.allowedRefreshes = allowedRefreshes } @@ -127,20 +172,36 @@ private constructor( /** The id of the job that has been created. */ fun jobId(jobId: String) = jobId(JsonField.of(jobId)) - /** The id of the job that has been created. */ + /** + * 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 } /** The url that can be used to retrieve the job status */ fun jobUrl(jobUrl: String) = jobUrl(JsonField.of(jobUrl)) - /** The url that can be used to retrieve the job status */ + /** + * Sets [Builder.jobUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.jobUrl] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun jobUrl(jobUrl: JsonField) = apply { this.jobUrl = jobUrl } /** The number of remaining refreshes available (per hour, fixed window) */ fun remainingRefreshes(remainingRefreshes: Long) = remainingRefreshes(JsonField.of(remainingRefreshes)) - /** The number of remaining refreshes available (per hour, fixed window) */ + /** + * Sets [Builder.remainingRefreshes] to an arbitrary JSON value. + * + * You should usually call [Builder.remainingRefreshes] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun remainingRefreshes(remainingRefreshes: JsonField) = apply { this.remainingRefreshes = remainingRefreshes } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt index ee18fbbf..512ffa21 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt @@ -15,6 +15,7 @@ import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional @@ -29,12 +30,30 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @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 data(): List = data.getRequired("data") + /** + * @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 meta(): Meta = meta.getRequired("meta") + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField> = data + /** + * Returns the raw JSON value of [meta]. + * + * Unlike [meta], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("meta") @ExcludeMissing fun _meta(): JsonField = meta @JsonAnyGetter @@ -85,10 +104,22 @@ private constructor( fun data(data: List) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun data(data: JsonField>) = apply { this.data = data.map { it.toMutableList() } } + /** + * Adds a single [AutomatedAsyncJob] to [Builder.data]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addData(data: AutomatedAsyncJob) = apply { this.data = (this.data ?: JsonField.of(mutableListOf())).also { @@ -98,6 +129,12 @@ private constructor( fun meta(meta: Meta) = meta(JsonField.of(meta)) + /** + * Sets [Builder.meta] to an arbitrary JSON value. + * + * You should usually call [Builder.meta] with a well-typed [Meta] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun meta(meta: JsonField) = apply { this.meta = meta } fun additionalProperties(additionalProperties: Map) = apply { @@ -142,13 +179,16 @@ private constructor( * Information about remaining quotas for this connection. Only applicable for customers * opted in to use Finch's Data Sync Refresh endpoint (`POST /jobs/automated`). Please * contact a Finch representative for more details. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun quotas(): Optional = Optional.ofNullable(quotas.getNullable("quotas")) /** - * Information about remaining quotas for this connection. Only applicable for customers - * opted in to use Finch's Data Sync Refresh endpoint (`POST /jobs/automated`). Please - * contact a Finch representative for more details. + * Returns the raw JSON value of [quotas]. + * + * Unlike [quotas], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("quotas") @ExcludeMissing fun _quotas(): JsonField = quotas @@ -195,9 +235,11 @@ private constructor( fun quotas(quotas: Quotas) = quotas(JsonField.of(quotas)) /** - * Information about remaining quotas for this connection. Only applicable for customers - * opted in to use Finch's Data Sync Refresh endpoint (`POST /jobs/automated`). Please - * contact a Finch representative for more details. + * Sets [Builder.quotas] to an arbitrary JSON value. + * + * You should usually call [Builder.quotas] with a well-typed [Quotas] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun quotas(quotas: JsonField) = apply { this.quotas = quotas } @@ -239,9 +281,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun dataSyncAll(): Optional = Optional.ofNullable(dataSyncAll.getNullable("data_sync_all")) + /** + * Returns the raw JSON value of [dataSyncAll]. + * + * Unlike [dataSyncAll], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("data_sync_all") @ExcludeMissing fun _dataSyncAll(): JsonField = dataSyncAll @@ -283,6 +335,13 @@ private constructor( fun dataSyncAll(dataSyncAll: DataSyncAll) = dataSyncAll(JsonField.of(dataSyncAll)) + /** + * Sets [Builder.dataSyncAll] to an arbitrary JSON value. + * + * You should usually call [Builder.dataSyncAll] with a well-typed [DataSyncAll] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun dataSyncAll(dataSyncAll: JsonField) = apply { this.dataSyncAll = dataSyncAll } @@ -326,16 +385,36 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun allowedRefreshes(): Optional = Optional.ofNullable(allowedRefreshes.getNullable("allowed_refreshes")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun remainingRefreshes(): Optional = Optional.ofNullable(remainingRefreshes.getNullable("remaining_refreshes")) + /** + * Returns the raw JSON value of [allowedRefreshes]. + * + * Unlike [allowedRefreshes], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("allowed_refreshes") @ExcludeMissing fun _allowedRefreshes(): JsonField = allowedRefreshes + /** + * Returns the raw JSON value of [remainingRefreshes]. + * + * Unlike [remainingRefreshes], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("remaining_refreshes") @ExcludeMissing fun _remainingRefreshes(): JsonField = remainingRefreshes @@ -381,6 +460,13 @@ private constructor( fun allowedRefreshes(allowedRefreshes: Long) = allowedRefreshes(JsonField.of(allowedRefreshes)) + /** + * Sets [Builder.allowedRefreshes] to an arbitrary JSON value. + * + * You should usually call [Builder.allowedRefreshes] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun allowedRefreshes(allowedRefreshes: JsonField) = apply { this.allowedRefreshes = allowedRefreshes } @@ -388,6 +474,13 @@ private constructor( fun remainingRefreshes(remainingRefreshes: Long) = remainingRefreshes(JsonField.of(remainingRefreshes)) + /** + * Sets [Builder.remainingRefreshes] to an arbitrary JSON value. + * + * You should usually call [Builder.remainingRefreshes] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun remainingRefreshes(remainingRefreshes: JsonField) = apply { this.remainingRefreshes = remainingRefreshes } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt index 9c4a9990..2553c147 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt @@ -14,6 +14,7 @@ import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional @@ -36,22 +37,34 @@ private constructor( /** * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. + * + * @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). */ @Deprecated("deprecated") fun accountId(): String = accountId.getRequired("account_id") /** * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. + * + * @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). */ @Deprecated("deprecated") fun companyId(): String = companyId.getRequired("company_id") - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Unique Finch ID of the connection associated with the webhook event. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun connectionId(): Optional = Optional.ofNullable(connectionId.getNullable("connection_id")) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use - * `connection_id` instead to identify the connection associated with this event. + * Returns the raw JSON value of [accountId]. + * + * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("account_id") @@ -59,15 +72,20 @@ private constructor( fun _accountId(): JsonField = accountId /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use - * `connection_id` instead to identify the connection associated with this event. + * Returns the raw JSON value of [companyId]. + * + * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("company_id") @ExcludeMissing fun _companyId(): JsonField = companyId - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Returns the raw JSON value of [connectionId]. + * + * Unlike [connectionId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("connection_id") @ExcludeMissing fun _connectionId(): JsonField = connectionId @@ -129,8 +147,11 @@ private constructor( fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use - * `connection_id` instead to identify the connection associated with this event. + * Sets [Builder.accountId] to an arbitrary JSON value. + * + * You should usually call [Builder.accountId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun accountId(accountId: JsonField) = apply { this.accountId = accountId } @@ -143,8 +164,11 @@ private constructor( fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use - * `connection_id` instead to identify the connection associated with this event. + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun companyId(companyId: JsonField) = apply { this.companyId = companyId } @@ -152,7 +176,13 @@ private constructor( /** Unique Finch ID of the connection associated with the webhook event. */ fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Sets [Builder.connectionId] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun connectionId(connectionId: JsonField) = apply { this.connectionId = connectionId } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt index 0be9d94f..8884c95d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt @@ -28,16 +28,34 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Contribution amount in cents (if `fixed`) or basis points (if `percent`). */ + /** + * Contribution amount in cents (if `fixed`) or basis points (if `percent`). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) - /** Contribution type. */ + /** + * Contribution type. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** Contribution amount in cents (if `fixed`) or basis points (if `percent`). */ + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - /** Contribution type. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -81,22 +99,36 @@ private constructor( /** Contribution amount in cents (if `fixed`) or basis points (if `percent`). */ fun amount(amount: Long?) = amount(JsonField.ofNullable(amount)) - /** Contribution amount in cents (if `fixed`) or basis points (if `percent`). */ + /** + * Alias for [Builder.amount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun amount(amount: Long) = amount(amount as Long?) - /** Contribution amount in cents (if `fixed`) or basis points (if `percent`). */ + /** Alias for calling [Builder.amount] with `amount.orElse(null)`. */ fun amount(amount: Optional) = amount(amount.getOrNull()) - /** Contribution amount in cents (if `fixed`) or basis points (if `percent`). */ + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } /** Contribution type. */ fun type(type: Type?) = type(JsonField.ofNullable(type)) - /** Contribution type. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** Contribution type. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt index 48c92ca9..61cfef15 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt @@ -33,16 +33,36 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun supportedFeatures(): Optional = Optional.ofNullable(supportedFeatures.getNullable("supported_features")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun supportedOperations(): Optional = Optional.ofNullable(supportedOperations.getNullable("supported_operations")) + /** + * Returns the raw JSON value of [supportedFeatures]. + * + * Unlike [supportedFeatures], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("supported_features") @ExcludeMissing fun _supportedFeatures(): JsonField = supportedFeatures + /** + * Returns the raw JSON value of [supportedOperations]. + * + * Unlike [supportedOperations], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("supported_operations") @ExcludeMissing fun _supportedOperations(): JsonField = supportedOperations @@ -90,6 +110,13 @@ private constructor( fun supportedFeatures(supportedFeatures: BenefitFeature) = supportedFeatures(JsonField.of(supportedFeatures)) + /** + * Sets [Builder.supportedFeatures] to an arbitrary JSON value. + * + * You should usually call [Builder.supportedFeatures] with a well-typed [BenefitFeature] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun supportedFeatures(supportedFeatures: JsonField) = apply { this.supportedFeatures = supportedFeatures } @@ -97,6 +124,13 @@ private constructor( fun supportedOperations(supportedOperations: SupportPerBenefitType) = supportedOperations(JsonField.of(supportedOperations)) + /** + * Sets [Builder.supportedOperations] to an arbitrary JSON value. + * + * You should usually call [Builder.supportedOperations] with a well-typed + * [SupportPerBenefitType] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun supportedOperations(supportedOperations: JsonField) = apply { this.supportedOperations = supportedOperations } @@ -157,75 +191,128 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Whether the provider supports an annual maximum for this benefit. */ + /** + * 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 = Optional.ofNullable(annualMaximum.getNullable("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 = Optional.ofNullable(catchUp.getNullable("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> = Optional.ofNullable(companyContribution.getNullable("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 = Optional.ofNullable(description.getNullable("description")) - /** Supported deduction types. An empty array indicates deductions are not supported. */ + /** + * 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> = Optional.ofNullable(employeeDeduction.getNullable("employee_deduction")) - /** The list of frequencies supported by the provider for this benefit */ + /** + * 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> = Optional.ofNullable(frequencies.getNullable("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> = Optional.ofNullable(hsaContributionLimit.getNullable("hsa_contribution_limit")) - /** Whether the provider supports an annual maximum for this benefit. */ + /** + * 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 /** - * Whether the provider supports catch up for this benefit. This field will only be true for - * retirement benefits. + * 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 /** - * Supported contribution types. An empty array indicates contributions are not supported. + * 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 - /** Supported deduction types. An empty array indicates deductions are not supported. */ + /** + * 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 - /** The list of frequencies supported by the provider for this benefit */ + /** + * 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 /** - * 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. + * 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 @@ -289,14 +376,24 @@ private constructor( fun annualMaximum(annualMaximum: Boolean?) = annualMaximum(JsonField.ofNullable(annualMaximum)) - /** Whether the provider supports an annual maximum for this benefit. */ + /** + * Alias for [Builder.annualMaximum]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun annualMaximum(annualMaximum: Boolean) = annualMaximum(annualMaximum as Boolean?) - /** Whether the provider supports an annual maximum for this benefit. */ + /** Alias for calling [Builder.annualMaximum] with `annualMaximum.orElse(null)`. */ fun annualMaximum(annualMaximum: Optional) = annualMaximum(annualMaximum.getOrNull()) - /** Whether the provider supports an annual maximum for this benefit. */ + /** + * 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 } @@ -308,20 +405,21 @@ private constructor( fun catchUp(catchUp: Boolean?) = catchUp(JsonField.ofNullable(catchUp)) /** - * Whether the provider supports catch up for this benefit. This field will only be true - * for retirement benefits. + * Alias for [Builder.catchUp]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun catchUp(catchUp: Boolean) = catchUp(catchUp as Boolean?) - /** - * Whether the provider supports catch up for this benefit. This field will only be true - * for retirement benefits. - */ + /** Alias for calling [Builder.catchUp] with `catchUp.orElse(null)`. */ fun catchUp(catchUp: Optional) = catchUp(catchUp.getOrNull()) /** - * Whether the provider supports catch up for this benefit. This field will only be true - * for retirement benefits. + * 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 } @@ -333,15 +431,18 @@ private constructor( companyContribution(JsonField.ofNullable(companyContribution)) /** - * Supported contribution types. An empty array indicates contributions are not - * supported. + * Alias for calling [Builder.companyContribution] with + * `companyContribution.orElse(null)`. */ fun companyContribution(companyContribution: Optional>) = companyContribution(companyContribution.getOrNull()) /** - * Supported contribution types. An empty array indicates contributions are not - * supported. + * 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 { @@ -349,8 +450,9 @@ private constructor( } /** - * Supported contribution types. An empty array indicates contributions are not - * supported. + * 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 = @@ -361,8 +463,16 @@ private constructor( 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 } @@ -371,16 +481,28 @@ private constructor( fun employeeDeduction(employeeDeduction: List?) = employeeDeduction(JsonField.ofNullable(employeeDeduction)) - /** Supported deduction types. An empty array indicates deductions are not supported. */ + /** + * Alias for calling [Builder.employeeDeduction] with `employeeDeduction.orElse(null)`. + */ fun employeeDeduction(employeeDeduction: Optional>) = employeeDeduction(employeeDeduction.getOrNull()) - /** Supported deduction types. An empty array indicates deductions are not supported. */ + /** + * 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() } } - /** Supported deduction types. An empty array indicates deductions are not supported. */ + /** + * 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 { @@ -392,12 +514,22 @@ private constructor( fun frequencies(frequencies: List) = frequencies(JsonField.of(frequencies)) - /** The list of frequencies supported by the provider for this benefit */ + /** + * 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() } } - /** The list of frequencies supported by the provider for this benefit */ + /** + * 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 { @@ -413,15 +545,18 @@ private constructor( hsaContributionLimit(JsonField.ofNullable(hsaContributionLimit)) /** - * 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. + * Alias for calling [Builder.hsaContributionLimit] with + * `hsaContributionLimit.orElse(null)`. */ fun hsaContributionLimit(hsaContributionLimit: Optional>) = hsaContributionLimit(hsaContributionLimit.getOrNull()) /** - * 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. + * 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 { @@ -429,8 +564,9 @@ private constructor( } /** - * 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. + * 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 = diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt index 9a67fafc..47e9e3e8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -64,86 +65,195 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun commuter(): Optional = Optional.ofNullable(commuter.getNullable("commuter")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun customPostTax(): Optional = Optional.ofNullable(customPostTax.getNullable("custom_post_tax")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun customPreTax(): Optional = Optional.ofNullable(customPreTax.getNullable("custom_pre_tax")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun fsaDependentCare(): Optional = Optional.ofNullable(fsaDependentCare.getNullable("fsa_dependent_care")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun fsaMedical(): Optional = Optional.ofNullable(fsaMedical.getNullable("fsa_medical")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun hsaPost(): Optional = Optional.ofNullable(hsaPost.getNullable("hsa_post")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun hsaPre(): Optional = Optional.ofNullable(hsaPre.getNullable("hsa_pre")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun s125Dental(): Optional = Optional.ofNullable(s125Dental.getNullable("s125_dental")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun s125Medical(): Optional = Optional.ofNullable(s125Medical.getNullable("s125_medical")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun s125Vision(): Optional = Optional.ofNullable(s125Vision.getNullable("s125_vision")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun simple(): Optional = Optional.ofNullable(simple.getNullable("simple")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun simpleIra(): Optional = Optional.ofNullable(simpleIra.getNullable("simple_ira")) + /** + * Returns the raw JSON value of [commuter]. + * + * Unlike [commuter], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("commuter") @ExcludeMissing fun _commuter(): JsonField = commuter + /** + * Returns the raw JSON value of [customPostTax]. + * + * Unlike [customPostTax], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("custom_post_tax") @ExcludeMissing fun _customPostTax(): JsonField = customPostTax + /** + * Returns the raw JSON value of [customPreTax]. + * + * Unlike [customPreTax], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("custom_pre_tax") @ExcludeMissing fun _customPreTax(): JsonField = customPreTax + /** + * Returns the raw JSON value of [fsaDependentCare]. + * + * Unlike [fsaDependentCare], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("fsa_dependent_care") @ExcludeMissing fun _fsaDependentCare(): JsonField = fsaDependentCare + /** + * Returns the raw JSON value of [fsaMedical]. + * + * Unlike [fsaMedical], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("fsa_medical") @ExcludeMissing fun _fsaMedical(): JsonField = fsaMedical + /** + * Returns the raw JSON value of [hsaPost]. + * + * Unlike [hsaPost], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("hsa_post") @ExcludeMissing fun _hsaPost(): JsonField = hsaPost + /** + * Returns the raw JSON value of [hsaPre]. + * + * Unlike [hsaPre], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("hsa_pre") @ExcludeMissing fun _hsaPre(): JsonField = hsaPre + /** + * Returns the raw JSON value of [s125Dental]. + * + * Unlike [s125Dental], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("s125_dental") @ExcludeMissing fun _s125Dental(): JsonField = s125Dental + /** + * Returns the raw JSON value of [s125Medical]. + * + * Unlike [s125Medical], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("s125_medical") @ExcludeMissing fun _s125Medical(): JsonField = s125Medical + /** + * Returns the raw JSON value of [s125Vision]. + * + * Unlike [s125Vision], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("s125_vision") @ExcludeMissing fun _s125Vision(): JsonField = s125Vision + /** + * Returns the raw JSON value of [simple]. + * + * Unlike [simple], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("simple") @ExcludeMissing fun _simple(): JsonField = simple + /** + * Returns the raw JSON value of [simpleIra]. + * + * Unlike [simpleIra], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("simple_ira") @ExcludeMissing fun _simpleIra(): JsonField = simpleIra @@ -219,9 +329,17 @@ private constructor( fun commuter(commuter: BenefitFeaturesAndOperations?) = commuter(JsonField.ofNullable(commuter)) + /** Alias for calling [Builder.commuter] with `commuter.orElse(null)`. */ fun commuter(commuter: Optional) = commuter(commuter.getOrNull()) + /** + * Sets [Builder.commuter] to an arbitrary JSON value. + * + * You should usually call [Builder.commuter] with a well-typed + * [BenefitFeaturesAndOperations] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun commuter(commuter: JsonField) = apply { this.commuter = commuter } @@ -229,9 +347,17 @@ private constructor( fun customPostTax(customPostTax: BenefitFeaturesAndOperations?) = customPostTax(JsonField.ofNullable(customPostTax)) + /** Alias for calling [Builder.customPostTax] with `customPostTax.orElse(null)`. */ fun customPostTax(customPostTax: Optional) = customPostTax(customPostTax.getOrNull()) + /** + * Sets [Builder.customPostTax] to an arbitrary JSON value. + * + * You should usually call [Builder.customPostTax] with a well-typed + * [BenefitFeaturesAndOperations] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun customPostTax(customPostTax: JsonField) = apply { this.customPostTax = customPostTax } @@ -239,9 +365,17 @@ private constructor( fun customPreTax(customPreTax: BenefitFeaturesAndOperations?) = customPreTax(JsonField.ofNullable(customPreTax)) + /** Alias for calling [Builder.customPreTax] with `customPreTax.orElse(null)`. */ fun customPreTax(customPreTax: Optional) = customPreTax(customPreTax.getOrNull()) + /** + * Sets [Builder.customPreTax] to an arbitrary JSON value. + * + * You should usually call [Builder.customPreTax] with a well-typed + * [BenefitFeaturesAndOperations] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun customPreTax(customPreTax: JsonField) = apply { this.customPreTax = customPreTax } @@ -249,9 +383,17 @@ private constructor( fun fsaDependentCare(fsaDependentCare: BenefitFeaturesAndOperations?) = fsaDependentCare(JsonField.ofNullable(fsaDependentCare)) + /** Alias for calling [Builder.fsaDependentCare] with `fsaDependentCare.orElse(null)`. */ fun fsaDependentCare(fsaDependentCare: Optional) = fsaDependentCare(fsaDependentCare.getOrNull()) + /** + * Sets [Builder.fsaDependentCare] to an arbitrary JSON value. + * + * You should usually call [Builder.fsaDependentCare] with a well-typed + * [BenefitFeaturesAndOperations] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun fsaDependentCare(fsaDependentCare: JsonField) = apply { this.fsaDependentCare = fsaDependentCare } @@ -259,33 +401,65 @@ private constructor( fun fsaMedical(fsaMedical: BenefitFeaturesAndOperations?) = fsaMedical(JsonField.ofNullable(fsaMedical)) + /** Alias for calling [Builder.fsaMedical] with `fsaMedical.orElse(null)`. */ fun fsaMedical(fsaMedical: Optional) = fsaMedical(fsaMedical.getOrNull()) + /** + * Sets [Builder.fsaMedical] to an arbitrary JSON value. + * + * You should usually call [Builder.fsaMedical] with a well-typed + * [BenefitFeaturesAndOperations] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun fsaMedical(fsaMedical: JsonField) = apply { this.fsaMedical = fsaMedical } fun hsaPost(hsaPost: BenefitFeaturesAndOperations?) = hsaPost(JsonField.ofNullable(hsaPost)) + /** Alias for calling [Builder.hsaPost] with `hsaPost.orElse(null)`. */ fun hsaPost(hsaPost: Optional) = hsaPost(hsaPost.getOrNull()) + /** + * Sets [Builder.hsaPost] to an arbitrary JSON value. + * + * You should usually call [Builder.hsaPost] with a well-typed + * [BenefitFeaturesAndOperations] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun hsaPost(hsaPost: JsonField) = apply { this.hsaPost = hsaPost } fun hsaPre(hsaPre: BenefitFeaturesAndOperations?) = hsaPre(JsonField.ofNullable(hsaPre)) + /** Alias for calling [Builder.hsaPre] with `hsaPre.orElse(null)`. */ fun hsaPre(hsaPre: Optional) = hsaPre(hsaPre.getOrNull()) + /** + * Sets [Builder.hsaPre] to an arbitrary JSON value. + * + * You should usually call [Builder.hsaPre] with a well-typed [BenefitFeaturesAndOperations] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun hsaPre(hsaPre: JsonField) = apply { this.hsaPre = hsaPre } fun s125Dental(s125Dental: BenefitFeaturesAndOperations?) = s125Dental(JsonField.ofNullable(s125Dental)) + /** Alias for calling [Builder.s125Dental] with `s125Dental.orElse(null)`. */ fun s125Dental(s125Dental: Optional) = s125Dental(s125Dental.getOrNull()) + /** + * Sets [Builder.s125Dental] to an arbitrary JSON value. + * + * You should usually call [Builder.s125Dental] with a well-typed + * [BenefitFeaturesAndOperations] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun s125Dental(s125Dental: JsonField) = apply { this.s125Dental = s125Dental } @@ -293,9 +467,17 @@ private constructor( fun s125Medical(s125Medical: BenefitFeaturesAndOperations?) = s125Medical(JsonField.ofNullable(s125Medical)) + /** Alias for calling [Builder.s125Medical] with `s125Medical.orElse(null)`. */ fun s125Medical(s125Medical: Optional) = s125Medical(s125Medical.getOrNull()) + /** + * Sets [Builder.s125Medical] to an arbitrary JSON value. + * + * You should usually call [Builder.s125Medical] with a well-typed + * [BenefitFeaturesAndOperations] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun s125Medical(s125Medical: JsonField) = apply { this.s125Medical = s125Medical } @@ -303,25 +485,49 @@ private constructor( fun s125Vision(s125Vision: BenefitFeaturesAndOperations?) = s125Vision(JsonField.ofNullable(s125Vision)) + /** Alias for calling [Builder.s125Vision] with `s125Vision.orElse(null)`. */ fun s125Vision(s125Vision: Optional) = s125Vision(s125Vision.getOrNull()) + /** + * Sets [Builder.s125Vision] to an arbitrary JSON value. + * + * You should usually call [Builder.s125Vision] with a well-typed + * [BenefitFeaturesAndOperations] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun s125Vision(s125Vision: JsonField) = apply { this.s125Vision = s125Vision } fun simple(simple: BenefitFeaturesAndOperations?) = simple(JsonField.ofNullable(simple)) + /** Alias for calling [Builder.simple] with `simple.orElse(null)`. */ fun simple(simple: Optional) = simple(simple.getOrNull()) + /** + * Sets [Builder.simple] to an arbitrary JSON value. + * + * You should usually call [Builder.simple] with a well-typed [BenefitFeaturesAndOperations] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun simple(simple: JsonField) = apply { this.simple = simple } fun simpleIra(simpleIra: BenefitFeaturesAndOperations?) = simpleIra(JsonField.ofNullable(simpleIra)) + /** Alias for calling [Builder.simpleIra] with `simpleIra.orElse(null)`. */ fun simpleIra(simpleIra: Optional) = simpleIra(simpleIra.getOrNull()) + /** + * Sets [Builder.simpleIra] to an arbitrary JSON value. + * + * You should usually call [Builder.simpleIra] with a well-typed + * [BenefitFeaturesAndOperations] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun simpleIra(simpleIra: JsonField) = apply { this.simpleIra = simpleIra } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt index bf5c255d..e2acc5a9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt @@ -51,66 +51,148 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A stable Finch `id` (UUID v4) for the company. */ + /** + * A stable Finch `id` (UUID v4) for the company. + * + * @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 id(): String = id.getRequired("id") - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** + * An array of bank account objects associated with the payroll/HRIS system. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun accounts(): Optional> = Optional.ofNullable(accounts.getNullable("accounts")) - /** The array of company departments. */ + /** + * The array of company departments. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun departments(): Optional> = Optional.ofNullable(departments.getNullable("departments")) - /** The employer identification number. */ + /** + * The employer identification number. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun ein(): Optional = Optional.ofNullable(ein.getNullable("ein")) - /** The entity type object. */ + /** + * The entity type object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun entity(): Optional = Optional.ofNullable(entity.getNullable("entity")) - /** The legal name of the company. */ + /** + * The legal name of the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun legalName(): Optional = Optional.ofNullable(legalName.getNullable("legal_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun locations(): Optional> = Optional.ofNullable(locations.getNullable("locations")) - /** The email of the main administrator on the account. */ + /** + * The email of the main administrator on the account. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun primaryEmail(): Optional = Optional.ofNullable(primaryEmail.getNullable("primary_email")) - /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + /** + * The phone number of the main administrator on the account. Format: `XXXXXXXXXX` + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun primaryPhoneNumber(): Optional = Optional.ofNullable(primaryPhoneNumber.getNullable("primary_phone_number")) - /** A stable Finch `id` (UUID v4) for the company. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** + * Returns the raw JSON value of [accounts]. + * + * Unlike [accounts], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("accounts") @ExcludeMissing fun _accounts(): JsonField> = accounts - /** The array of company departments. */ + /** + * Returns the raw JSON value of [departments]. + * + * Unlike [departments], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("departments") @ExcludeMissing fun _departments(): JsonField> = departments - /** The employer identification number. */ + /** + * Returns the raw JSON value of [ein]. + * + * Unlike [ein], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("ein") @ExcludeMissing fun _ein(): JsonField = ein - /** The entity type object. */ + /** + * Returns the raw JSON value of [entity]. + * + * Unlike [entity], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("entity") @ExcludeMissing fun _entity(): JsonField = entity - /** The legal name of the company. */ + /** + * Returns the raw JSON value of [legalName]. + * + * Unlike [legalName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("legal_name") @ExcludeMissing fun _legalName(): JsonField = legalName + /** + * Returns the raw JSON value of [locations]. + * + * Unlike [locations], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("locations") @ExcludeMissing fun _locations(): JsonField> = locations - /** The email of the main administrator on the account. */ + /** + * Returns the raw JSON value of [primaryEmail]. + * + * Unlike [primaryEmail], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("primary_email") @ExcludeMissing fun _primaryEmail(): JsonField = primaryEmail - /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + /** + * Returns the raw JSON value of [primaryPhoneNumber]. + * + * Unlike [primaryPhoneNumber], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("primary_phone_number") @ExcludeMissing fun _primaryPhoneNumber(): JsonField = primaryPhoneNumber @@ -192,21 +274,36 @@ private constructor( /** A stable Finch `id` (UUID v4) for the company. */ fun id(id: String) = id(JsonField.of(id)) - /** A stable Finch `id` (UUID v4) for the company. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** An array of bank account objects associated with the payroll/HRIS system. */ fun accounts(accounts: List?) = accounts(JsonField.ofNullable(accounts)) - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** Alias for calling [Builder.accounts] with `accounts.orElse(null)`. */ fun accounts(accounts: Optional>) = accounts(accounts.getOrNull()) - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** + * Sets [Builder.accounts] to an arbitrary JSON value. + * + * You should usually call [Builder.accounts] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun accounts(accounts: JsonField>) = apply { this.accounts = accounts.map { it.toMutableList() } } - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** + * Adds a single [Account] to [accounts]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addAccount(account: Account) = apply { accounts = (accounts ?: JsonField.of(mutableListOf())).also { @@ -218,16 +315,26 @@ private constructor( fun departments(departments: List?) = departments(JsonField.ofNullable(departments)) - /** The array of company departments. */ + /** Alias for calling [Builder.departments] with `departments.orElse(null)`. */ fun departments(departments: Optional>) = departments(departments.getOrNull()) - /** The array of company departments. */ + /** + * Sets [Builder.departments] to an arbitrary JSON value. + * + * You should usually call [Builder.departments] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun departments(departments: JsonField>) = apply { this.departments = departments.map { it.toMutableList() } } - /** The array of company departments. */ + /** + * Adds a single [Department] to [departments]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addDepartment(department: Department) = apply { departments = (departments ?: JsonField.of(mutableListOf())).also { @@ -238,38 +345,67 @@ private constructor( /** The employer identification number. */ fun ein(ein: String?) = ein(JsonField.ofNullable(ein)) - /** The employer identification number. */ + /** Alias for calling [Builder.ein] with `ein.orElse(null)`. */ fun ein(ein: Optional) = ein(ein.getOrNull()) - /** The employer identification number. */ + /** + * Sets [Builder.ein] to an arbitrary JSON value. + * + * You should usually call [Builder.ein] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun ein(ein: JsonField) = apply { this.ein = ein } /** The entity type object. */ fun entity(entity: Entity?) = entity(JsonField.ofNullable(entity)) - /** The entity type object. */ + /** Alias for calling [Builder.entity] with `entity.orElse(null)`. */ fun entity(entity: Optional) = entity(entity.getOrNull()) - /** The entity type object. */ + /** + * Sets [Builder.entity] to an arbitrary JSON value. + * + * You should usually call [Builder.entity] with a well-typed [Entity] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun entity(entity: JsonField) = apply { this.entity = entity } /** The legal name of the company. */ fun legalName(legalName: String?) = legalName(JsonField.ofNullable(legalName)) - /** The legal name of the company. */ + /** Alias for calling [Builder.legalName] with `legalName.orElse(null)`. */ fun legalName(legalName: Optional) = legalName(legalName.getOrNull()) - /** The legal name of the company. */ + /** + * Sets [Builder.legalName] to an arbitrary JSON value. + * + * You should usually call [Builder.legalName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun legalName(legalName: JsonField) = apply { this.legalName = legalName } fun locations(locations: List?) = locations(JsonField.ofNullable(locations)) + /** Alias for calling [Builder.locations] with `locations.orElse(null)`. */ fun locations(locations: Optional>) = locations(locations.getOrNull()) + /** + * Sets [Builder.locations] to an arbitrary JSON value. + * + * You should usually call [Builder.locations] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun locations(locations: JsonField>) = apply { this.locations = locations.map { it.toMutableList() } } + /** + * Adds a single [Location] to [locations]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addLocation(location: Location) = apply { locations = (locations ?: JsonField.of(mutableListOf())).also { @@ -280,10 +416,16 @@ private constructor( /** The email of the main administrator on the account. */ fun primaryEmail(primaryEmail: String?) = primaryEmail(JsonField.ofNullable(primaryEmail)) - /** The email of the main administrator on the account. */ + /** Alias for calling [Builder.primaryEmail] with `primaryEmail.orElse(null)`. */ fun primaryEmail(primaryEmail: Optional) = primaryEmail(primaryEmail.getOrNull()) - /** The email of the main administrator on the account. */ + /** + * Sets [Builder.primaryEmail] to an arbitrary JSON value. + * + * You should usually call [Builder.primaryEmail] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun primaryEmail(primaryEmail: JsonField) = apply { this.primaryEmail = primaryEmail } @@ -292,11 +434,19 @@ private constructor( fun primaryPhoneNumber(primaryPhoneNumber: String?) = primaryPhoneNumber(JsonField.ofNullable(primaryPhoneNumber)) - /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + /** + * Alias for calling [Builder.primaryPhoneNumber] with `primaryPhoneNumber.orElse(null)`. + */ fun primaryPhoneNumber(primaryPhoneNumber: Optional) = primaryPhoneNumber(primaryPhoneNumber.getOrNull()) - /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + /** + * Sets [Builder.primaryPhoneNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.primaryPhoneNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun primaryPhoneNumber(primaryPhoneNumber: JsonField) = apply { this.primaryPhoneNumber = primaryPhoneNumber } @@ -358,50 +508,94 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The name of the bank associated in the payroll/HRIS system. */ + /** + * The name of the bank associated in the payroll/HRIS system. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun accountName(): Optional = Optional.ofNullable(accountName.getNullable("account_name")) - /** 10-12 digit number to specify the bank account */ + /** + * 10-12 digit number to specify the bank account + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun accountNumber(): Optional = Optional.ofNullable(accountNumber.getNullable("account_number")) - /** The type of bank account. */ + /** + * The type of bank account. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun accountType(): Optional = Optional.ofNullable(accountType.getNullable("account_type")) - /** Name of the banking institution. */ + /** + * Name of the banking institution. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun institutionName(): Optional = Optional.ofNullable(institutionName.getNullable("institution_name")) /** * A nine-digit code that's based on the U.S. Bank location where your account was opened. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun routingNumber(): Optional = Optional.ofNullable(routingNumber.getNullable("routing_number")) - /** The name of the bank associated in the payroll/HRIS system. */ + /** + * Returns the raw JSON value of [accountName]. + * + * Unlike [accountName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("account_name") @ExcludeMissing fun _accountName(): JsonField = accountName - /** 10-12 digit number to specify the bank account */ + /** + * Returns the raw JSON value of [accountNumber]. + * + * Unlike [accountNumber], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("account_number") @ExcludeMissing fun _accountNumber(): JsonField = accountNumber - /** The type of bank account. */ + /** + * Returns the raw JSON value of [accountType]. + * + * Unlike [accountType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("account_type") @ExcludeMissing fun _accountType(): JsonField = accountType - /** Name of the banking institution. */ + /** + * Returns the raw JSON value of [institutionName]. + * + * Unlike [institutionName], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("institution_name") @ExcludeMissing fun _institutionName(): JsonField = institutionName /** - * A nine-digit code that's based on the U.S. Bank location where your account was opened. + * Returns the raw JSON value of [routingNumber]. + * + * Unlike [routingNumber], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("routing_number") @ExcludeMissing @@ -457,10 +651,16 @@ private constructor( /** The name of the bank associated in the payroll/HRIS system. */ fun accountName(accountName: String?) = accountName(JsonField.ofNullable(accountName)) - /** The name of the bank associated in the payroll/HRIS system. */ + /** Alias for calling [Builder.accountName] with `accountName.orElse(null)`. */ fun accountName(accountName: Optional) = accountName(accountName.getOrNull()) - /** The name of the bank associated in the payroll/HRIS system. */ + /** + * Sets [Builder.accountName] to an arbitrary JSON value. + * + * You should usually call [Builder.accountName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun accountName(accountName: JsonField) = apply { this.accountName = accountName } @@ -469,11 +669,17 @@ private constructor( fun accountNumber(accountNumber: String?) = accountNumber(JsonField.ofNullable(accountNumber)) - /** 10-12 digit number to specify the bank account */ + /** Alias for calling [Builder.accountNumber] with `accountNumber.orElse(null)`. */ fun accountNumber(accountNumber: Optional) = accountNumber(accountNumber.getOrNull()) - /** 10-12 digit number to specify the bank account */ + /** + * Sets [Builder.accountNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.accountNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun accountNumber(accountNumber: JsonField) = apply { this.accountNumber = accountNumber } @@ -482,11 +688,17 @@ private constructor( fun accountType(accountType: AccountType?) = accountType(JsonField.ofNullable(accountType)) - /** The type of bank account. */ + /** Alias for calling [Builder.accountType] with `accountType.orElse(null)`. */ fun accountType(accountType: Optional) = accountType(accountType.getOrNull()) - /** The type of bank account. */ + /** + * Sets [Builder.accountType] to an arbitrary JSON value. + * + * You should usually call [Builder.accountType] with a well-typed [AccountType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun accountType(accountType: JsonField) = apply { this.accountType = accountType } @@ -495,11 +707,17 @@ private constructor( fun institutionName(institutionName: String?) = institutionName(JsonField.ofNullable(institutionName)) - /** Name of the banking institution. */ + /** Alias for calling [Builder.institutionName] with `institutionName.orElse(null)`. */ fun institutionName(institutionName: Optional) = institutionName(institutionName.getOrNull()) - /** Name of the banking institution. */ + /** + * Sets [Builder.institutionName] to an arbitrary JSON value. + * + * You should usually call [Builder.institutionName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun institutionName(institutionName: JsonField) = apply { this.institutionName = institutionName } @@ -511,16 +729,16 @@ private constructor( fun routingNumber(routingNumber: String?) = routingNumber(JsonField.ofNullable(routingNumber)) - /** - * A nine-digit code that's based on the U.S. Bank location where your account was - * opened. - */ + /** Alias for calling [Builder.routingNumber] with `routingNumber.orElse(null)`. */ fun routingNumber(routingNumber: Optional) = routingNumber(routingNumber.getOrNull()) /** - * A nine-digit code that's based on the U.S. Bank location where your account was - * opened. + * Sets [Builder.routingNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.routingNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun routingNumber(routingNumber: JsonField) = apply { this.routingNumber = routingNumber @@ -693,16 +911,34 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The department name. */ + /** + * The department name. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The parent department, if present. */ + /** + * The parent department, if present. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun parent(): Optional = Optional.ofNullable(parent.getNullable("parent")) - /** The department name. */ + /** + * 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 - /** The parent department, if present. */ + /** + * Returns the raw JSON value of [parent]. + * + * Unlike [parent], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("parent") @ExcludeMissing fun _parent(): JsonField = parent @JsonAnyGetter @@ -746,19 +982,31 @@ private constructor( /** The department name. */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The department name. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The department name. */ + /** + * 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 } /** The parent department, if present. */ fun parent(parent: Parent?) = parent(JsonField.ofNullable(parent)) - /** The parent department, if present. */ + /** Alias for calling [Builder.parent] with `parent.orElse(null)`. */ fun parent(parent: Optional) = parent(parent.getOrNull()) - /** The parent department, if present. */ + /** + * Sets [Builder.parent] to an arbitrary JSON value. + * + * You should usually call [Builder.parent] with a well-typed [Parent] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun parent(parent: JsonField) = apply { this.parent = parent } fun additionalProperties(additionalProperties: Map) = apply { @@ -795,10 +1043,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The parent department's name. */ + /** + * The parent department's name. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The parent department's name. */ + /** + * 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 @JsonAnyGetter @@ -839,10 +1096,16 @@ private constructor( /** The parent department's name. */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The parent department's name. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The parent department's name. */ + /** + * 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 { @@ -919,16 +1182,34 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The tax payer subtype of the company. */ + /** + * The tax payer subtype of the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) - /** The tax payer type of the company. */ + /** + * The tax payer type of the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** The tax payer subtype of the company. */ + /** + * Returns the raw JSON value of [subtype]. + * + * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype - /** The tax payer type of the company. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -972,19 +1253,31 @@ private constructor( /** The tax payer subtype of the company. */ fun subtype(subtype: Subtype?) = subtype(JsonField.ofNullable(subtype)) - /** The tax payer subtype of the company. */ + /** Alias for calling [Builder.subtype] with `subtype.orElse(null)`. */ fun subtype(subtype: Optional) = subtype(subtype.getOrNull()) - /** The tax payer subtype of the company. */ + /** + * Sets [Builder.subtype] to an arbitrary JSON value. + * + * You should usually call [Builder.subtype] with a well-typed [Subtype] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun subtype(subtype: JsonField) = apply { this.subtype = subtype } /** The tax payer type of the company. */ fun type(type: Type?) = type(JsonField.ofNullable(type)) - /** The tax payer type of the company. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** The tax payer type of the company. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt index 5ea643d9..97e49bb2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt @@ -14,6 +14,7 @@ import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -37,26 +38,62 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @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 benefitId(): String = benefitId.getRequired("benefit_id") + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun frequency(): Optional = Optional.ofNullable(frequency.getNullable("frequency")) - /** Type of benefit. */ + /** + * Type of benefit. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [benefitId]. + * + * Unlike [benefitId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("benefit_id") @ExcludeMissing fun _benefitId(): JsonField = benefitId + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + /** + * Returns the raw JSON value of [frequency]. + * + * Unlike [frequency], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("frequency") @ExcludeMissing fun _frequency(): JsonField = frequency - /** Type of benefit. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -115,27 +152,56 @@ private constructor( fun benefitId(benefitId: String) = benefitId(JsonField.of(benefitId)) + /** + * Sets [Builder.benefitId] to an arbitrary JSON value. + * + * You should usually call [Builder.benefitId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun benefitId(benefitId: JsonField) = apply { this.benefitId = benefitId } 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 } fun frequency(frequency: BenefitFrequency?) = frequency(JsonField.ofNullable(frequency)) + /** Alias for calling [Builder.frequency] with `frequency.orElse(null)`. */ fun frequency(frequency: Optional) = frequency(frequency.getOrNull()) + /** + * Sets [Builder.frequency] to an arbitrary JSON value. + * + * You should usually call [Builder.frequency] with a well-typed [BenefitFrequency] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun frequency(frequency: JsonField) = apply { this.frequency = frequency } /** Type of benefit. */ fun type(type: BenefitType?) = type(JsonField.ofNullable(type)) - /** Type of benefit. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** Type of benefit. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [BenefitType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt index ceb6069d..606a5209 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt @@ -43,26 +43,46 @@ private constructor( /** * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. + * + * @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). */ @Deprecated("deprecated") fun accountId(): String = accountId.getRequired("account_id") /** * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. + * + * @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). */ @Deprecated("deprecated") fun companyId(): String = companyId.getRequired("company_id") - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Unique Finch ID of the connection associated with the webhook event. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun connectionId(): Optional = Optional.ofNullable(connectionId.getNullable("connection_id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use - * `connection_id` instead to identify the connection associated with this event. + * Returns the raw JSON value of [accountId]. + * + * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("account_id") @@ -70,21 +90,36 @@ private constructor( fun _accountId(): JsonField = accountId /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use - * `connection_id` instead to identify the connection associated with this event. + * Returns the raw JSON value of [companyId]. + * + * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("company_id") @ExcludeMissing fun _companyId(): JsonField = companyId - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Returns the raw JSON value of [connectionId]. + * + * Unlike [connectionId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("connection_id") @ExcludeMissing fun _connectionId(): JsonField = connectionId + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [eventType]. + * + * Unlike [eventType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType @JsonAnyGetter @@ -157,8 +192,11 @@ private constructor( fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use - * `connection_id` instead to identify the connection associated with this event. + * Sets [Builder.accountId] to an arbitrary JSON value. + * + * You should usually call [Builder.accountId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun accountId(accountId: JsonField) = apply { this.accountId = accountId } @@ -171,8 +209,11 @@ private constructor( fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use - * `connection_id` instead to identify the connection associated with this event. + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun companyId(companyId: JsonField) = apply { this.companyId = companyId } @@ -180,19 +221,39 @@ private constructor( /** Unique Finch ID of the connection associated with the webhook event. */ fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Sets [Builder.connectionId] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun connectionId(connectionId: JsonField) = apply { this.connectionId = connectionId } fun data(data: Data?) = data(JsonField.ofNullable(data)) + /** Alias for calling [Builder.data] with `data.orElse(null)`. */ fun data(data: Optional) = data(data.getOrNull()) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Data] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun data(data: JsonField) = apply { this.data = data } fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + /** + * Sets [Builder.eventType] to an arbitrary JSON value. + * + * You should usually call [Builder.eventType] with a well-typed [EventType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun eventType(eventType: JsonField) = apply { this.eventType = eventType } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt index b9568f77..8da60142 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt @@ -50,60 +50,133 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** + * An array of bank account objects associated with the payroll/HRIS system. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun accounts(): Optional> = Optional.ofNullable(accounts.getNullable("accounts")) - /** The array of company departments. */ + /** + * The array of company departments. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun departments(): Optional> = Optional.ofNullable(departments.getNullable("departments")) - /** The employer identification number. */ + /** + * The employer identification number. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun ein(): Optional = Optional.ofNullable(ein.getNullable("ein")) - /** The entity type object. */ + /** + * The entity type object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun entity(): Optional = Optional.ofNullable(entity.getNullable("entity")) - /** The legal name of the company. */ + /** + * The legal name of the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun legalName(): Optional = Optional.ofNullable(legalName.getNullable("legal_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun locations(): Optional> = Optional.ofNullable(locations.getNullable("locations")) - /** The email of the main administrator on the account. */ + /** + * The email of the main administrator on the account. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun primaryEmail(): Optional = Optional.ofNullable(primaryEmail.getNullable("primary_email")) - /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + /** + * The phone number of the main administrator on the account. Format: `XXXXXXXXXX` + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun primaryPhoneNumber(): Optional = Optional.ofNullable(primaryPhoneNumber.getNullable("primary_phone_number")) - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** + * Returns the raw JSON value of [accounts]. + * + * Unlike [accounts], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("accounts") @ExcludeMissing fun _accounts(): JsonField> = accounts - /** The array of company departments. */ + /** + * Returns the raw JSON value of [departments]. + * + * Unlike [departments], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("departments") @ExcludeMissing fun _departments(): JsonField> = departments - /** The employer identification number. */ + /** + * Returns the raw JSON value of [ein]. + * + * Unlike [ein], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("ein") @ExcludeMissing fun _ein(): JsonField = ein - /** The entity type object. */ + /** + * Returns the raw JSON value of [entity]. + * + * Unlike [entity], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("entity") @ExcludeMissing fun _entity(): JsonField = entity - /** The legal name of the company. */ + /** + * Returns the raw JSON value of [legalName]. + * + * Unlike [legalName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("legal_name") @ExcludeMissing fun _legalName(): JsonField = legalName + /** + * Returns the raw JSON value of [locations]. + * + * Unlike [locations], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("locations") @ExcludeMissing fun _locations(): JsonField> = locations - /** The email of the main administrator on the account. */ + /** + * Returns the raw JSON value of [primaryEmail]. + * + * Unlike [primaryEmail], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("primary_email") @ExcludeMissing fun _primaryEmail(): JsonField = primaryEmail - /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + /** + * Returns the raw JSON value of [primaryPhoneNumber]. + * + * Unlike [primaryPhoneNumber], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("primary_phone_number") @ExcludeMissing fun _primaryPhoneNumber(): JsonField = primaryPhoneNumber @@ -181,15 +254,25 @@ private constructor( /** An array of bank account objects associated with the payroll/HRIS system. */ fun accounts(accounts: List?) = accounts(JsonField.ofNullable(accounts)) - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** Alias for calling [Builder.accounts] with `accounts.orElse(null)`. */ fun accounts(accounts: Optional>) = accounts(accounts.getOrNull()) - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** + * Sets [Builder.accounts] to an arbitrary JSON value. + * + * You should usually call [Builder.accounts] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun accounts(accounts: JsonField>) = apply { this.accounts = accounts.map { it.toMutableList() } } - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** + * Adds a single [Account] to [accounts]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addAccount(account: Account) = apply { accounts = (accounts ?: JsonField.of(mutableListOf())).also { @@ -201,16 +284,26 @@ private constructor( fun departments(departments: List?) = departments(JsonField.ofNullable(departments)) - /** The array of company departments. */ + /** Alias for calling [Builder.departments] with `departments.orElse(null)`. */ fun departments(departments: Optional>) = departments(departments.getOrNull()) - /** The array of company departments. */ + /** + * Sets [Builder.departments] to an arbitrary JSON value. + * + * You should usually call [Builder.departments] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun departments(departments: JsonField>) = apply { this.departments = departments.map { it.toMutableList() } } - /** The array of company departments. */ + /** + * Adds a single [Department] to [departments]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addDepartment(department: Department) = apply { departments = (departments ?: JsonField.of(mutableListOf())).also { @@ -221,38 +314,67 @@ private constructor( /** The employer identification number. */ fun ein(ein: String?) = ein(JsonField.ofNullable(ein)) - /** The employer identification number. */ + /** Alias for calling [Builder.ein] with `ein.orElse(null)`. */ fun ein(ein: Optional) = ein(ein.getOrNull()) - /** The employer identification number. */ + /** + * Sets [Builder.ein] to an arbitrary JSON value. + * + * You should usually call [Builder.ein] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun ein(ein: JsonField) = apply { this.ein = ein } /** The entity type object. */ fun entity(entity: Entity?) = entity(JsonField.ofNullable(entity)) - /** The entity type object. */ + /** Alias for calling [Builder.entity] with `entity.orElse(null)`. */ fun entity(entity: Optional) = entity(entity.getOrNull()) - /** The entity type object. */ + /** + * Sets [Builder.entity] to an arbitrary JSON value. + * + * You should usually call [Builder.entity] with a well-typed [Entity] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun entity(entity: JsonField) = apply { this.entity = entity } /** The legal name of the company. */ fun legalName(legalName: String?) = legalName(JsonField.ofNullable(legalName)) - /** The legal name of the company. */ + /** Alias for calling [Builder.legalName] with `legalName.orElse(null)`. */ fun legalName(legalName: Optional) = legalName(legalName.getOrNull()) - /** The legal name of the company. */ + /** + * Sets [Builder.legalName] to an arbitrary JSON value. + * + * You should usually call [Builder.legalName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun legalName(legalName: JsonField) = apply { this.legalName = legalName } fun locations(locations: List?) = locations(JsonField.ofNullable(locations)) + /** Alias for calling [Builder.locations] with `locations.orElse(null)`. */ fun locations(locations: Optional>) = locations(locations.getOrNull()) + /** + * Sets [Builder.locations] to an arbitrary JSON value. + * + * You should usually call [Builder.locations] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun locations(locations: JsonField>) = apply { this.locations = locations.map { it.toMutableList() } } + /** + * Adds a single [Location] to [locations]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addLocation(location: Location) = apply { locations = (locations ?: JsonField.of(mutableListOf())).also { @@ -263,10 +385,16 @@ private constructor( /** The email of the main administrator on the account. */ fun primaryEmail(primaryEmail: String?) = primaryEmail(JsonField.ofNullable(primaryEmail)) - /** The email of the main administrator on the account. */ + /** Alias for calling [Builder.primaryEmail] with `primaryEmail.orElse(null)`. */ fun primaryEmail(primaryEmail: Optional) = primaryEmail(primaryEmail.getOrNull()) - /** The email of the main administrator on the account. */ + /** + * Sets [Builder.primaryEmail] to an arbitrary JSON value. + * + * You should usually call [Builder.primaryEmail] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun primaryEmail(primaryEmail: JsonField) = apply { this.primaryEmail = primaryEmail } @@ -275,11 +403,19 @@ private constructor( fun primaryPhoneNumber(primaryPhoneNumber: String?) = primaryPhoneNumber(JsonField.ofNullable(primaryPhoneNumber)) - /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + /** + * Alias for calling [Builder.primaryPhoneNumber] with `primaryPhoneNumber.orElse(null)`. + */ fun primaryPhoneNumber(primaryPhoneNumber: Optional) = primaryPhoneNumber(primaryPhoneNumber.getOrNull()) - /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + /** + * Sets [Builder.primaryPhoneNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.primaryPhoneNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun primaryPhoneNumber(primaryPhoneNumber: JsonField) = apply { this.primaryPhoneNumber = primaryPhoneNumber } @@ -340,50 +476,94 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The name of the bank associated in the payroll/HRIS system. */ + /** + * The name of the bank associated in the payroll/HRIS system. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun accountName(): Optional = Optional.ofNullable(accountName.getNullable("account_name")) - /** 10-12 digit number to specify the bank account */ + /** + * 10-12 digit number to specify the bank account + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun accountNumber(): Optional = Optional.ofNullable(accountNumber.getNullable("account_number")) - /** The type of bank account. */ + /** + * The type of bank account. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun accountType(): Optional = Optional.ofNullable(accountType.getNullable("account_type")) - /** Name of the banking institution. */ + /** + * Name of the banking institution. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun institutionName(): Optional = Optional.ofNullable(institutionName.getNullable("institution_name")) /** * A nine-digit code that's based on the U.S. Bank location where your account was opened. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun routingNumber(): Optional = Optional.ofNullable(routingNumber.getNullable("routing_number")) - /** The name of the bank associated in the payroll/HRIS system. */ + /** + * Returns the raw JSON value of [accountName]. + * + * Unlike [accountName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("account_name") @ExcludeMissing fun _accountName(): JsonField = accountName - /** 10-12 digit number to specify the bank account */ + /** + * Returns the raw JSON value of [accountNumber]. + * + * Unlike [accountNumber], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("account_number") @ExcludeMissing fun _accountNumber(): JsonField = accountNumber - /** The type of bank account. */ + /** + * Returns the raw JSON value of [accountType]. + * + * Unlike [accountType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("account_type") @ExcludeMissing fun _accountType(): JsonField = accountType - /** Name of the banking institution. */ + /** + * Returns the raw JSON value of [institutionName]. + * + * Unlike [institutionName], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("institution_name") @ExcludeMissing fun _institutionName(): JsonField = institutionName /** - * A nine-digit code that's based on the U.S. Bank location where your account was opened. + * Returns the raw JSON value of [routingNumber]. + * + * Unlike [routingNumber], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("routing_number") @ExcludeMissing @@ -439,10 +619,16 @@ private constructor( /** The name of the bank associated in the payroll/HRIS system. */ fun accountName(accountName: String?) = accountName(JsonField.ofNullable(accountName)) - /** The name of the bank associated in the payroll/HRIS system. */ + /** Alias for calling [Builder.accountName] with `accountName.orElse(null)`. */ fun accountName(accountName: Optional) = accountName(accountName.getOrNull()) - /** The name of the bank associated in the payroll/HRIS system. */ + /** + * Sets [Builder.accountName] to an arbitrary JSON value. + * + * You should usually call [Builder.accountName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun accountName(accountName: JsonField) = apply { this.accountName = accountName } @@ -451,11 +637,17 @@ private constructor( fun accountNumber(accountNumber: String?) = accountNumber(JsonField.ofNullable(accountNumber)) - /** 10-12 digit number to specify the bank account */ + /** Alias for calling [Builder.accountNumber] with `accountNumber.orElse(null)`. */ fun accountNumber(accountNumber: Optional) = accountNumber(accountNumber.getOrNull()) - /** 10-12 digit number to specify the bank account */ + /** + * Sets [Builder.accountNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.accountNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun accountNumber(accountNumber: JsonField) = apply { this.accountNumber = accountNumber } @@ -464,11 +656,17 @@ private constructor( fun accountType(accountType: AccountType?) = accountType(JsonField.ofNullable(accountType)) - /** The type of bank account. */ + /** Alias for calling [Builder.accountType] with `accountType.orElse(null)`. */ fun accountType(accountType: Optional) = accountType(accountType.getOrNull()) - /** The type of bank account. */ + /** + * Sets [Builder.accountType] to an arbitrary JSON value. + * + * You should usually call [Builder.accountType] with a well-typed [AccountType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun accountType(accountType: JsonField) = apply { this.accountType = accountType } @@ -477,11 +675,17 @@ private constructor( fun institutionName(institutionName: String?) = institutionName(JsonField.ofNullable(institutionName)) - /** Name of the banking institution. */ + /** Alias for calling [Builder.institutionName] with `institutionName.orElse(null)`. */ fun institutionName(institutionName: Optional) = institutionName(institutionName.getOrNull()) - /** Name of the banking institution. */ + /** + * Sets [Builder.institutionName] to an arbitrary JSON value. + * + * You should usually call [Builder.institutionName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun institutionName(institutionName: JsonField) = apply { this.institutionName = institutionName } @@ -493,16 +697,16 @@ private constructor( fun routingNumber(routingNumber: String?) = routingNumber(JsonField.ofNullable(routingNumber)) - /** - * A nine-digit code that's based on the U.S. Bank location where your account was - * opened. - */ + /** Alias for calling [Builder.routingNumber] with `routingNumber.orElse(null)`. */ fun routingNumber(routingNumber: Optional) = routingNumber(routingNumber.getOrNull()) /** - * A nine-digit code that's based on the U.S. Bank location where your account was - * opened. + * Sets [Builder.routingNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.routingNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun routingNumber(routingNumber: JsonField) = apply { this.routingNumber = routingNumber @@ -675,16 +879,34 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The department name. */ + /** + * The department name. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The parent department, if present. */ + /** + * The parent department, if present. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun parent(): Optional = Optional.ofNullable(parent.getNullable("parent")) - /** The department name. */ + /** + * 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 - /** The parent department, if present. */ + /** + * Returns the raw JSON value of [parent]. + * + * Unlike [parent], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("parent") @ExcludeMissing fun _parent(): JsonField = parent @JsonAnyGetter @@ -728,19 +950,31 @@ private constructor( /** The department name. */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The department name. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The department name. */ + /** + * 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 } /** The parent department, if present. */ fun parent(parent: Parent?) = parent(JsonField.ofNullable(parent)) - /** The parent department, if present. */ + /** Alias for calling [Builder.parent] with `parent.orElse(null)`. */ fun parent(parent: Optional) = parent(parent.getOrNull()) - /** The parent department, if present. */ + /** + * Sets [Builder.parent] to an arbitrary JSON value. + * + * You should usually call [Builder.parent] with a well-typed [Parent] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun parent(parent: JsonField) = apply { this.parent = parent } fun additionalProperties(additionalProperties: Map) = apply { @@ -777,10 +1011,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The parent department's name. */ + /** + * The parent department's name. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The parent department's name. */ + /** + * 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 @JsonAnyGetter @@ -821,10 +1064,16 @@ private constructor( /** The parent department's name. */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The parent department's name. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The parent department's name. */ + /** + * 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 { @@ -901,16 +1150,34 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The tax payer subtype of the company. */ + /** + * The tax payer subtype of the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) - /** The tax payer type of the company. */ + /** + * The tax payer type of the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** The tax payer subtype of the company. */ + /** + * Returns the raw JSON value of [subtype]. + * + * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype - /** The tax payer type of the company. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -954,19 +1221,31 @@ private constructor( /** The tax payer subtype of the company. */ fun subtype(subtype: Subtype?) = subtype(JsonField.ofNullable(subtype)) - /** The tax payer subtype of the company. */ + /** Alias for calling [Builder.subtype] with `subtype.orElse(null)`. */ fun subtype(subtype: Optional) = subtype(subtype.getOrNull()) - /** The tax payer subtype of the company. */ + /** + * Sets [Builder.subtype] to an arbitrary JSON value. + * + * You should usually call [Builder.subtype] with a well-typed [Subtype] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun subtype(subtype: JsonField) = apply { this.subtype = subtype } /** The tax payer type of the company. */ fun type(type: Type?) = type(JsonField.ofNullable(type)) - /** The tax payer type of the company. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** The tax payer type of the company. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt index 08194700..fd75183b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt @@ -32,42 +32,123 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { + /** + * @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 customerId(): String = body.customerId() + /** + * @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 customerName(): String = body.customerName() + /** + * @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 products(): List = body.products() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun customerEmail(): Optional = body.customerEmail() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun integration(): Optional = body.integration() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun manual(): Optional = body.manual() - /** The number of minutes until the session expires (defaults to 43,200, which is 30 days) */ + /** + * The number of minutes until the session expires (defaults to 43,200, which is 30 days) + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun minutesToExpire(): Optional = body.minutesToExpire() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun redirectUri(): Optional = body.redirectUri() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun sandbox(): Optional = body.sandbox() + /** + * Returns the raw JSON value of [customerId]. + * + * Unlike [customerId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _customerId(): JsonField = body._customerId() + /** + * Returns the raw JSON value of [customerName]. + * + * Unlike [customerName], this method doesn't throw if the JSON field has an unexpected type. + */ fun _customerName(): JsonField = body._customerName() + /** + * Returns the raw JSON value of [products]. + * + * Unlike [products], this method doesn't throw if the JSON field has an unexpected type. + */ fun _products(): JsonField> = body._products() + /** + * Returns the raw JSON value of [customerEmail]. + * + * Unlike [customerEmail], this method doesn't throw if the JSON field has an unexpected type. + */ fun _customerEmail(): JsonField = body._customerEmail() + /** + * Returns the raw JSON value of [integration]. + * + * Unlike [integration], this method doesn't throw if the JSON field has an unexpected type. + */ fun _integration(): JsonField = body._integration() + /** + * Returns the raw JSON value of [manual]. + * + * Unlike [manual], this method doesn't throw if the JSON field has an unexpected type. + */ fun _manual(): JsonField = body._manual() - /** The number of minutes until the session expires (defaults to 43,200, which is 30 days) */ + /** + * Returns the raw JSON value of [minutesToExpire]. + * + * Unlike [minutesToExpire], this method doesn't throw if the JSON field has an unexpected type. + */ fun _minutesToExpire(): JsonField = body._minutesToExpire() + /** + * Returns the raw JSON value of [redirectUri]. + * + * Unlike [redirectUri], this method doesn't throw if the JSON field has an unexpected type. + */ fun _redirectUri(): JsonField = body._redirectUri() + /** + * Returns the raw JSON value of [sandbox]. + * + * Unlike [sandbox], this method doesn't throw if the JSON field has an unexpected type. + */ fun _sandbox(): JsonField = body._sandbox() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -117,64 +198,144 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @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 customerId(): String = customerId.getRequired("customer_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 customerName(): String = customerName.getRequired("customer_name") + /** + * @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 products(): List = products.getRequired("products") + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun customerEmail(): Optional = Optional.ofNullable(customerEmail.getNullable("customer_email")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun integration(): Optional = Optional.ofNullable(integration.getNullable("integration")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun manual(): Optional = Optional.ofNullable(manual.getNullable("manual")) /** * The number of minutes until the session expires (defaults to 43,200, which is 30 days) + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun minutesToExpire(): Optional = Optional.ofNullable(minutesToExpire.getNullable("minutes_to_expire")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun redirectUri(): Optional = Optional.ofNullable(redirectUri.getNullable("redirect_uri")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun sandbox(): Optional = Optional.ofNullable(sandbox.getNullable("sandbox")) + /** + * Returns the raw JSON value of [customerId]. + * + * Unlike [customerId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("customer_id") @ExcludeMissing fun _customerId(): JsonField = customerId + /** + * Returns the raw JSON value of [customerName]. + * + * Unlike [customerName], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("customer_name") @ExcludeMissing fun _customerName(): JsonField = customerName + /** + * Returns the raw JSON value of [products]. + * + * Unlike [products], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("products") @ExcludeMissing fun _products(): JsonField> = products + /** + * Returns the raw JSON value of [customerEmail]. + * + * Unlike [customerEmail], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("customer_email") @ExcludeMissing fun _customerEmail(): JsonField = customerEmail + /** + * Returns the raw JSON value of [integration]. + * + * Unlike [integration], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("integration") @ExcludeMissing fun _integration(): JsonField = integration + /** + * Returns the raw JSON value of [manual]. + * + * Unlike [manual], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("manual") @ExcludeMissing fun _manual(): JsonField = manual /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 days) + * Returns the raw JSON value of [minutesToExpire]. + * + * Unlike [minutesToExpire], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("minutes_to_expire") @ExcludeMissing fun _minutesToExpire(): JsonField = minutesToExpire + /** + * Returns the raw JSON value of [redirectUri]. + * + * Unlike [redirectUri], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("redirect_uri") @ExcludeMissing fun _redirectUri(): JsonField = redirectUri + /** + * Returns the raw JSON value of [sandbox]. + * + * Unlike [sandbox], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("sandbox") @ExcludeMissing fun _sandbox(): JsonField = sandbox @JsonAnyGetter @@ -247,20 +408,46 @@ private constructor( fun customerId(customerId: String) = customerId(JsonField.of(customerId)) + /** + * Sets [Builder.customerId] to an arbitrary JSON value. + * + * You should usually call [Builder.customerId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun customerId(customerId: JsonField) = apply { this.customerId = customerId } fun customerName(customerName: String) = customerName(JsonField.of(customerName)) + /** + * Sets [Builder.customerName] to an arbitrary JSON value. + * + * You should usually call [Builder.customerName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun customerName(customerName: JsonField) = apply { this.customerName = customerName } fun products(products: List) = products(JsonField.of(products)) + /** + * Sets [Builder.products] to an arbitrary JSON value. + * + * You should usually call [Builder.products] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun products(products: JsonField>) = apply { this.products = products.map { it.toMutableList() } } + /** + * Adds a single [ConnectProducts] to [products]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addProduct(product: ConnectProducts) = apply { products = (products ?: JsonField.of(mutableListOf())).also { @@ -271,9 +458,17 @@ private constructor( fun customerEmail(customerEmail: String?) = customerEmail(JsonField.ofNullable(customerEmail)) + /** Alias for calling [Builder.customerEmail] with `customerEmail.orElse(null)`. */ fun customerEmail(customerEmail: Optional) = customerEmail(customerEmail.getOrNull()) + /** + * Sets [Builder.customerEmail] to an arbitrary JSON value. + * + * You should usually call [Builder.customerEmail] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun customerEmail(customerEmail: JsonField) = apply { this.customerEmail = customerEmail } @@ -281,19 +476,40 @@ private constructor( fun integration(integration: Integration?) = integration(JsonField.ofNullable(integration)) + /** Alias for calling [Builder.integration] with `integration.orElse(null)`. */ fun integration(integration: Optional) = integration(integration.getOrNull()) + /** + * Sets [Builder.integration] to an arbitrary JSON value. + * + * You should usually call [Builder.integration] with a well-typed [Integration] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun integration(integration: JsonField) = apply { this.integration = integration } fun manual(manual: Boolean?) = manual(JsonField.ofNullable(manual)) + /** + * Alias for [Builder.manual]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun manual(manual: Boolean) = manual(manual as Boolean?) + /** Alias for calling [Builder.manual] with `manual.orElse(null)`. */ fun manual(manual: Optional) = manual(manual.getOrNull()) + /** + * Sets [Builder.manual] to an arbitrary JSON value. + * + * You should usually call [Builder.manual] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun manual(manual: JsonField) = apply { this.manual = manual } /** @@ -304,22 +520,23 @@ private constructor( minutesToExpire(JsonField.ofNullable(minutesToExpire)) /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 - * days) + * Alias for [Builder.minutesToExpire]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun minutesToExpire(minutesToExpire: Double) = minutesToExpire(minutesToExpire as Double?) - /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 - * days) - */ + /** Alias for calling [Builder.minutesToExpire] with `minutesToExpire.orElse(null)`. */ fun minutesToExpire(minutesToExpire: Optional) = minutesToExpire(minutesToExpire.getOrNull()) /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 - * days) + * Sets [Builder.minutesToExpire] to an arbitrary JSON value. + * + * You should usually call [Builder.minutesToExpire] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun minutesToExpire(minutesToExpire: JsonField) = apply { this.minutesToExpire = minutesToExpire @@ -327,16 +544,32 @@ private constructor( fun redirectUri(redirectUri: String?) = redirectUri(JsonField.ofNullable(redirectUri)) + /** Alias for calling [Builder.redirectUri] with `redirectUri.orElse(null)`. */ fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.getOrNull()) + /** + * Sets [Builder.redirectUri] to an arbitrary JSON value. + * + * You should usually call [Builder.redirectUri] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun redirectUri(redirectUri: JsonField) = apply { this.redirectUri = redirectUri } fun sandbox(sandbox: Sandbox?) = sandbox(JsonField.ofNullable(sandbox)) + /** Alias for calling [Builder.sandbox] with `sandbox.orElse(null)`. */ fun sandbox(sandbox: Optional) = sandbox(sandbox.getOrNull()) + /** + * Sets [Builder.sandbox] to an arbitrary JSON value. + * + * You should usually call [Builder.sandbox] with a well-typed [Sandbox] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun sandbox(sandbox: JsonField) = apply { this.sandbox = sandbox } fun additionalProperties(additionalProperties: Map) = apply { @@ -425,43 +658,97 @@ private constructor( fun customerId(customerId: String) = apply { body.customerId(customerId) } + /** + * Sets [Builder.customerId] to an arbitrary JSON value. + * + * You should usually call [Builder.customerId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun customerId(customerId: JsonField) = apply { body.customerId(customerId) } fun customerName(customerName: String) = apply { body.customerName(customerName) } + /** + * Sets [Builder.customerName] to an arbitrary JSON value. + * + * You should usually call [Builder.customerName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun customerName(customerName: JsonField) = apply { body.customerName(customerName) } fun products(products: List) = apply { body.products(products) } + /** + * Sets [Builder.products] to an arbitrary JSON value. + * + * You should usually call [Builder.products] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun products(products: JsonField>) = apply { body.products(products) } + /** + * Adds a single [ConnectProducts] to [products]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addProduct(product: ConnectProducts) = apply { body.addProduct(product) } fun customerEmail(customerEmail: String?) = apply { body.customerEmail(customerEmail) } + /** Alias for calling [Builder.customerEmail] with `customerEmail.orElse(null)`. */ fun customerEmail(customerEmail: Optional) = customerEmail(customerEmail.getOrNull()) + /** + * Sets [Builder.customerEmail] to an arbitrary JSON value. + * + * You should usually call [Builder.customerEmail] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun customerEmail(customerEmail: JsonField) = apply { body.customerEmail(customerEmail) } fun integration(integration: Integration?) = apply { body.integration(integration) } + /** Alias for calling [Builder.integration] with `integration.orElse(null)`. */ fun integration(integration: Optional) = integration(integration.getOrNull()) + /** + * Sets [Builder.integration] to an arbitrary JSON value. + * + * You should usually call [Builder.integration] with a well-typed [Integration] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun integration(integration: JsonField) = apply { body.integration(integration) } fun manual(manual: Boolean?) = apply { body.manual(manual) } + /** + * Alias for [Builder.manual]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun manual(manual: Boolean) = manual(manual as Boolean?) + /** Alias for calling [Builder.manual] with `manual.orElse(null)`. */ fun manual(manual: Optional) = manual(manual.getOrNull()) + /** + * Sets [Builder.manual] to an arbitrary JSON value. + * + * You should usually call [Builder.manual] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun manual(manual: JsonField) = apply { body.manual(manual) } /** @@ -472,18 +759,22 @@ private constructor( } /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 days) + * Alias for [Builder.minutesToExpire]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun minutesToExpire(minutesToExpire: Double) = minutesToExpire(minutesToExpire as Double?) - /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 days) - */ + /** Alias for calling [Builder.minutesToExpire] with `minutesToExpire.orElse(null)`. */ fun minutesToExpire(minutesToExpire: Optional) = minutesToExpire(minutesToExpire.getOrNull()) /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 days) + * Sets [Builder.minutesToExpire] to an arbitrary JSON value. + * + * You should usually call [Builder.minutesToExpire] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun minutesToExpire(minutesToExpire: JsonField) = apply { body.minutesToExpire(minutesToExpire) @@ -491,14 +782,29 @@ private constructor( fun redirectUri(redirectUri: String?) = apply { body.redirectUri(redirectUri) } + /** Alias for calling [Builder.redirectUri] with `redirectUri.orElse(null)`. */ fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.getOrNull()) + /** + * Sets [Builder.redirectUri] to an arbitrary JSON value. + * + * You should usually call [Builder.redirectUri] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun redirectUri(redirectUri: JsonField) = apply { body.redirectUri(redirectUri) } fun sandbox(sandbox: Sandbox?) = apply { body.sandbox(sandbox) } + /** Alias for calling [Builder.sandbox] with `sandbox.orElse(null)`. */ fun sandbox(sandbox: Optional) = sandbox(sandbox.getOrNull()) + /** + * Sets [Builder.sandbox] to an arbitrary JSON value. + * + * You should usually call [Builder.sandbox] with a well-typed [Sandbox] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun sandbox(sandbox: JsonField) = apply { body.sandbox(sandbox) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { @@ -778,15 +1084,33 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun authMethod(): Optional = Optional.ofNullable(authMethod.getNullable("auth_method")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun provider(): Optional = Optional.ofNullable(provider.getNullable("provider")) + /** + * Returns the raw JSON value of [authMethod]. + * + * Unlike [authMethod], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("auth_method") @ExcludeMissing fun _authMethod(): JsonField = authMethod + /** + * Returns the raw JSON value of [provider]. + * + * Unlike [provider], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("provider") @ExcludeMissing fun _provider(): JsonField = provider @JsonAnyGetter @@ -829,16 +1153,32 @@ private constructor( fun authMethod(authMethod: AuthMethod?) = authMethod(JsonField.ofNullable(authMethod)) + /** Alias for calling [Builder.authMethod] with `authMethod.orElse(null)`. */ fun authMethod(authMethod: Optional) = authMethod(authMethod.getOrNull()) + /** + * Sets [Builder.authMethod] to an arbitrary JSON value. + * + * You should usually call [Builder.authMethod] with a well-typed [AuthMethod] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun authMethod(authMethod: JsonField) = apply { this.authMethod = authMethod } fun provider(provider: String?) = provider(JsonField.ofNullable(provider)) + /** Alias for calling [Builder.provider] with `provider.orElse(null)`. */ fun provider(provider: Optional) = provider(provider.getOrNull()) + /** + * Sets [Builder.provider] to an arbitrary JSON value. + * + * You should usually call [Builder.provider] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun provider(provider: JsonField) = apply { this.provider = provider } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt index 674be9bb..aaee7b98 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt @@ -32,28 +32,64 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** The ID of the existing connection to reauthenticate */ + /** + * The ID of the existing connection to reauthenticate + * + * @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 connectionId(): String = body.connectionId() - /** The number of minutes until the session expires (defaults to 43,200, which is 30 days) */ + /** + * The number of minutes until the session expires (defaults to 43,200, which is 30 days) + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun minutesToExpire(): Optional = body.minutesToExpire() - /** The products to request access to (optional for reauthentication) */ + /** + * The products to request access to (optional for reauthentication) + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun products(): Optional> = body.products() - /** The URI to redirect to after the Connect flow is completed */ + /** + * The URI to redirect to after the Connect flow is completed + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun redirectUri(): Optional = body.redirectUri() - /** The ID of the existing connection to reauthenticate */ + /** + * Returns the raw JSON value of [connectionId]. + * + * Unlike [connectionId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _connectionId(): JsonField = body._connectionId() - /** The number of minutes until the session expires (defaults to 43,200, which is 30 days) */ + /** + * Returns the raw JSON value of [minutesToExpire]. + * + * Unlike [minutesToExpire], this method doesn't throw if the JSON field has an unexpected type. + */ fun _minutesToExpire(): JsonField = body._minutesToExpire() - /** The products to request access to (optional for reauthentication) */ + /** + * Returns the raw JSON value of [products]. + * + * Unlike [products], this method doesn't throw if the JSON field has an unexpected type. + */ fun _products(): JsonField> = body._products() - /** The URI to redirect to after the Connect flow is completed */ + /** + * Returns the raw JSON value of [redirectUri]. + * + * Unlike [redirectUri], this method doesn't throw if the JSON field has an unexpected type. + */ fun _redirectUri(): JsonField = body._redirectUri() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -88,41 +124,75 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The ID of the existing connection to reauthenticate */ + /** + * The ID of the existing connection to reauthenticate + * + * @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 connectionId(): String = connectionId.getRequired("connection_id") /** * The number of minutes until the session expires (defaults to 43,200, which is 30 days) + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun minutesToExpire(): Optional = Optional.ofNullable(minutesToExpire.getNullable("minutes_to_expire")) - /** The products to request access to (optional for reauthentication) */ + /** + * The products to request access to (optional for reauthentication) + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun products(): Optional> = Optional.ofNullable(products.getNullable("products")) - /** The URI to redirect to after the Connect flow is completed */ + /** + * The URI to redirect to after the Connect flow is completed + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun redirectUri(): Optional = Optional.ofNullable(redirectUri.getNullable("redirect_uri")) - /** The ID of the existing connection to reauthenticate */ + /** + * Returns the raw JSON value of [connectionId]. + * + * Unlike [connectionId], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("connection_id") @ExcludeMissing fun _connectionId(): JsonField = connectionId /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 days) + * Returns the raw JSON value of [minutesToExpire]. + * + * Unlike [minutesToExpire], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("minutes_to_expire") @ExcludeMissing fun _minutesToExpire(): JsonField = minutesToExpire - /** The products to request access to (optional for reauthentication) */ + /** + * Returns the raw JSON value of [products]. + * + * Unlike [products], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("products") @ExcludeMissing fun _products(): JsonField> = products - /** The URI to redirect to after the Connect flow is completed */ + /** + * Returns the raw JSON value of [redirectUri]. + * + * Unlike [redirectUri], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("redirect_uri") @ExcludeMissing fun _redirectUri(): JsonField = redirectUri @@ -181,7 +251,13 @@ private constructor( /** The ID of the existing connection to reauthenticate */ fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - /** The ID of the existing connection to reauthenticate */ + /** + * Sets [Builder.connectionId] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun connectionId(connectionId: JsonField) = apply { this.connectionId = connectionId } @@ -194,21 +270,22 @@ private constructor( minutesToExpire(JsonField.ofNullable(minutesToExpire)) /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 - * days) + * Alias for [Builder.minutesToExpire]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun minutesToExpire(minutesToExpire: Long) = minutesToExpire(minutesToExpire as Long?) - /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 - * days) - */ + /** Alias for calling [Builder.minutesToExpire] with `minutesToExpire.orElse(null)`. */ fun minutesToExpire(minutesToExpire: Optional) = minutesToExpire(minutesToExpire.getOrNull()) /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 - * days) + * Sets [Builder.minutesToExpire] to an arbitrary JSON value. + * + * You should usually call [Builder.minutesToExpire] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun minutesToExpire(minutesToExpire: JsonField) = apply { this.minutesToExpire = minutesToExpire @@ -218,15 +295,25 @@ private constructor( fun products(products: List?) = products(JsonField.ofNullable(products)) - /** The products to request access to (optional for reauthentication) */ + /** Alias for calling [Builder.products] with `products.orElse(null)`. */ fun products(products: Optional>) = products(products.getOrNull()) - /** The products to request access to (optional for reauthentication) */ + /** + * Sets [Builder.products] to an arbitrary JSON value. + * + * You should usually call [Builder.products] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun products(products: JsonField>) = apply { this.products = products.map { it.toMutableList() } } - /** The products to request access to (optional for reauthentication) */ + /** + * Adds a single [ConnectProducts] to [products]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addProduct(product: ConnectProducts) = apply { products = (products ?: JsonField.of(mutableListOf())).also { @@ -237,10 +324,16 @@ private constructor( /** The URI to redirect to after the Connect flow is completed */ fun redirectUri(redirectUri: String?) = redirectUri(JsonField.ofNullable(redirectUri)) - /** The URI to redirect to after the Connect flow is completed */ + /** Alias for calling [Builder.redirectUri] with `redirectUri.orElse(null)`. */ fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.getOrNull()) - /** The URI to redirect to after the Connect flow is completed */ + /** + * Sets [Builder.redirectUri] to an arbitrary JSON value. + * + * You should usually call [Builder.redirectUri] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun redirectUri(redirectUri: JsonField) = apply { this.redirectUri = redirectUri } @@ -328,7 +421,13 @@ private constructor( /** The ID of the existing connection to reauthenticate */ fun connectionId(connectionId: String) = apply { body.connectionId(connectionId) } - /** The ID of the existing connection to reauthenticate */ + /** + * Sets [Builder.connectionId] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun connectionId(connectionId: JsonField) = apply { body.connectionId(connectionId) } @@ -341,18 +440,22 @@ private constructor( } /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 days) + * Alias for [Builder.minutesToExpire]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun minutesToExpire(minutesToExpire: Long) = minutesToExpire(minutesToExpire as Long?) - /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 days) - */ + /** Alias for calling [Builder.minutesToExpire] with `minutesToExpire.orElse(null)`. */ fun minutesToExpire(minutesToExpire: Optional) = minutesToExpire(minutesToExpire.getOrNull()) /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 days) + * Sets [Builder.minutesToExpire] to an arbitrary JSON value. + * + * You should usually call [Builder.minutesToExpire] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun minutesToExpire(minutesToExpire: JsonField) = apply { body.minutesToExpire(minutesToExpire) @@ -361,22 +464,38 @@ private constructor( /** The products to request access to (optional for reauthentication) */ fun products(products: List?) = apply { body.products(products) } - /** The products to request access to (optional for reauthentication) */ + /** Alias for calling [Builder.products] with `products.orElse(null)`. */ fun products(products: Optional>) = products(products.getOrNull()) - /** The products to request access to (optional for reauthentication) */ + /** + * Sets [Builder.products] to an arbitrary JSON value. + * + * You should usually call [Builder.products] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun products(products: JsonField>) = apply { body.products(products) } - /** The products to request access to (optional for reauthentication) */ + /** + * Adds a single [ConnectProducts] to [products]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addProduct(product: ConnectProducts) = apply { body.addProduct(product) } /** The URI to redirect to after the Connect flow is completed */ fun redirectUri(redirectUri: String?) = apply { body.redirectUri(redirectUri) } - /** The URI to redirect to after the Connect flow is completed */ + /** Alias for calling [Builder.redirectUri] with `redirectUri.orElse(null)`. */ fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.getOrNull()) - /** The URI to redirect to after the Connect flow is completed */ + /** + * Sets [Builder.redirectUri] to an arbitrary JSON value. + * + * You should usually call [Builder.redirectUri] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun redirectUri(redirectUri: JsonField) = apply { body.redirectUri(redirectUri) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt index 0ffd9785..3d341e85 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt @@ -51,57 +51,130 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @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 accessToken(): String = accessToken.getRequired("access_token") - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + /** + * [DEPRECATED] Use `connection_id` to associate a connection with an access token + * + * @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). + */ @Deprecated("deprecated") fun accountId(): String = accountId.getRequired("account_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 authenticationType(): AuthenticationType = authenticationType.getRequired("authentication_type") - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + /** + * [DEPRECATED] Use `connection_id` to associate a connection with an access token + * + * @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). + */ @Deprecated("deprecated") fun companyId(): String = companyId.getRequired("company_id") - /** The ID of the new connection */ + /** + * The ID of the new connection + * + * @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 connectionId(): String = connectionId.getRequired("connection_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 products(): List = products.getRequired("products") - /** The ID of the provider associated with the `access_token`. */ + /** + * The ID of the provider associated with the `access_token`. + * + * @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 providerId(): String = providerId.getRequired("provider_id") + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tokenType(): Optional = Optional.ofNullable(tokenType.getNullable("token_type")) + /** + * Returns the raw JSON value of [accessToken]. + * + * Unlike [accessToken], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("access_token") @ExcludeMissing fun _accessToken(): JsonField = accessToken - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + /** + * Returns the raw JSON value of [accountId]. + * + * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. + */ @Deprecated("deprecated") @JsonProperty("account_id") @ExcludeMissing fun _accountId(): JsonField = accountId + /** + * Returns the raw JSON value of [authenticationType]. + * + * Unlike [authenticationType], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("authentication_type") @ExcludeMissing fun _authenticationType(): JsonField = authenticationType - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + /** + * Returns the raw JSON value of [companyId]. + * + * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected type. + */ @Deprecated("deprecated") @JsonProperty("company_id") @ExcludeMissing fun _companyId(): JsonField = companyId - /** The ID of the new connection */ + /** + * Returns the raw JSON value of [connectionId]. + * + * Unlike [connectionId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("connection_id") @ExcludeMissing fun _connectionId(): JsonField = connectionId + /** + * Returns the raw JSON value of [products]. + * + * Unlike [products], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("products") @ExcludeMissing fun _products(): JsonField> = products - /** The ID of the provider associated with the `access_token`. */ + /** + * Returns the raw JSON value of [providerId]. + * + * Unlike [providerId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("provider_id") @ExcludeMissing fun _providerId(): JsonField = providerId + /** + * Returns the raw JSON value of [tokenType]. + * + * Unlike [tokenType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("token_type") @ExcludeMissing fun _tokenType(): JsonField = tokenType @JsonAnyGetter @@ -175,19 +248,39 @@ private constructor( fun accessToken(accessToken: String) = accessToken(JsonField.of(accessToken)) + /** + * Sets [Builder.accessToken] to an arbitrary JSON value. + * + * You should usually call [Builder.accessToken] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun accessToken(accessToken: JsonField) = apply { this.accessToken = accessToken } /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ @Deprecated("deprecated") fun accountId(accountId: String) = accountId(JsonField.of(accountId)) - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + /** + * Sets [Builder.accountId] to an arbitrary JSON value. + * + * You should usually call [Builder.accountId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ @Deprecated("deprecated") fun accountId(accountId: JsonField) = apply { this.accountId = accountId } fun authenticationType(authenticationType: AuthenticationType) = authenticationType(JsonField.of(authenticationType)) + /** + * Sets [Builder.authenticationType] to an arbitrary JSON value. + * + * You should usually call [Builder.authenticationType] with a well-typed + * [AuthenticationType] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun authenticationType(authenticationType: JsonField) = apply { this.authenticationType = authenticationType } @@ -196,24 +289,48 @@ private constructor( @Deprecated("deprecated") fun companyId(companyId: String) = companyId(JsonField.of(companyId)) - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + /** + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ @Deprecated("deprecated") fun companyId(companyId: JsonField) = apply { this.companyId = companyId } /** The ID of the new connection */ fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - /** The ID of the new connection */ + /** + * Sets [Builder.connectionId] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun connectionId(connectionId: JsonField) = apply { this.connectionId = connectionId } fun products(products: List) = products(JsonField.of(products)) + /** + * Sets [Builder.products] to an arbitrary JSON value. + * + * You should usually call [Builder.products] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun products(products: JsonField>) = apply { this.products = products.map { it.toMutableList() } } + /** + * Adds a single [String] to [products]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addProduct(product: String) = apply { products = (products ?: JsonField.of(mutableListOf())).also { @@ -224,11 +341,24 @@ private constructor( /** The ID of the provider associated with the `access_token`. */ fun providerId(providerId: String) = providerId(JsonField.of(providerId)) - /** The ID of the provider associated with the `access_token`. */ + /** + * Sets [Builder.providerId] to an arbitrary JSON value. + * + * You should usually call [Builder.providerId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun providerId(providerId: JsonField) = apply { this.providerId = providerId } fun tokenType(tokenType: String) = tokenType(JsonField.of(tokenType)) + /** + * Sets [Builder.tokenType] to an arbitrary JSON value. + * + * You should usually call [Builder.tokenType] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tokenType(tokenType: JsonField) = apply { this.tokenType = tokenType } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt index 2fa19d9f..c90f319e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt @@ -58,92 +58,171 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The access token for the connection. */ + /** + * The access token for the connection. + * + * @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 accessToken(): String = accessToken.getRequired("access_token") - /** [DEPRECATED] Use `connection_id` to identify the connection instead of this account ID. */ + /** + * [DEPRECATED] Use `connection_id` to identify the connection instead of this account 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). + */ @Deprecated("deprecated") fun accountId(): String = accountId.getRequired("account_id") - /** The type of application associated with a token. */ + /** + * The type of application associated with a token. + * + * @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 clientType(): ClientType = clientType.getRequired("client_type") - /** [DEPRECATED] Use `connection_id` to identify the connection instead of this company ID. */ + /** + * [DEPRECATED] Use `connection_id` to identify the connection instead of this company 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). + */ @Deprecated("deprecated") fun companyId(): String = companyId.getRequired("company_id") - /** The Finch UUID of the connection associated with the `access_token`. */ + /** + * The Finch UUID of the connection associated with the `access_token`. + * + * @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 connectionId(): String = connectionId.getRequired("connection_id") /** * The type of the connection associated with the token. * - `provider` - connection to an external provider * - `finch` - finch-generated data. + * + * @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 connectionType(): ConnectionType = connectionType.getRequired("connection_type") - /** An array of the authorized products associated with the `access_token`. */ + /** + * An array of the authorized products associated with the `access_token`. + * + * @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 products(): List = products.getRequired("products") - /** The ID of the provider associated with the `access_token`. */ + /** + * The ID of the provider associated with the `access_token`. + * + * @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 providerId(): String = providerId.getRequired("provider_id") /** * The ID of your customer you provided to Finch when a connect session was created for this * connection. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun customerId(): Optional = Optional.ofNullable(customerId.getNullable("customer_id")) - /** The RFC 8693 token type (Finch uses `bearer` tokens) */ + /** + * The RFC 8693 token type (Finch uses `bearer` tokens) + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun tokenType(): Optional = Optional.ofNullable(tokenType.getNullable("token_type")) - /** The access token for the connection. */ + /** + * Returns the raw JSON value of [accessToken]. + * + * Unlike [accessToken], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("access_token") @ExcludeMissing fun _accessToken(): JsonField = accessToken - /** [DEPRECATED] Use `connection_id` to identify the connection instead of this account ID. */ + /** + * Returns the raw JSON value of [accountId]. + * + * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. + */ @Deprecated("deprecated") @JsonProperty("account_id") @ExcludeMissing fun _accountId(): JsonField = accountId - /** The type of application associated with a token. */ + /** + * Returns the raw JSON value of [clientType]. + * + * Unlike [clientType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("client_type") @ExcludeMissing fun _clientType(): JsonField = clientType - /** [DEPRECATED] Use `connection_id` to identify the connection instead of this company ID. */ + /** + * Returns the raw JSON value of [companyId]. + * + * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected type. + */ @Deprecated("deprecated") @JsonProperty("company_id") @ExcludeMissing fun _companyId(): JsonField = companyId - /** The Finch UUID of the connection associated with the `access_token`. */ + /** + * Returns the raw JSON value of [connectionId]. + * + * Unlike [connectionId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("connection_id") @ExcludeMissing fun _connectionId(): JsonField = connectionId /** - * The type of the connection associated with the token. - * - `provider` - connection to an external provider - * - `finch` - finch-generated data. + * Returns the raw JSON value of [connectionType]. + * + * Unlike [connectionType], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("connection_type") @ExcludeMissing fun _connectionType(): JsonField = connectionType - /** An array of the authorized products associated with the `access_token`. */ + /** + * Returns the raw JSON value of [products]. + * + * Unlike [products], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("products") @ExcludeMissing fun _products(): JsonField> = products - /** The ID of the provider associated with the `access_token`. */ + /** + * Returns the raw JSON value of [providerId]. + * + * Unlike [providerId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("provider_id") @ExcludeMissing fun _providerId(): JsonField = providerId /** - * The ID of your customer you provided to Finch when a connect session was created for this - * connection. + * Returns the raw JSON value of [customerId]. + * + * Unlike [customerId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("customer_id") @ExcludeMissing fun _customerId(): JsonField = customerId - /** The RFC 8693 token type (Finch uses `bearer` tokens) */ + /** + * Returns the raw JSON value of [tokenType]. + * + * Unlike [tokenType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("token_type") @ExcludeMissing fun _tokenType(): JsonField = tokenType @JsonAnyGetter @@ -225,7 +304,13 @@ private constructor( /** The access token for the connection. */ fun accessToken(accessToken: String) = accessToken(JsonField.of(accessToken)) - /** The access token for the connection. */ + /** + * Sets [Builder.accessToken] to an arbitrary JSON value. + * + * You should usually call [Builder.accessToken] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun accessToken(accessToken: JsonField) = apply { this.accessToken = accessToken } /** @@ -235,7 +320,11 @@ private constructor( fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Use `connection_id` to identify the connection instead of this account ID. + * Sets [Builder.accountId] to an arbitrary JSON value. + * + * You should usually call [Builder.accountId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun accountId(accountId: JsonField) = apply { this.accountId = accountId } @@ -243,7 +332,13 @@ private constructor( /** The type of application associated with a token. */ fun clientType(clientType: ClientType) = clientType(JsonField.of(clientType)) - /** The type of application associated with a token. */ + /** + * Sets [Builder.clientType] to an arbitrary JSON value. + * + * You should usually call [Builder.clientType] with a well-typed [ClientType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun clientType(clientType: JsonField) = apply { this.clientType = clientType } /** @@ -253,7 +348,11 @@ private constructor( fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Use `connection_id` to identify the connection instead of this company ID. + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun companyId(companyId: JsonField) = apply { this.companyId = companyId } @@ -261,7 +360,13 @@ private constructor( /** The Finch UUID of the connection associated with the `access_token`. */ fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - /** The Finch UUID of the connection associated with the `access_token`. */ + /** + * Sets [Builder.connectionId] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun connectionId(connectionId: JsonField) = apply { this.connectionId = connectionId } @@ -275,9 +380,11 @@ private constructor( connectionType(JsonField.of(connectionType)) /** - * The type of the connection associated with the token. - * - `provider` - connection to an external provider - * - `finch` - finch-generated data. + * Sets [Builder.connectionType] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionType] with a well-typed [ConnectionType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun connectionType(connectionType: JsonField) = apply { this.connectionType = connectionType @@ -286,12 +393,22 @@ private constructor( /** An array of the authorized products associated with the `access_token`. */ fun products(products: List) = products(JsonField.of(products)) - /** An array of the authorized products associated with the `access_token`. */ + /** + * Sets [Builder.products] to an arbitrary JSON value. + * + * You should usually call [Builder.products] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun products(products: JsonField>) = apply { this.products = products.map { it.toMutableList() } } - /** An array of the authorized products associated with the `access_token`. */ + /** + * Adds a single [String] to [products]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addProduct(product: String) = apply { products = (products ?: JsonField.of(mutableListOf())).also { @@ -302,7 +419,13 @@ private constructor( /** The ID of the provider associated with the `access_token`. */ fun providerId(providerId: String) = providerId(JsonField.of(providerId)) - /** The ID of the provider associated with the `access_token`. */ + /** + * Sets [Builder.providerId] to an arbitrary JSON value. + * + * You should usually call [Builder.providerId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun providerId(providerId: JsonField) = apply { this.providerId = providerId } /** @@ -311,22 +434,28 @@ private constructor( */ fun customerId(customerId: String?) = customerId(JsonField.ofNullable(customerId)) - /** - * The ID of your customer you provided to Finch when a connect session was created for this - * connection. - */ + /** Alias for calling [Builder.customerId] with `customerId.orElse(null)`. */ fun customerId(customerId: Optional) = customerId(customerId.getOrNull()) /** - * The ID of your customer you provided to Finch when a connect session was created for this - * connection. + * Sets [Builder.customerId] to an arbitrary JSON value. + * + * You should usually call [Builder.customerId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun customerId(customerId: JsonField) = apply { this.customerId = customerId } /** The RFC 8693 token type (Finch uses `bearer` tokens) */ fun tokenType(tokenType: String) = tokenType(JsonField.of(tokenType)) - /** The RFC 8693 token type (Finch uses `bearer` tokens) */ + /** + * Sets [Builder.tokenType] to an arbitrary JSON value. + * + * You should usually call [Builder.tokenType] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun tokenType(tokenType: JsonField) = apply { this.tokenType = tokenType } fun additionalProperties(additionalProperties: Map) = apply { 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 debd9112..b66d093d 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 @@ -14,6 +14,7 @@ import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @NoAutoDetect @@ -26,8 +27,17 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @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 benefitId(): String = benefitId.getRequired("benefit_id") + /** + * Returns the raw JSON value of [benefitId]. + * + * Unlike [benefitId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("benefit_id") @ExcludeMissing fun _benefitId(): JsonField = benefitId @JsonAnyGetter @@ -75,6 +85,13 @@ private constructor( fun benefitId(benefitId: String) = benefitId(JsonField.of(benefitId)) + /** + * Sets [Builder.benefitId] to an arbitrary JSON value. + * + * You should usually call [Builder.benefitId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun benefitId(benefitId: JsonField) = apply { this.benefitId = benefitId } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt index b7d4d199..8daa4499 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt @@ -42,26 +42,46 @@ private constructor( /** * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. + * + * @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). */ @Deprecated("deprecated") fun accountId(): String = accountId.getRequired("account_id") /** * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. + * + * @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). */ @Deprecated("deprecated") fun companyId(): String = companyId.getRequired("company_id") - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Unique Finch ID of the connection associated with the webhook event. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun connectionId(): Optional = Optional.ofNullable(connectionId.getNullable("connection_id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use - * `connection_id` instead to identify the connection associated with this event. + * Returns the raw JSON value of [accountId]. + * + * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("account_id") @@ -69,21 +89,36 @@ private constructor( fun _accountId(): JsonField = accountId /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use - * `connection_id` instead to identify the connection associated with this event. + * Returns the raw JSON value of [companyId]. + * + * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("company_id") @ExcludeMissing fun _companyId(): JsonField = companyId - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Returns the raw JSON value of [connectionId]. + * + * Unlike [connectionId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("connection_id") @ExcludeMissing fun _connectionId(): JsonField = connectionId + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [eventType]. + * + * Unlike [eventType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType @JsonAnyGetter @@ -156,8 +191,11 @@ private constructor( fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use - * `connection_id` instead to identify the connection associated with this event. + * Sets [Builder.accountId] to an arbitrary JSON value. + * + * You should usually call [Builder.accountId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun accountId(accountId: JsonField) = apply { this.accountId = accountId } @@ -170,8 +208,11 @@ private constructor( fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use - * `connection_id` instead to identify the connection associated with this event. + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun companyId(companyId: JsonField) = apply { this.companyId = companyId } @@ -179,17 +220,36 @@ private constructor( /** Unique Finch ID of the connection associated with the webhook event. */ fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Sets [Builder.connectionId] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun connectionId(connectionId: JsonField) = apply { this.connectionId = connectionId } fun data(data: Data) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Data] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun data(data: JsonField) = apply { this.data = data } fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + /** + * Sets [Builder.eventType] to an arbitrary JSON value. + * + * You should usually call [Builder.eventType] with a well-typed [EventType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun eventType(eventType: JsonField) = apply { this.eventType = eventType } fun additionalProperties(additionalProperties: Map) = apply { @@ -233,11 +293,21 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The ID of the individual related to the event. */ + /** + * The ID of the individual related to the event. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("individual_id")) - /** The ID of the individual related to the event. */ + /** + * 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 @@ -280,7 +350,13 @@ private constructor( /** The ID of the individual related to the event. */ fun individualId(individualId: String) = individualId(JsonField.of(individualId)) - /** The ID of the individual related to the event. */ + /** + * 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 } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt index 90850d4a..f7831576 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt @@ -14,6 +14,7 @@ import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @NoAutoDetect @@ -26,10 +27,19 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** If the request is successful, Finch will return “success” (HTTP 200 status). */ + /** + * If the request is successful, Finch will return “success” (HTTP 200 status). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly + * missing or null (e.g. if the server responded with an unexpected value). + */ fun status(): String = status.getRequired("status") - /** If the request is successful, Finch will return “success” (HTTP 200 status). */ + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status @JsonAnyGetter @@ -77,7 +87,12 @@ private constructor( /** If the request is successful, Finch will return “success” (HTTP 200 status). */ fun status(status: String) = status(JsonField.of(status)) - /** If the request is successful, Finch will return “success” (HTTP 200 status). */ + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun status(status: JsonField) = apply { this.status = status } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt index dc86fdfe..cf432ce7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt @@ -15,6 +15,7 @@ import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @NoAutoDetect @@ -30,14 +31,32 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @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 documents(): List = documents.getRequired("documents") + /** + * @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 paging(): Paging = paging.getRequired("paging") + /** + * Returns the raw JSON value of [documents]. + * + * Unlike [documents], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("documents") @ExcludeMissing fun _documents(): JsonField> = documents + /** + * Returns the raw JSON value of [paging]. + * + * Unlike [paging], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("paging") @ExcludeMissing fun _paging(): JsonField = paging @JsonAnyGetter @@ -88,10 +107,22 @@ private constructor( fun documents(documents: List) = documents(JsonField.of(documents)) + /** + * Sets [Builder.documents] to an arbitrary JSON value. + * + * You should usually call [Builder.documents] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun documents(documents: JsonField>) = apply { this.documents = documents.map { it.toMutableList() } } + /** + * Adds a single [DocumentResponse] to [documents]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addDocument(document: DocumentResponse) = apply { documents = (documents ?: JsonField.of(mutableListOf())).also { @@ -101,6 +132,12 @@ private constructor( fun paging(paging: Paging) = paging(JsonField.of(paging)) + /** + * Sets [Builder.paging] to an arbitrary JSON value. + * + * You should usually call [Builder.paging] with a well-typed [Paging] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun paging(paging: JsonField) = apply { this.paging = paging } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt index a029ccc0..1572b138 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt @@ -33,49 +33,84 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A stable Finch id for the document. */ + /** + * A stable Finch id for the document. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) /** * The ID of the individual associated with the document. This will be null for employer-level * documents. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("individual_id")) - /** The type of document. */ + /** + * The type of document. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) /** * A URL to access the document. Format: * `https://api.tryfinch.com/employer/documents/:document_id`. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun url(): Optional = Optional.ofNullable(url.getNullable("url")) - /** The year the document applies to, if available. */ + /** + * The year the document applies to, if available. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun year(): Optional = Optional.ofNullable(year.getNullable("year")) - /** A stable Finch id for the document. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** - * The ID of the individual associated with the document. This will be null for employer-level - * documents. + * 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 - /** The type of document. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type /** - * A URL to access the document. Format: - * `https://api.tryfinch.com/employer/documents/:document_id`. + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url - /** The year the document applies to, if available. */ + /** + * Returns the raw JSON value of [year]. + * + * Unlike [year], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("year") @ExcludeMissing fun _year(): JsonField = year @JsonAnyGetter @@ -128,7 +163,12 @@ private constructor( /** A stable Finch id for the document. */ fun id(id: String) = id(JsonField.of(id)) - /** A stable Finch id for the document. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** @@ -137,15 +177,15 @@ private constructor( */ fun individualId(individualId: String?) = individualId(JsonField.ofNullable(individualId)) - /** - * The ID of the individual associated with the document. This will be null for - * employer-level documents. - */ + /** Alias for calling [Builder.individualId] with `individualId.orElse(null)`. */ fun individualId(individualId: Optional) = individualId(individualId.getOrNull()) /** - * The ID of the individual associated with the document. This will be null for - * employer-level documents. + * 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 @@ -154,7 +194,12 @@ private constructor( /** The type of document. */ fun type(type: Type) = type(JsonField.of(type)) - /** The type of document. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } /** @@ -164,21 +209,32 @@ private constructor( fun url(url: String) = url(JsonField.of(url)) /** - * A URL to access the document. Format: - * `https://api.tryfinch.com/employer/documents/:document_id`. + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun url(url: JsonField) = apply { this.url = url } /** The year the document applies to, if available. */ fun year(year: Double?) = year(JsonField.ofNullable(year)) - /** The year the document applies to, if available. */ + /** + * Alias for [Builder.year]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun year(year: Double) = year(year as Double?) - /** The year the document applies to, if available. */ + /** Alias for calling [Builder.year] with `year.orElse(null)`. */ fun year(year: Optional) = year(year.getOrNull()) - /** The year the document applies to, if available. */ + /** + * Sets [Builder.year] to an arbitrary JSON value. + * + * You should usually call [Builder.year] with a well-typed [Double] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun year(year: JsonField) = apply { this.year = year } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt index df60c4b1..e8b36762 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt @@ -83,155 +83,321 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** string A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * string A stable Finch `id` (UUID v4) for an individual in the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) - /** Worker's compensation classification code for this employee */ + /** + * Worker's compensation classification code for this employee + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun classCode(): Optional = Optional.ofNullable(classCode.getNullable("class_code")) /** * Custom fields for the individual. These are fields which are defined by the employer in the * system. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun customFields(): Optional> = Optional.ofNullable(customFields.getNullable("custom_fields")) - /** The department object. */ + /** + * The department object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun department(): Optional = Optional.ofNullable(department.getNullable("department")) - /** The employment object. */ + /** + * The employment object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun employment(): Optional = Optional.ofNullable(employment.getNullable("employment")) /** * The detailed employment status of the individual. Available options: `active`, `deceased`, * `leave`, `onboarding`, `prehire`, `retired`, `terminated`. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun employmentStatus(): Optional = Optional.ofNullable(employmentStatus.getNullable("employment_status")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - /** The legal first name of the individual. */ + /** + * The legal first name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) /** * The employee's income as reported by the provider. This may not always be annualized income, * but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what information the * provider returns. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun income(): Optional = Optional.ofNullable(income.getNullable("income")) - /** The array of income history. */ + /** + * The array of income history. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun incomeHistory(): Optional> = Optional.ofNullable(incomeHistory.getNullable("income_history")) - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * `true` if the individual an an active employee or contractor at the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) - /** The legal last name of the individual. */ + /** + * The legal last name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun latestRehireDate(): Optional = Optional.ofNullable(latestRehireDate.getNullable("latest_rehire_date")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun location(): Optional = Optional.ofNullable(location.getNullable("location")) - /** The manager object representing the manager of the individual within the org. */ + /** + * The manager object representing the manager of the individual within the org. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) - /** The legal middle name of the individual. */ + /** + * The legal middle name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) - /** The source system's unique employment identifier for this individual */ + /** + * The source system's unique employment identifier for this individual + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun sourceId(): Optional = Optional.ofNullable(sourceId.getNullable("source_id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) - /** The current title of the individual. */ + /** + * The current title of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun title(): Optional = Optional.ofNullable(title.getNullable("title")) - /** This field is deprecated in favour of `source_id` */ + /** + * This field is deprecated in favour of `source_id` + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ @Deprecated("deprecated") fun workId(): Optional = Optional.ofNullable(workId.getNullable("work_id")) - /** string A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** Worker's compensation classification code for this employee */ + /** + * Returns the raw JSON value of [classCode]. + * + * Unlike [classCode], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("class_code") @ExcludeMissing fun _classCode(): JsonField = classCode /** - * Custom fields for the individual. These are fields which are defined by the employer in the - * system. + * Returns the raw JSON value of [customFields]. + * + * Unlike [customFields], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("custom_fields") @ExcludeMissing fun _customFields(): JsonField> = customFields - /** The department object. */ + /** + * Returns the raw JSON value of [department]. + * + * Unlike [department], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("department") @ExcludeMissing fun _department(): JsonField = department - /** The employment object. */ + /** + * Returns the raw JSON value of [employment]. + * + * Unlike [employment], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("employment") @ExcludeMissing fun _employment(): JsonField = employment /** - * The detailed employment status of the individual. Available options: `active`, `deceased`, - * `leave`, `onboarding`, `prehire`, `retired`, `terminated`. + * Returns the raw JSON value of [employmentStatus]. + * + * Unlike [employmentStatus], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("employment_status") @ExcludeMissing fun _employmentStatus(): JsonField = employmentStatus + /** + * Returns the raw JSON value of [endDate]. + * + * Unlike [endDate], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("end_date") @ExcludeMissing fun _endDate(): JsonField = endDate - /** The legal first name of the individual. */ + /** + * Returns the raw JSON value of [firstName]. + * + * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName /** - * The employee's income as reported by the provider. This may not always be annualized income, - * but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what information the - * provider returns. + * Returns the raw JSON value of [income]. + * + * Unlike [income], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("income") @ExcludeMissing fun _income(): JsonField = income - /** The array of income history. */ + /** + * Returns the raw JSON value of [incomeHistory]. + * + * Unlike [incomeHistory], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("income_history") @ExcludeMissing fun _incomeHistory(): JsonField> = incomeHistory - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * Returns the raw JSON value of [isActive]. + * + * Unlike [isActive], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("is_active") @ExcludeMissing fun _isActive(): JsonField = isActive - /** The legal last name of the individual. */ + /** + * Returns the raw JSON value of [lastName]. + * + * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName + /** + * Returns the raw JSON value of [latestRehireDate]. + * + * Unlike [latestRehireDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("latest_rehire_date") @ExcludeMissing fun _latestRehireDate(): JsonField = latestRehireDate + /** + * Returns the raw JSON value of [location]. + * + * Unlike [location], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("location") @ExcludeMissing fun _location(): JsonField = location - /** The manager object representing the manager of the individual within the org. */ + /** + * Returns the raw JSON value of [manager]. + * + * Unlike [manager], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("manager") @ExcludeMissing fun _manager(): JsonField = manager - /** The legal middle name of the individual. */ + /** + * Returns the raw JSON value of [middleName]. + * + * Unlike [middleName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("middle_name") @ExcludeMissing fun _middleName(): JsonField = middleName - /** The source system's unique employment identifier for this individual */ + /** + * Returns the raw JSON value of [sourceId]. + * + * Unlike [sourceId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("source_id") @ExcludeMissing fun _sourceId(): JsonField = sourceId + /** + * Returns the raw JSON value of [startDate]. + * + * Unlike [startDate], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("start_date") @ExcludeMissing fun _startDate(): JsonField = startDate - /** The current title of the individual. */ + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title - /** This field is deprecated in favour of `source_id` */ + /** + * Returns the raw JSON value of [workId]. + * + * Unlike [workId], this method doesn't throw if the JSON field has an unexpected type. + */ @Deprecated("deprecated") @JsonProperty("work_id") @ExcludeMissing @@ -332,16 +498,27 @@ private constructor( /** string A stable Finch `id` (UUID v4) for an individual in the company. */ fun id(id: String) = id(JsonField.of(id)) - /** string A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** Worker's compensation classification code for this employee */ fun classCode(classCode: String?) = classCode(JsonField.ofNullable(classCode)) - /** Worker's compensation classification code for this employee */ + /** Alias for calling [Builder.classCode] with `classCode.orElse(null)`. */ fun classCode(classCode: Optional) = classCode(classCode.getOrNull()) - /** Worker's compensation classification code for this employee */ + /** + * Sets [Builder.classCode] to an arbitrary JSON value. + * + * You should usually call [Builder.classCode] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun classCode(classCode: JsonField) = apply { this.classCode = classCode } /** @@ -351,24 +528,25 @@ private constructor( fun customFields(customFields: List?) = customFields(JsonField.ofNullable(customFields)) - /** - * Custom fields for the individual. These are fields which are defined by the employer in - * the system. - */ + /** Alias for calling [Builder.customFields] with `customFields.orElse(null)`. */ fun customFields(customFields: Optional>) = customFields(customFields.getOrNull()) /** - * Custom fields for the individual. These are fields which are defined by the employer in - * the system. + * Sets [Builder.customFields] to an arbitrary JSON value. + * + * You should usually call [Builder.customFields] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ fun customFields(customFields: JsonField>) = apply { this.customFields = customFields.map { it.toMutableList() } } /** - * Custom fields for the individual. These are fields which are defined by the employer in - * the system. + * Adds a single [CustomField] to [customFields]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addCustomField(customField: CustomField) = apply { customFields = @@ -380,19 +558,31 @@ private constructor( /** The department object. */ fun department(department: Department?) = department(JsonField.ofNullable(department)) - /** The department object. */ + /** Alias for calling [Builder.department] with `department.orElse(null)`. */ fun department(department: Optional) = department(department.getOrNull()) - /** The department object. */ + /** + * Sets [Builder.department] to an arbitrary JSON value. + * + * You should usually call [Builder.department] with a well-typed [Department] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun department(department: JsonField) = apply { this.department = department } /** The employment object. */ fun employment(employment: Employment?) = employment(JsonField.ofNullable(employment)) - /** The employment object. */ + /** Alias for calling [Builder.employment] with `employment.orElse(null)`. */ fun employment(employment: Optional) = employment(employment.getOrNull()) - /** The employment object. */ + /** + * Sets [Builder.employment] to an arbitrary JSON value. + * + * You should usually call [Builder.employment] with a well-typed [Employment] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun employment(employment: JsonField) = apply { this.employment = employment } /** @@ -402,16 +592,16 @@ private constructor( fun employmentStatus(employmentStatus: EmploymentStatus?) = employmentStatus(JsonField.ofNullable(employmentStatus)) - /** - * The detailed employment status of the individual. Available options: `active`, - * `deceased`, `leave`, `onboarding`, `prehire`, `retired`, `terminated`. - */ + /** Alias for calling [Builder.employmentStatus] with `employmentStatus.orElse(null)`. */ fun employmentStatus(employmentStatus: Optional) = employmentStatus(employmentStatus.getOrNull()) /** - * The detailed employment status of the individual. Available options: `active`, - * `deceased`, `leave`, `onboarding`, `prehire`, `retired`, `terminated`. + * Sets [Builder.employmentStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.employmentStatus] with a well-typed [EmploymentStatus] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ fun employmentStatus(employmentStatus: JsonField) = apply { this.employmentStatus = employmentStatus @@ -419,17 +609,30 @@ private constructor( fun endDate(endDate: String?) = endDate(JsonField.ofNullable(endDate)) + /** Alias for calling [Builder.endDate] with `endDate.orElse(null)`. */ fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) + /** + * Sets [Builder.endDate] to an arbitrary JSON value. + * + * You should usually call [Builder.endDate] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } /** The legal first name of the individual. */ fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) - /** The legal first name of the individual. */ + /** Alias for calling [Builder.firstName] with `firstName.orElse(null)`. */ fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) - /** The legal first name of the individual. */ + /** + * Sets [Builder.firstName] to an arbitrary JSON value. + * + * You should usually call [Builder.firstName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } /** @@ -439,17 +642,14 @@ private constructor( */ fun income(income: Income?) = income(JsonField.ofNullable(income)) - /** - * The employee's income as reported by the provider. This may not always be annualized - * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what - * information the provider returns. - */ + /** Alias for calling [Builder.income] with `income.orElse(null)`. */ fun income(income: Optional) = income(income.getOrNull()) /** - * The employee's income as reported by the provider. This may not always be annualized - * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what - * information the provider returns. + * Sets [Builder.income] to an arbitrary JSON value. + * + * You should usually call [Builder.income] with a well-typed [Income] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun income(income: JsonField) = apply { this.income = income } @@ -457,16 +657,26 @@ private constructor( fun incomeHistory(incomeHistory: List?) = incomeHistory(JsonField.ofNullable(incomeHistory)) - /** The array of income history. */ + /** Alias for calling [Builder.incomeHistory] with `incomeHistory.orElse(null)`. */ fun incomeHistory(incomeHistory: Optional>) = incomeHistory(incomeHistory.getOrNull()) - /** The array of income history. */ + /** + * Sets [Builder.incomeHistory] to an arbitrary JSON value. + * + * You should usually call [Builder.incomeHistory] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun incomeHistory(incomeHistory: JsonField>) = apply { this.incomeHistory = incomeHistory.map { it.toMutableList() } } - /** The array of income history. */ + /** + * Adds a single [Income] to [Builder.incomeHistory]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addIncomeHistory(incomeHistory: Income) = apply { this.incomeHistory = (this.incomeHistory ?: JsonField.of(mutableListOf())).also { @@ -477,89 +687,154 @@ private constructor( /** `true` if the individual an an active employee or contractor at the company. */ fun isActive(isActive: Boolean?) = isActive(JsonField.ofNullable(isActive)) - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * Alias for [Builder.isActive]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun isActive(isActive: Boolean) = isActive(isActive as Boolean?) - /** `true` if the individual an an active employee or contractor at the company. */ + /** Alias for calling [Builder.isActive] with `isActive.orElse(null)`. */ fun isActive(isActive: Optional) = isActive(isActive.getOrNull()) - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * Sets [Builder.isActive] to an arbitrary JSON value. + * + * You should usually call [Builder.isActive] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun isActive(isActive: JsonField) = apply { this.isActive = isActive } /** The legal last name of the individual. */ fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) - /** The legal last name of the individual. */ + /** Alias for calling [Builder.lastName] with `lastName.orElse(null)`. */ fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) - /** The legal last name of the individual. */ + /** + * Sets [Builder.lastName] to an arbitrary JSON value. + * + * You should usually call [Builder.lastName] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } fun latestRehireDate(latestRehireDate: String?) = latestRehireDate(JsonField.ofNullable(latestRehireDate)) + /** Alias for calling [Builder.latestRehireDate] with `latestRehireDate.orElse(null)`. */ fun latestRehireDate(latestRehireDate: Optional) = latestRehireDate(latestRehireDate.getOrNull()) + /** + * Sets [Builder.latestRehireDate] to an arbitrary JSON value. + * + * You should usually call [Builder.latestRehireDate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun latestRehireDate(latestRehireDate: JsonField) = apply { this.latestRehireDate = latestRehireDate } fun location(location: Location?) = location(JsonField.ofNullable(location)) + /** Alias for calling [Builder.location] with `location.orElse(null)`. */ fun location(location: Optional) = location(location.getOrNull()) + /** + * Sets [Builder.location] to an arbitrary JSON value. + * + * You should usually call [Builder.location] with a well-typed [Location] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun location(location: JsonField) = apply { this.location = location } /** The manager object representing the manager of the individual within the org. */ fun manager(manager: Manager?) = manager(JsonField.ofNullable(manager)) - /** The manager object representing the manager of the individual within the org. */ + /** Alias for calling [Builder.manager] with `manager.orElse(null)`. */ fun manager(manager: Optional) = manager(manager.getOrNull()) - /** The manager object representing the manager of the individual within the org. */ + /** + * Sets [Builder.manager] to an arbitrary JSON value. + * + * You should usually call [Builder.manager] with a well-typed [Manager] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun manager(manager: JsonField) = apply { this.manager = manager } /** The legal middle name of the individual. */ fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) - /** The legal middle name of the individual. */ + /** Alias for calling [Builder.middleName] with `middleName.orElse(null)`. */ fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) - /** The legal middle name of the individual. */ + /** + * Sets [Builder.middleName] to an arbitrary JSON value. + * + * You should usually call [Builder.middleName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } /** The source system's unique employment identifier for this individual */ fun sourceId(sourceId: String?) = sourceId(JsonField.ofNullable(sourceId)) - /** The source system's unique employment identifier for this individual */ + /** Alias for calling [Builder.sourceId] with `sourceId.orElse(null)`. */ fun sourceId(sourceId: Optional) = sourceId(sourceId.getOrNull()) - /** The source system's unique employment identifier for this individual */ + /** + * Sets [Builder.sourceId] to an arbitrary JSON value. + * + * You should usually call [Builder.sourceId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun sourceId(sourceId: JsonField) = apply { this.sourceId = sourceId } fun startDate(startDate: String?) = startDate(JsonField.ofNullable(startDate)) + /** Alias for calling [Builder.startDate] with `startDate.orElse(null)`. */ fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) + /** + * Sets [Builder.startDate] to an arbitrary JSON value. + * + * You should usually call [Builder.startDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun startDate(startDate: JsonField) = apply { this.startDate = startDate } /** The current title of the individual. */ fun title(title: String?) = title(JsonField.ofNullable(title)) - /** The current title of the individual. */ + /** Alias for calling [Builder.title] with `title.orElse(null)`. */ fun title(title: Optional) = title(title.getOrNull()) - /** The current title of the individual. */ + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun title(title: JsonField) = apply { this.title = title } /** This field is deprecated in favour of `source_id` */ @Deprecated("deprecated") fun workId(workId: String?) = workId(JsonField.ofNullable(workId)) - /** This field is deprecated in favour of `source_id` */ + /** Alias for calling [Builder.workId] with `workId.orElse(null)`. */ @Deprecated("deprecated") fun workId(workId: Optional) = workId(workId.getOrNull()) - /** This field is deprecated in favour of `source_id` */ + /** + * Sets [Builder.workId] to an arbitrary JSON value. + * + * You should usually call [Builder.workId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ @Deprecated("deprecated") fun workId(workId: JsonField) = apply { this.workId = workId } @@ -620,10 +895,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value + /** + * 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 @JsonAnyGetter @@ -665,6 +949,13 @@ private constructor( fun name(name: String) = name(JsonField.of(name)) + /** + * 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 value(value: JsonValue) = apply { this.value = value } @@ -721,10 +1012,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The name of the department associated with the individual. */ + /** + * The name of the department associated with the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The name of the department associated with the individual. */ + /** + * 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 @JsonAnyGetter @@ -765,10 +1065,16 @@ private constructor( /** The name of the department associated with the individual. */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The name of the department associated with the individual. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The name of the department associated with the individual. */ + /** + * 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 { @@ -827,19 +1133,32 @@ private constructor( /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, * `intern`, `temp`, `seasonal` and `individual_contractor`. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) - /** The main employment type of the individual. */ + /** + * The main employment type of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) /** - * The secondary employment type of the individual. Options: `full_time`, `part_time`, - * `intern`, `temp`, `seasonal` and `individual_contractor`. + * Returns the raw JSON value of [subtype]. + * + * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype - /** The main employment type of the individual. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -886,25 +1205,31 @@ private constructor( */ fun subtype(subtype: Subtype?) = subtype(JsonField.ofNullable(subtype)) - /** - * The secondary employment type of the individual. Options: `full_time`, `part_time`, - * `intern`, `temp`, `seasonal` and `individual_contractor`. - */ + /** Alias for calling [Builder.subtype] with `subtype.orElse(null)`. */ fun subtype(subtype: Optional) = subtype(subtype.getOrNull()) /** - * The secondary employment type of the individual. Options: `full_time`, `part_time`, - * `intern`, `temp`, `seasonal` and `individual_contractor`. + * Sets [Builder.subtype] to an arbitrary JSON value. + * + * You should usually call [Builder.subtype] with a well-typed [Subtype] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun subtype(subtype: JsonField) = apply { this.subtype = subtype } /** The main employment type of the individual. */ fun type(type: Type?) = type(JsonField.ofNullable(type)) - /** The main employment type of the individual. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** The main employment type of the individual. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -1324,10 +1649,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * A stable Finch `id` (UUID v4) for an individual in the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id @JsonAnyGetter @@ -1368,7 +1702,13 @@ private constructor( /** A stable Finch `id` (UUID v4) for an individual in the company. */ fun id(id: String) = id(JsonField.of(id)) - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt index be8638ad..194d4a2a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional @@ -30,17 +31,44 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun body(): Optional = Optional.ofNullable(body.getNullable("body")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun code(): Optional = Optional.ofNullable(code.getNullable("code")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("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 @@ -88,14 +116,34 @@ private constructor( fun body(body: EmploymentData) = body(JsonField.of(body)) + /** + * Sets [Builder.body] to an arbitrary JSON value. + * + * You should usually call [Builder.body] with a well-typed [EmploymentData] 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 } fun code(code: Long) = code(JsonField.of(code)) + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [Long] 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 } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt index e63e58df..f6ad8900 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt @@ -42,26 +42,46 @@ private constructor( /** * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. + * + * @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). */ @Deprecated("deprecated") fun accountId(): String = accountId.getRequired("account_id") /** * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. + * + * @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). */ @Deprecated("deprecated") fun companyId(): String = companyId.getRequired("company_id") - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Unique Finch ID of the connection associated with the webhook event. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun connectionId(): Optional = Optional.ofNullable(connectionId.getNullable("connection_id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use - * `connection_id` instead to identify the connection associated with this event. + * Returns the raw JSON value of [accountId]. + * + * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("account_id") @@ -69,21 +89,36 @@ private constructor( fun _accountId(): JsonField = accountId /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use - * `connection_id` instead to identify the connection associated with this event. + * Returns the raw JSON value of [companyId]. + * + * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("company_id") @ExcludeMissing fun _companyId(): JsonField = companyId - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Returns the raw JSON value of [connectionId]. + * + * Unlike [connectionId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("connection_id") @ExcludeMissing fun _connectionId(): JsonField = connectionId + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [eventType]. + * + * Unlike [eventType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType @JsonAnyGetter @@ -156,8 +191,11 @@ private constructor( fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use - * `connection_id` instead to identify the connection associated with this event. + * Sets [Builder.accountId] to an arbitrary JSON value. + * + * You should usually call [Builder.accountId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun accountId(accountId: JsonField) = apply { this.accountId = accountId } @@ -170,8 +208,11 @@ private constructor( fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use - * `connection_id` instead to identify the connection associated with this event. + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun companyId(companyId: JsonField) = apply { this.companyId = companyId } @@ -179,17 +220,36 @@ private constructor( /** Unique Finch ID of the connection associated with the webhook event. */ fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Sets [Builder.connectionId] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun connectionId(connectionId: JsonField) = apply { this.connectionId = connectionId } fun data(data: Data) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Data] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun data(data: JsonField) = apply { this.data = data } fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + /** + * Sets [Builder.eventType] to an arbitrary JSON value. + * + * You should usually call [Builder.eventType] with a well-typed [EventType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun eventType(eventType: JsonField) = apply { this.eventType = eventType } fun additionalProperties(additionalProperties: Map) = apply { @@ -233,11 +293,21 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The ID of the individual related to the event. */ + /** + * The ID of the individual related to the event. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("individual_id")) - /** The ID of the individual related to the event. */ + /** + * 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 @@ -280,7 +350,13 @@ private constructor( /** The ID of the individual related to the event. */ fun individualId(individualId: String) = individualId(JsonField.of(individualId)) - /** The ID of the individual related to the event. */ + /** + * 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 } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt index b344f9c9..be949862 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt @@ -80,142 +80,304 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * A stable Finch `id` (UUID v4) for an individual in the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) - /** Worker's compensation classification code for this employee */ + /** + * Worker's compensation classification code for this employee + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun classCode(): Optional = Optional.ofNullable(classCode.getNullable("class_code")) /** * Custom fields for the individual. These are fields which are defined by the employer in the * system. Custom fields are not currently supported for assisted connections. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun customFields(): Optional> = Optional.ofNullable(customFields.getNullable("custom_fields")) - /** The department object. */ + /** + * The department object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun department(): Optional = Optional.ofNullable(department.getNullable("department")) - /** The employment object. */ + /** + * The employment object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun employment(): Optional = Optional.ofNullable(employment.getNullable("employment")) - /** The detailed employment status of the individual. */ + /** + * The detailed employment status of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun employmentStatus(): Optional = Optional.ofNullable(employmentStatus.getNullable("employment_status")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - /** The legal first name of the individual. */ + /** + * The legal first name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) /** * The employee's income as reported by the provider. This may not always be annualized income, * but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what information the * provider returns. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun income(): Optional = Optional.ofNullable(income.getNullable("income")) - /** The array of income history. */ + /** + * The array of income history. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun incomeHistory(): Optional> = Optional.ofNullable(incomeHistory.getNullable("income_history")) - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * `true` if the individual an an active employee or contractor at the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) - /** The legal last name of the individual. */ + /** + * The legal last name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun latestRehireDate(): Optional = Optional.ofNullable(latestRehireDate.getNullable("latest_rehire_date")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun location(): Optional = Optional.ofNullable(location.getNullable("location")) - /** The manager object representing the manager of the individual within the org. */ + /** + * The manager object representing the manager of the individual within the org. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) - /** The legal middle name of the individual. */ + /** + * The legal middle name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) - /** The source system's unique employment identifier for this individual */ + /** + * The source system's unique employment identifier for this individual + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun sourceId(): Optional = Optional.ofNullable(sourceId.getNullable("source_id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) - /** The current title of the individual. */ + /** + * The current title of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun title(): Optional = Optional.ofNullable(title.getNullable("title")) - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** Worker's compensation classification code for this employee */ + /** + * Returns the raw JSON value of [classCode]. + * + * Unlike [classCode], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("class_code") @ExcludeMissing fun _classCode(): JsonField = classCode /** - * Custom fields for the individual. These are fields which are defined by the employer in the - * system. Custom fields are not currently supported for assisted connections. + * Returns the raw JSON value of [customFields]. + * + * Unlike [customFields], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("custom_fields") @ExcludeMissing fun _customFields(): JsonField> = customFields - /** The department object. */ + /** + * Returns the raw JSON value of [department]. + * + * Unlike [department], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("department") @ExcludeMissing fun _department(): JsonField = department - /** The employment object. */ + /** + * Returns the raw JSON value of [employment]. + * + * Unlike [employment], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("employment") @ExcludeMissing fun _employment(): JsonField = employment - /** The detailed employment status of the individual. */ + /** + * Returns the raw JSON value of [employmentStatus]. + * + * Unlike [employmentStatus], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("employment_status") @ExcludeMissing fun _employmentStatus(): JsonField = employmentStatus + /** + * Returns the raw JSON value of [endDate]. + * + * Unlike [endDate], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("end_date") @ExcludeMissing fun _endDate(): JsonField = endDate - /** The legal first name of the individual. */ + /** + * Returns the raw JSON value of [firstName]. + * + * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName /** - * The employee's income as reported by the provider. This may not always be annualized income, - * but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what information the - * provider returns. + * Returns the raw JSON value of [income]. + * + * Unlike [income], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("income") @ExcludeMissing fun _income(): JsonField = income - /** The array of income history. */ + /** + * Returns the raw JSON value of [incomeHistory]. + * + * Unlike [incomeHistory], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("income_history") @ExcludeMissing fun _incomeHistory(): JsonField> = incomeHistory - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * Returns the raw JSON value of [isActive]. + * + * Unlike [isActive], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("is_active") @ExcludeMissing fun _isActive(): JsonField = isActive - /** The legal last name of the individual. */ + /** + * Returns the raw JSON value of [lastName]. + * + * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName + /** + * Returns the raw JSON value of [latestRehireDate]. + * + * Unlike [latestRehireDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("latest_rehire_date") @ExcludeMissing fun _latestRehireDate(): JsonField = latestRehireDate + /** + * Returns the raw JSON value of [location]. + * + * Unlike [location], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("location") @ExcludeMissing fun _location(): JsonField = location - /** The manager object representing the manager of the individual within the org. */ + /** + * Returns the raw JSON value of [manager]. + * + * Unlike [manager], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("manager") @ExcludeMissing fun _manager(): JsonField = manager - /** The legal middle name of the individual. */ + /** + * Returns the raw JSON value of [middleName]. + * + * Unlike [middleName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("middle_name") @ExcludeMissing fun _middleName(): JsonField = middleName - /** The source system's unique employment identifier for this individual */ + /** + * Returns the raw JSON value of [sourceId]. + * + * Unlike [sourceId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("source_id") @ExcludeMissing fun _sourceId(): JsonField = sourceId + /** + * Returns the raw JSON value of [startDate]. + * + * Unlike [startDate], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("start_date") @ExcludeMissing fun _startDate(): JsonField = startDate - /** The current title of the individual. */ + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title @JsonAnyGetter @@ -310,16 +472,27 @@ private constructor( /** A stable Finch `id` (UUID v4) for an individual in the company. */ fun id(id: String) = id(JsonField.of(id)) - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** Worker's compensation classification code for this employee */ fun classCode(classCode: String?) = classCode(JsonField.ofNullable(classCode)) - /** Worker's compensation classification code for this employee */ + /** Alias for calling [Builder.classCode] with `classCode.orElse(null)`. */ fun classCode(classCode: Optional) = classCode(classCode.getOrNull()) - /** Worker's compensation classification code for this employee */ + /** + * Sets [Builder.classCode] to an arbitrary JSON value. + * + * You should usually call [Builder.classCode] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun classCode(classCode: JsonField) = apply { this.classCode = classCode } /** @@ -329,16 +502,20 @@ private constructor( fun customFields(customFields: List) = customFields(JsonField.of(customFields)) /** - * Custom fields for the individual. These are fields which are defined by the employer in - * the system. Custom fields are not currently supported for assisted connections. + * Sets [Builder.customFields] to an arbitrary JSON value. + * + * You should usually call [Builder.customFields] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ fun customFields(customFields: JsonField>) = apply { this.customFields = customFields.map { it.toMutableList() } } /** - * Custom fields for the individual. These are fields which are defined by the employer in - * the system. Custom fields are not currently supported for assisted connections. + * Adds a single [CustomField] to [customFields]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addCustomField(customField: CustomField) = apply { customFields = @@ -350,47 +527,78 @@ private constructor( /** The department object. */ fun department(department: Department?) = department(JsonField.ofNullable(department)) - /** The department object. */ + /** Alias for calling [Builder.department] with `department.orElse(null)`. */ fun department(department: Optional) = department(department.getOrNull()) - /** The department object. */ + /** + * Sets [Builder.department] to an arbitrary JSON value. + * + * You should usually call [Builder.department] with a well-typed [Department] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun department(department: JsonField) = apply { this.department = department } /** The employment object. */ fun employment(employment: Employment?) = employment(JsonField.ofNullable(employment)) - /** The employment object. */ + /** Alias for calling [Builder.employment] with `employment.orElse(null)`. */ fun employment(employment: Optional) = employment(employment.getOrNull()) - /** The employment object. */ + /** + * Sets [Builder.employment] to an arbitrary JSON value. + * + * You should usually call [Builder.employment] with a well-typed [Employment] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun employment(employment: JsonField) = apply { this.employment = employment } /** The detailed employment status of the individual. */ fun employmentStatus(employmentStatus: EmploymentStatus?) = employmentStatus(JsonField.ofNullable(employmentStatus)) - /** The detailed employment status of the individual. */ + /** Alias for calling [Builder.employmentStatus] with `employmentStatus.orElse(null)`. */ fun employmentStatus(employmentStatus: Optional) = employmentStatus(employmentStatus.getOrNull()) - /** The detailed employment status of the individual. */ + /** + * Sets [Builder.employmentStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.employmentStatus] with a well-typed [EmploymentStatus] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun employmentStatus(employmentStatus: JsonField) = apply { this.employmentStatus = employmentStatus } fun endDate(endDate: String?) = endDate(JsonField.ofNullable(endDate)) + /** Alias for calling [Builder.endDate] with `endDate.orElse(null)`. */ fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) + /** + * Sets [Builder.endDate] to an arbitrary JSON value. + * + * You should usually call [Builder.endDate] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } /** The legal first name of the individual. */ fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) - /** The legal first name of the individual. */ + /** Alias for calling [Builder.firstName] with `firstName.orElse(null)`. */ fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) - /** The legal first name of the individual. */ + /** + * Sets [Builder.firstName] to an arbitrary JSON value. + * + * You should usually call [Builder.firstName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } /** @@ -400,17 +608,14 @@ private constructor( */ fun income(income: Income?) = income(JsonField.ofNullable(income)) - /** - * The employee's income as reported by the provider. This may not always be annualized - * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what - * information the provider returns. - */ + /** Alias for calling [Builder.income] with `income.orElse(null)`. */ fun income(income: Optional) = income(income.getOrNull()) /** - * The employee's income as reported by the provider. This may not always be annualized - * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what - * information the provider returns. + * Sets [Builder.income] to an arbitrary JSON value. + * + * You should usually call [Builder.income] with a well-typed [Income] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun income(income: JsonField) = apply { this.income = income } @@ -418,16 +623,26 @@ private constructor( fun incomeHistory(incomeHistory: List?) = incomeHistory(JsonField.ofNullable(incomeHistory)) - /** The array of income history. */ + /** Alias for calling [Builder.incomeHistory] with `incomeHistory.orElse(null)`. */ fun incomeHistory(incomeHistory: Optional>) = incomeHistory(incomeHistory.getOrNull()) - /** The array of income history. */ + /** + * Sets [Builder.incomeHistory] to an arbitrary JSON value. + * + * You should usually call [Builder.incomeHistory] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun incomeHistory(incomeHistory: JsonField>) = apply { this.incomeHistory = incomeHistory.map { it.toMutableList() } } - /** The array of income history. */ + /** + * Adds a single [Income] to [Builder.incomeHistory]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addIncomeHistory(incomeHistory: Income) = apply { this.incomeHistory = (this.incomeHistory ?: JsonField.of(mutableListOf())).also { @@ -438,77 +653,137 @@ private constructor( /** `true` if the individual an an active employee or contractor at the company. */ fun isActive(isActive: Boolean?) = isActive(JsonField.ofNullable(isActive)) - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * Alias for [Builder.isActive]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun isActive(isActive: Boolean) = isActive(isActive as Boolean?) - /** `true` if the individual an an active employee or contractor at the company. */ + /** Alias for calling [Builder.isActive] with `isActive.orElse(null)`. */ fun isActive(isActive: Optional) = isActive(isActive.getOrNull()) - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * Sets [Builder.isActive] to an arbitrary JSON value. + * + * You should usually call [Builder.isActive] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun isActive(isActive: JsonField) = apply { this.isActive = isActive } /** The legal last name of the individual. */ fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) - /** The legal last name of the individual. */ + /** Alias for calling [Builder.lastName] with `lastName.orElse(null)`. */ fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) - /** The legal last name of the individual. */ + /** + * Sets [Builder.lastName] to an arbitrary JSON value. + * + * You should usually call [Builder.lastName] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } fun latestRehireDate(latestRehireDate: String?) = latestRehireDate(JsonField.ofNullable(latestRehireDate)) + /** Alias for calling [Builder.latestRehireDate] with `latestRehireDate.orElse(null)`. */ fun latestRehireDate(latestRehireDate: Optional) = latestRehireDate(latestRehireDate.getOrNull()) + /** + * Sets [Builder.latestRehireDate] to an arbitrary JSON value. + * + * You should usually call [Builder.latestRehireDate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun latestRehireDate(latestRehireDate: JsonField) = apply { this.latestRehireDate = latestRehireDate } fun location(location: Location?) = location(JsonField.ofNullable(location)) + /** Alias for calling [Builder.location] with `location.orElse(null)`. */ fun location(location: Optional) = location(location.getOrNull()) + /** + * Sets [Builder.location] to an arbitrary JSON value. + * + * You should usually call [Builder.location] with a well-typed [Location] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun location(location: JsonField) = apply { this.location = location } /** The manager object representing the manager of the individual within the org. */ fun manager(manager: Manager?) = manager(JsonField.ofNullable(manager)) - /** The manager object representing the manager of the individual within the org. */ + /** Alias for calling [Builder.manager] with `manager.orElse(null)`. */ fun manager(manager: Optional) = manager(manager.getOrNull()) - /** The manager object representing the manager of the individual within the org. */ + /** + * Sets [Builder.manager] to an arbitrary JSON value. + * + * You should usually call [Builder.manager] with a well-typed [Manager] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun manager(manager: JsonField) = apply { this.manager = manager } /** The legal middle name of the individual. */ fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) - /** The legal middle name of the individual. */ + /** Alias for calling [Builder.middleName] with `middleName.orElse(null)`. */ fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) - /** The legal middle name of the individual. */ + /** + * Sets [Builder.middleName] to an arbitrary JSON value. + * + * You should usually call [Builder.middleName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } /** The source system's unique employment identifier for this individual */ fun sourceId(sourceId: String) = sourceId(JsonField.of(sourceId)) - /** The source system's unique employment identifier for this individual */ + /** + * Sets [Builder.sourceId] to an arbitrary JSON value. + * + * You should usually call [Builder.sourceId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun sourceId(sourceId: JsonField) = apply { this.sourceId = sourceId } fun startDate(startDate: String?) = startDate(JsonField.ofNullable(startDate)) + /** Alias for calling [Builder.startDate] with `startDate.orElse(null)`. */ fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) + /** + * Sets [Builder.startDate] to an arbitrary JSON value. + * + * You should usually call [Builder.startDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun startDate(startDate: JsonField) = apply { this.startDate = startDate } /** The current title of the individual. */ fun title(title: String?) = title(JsonField.ofNullable(title)) - /** The current title of the individual. */ + /** Alias for calling [Builder.title] with `title.orElse(null)`. */ fun title(title: Optional) = title(title.getOrNull()) - /** The current title of the individual. */ + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun title(title: JsonField) = apply { this.title = title } fun additionalProperties(additionalProperties: Map) = apply { @@ -567,10 +842,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value + /** + * 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 @JsonAnyGetter @@ -612,8 +896,16 @@ private constructor( 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 value(value: JsonValue) = apply { this.value = value } @@ -670,10 +962,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The name of the department associated with the individual. */ + /** + * The name of the department associated with the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The name of the department associated with the individual. */ + /** + * 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 @JsonAnyGetter @@ -714,10 +1015,16 @@ private constructor( /** The name of the department associated with the individual. */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The name of the department associated with the individual. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The name of the department associated with the individual. */ + /** + * 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 { @@ -776,19 +1083,32 @@ private constructor( /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, * `intern`, `temp`, `seasonal` and `individual_contractor`. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) - /** The main employment type of the individual. */ + /** + * The main employment type of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) /** - * The secondary employment type of the individual. Options: `full_time`, `part_time`, - * `intern`, `temp`, `seasonal` and `individual_contractor`. + * Returns the raw JSON value of [subtype]. + * + * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype - /** The main employment type of the individual. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -835,25 +1155,31 @@ private constructor( */ fun subtype(subtype: Subtype?) = subtype(JsonField.ofNullable(subtype)) - /** - * The secondary employment type of the individual. Options: `full_time`, `part_time`, - * `intern`, `temp`, `seasonal` and `individual_contractor`. - */ + /** Alias for calling [Builder.subtype] with `subtype.orElse(null)`. */ fun subtype(subtype: Optional) = subtype(subtype.getOrNull()) /** - * The secondary employment type of the individual. Options: `full_time`, `part_time`, - * `intern`, `temp`, `seasonal` and `individual_contractor`. + * Sets [Builder.subtype] to an arbitrary JSON value. + * + * You should usually call [Builder.subtype] with a well-typed [Subtype] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun subtype(subtype: JsonField) = apply { this.subtype = subtype } /** The main employment type of the individual. */ fun type(type: Type?) = type(JsonField.ofNullable(type)) - /** The main employment type of the individual. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** The main employment type of the individual. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -1270,10 +1596,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * A stable Finch `id` (UUID v4) for an individual in the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id @JsonAnyGetter @@ -1314,7 +1649,13 @@ private constructor( /** A stable Finch `id` (UUID v4) for an individual in the company. */ fun id(id: String) = id(JsonField.of(id)) - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } fun additionalProperties(additionalProperties: Map) = apply { 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 index 371bc9ee..8e9cb4e4 100644 --- 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 @@ -31,19 +31,46 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun body(): Optional = Optional.ofNullable(body.getNullable("body")) - /** HTTP status code. Either 201 or 200 */ + /** + * 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 = Optional.ofNullable(code.getNullable("code")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("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 - /** HTTP status code. Either 201 or 200 */ + /** + * 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 @@ -91,16 +118,34 @@ private constructor( 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)) - /** HTTP status code. Either 201 or 200 */ + /** + * 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 } @@ -145,22 +190,49 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A descriptive identifier for the response */ + /** + * 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 = Optional.ofNullable(finchCode.getNullable("finch_code")) - /** Short description in English that provides more information about the response. */ + /** + * 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 = Optional.ofNullable(message.getNullable("message")) - /** Identifier indicating whether the benefit was newly enrolled or updated. */ + /** + * 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 = Optional.ofNullable(name.getNullable("name")) - /** A descriptive identifier for the response */ + /** + * 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 - /** Short description in English that provides more information about the response. */ + /** + * 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 - /** Identifier indicating whether the benefit was newly enrolled or updated. */ + /** + * 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 @JsonAnyGetter @@ -207,28 +279,46 @@ private constructor( /** A descriptive identifier for the response */ fun finchCode(finchCode: String?) = finchCode(JsonField.ofNullable(finchCode)) - /** A descriptive identifier for the response */ + /** Alias for calling [Builder.finchCode] with `finchCode.orElse(null)`. */ fun finchCode(finchCode: Optional) = finchCode(finchCode.getOrNull()) - /** A descriptive identifier for the response */ + /** + * 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)) - /** Short description in English that provides more information about the response. */ + /** Alias for calling [Builder.message] with `message.orElse(null)`. */ fun message(message: Optional) = message(message.getOrNull()) - /** Short description in English that provides more information about the response. */ + /** + * 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)) - /** Identifier indicating whether the benefit was newly enrolled or updated. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Identifier indicating whether the benefit was newly enrolled or updated. */ + /** + * 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 { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt index 51f000f2..9a86d079 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt @@ -16,6 +16,7 @@ import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -34,23 +35,45 @@ private constructor( /** * Name of the benefit as it appears in the provider and pay statements. Recommend limiting this * to <30 characters due to limitations in specific providers (e.g. Justworks). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun description(): Optional = body.description() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun frequency(): Optional = body.frequency() - /** Type of benefit. */ + /** + * Type of benefit. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = body.type() /** - * Name of the benefit as it appears in the provider and pay statements. Recommend limiting this - * to <30 characters due to limitations in specific providers (e.g. Justworks). + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. */ fun _description(): JsonField = body._description() + /** + * Returns the raw JSON value of [frequency]. + * + * Unlike [frequency], this method doesn't throw if the JSON field has an unexpected type. + */ fun _frequency(): JsonField = body._frequency() - /** Type of benefit. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ fun _type(): JsonField = body._type() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -85,29 +108,51 @@ private constructor( /** * Name of the benefit as it appears in the provider and pay statements. Recommend limiting * this to <30 characters due to limitations in specific providers (e.g. Justworks). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun frequency(): Optional = Optional.ofNullable(frequency.getNullable("frequency")) - /** Type of benefit. */ + /** + * Type of benefit. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) /** - * Name of the benefit as it appears in the provider and pay statements. Recommend limiting - * this to <30 characters due to limitations in specific providers (e.g. Justworks). + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + /** + * Returns the raw JSON value of [frequency]. + * + * Unlike [frequency], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("frequency") @ExcludeMissing fun _frequency(): JsonField = frequency - /** Type of benefit. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -159,9 +204,11 @@ private constructor( fun description(description: String) = description(JsonField.of(description)) /** - * Name of the benefit as it appears in the provider and pay statements. Recommend - * limiting this to <30 characters due to limitations in specific providers (e.g. - * Justworks). + * 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 @@ -169,8 +216,16 @@ private constructor( fun frequency(frequency: BenefitFrequency?) = frequency(JsonField.ofNullable(frequency)) + /** Alias for calling [Builder.frequency] with `frequency.orElse(null)`. */ fun frequency(frequency: Optional) = frequency(frequency.getOrNull()) + /** + * Sets [Builder.frequency] to an arbitrary JSON value. + * + * You should usually call [Builder.frequency] with a well-typed [BenefitFrequency] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun frequency(frequency: JsonField) = apply { this.frequency = frequency } @@ -178,10 +233,16 @@ private constructor( /** Type of benefit. */ fun type(type: BenefitType?) = type(JsonField.ofNullable(type)) - /** Type of benefit. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** Type of benefit. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [BenefitType] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -257,24 +318,41 @@ private constructor( fun description(description: String) = apply { body.description(description) } /** - * Name of the benefit as it appears in the provider and pay statements. Recommend limiting - * this to <30 characters due to limitations in specific providers (e.g. Justworks). + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun description(description: JsonField) = apply { body.description(description) } fun frequency(frequency: BenefitFrequency?) = apply { body.frequency(frequency) } + /** Alias for calling [Builder.frequency] with `frequency.orElse(null)`. */ fun frequency(frequency: Optional) = frequency(frequency.getOrNull()) + /** + * Sets [Builder.frequency] to an arbitrary JSON value. + * + * You should usually call [Builder.frequency] with a well-typed [BenefitFrequency] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun frequency(frequency: JsonField) = apply { body.frequency(frequency) } /** Type of benefit. */ fun type(type: BenefitType?) = apply { body.type(type) } - /** Type of benefit. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** Type of benefit. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [BenefitType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { body.type(type) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt index f3e776f3..a308eb41 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt @@ -94,10 +94,7 @@ private constructor( */ fun individualIds(individualIds: String?) = apply { this.individualIds = individualIds } - /** - * comma-delimited list of stable Finch uuids for each individual. If empty, defaults to all - * individuals - */ + /** Alias for calling [Builder.individualIds] with `individualIds.orElse(null)`. */ fun individualIds(individualIds: Optional) = individualIds(individualIds.getOrNull()) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt index feed07ae..14c12f3a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt @@ -18,6 +18,7 @@ import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional @@ -32,10 +33,19 @@ private constructor( fun benefitId(): String = benefitId - /** Array of individual_ids to unenroll. */ + /** + * Array of individual_ids to unenroll. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun individualIds(): Optional> = body.individualIds() - /** Array of individual_ids to unenroll. */ + /** + * Returns the raw JSON value of [individualIds]. + * + * Unlike [individualIds], this method doesn't throw if the JSON field has an unexpected type. + */ fun _individualIds(): JsonField> = body._individualIds() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -68,11 +78,21 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Array of individual_ids to unenroll. */ + /** + * Array of individual_ids to unenroll. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun individualIds(): Optional> = Optional.ofNullable(individualIds.getNullable("individual_ids")) - /** Array of individual_ids to unenroll. */ + /** + * Returns the raw JSON value of [individualIds]. + * + * Unlike [individualIds], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("individual_ids") @ExcludeMissing fun _individualIds(): JsonField> = individualIds @@ -116,12 +136,22 @@ private constructor( fun individualIds(individualIds: List) = individualIds(JsonField.of(individualIds)) - /** Array of individual_ids to unenroll. */ + /** + * Sets [Builder.individualIds] to an arbitrary JSON value. + * + * You should usually call [Builder.individualIds] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun individualIds(individualIds: JsonField>) = apply { this.individualIds = individualIds.map { it.toMutableList() } } - /** Array of individual_ids to unenroll. */ + /** + * Adds a single [String] to [individualIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addIndividualId(individualId: String) = apply { individualIds = (individualIds ?: JsonField.of(mutableListOf())).also { @@ -215,12 +245,22 @@ private constructor( /** Array of individual_ids to unenroll. */ fun individualIds(individualIds: List) = apply { body.individualIds(individualIds) } - /** Array of individual_ids to unenroll. */ + /** + * Sets [Builder.individualIds] to an arbitrary JSON value. + * + * You should usually call [Builder.individualIds] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun individualIds(individualIds: JsonField>) = apply { body.individualIds(individualIds) } - /** Array of individual_ids to unenroll. */ + /** + * Adds a single [String] to [individualIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addIndividualId(individualId: String) = apply { body.addIndividualId(individualId) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt index 0cee2045..4bd37abf 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt @@ -17,6 +17,7 @@ import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional @@ -31,10 +32,19 @@ private constructor( fun benefitId(): String = benefitId - /** Updated name or description. */ + /** + * Updated name or description. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = body.description() - /** Updated name or description. */ + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ fun _description(): JsonField = body._description() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -67,11 +77,20 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Updated name or description. */ + /** + * Updated name or description. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** Updated name or description. */ + /** + * 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 @@ -114,7 +133,13 @@ private constructor( /** Updated name or description. */ fun description(description: String) = description(JsonField.of(description)) - /** Updated name or description. */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun description(description: JsonField) = apply { this.description = description } @@ -196,7 +221,13 @@ private constructor( /** Updated name or description. */ fun description(description: String) = apply { body.description(description) } - /** Updated name or description. */ + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun description(description: JsonField) = apply { body.description(description) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt index adb8a186..2ddb18b6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt @@ -75,19 +75,27 @@ private constructor( /** Number of employees to return (defaults to all) */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Number of employees to return (defaults to all) */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Number of employees to return (defaults to all) */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** Index to start from (defaults to 0) */ fun offset(offset: Long?) = apply { this.offset = offset } - /** Index to start from (defaults to 0) */ + /** + * Alias for [Builder.offset]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun offset(offset: Long) = offset(offset as Long?) - /** Index to start from (defaults to 0) */ + /** Alias for calling [Builder.offset] with `offset.orElse(null)`. */ fun offset(offset: Optional) = offset(offset.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt index d02f0af3..e82bea80 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt @@ -69,19 +69,27 @@ private constructor( /** Number of employees to return (defaults to all) */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Number of employees to return (defaults to all) */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Number of employees to return (defaults to all) */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** Index to start from (defaults to 0) */ fun offset(offset: Long?) = apply { this.offset = offset } - /** Index to start from (defaults to 0) */ + /** + * Alias for [Builder.offset]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun offset(offset: Long) = offset(offset as Long?) - /** Index to start from (defaults to 0) */ + /** Alias for calling [Builder.offset] with `offset.orElse(null)`. */ fun offset(offset: Optional) = offset(offset.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt index a997ca50..2a8059b6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt @@ -96,16 +96,14 @@ private constructor( this.individualIds = individualIds?.toMutableList() } - /** - * Comma-delimited list of stable Finch uuids for each individual. If empty, defaults to all - * individuals - */ + /** Alias for calling [Builder.individualIds] with `individualIds.orElse(null)`. */ fun individualIds(individualIds: Optional>) = individualIds(individualIds.getOrNull()) /** - * Comma-delimited list of stable Finch uuids for each individual. If empty, defaults to all - * individuals + * Adds a single [String] to [individualIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addIndividualId(individualId: String) = apply { individualIds = (individualIds ?: mutableListOf()).apply { add(individualId) } @@ -114,28 +112,40 @@ private constructor( /** Number of documents to return (defaults to all) */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Number of documents to return (defaults to all) */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Number of documents to return (defaults to all) */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** Index to start from (defaults to 0) */ fun offset(offset: Long?) = apply { this.offset = offset } - /** Index to start from (defaults to 0) */ + /** + * Alias for [Builder.offset]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun offset(offset: Long) = offset(offset as Long?) - /** Index to start from (defaults to 0) */ + /** Alias for calling [Builder.offset] with `offset.orElse(null)`. */ fun offset(offset: Optional) = offset(offset.getOrNull()) /** Comma-delimited list of document types to filter on. If empty, defaults to all types */ fun types(types: List?) = apply { this.types = types?.toMutableList() } - /** Comma-delimited list of document types to filter on. If empty, defaults to all types */ + /** Alias for calling [Builder.types] with `types.orElse(null)`. */ fun types(types: Optional>) = types(types.getOrNull()) - /** Comma-delimited list of document types to filter on. If empty, defaults to all types */ + /** + * Adds a single [Type] to [types]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addType(type: Type) = apply { types = (types ?: mutableListOf()).apply { add(type) } } fun additionalHeaders(additionalHeaders: Headers) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt index b29b8fd4..4c7f3344 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt @@ -18,6 +18,7 @@ import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects /** Read individual employment and income data */ @@ -28,10 +29,19 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** The array of batch requests. */ + /** + * The array of batch requests. + * + * @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 requests(): List = body.requests() - /** The array of batch requests. */ + /** + * Returns the raw JSON value of [requests]. + * + * Unlike [requests], this method doesn't throw if the JSON field has an unexpected type. + */ fun _requests(): JsonField> = body._requests() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -58,10 +68,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The array of batch requests. */ + /** + * The array of batch requests. + * + * @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 requests(): List = requests.getRequired("requests") - /** The array of batch requests. */ + /** + * Returns the raw JSON value of [requests]. + * + * Unlike [requests], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("requests") @ExcludeMissing fun _requests(): JsonField> = requests @@ -111,12 +130,22 @@ private constructor( /** The array of batch requests. */ fun requests(requests: List) = requests(JsonField.of(requests)) - /** The array of batch requests. */ + /** + * Sets [Builder.requests] to an arbitrary JSON value. + * + * You should usually call [Builder.requests] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun requests(requests: JsonField>) = apply { this.requests = requests.map { it.toMutableList() } } - /** The array of batch requests. */ + /** + * Adds a single [Request] to [requests]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addRequest(request: Request) = apply { requests = (requests ?: JsonField.of(mutableListOf())).also { @@ -204,10 +233,20 @@ private constructor( /** The array of batch requests. */ fun requests(requests: List) = apply { body.requests(requests) } - /** The array of batch requests. */ + /** + * Sets [Builder.requests] to an arbitrary JSON value. + * + * You should usually call [Builder.requests] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun requests(requests: JsonField>) = apply { body.requests(requests) } - /** The array of batch requests. */ + /** + * Adds a single [Request] to [requests]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addRequest(request: Request) = apply { body.addRequest(request) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { @@ -350,13 +389,17 @@ private constructor( * A stable Finch `id` (UUID v4) for an individual in the company. There is no limit to the * number of `individual_id` to send per request. It is preferantial to send all ids in a * single request for Finch to optimize provider rate-limits. + * + * @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 individualId(): String = individualId.getRequired("individual_id") /** - * A stable Finch `id` (UUID v4) for an individual in the company. There is no limit to the - * number of `individual_id` to send per request. It is preferantial to send all ids in a - * single request for Finch to optimize provider rate-limits. + * 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 @@ -412,9 +455,11 @@ private constructor( fun individualId(individualId: String) = individualId(JsonField.of(individualId)) /** - * A stable Finch `id` (UUID v4) for an individual in the company. There is no limit to - * the number of `individual_id` to send per request. It is preferantial to send all ids - * in a single request for Finch to optimize provider rate-limits. + * 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt index 430d639e..1d830ce5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt @@ -17,6 +17,7 @@ import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -29,12 +30,30 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun options(): Optional = body.options() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun requests(): Optional> = body.requests() + /** + * Returns the raw JSON value of [options]. + * + * Unlike [options], this method doesn't throw if the JSON field has an unexpected type. + */ fun _options(): JsonField = body._options() + /** + * Returns the raw JSON value of [requests]. + * + * Unlike [requests], this method doesn't throw if the JSON field has an unexpected type. + */ fun _requests(): JsonField> = body._requests() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -63,13 +82,31 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun options(): Optional = Optional.ofNullable(options.getNullable("options")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun requests(): Optional> = Optional.ofNullable(requests.getNullable("requests")) + /** + * Returns the raw JSON value of [options]. + * + * Unlike [options], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("options") @ExcludeMissing fun _options(): JsonField = options + /** + * Returns the raw JSON value of [requests]. + * + * Unlike [requests], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("requests") @ExcludeMissing fun _requests(): JsonField> = requests @@ -114,16 +151,36 @@ private constructor( fun options(options: Options?) = options(JsonField.ofNullable(options)) + /** Alias for calling [Builder.options] with `options.orElse(null)`. */ fun options(options: Optional) = options(options.getOrNull()) + /** + * Sets [Builder.options] to an arbitrary JSON value. + * + * You should usually call [Builder.options] with a well-typed [Options] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun options(options: JsonField) = apply { this.options = options } fun requests(requests: List) = requests(JsonField.of(requests)) + /** + * Sets [Builder.requests] to an arbitrary JSON value. + * + * You should usually call [Builder.requests] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun requests(requests: JsonField>) = apply { this.requests = requests.map { it.toMutableList() } } + /** + * Adds a single [Request] to [requests]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addRequest(request: Request) = apply { requests = (requests ?: JsonField.of(mutableListOf())).also { @@ -208,14 +265,33 @@ private constructor( fun options(options: Options?) = apply { body.options(options) } + /** Alias for calling [Builder.options] with `options.orElse(null)`. */ fun options(options: Optional) = options(options.getOrNull()) + /** + * Sets [Builder.options] to an arbitrary JSON value. + * + * You should usually call [Builder.options] with a well-typed [Options] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun options(options: JsonField) = apply { body.options(options) } fun requests(requests: List) = apply { body.requests(requests) } + /** + * Sets [Builder.requests] to an arbitrary JSON value. + * + * You should usually call [Builder.requests] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun requests(requests: JsonField>) = apply { body.requests(requests) } + /** + * Adds a single [Request] to [requests]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addRequest(request: Request) = apply { body.addRequest(request) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { @@ -354,8 +430,17 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun include(): Optional> = Optional.ofNullable(include.getNullable("include")) + /** + * Returns the raw JSON value of [include]. + * + * Unlike [include], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("include") @ExcludeMissing fun _include(): JsonField> = include @JsonAnyGetter @@ -395,10 +480,22 @@ private constructor( fun include(include: List) = include(JsonField.of(include)) + /** + * Sets [Builder.include] to an arbitrary JSON value. + * + * You should usually call [Builder.include] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun include(include: JsonField>) = apply { this.include = include.map { it.toMutableList() } } + /** + * Adds a single [String] to [Builder.include]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addInclude(include: String) = apply { this.include = (this.include ?: JsonField.of(mutableListOf())).also { @@ -461,9 +558,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("individual_id")) + /** + * 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 @@ -505,6 +612,13 @@ private constructor( 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 } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt index 943785a1..99b493ce 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt @@ -18,6 +18,7 @@ import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional @@ -33,10 +34,19 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** The array of batch requests. */ + /** + * The array of batch requests. + * + * @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 requests(): List = body.requests() - /** The array of batch requests. */ + /** + * Returns the raw JSON value of [requests]. + * + * Unlike [requests], this method doesn't throw if the JSON field has an unexpected type. + */ fun _requests(): JsonField> = body._requests() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -62,10 +72,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The array of batch requests. */ + /** + * The array of batch requests. + * + * @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 requests(): List = requests.getRequired("requests") - /** The array of batch requests. */ + /** + * Returns the raw JSON value of [requests]. + * + * Unlike [requests], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("requests") @ExcludeMissing fun _requests(): JsonField> = requests @@ -115,12 +134,22 @@ private constructor( /** The array of batch requests. */ fun requests(requests: List) = requests(JsonField.of(requests)) - /** The array of batch requests. */ + /** + * Sets [Builder.requests] to an arbitrary JSON value. + * + * You should usually call [Builder.requests] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun requests(requests: JsonField>) = apply { this.requests = requests.map { it.toMutableList() } } - /** The array of batch requests. */ + /** + * Adds a single [Request] to [requests]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addRequest(request: Request) = apply { requests = (requests ?: JsonField.of(mutableListOf())).also { @@ -208,10 +237,20 @@ private constructor( /** The array of batch requests. */ fun requests(requests: List) = apply { body.requests(requests) } - /** The array of batch requests. */ + /** + * Sets [Builder.requests] to an arbitrary JSON value. + * + * You should usually call [Builder.requests] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun requests(requests: JsonField>) = apply { body.requests(requests) } - /** The array of batch requests. */ + /** + * Adds a single [Request] to [requests]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addRequest(request: Request) = apply { body.addRequest(request) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { @@ -356,22 +395,49 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A stable Finch `id` (UUID v4) for a payment. */ + /** + * A stable Finch `id` (UUID v4) for a payment. + * + * @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 paymentId(): String = paymentId.getRequired("payment_id") - /** Number of pay statements to return (defaults to all). */ + /** + * Number of pay statements to return (defaults to all). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun limit(): Optional = Optional.ofNullable(limit.getNullable("limit")) - /** Index to start from. */ + /** + * Index to start from. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun offset(): Optional = Optional.ofNullable(offset.getNullable("offset")) - /** A stable Finch `id` (UUID v4) for a payment. */ + /** + * Returns the raw JSON value of [paymentId]. + * + * Unlike [paymentId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("payment_id") @ExcludeMissing fun _paymentId(): JsonField = paymentId - /** Number of pay statements to return (defaults to all). */ + /** + * Returns the raw JSON value of [limit]. + * + * Unlike [limit], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("limit") @ExcludeMissing fun _limit(): JsonField = limit - /** Index to start from. */ + /** + * Returns the raw JSON value of [offset]. + * + * Unlike [offset], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("offset") @ExcludeMissing fun _offset(): JsonField = offset @JsonAnyGetter @@ -425,19 +491,37 @@ private constructor( /** A stable Finch `id` (UUID v4) for a payment. */ fun paymentId(paymentId: String) = paymentId(JsonField.of(paymentId)) - /** A stable Finch `id` (UUID v4) for a payment. */ + /** + * Sets [Builder.paymentId] to an arbitrary JSON value. + * + * You should usually call [Builder.paymentId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun paymentId(paymentId: JsonField) = apply { this.paymentId = paymentId } /** Number of pay statements to return (defaults to all). */ fun limit(limit: Long) = limit(JsonField.of(limit)) - /** Number of pay statements to return (defaults to all). */ + /** + * Sets [Builder.limit] to an arbitrary JSON value. + * + * You should usually call [Builder.limit] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun limit(limit: JsonField) = apply { this.limit = limit } /** Index to start from. */ fun offset(offset: Long) = offset(JsonField.of(offset)) - /** Index to start from. */ + /** + * Sets [Builder.offset] to an arbitrary JSON value. + * + * You should usually call [Builder.offset] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun offset(offset: JsonField) = apply { this.offset = offset } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt index 2766cf2e..2f1c68f5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt @@ -39,36 +39,67 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The income amount in cents. */ + /** + * The income amount in cents. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) - /** The currency code. */ + /** + * The currency code. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - /** The date the income amount went into effect. */ + /** + * The date the income amount went into effect. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun effectiveDate(): Optional = Optional.ofNullable(effectiveDate.getNullable("effective_date")) /** * The income unit of payment. Options: `yearly`, `quarterly`, `monthly`, `semi_monthly`, * `bi_weekly`, `weekly`, `daily`, `hourly`, and `fixed`. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun unit(): Optional = Optional.ofNullable(unit.getNullable("unit")) - /** The income amount in cents. */ + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - /** The currency code. */ + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** The date the income amount went into effect. */ + /** + * Returns the raw JSON value of [effectiveDate]. + * + * Unlike [effectiveDate], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("effective_date") @ExcludeMissing fun _effectiveDate(): JsonField = effectiveDate /** - * The income unit of payment. Options: `yearly`, `quarterly`, `monthly`, `semi_monthly`, - * `bi_weekly`, `weekly`, `daily`, `hourly`, and `fixed`. + * Returns the raw JSON value of [unit]. + * + * Unlike [unit], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("unit") @ExcludeMissing fun _unit(): JsonField = unit @@ -119,33 +150,53 @@ private constructor( /** The income amount in cents. */ fun amount(amount: Long?) = amount(JsonField.ofNullable(amount)) - /** The income amount in cents. */ + /** + * Alias for [Builder.amount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun amount(amount: Long) = amount(amount as Long?) - /** The income amount in cents. */ + /** Alias for calling [Builder.amount] with `amount.orElse(null)`. */ fun amount(amount: Optional) = amount(amount.getOrNull()) - /** The income amount in cents. */ + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } /** The currency code. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) - /** The currency code. */ + /** Alias for calling [Builder.currency] with `currency.orElse(null)`. */ fun currency(currency: Optional) = currency(currency.getOrNull()) - /** The currency code. */ + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } /** The date the income amount went into effect. */ fun effectiveDate(effectiveDate: String?) = effectiveDate(JsonField.ofNullable(effectiveDate)) - /** The date the income amount went into effect. */ + /** Alias for calling [Builder.effectiveDate] with `effectiveDate.orElse(null)`. */ fun effectiveDate(effectiveDate: Optional) = effectiveDate(effectiveDate.getOrNull()) - /** The date the income amount went into effect. */ + /** + * Sets [Builder.effectiveDate] to an arbitrary JSON value. + * + * You should usually call [Builder.effectiveDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun effectiveDate(effectiveDate: JsonField) = apply { this.effectiveDate = effectiveDate } @@ -156,15 +207,14 @@ private constructor( */ fun unit(unit: Unit?) = unit(JsonField.ofNullable(unit)) - /** - * The income unit of payment. Options: `yearly`, `quarterly`, `monthly`, `semi_monthly`, - * `bi_weekly`, `weekly`, `daily`, `hourly`, and `fixed`. - */ + /** Alias for calling [Builder.unit] with `unit.orElse(null)`. */ fun unit(unit: Optional) = unit(unit.getOrNull()) /** - * The income unit of payment. Options: `yearly`, `quarterly`, `monthly`, `semi_monthly`, - * `bi_weekly`, `weekly`, `daily`, `hourly`, and `fixed`. + * Sets [Builder.unit] to an arbitrary JSON value. + * + * You should usually call [Builder.unit] with a well-typed [Unit] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun unit(unit: JsonField) = apply { this.unit = unit } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt index a66b7e4b..dc2c8fd6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt @@ -60,98 +60,203 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * A stable Finch `id` (UUID v4) for an individual in the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun emails(): Optional> = Optional.ofNullable(emails.getNullable("emails")) /** * Social Security Number of the individual in **encrypted** format. This field is only * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set in * the body. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun encryptedSsn(): Optional = Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) - /** The EEOC-defined ethnicity of the individual. */ + /** + * The EEOC-defined ethnicity of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun ethnicity(): Optional = Optional.ofNullable(ethnicity.getNullable("ethnicity")) - /** The legal first name of the individual. */ + /** + * The legal first name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) - /** The gender of the individual. */ + /** + * The gender of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun gender(): Optional = Optional.ofNullable(gender.getNullable("gender")) - /** The legal last name of the individual. */ + /** + * The legal last name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) - /** The legal middle name of the individual. */ + /** + * The legal middle name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun phoneNumbers(): Optional> = Optional.ofNullable(phoneNumbers.getNullable("phone_numbers")) - /** The preferred name of the individual. */ + /** + * The preferred name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun preferredName(): Optional = Optional.ofNullable(preferredName.getNullable("preferred_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun residence(): Optional = Optional.ofNullable(residence.getNullable("residence")) /** * Social Security Number of the individual. This field is only available with the `ssn` scope * enabled and the `options: { include: ['ssn'] }` param set in the body. * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [dob]. + * + * Unlike [dob], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dob") @ExcludeMissing fun _dob(): JsonField = dob + /** + * Returns the raw JSON value of [emails]. + * + * Unlike [emails], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("emails") @ExcludeMissing fun _emails(): JsonField> = emails /** - * Social Security Number of the individual in **encrypted** format. This field is only - * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set in - * the body. + * Returns the raw JSON value of [encryptedSsn]. + * + * Unlike [encryptedSsn], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("encrypted_ssn") @ExcludeMissing fun _encryptedSsn(): JsonField = encryptedSsn - /** The EEOC-defined ethnicity of the individual. */ + /** + * Returns the raw JSON value of [ethnicity]. + * + * Unlike [ethnicity], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("ethnicity") @ExcludeMissing fun _ethnicity(): JsonField = ethnicity - /** The legal first name of the individual. */ + /** + * Returns the raw JSON value of [firstName]. + * + * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName - /** The gender of the individual. */ + /** + * Returns the raw JSON value of [gender]. + * + * Unlike [gender], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gender") @ExcludeMissing fun _gender(): JsonField = gender - /** The legal last name of the individual. */ + /** + * Returns the raw JSON value of [lastName]. + * + * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName - /** The legal middle name of the individual. */ + /** + * Returns the raw JSON value of [middleName]. + * + * Unlike [middleName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("middle_name") @ExcludeMissing fun _middleName(): JsonField = middleName + /** + * Returns the raw JSON value of [phoneNumbers]. + * + * Unlike [phoneNumbers], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("phone_numbers") @ExcludeMissing fun _phoneNumbers(): JsonField> = phoneNumbers - /** The preferred name of the individual. */ + /** + * Returns the raw JSON value of [preferredName]. + * + * Unlike [preferredName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("preferred_name") @ExcludeMissing fun _preferredName(): JsonField = preferredName + /** + * Returns the raw JSON value of [residence]. + * + * Unlike [residence], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("residence") @ExcludeMissing fun _residence(): JsonField = residence /** - * Social Security Number of the individual. This field is only available with the `ssn` scope - * enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + * Returns the raw JSON value of [ssn]. + * + * Unlike [ssn], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("ssn") @ExcludeMissing fun _ssn(): JsonField = ssn @@ -229,23 +334,48 @@ private constructor( /** A stable Finch `id` (UUID v4) for an individual in the company. */ fun id(id: String) = id(JsonField.of(id)) - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun dob(dob: String?) = dob(JsonField.ofNullable(dob)) + /** Alias for calling [Builder.dob] with `dob.orElse(null)`. */ fun dob(dob: Optional) = dob(dob.getOrNull()) + /** + * Sets [Builder.dob] to an arbitrary JSON value. + * + * You should usually call [Builder.dob] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun dob(dob: JsonField) = apply { this.dob = dob } fun emails(emails: List?) = emails(JsonField.ofNullable(emails)) + /** Alias for calling [Builder.emails] with `emails.orElse(null)`. */ fun emails(emails: Optional>) = emails(emails.getOrNull()) + /** + * Sets [Builder.emails] to an arbitrary JSON value. + * + * You should usually call [Builder.emails] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun emails(emails: JsonField>) = apply { this.emails = emails.map { it.toMutableList() } } + /** + * Adds a single [Email] to [emails]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEmail(email: Email) = apply { emails = (emails ?: JsonField.of(mutableListOf())).also { @@ -260,17 +390,15 @@ private constructor( */ fun encryptedSsn(encryptedSsn: String?) = encryptedSsn(JsonField.ofNullable(encryptedSsn)) - /** - * Social Security Number of the individual in **encrypted** format. This field is only - * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set - * in the body. - */ + /** Alias for calling [Builder.encryptedSsn] with `encryptedSsn.orElse(null)`. */ fun encryptedSsn(encryptedSsn: Optional) = encryptedSsn(encryptedSsn.getOrNull()) /** - * Social Security Number of the individual in **encrypted** format. This field is only - * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set - * in the body. + * Sets [Builder.encryptedSsn] to an arbitrary JSON value. + * + * You should usually call [Builder.encryptedSsn] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun encryptedSsn(encryptedSsn: JsonField) = apply { this.encryptedSsn = encryptedSsn @@ -279,58 +407,99 @@ private constructor( /** The EEOC-defined ethnicity of the individual. */ fun ethnicity(ethnicity: Ethnicity?) = ethnicity(JsonField.ofNullable(ethnicity)) - /** The EEOC-defined ethnicity of the individual. */ + /** Alias for calling [Builder.ethnicity] with `ethnicity.orElse(null)`. */ fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.getOrNull()) - /** The EEOC-defined ethnicity of the individual. */ + /** + * Sets [Builder.ethnicity] to an arbitrary JSON value. + * + * You should usually call [Builder.ethnicity] with a well-typed [Ethnicity] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun ethnicity(ethnicity: JsonField) = apply { this.ethnicity = ethnicity } /** The legal first name of the individual. */ fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) - /** The legal first name of the individual. */ + /** Alias for calling [Builder.firstName] with `firstName.orElse(null)`. */ fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) - /** The legal first name of the individual. */ + /** + * Sets [Builder.firstName] to an arbitrary JSON value. + * + * You should usually call [Builder.firstName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } /** The gender of the individual. */ fun gender(gender: Gender?) = gender(JsonField.ofNullable(gender)) - /** The gender of the individual. */ + /** Alias for calling [Builder.gender] with `gender.orElse(null)`. */ fun gender(gender: Optional) = gender(gender.getOrNull()) - /** The gender of the individual. */ + /** + * Sets [Builder.gender] to an arbitrary JSON value. + * + * You should usually call [Builder.gender] with a well-typed [Gender] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun gender(gender: JsonField) = apply { this.gender = gender } /** The legal last name of the individual. */ fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) - /** The legal last name of the individual. */ + /** Alias for calling [Builder.lastName] with `lastName.orElse(null)`. */ fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) - /** The legal last name of the individual. */ + /** + * Sets [Builder.lastName] to an arbitrary JSON value. + * + * You should usually call [Builder.lastName] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } /** The legal middle name of the individual. */ fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) - /** The legal middle name of the individual. */ + /** Alias for calling [Builder.middleName] with `middleName.orElse(null)`. */ fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) - /** The legal middle name of the individual. */ + /** + * Sets [Builder.middleName] to an arbitrary JSON value. + * + * You should usually call [Builder.middleName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } fun phoneNumbers(phoneNumbers: List?) = phoneNumbers(JsonField.ofNullable(phoneNumbers)) + /** Alias for calling [Builder.phoneNumbers] with `phoneNumbers.orElse(null)`. */ fun phoneNumbers(phoneNumbers: Optional>) = phoneNumbers(phoneNumbers.getOrNull()) + /** + * Sets [Builder.phoneNumbers] to an arbitrary JSON value. + * + * You should usually call [Builder.phoneNumbers] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun phoneNumbers(phoneNumbers: JsonField>) = apply { this.phoneNumbers = phoneNumbers.map { it.toMutableList() } } + /** + * Adds a single [PhoneNumber] to [phoneNumbers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addPhoneNumber(phoneNumber: PhoneNumber) = apply { phoneNumbers = (phoneNumbers ?: JsonField.of(mutableListOf())).also { @@ -342,19 +511,33 @@ private constructor( fun preferredName(preferredName: String?) = preferredName(JsonField.ofNullable(preferredName)) - /** The preferred name of the individual. */ + /** Alias for calling [Builder.preferredName] with `preferredName.orElse(null)`. */ fun preferredName(preferredName: Optional) = preferredName(preferredName.getOrNull()) - /** The preferred name of the individual. */ + /** + * Sets [Builder.preferredName] to an arbitrary JSON value. + * + * You should usually call [Builder.preferredName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun preferredName(preferredName: JsonField) = apply { this.preferredName = preferredName } fun residence(residence: Location?) = residence(JsonField.ofNullable(residence)) + /** Alias for calling [Builder.residence] with `residence.orElse(null)`. */ fun residence(residence: Optional) = residence(residence.getOrNull()) + /** + * Sets [Builder.residence] to an arbitrary JSON value. + * + * You should usually call [Builder.residence] with a well-typed [Location] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun residence(residence: JsonField) = apply { this.residence = residence } /** @@ -364,17 +547,14 @@ private constructor( */ fun ssn(ssn: String?) = ssn(JsonField.ofNullable(ssn)) - /** - * Social Security Number of the individual. This field is only available with the `ssn` - * scope enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). - */ + /** Alias for calling [Builder.ssn] with `ssn.orElse(null)`. */ fun ssn(ssn: Optional) = ssn(ssn.getOrNull()) /** - * Social Security Number of the individual. This field is only available with the `ssn` - * scope enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + * Sets [Builder.ssn] to an arbitrary JSON value. + * + * You should usually call [Builder.ssn] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun ssn(ssn: JsonField) = apply { this.ssn = ssn } @@ -428,12 +608,30 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -476,12 +674,27 @@ private constructor( fun data(data: String) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun data(data: JsonField) = apply { this.data = data } fun type(type: Type?) = type(JsonField.ofNullable(type)) + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -883,12 +1096,30 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -931,14 +1162,30 @@ private constructor( fun data(data: String?) = data(JsonField.ofNullable(data)) + /** Alias for calling [Builder.data] with `data.orElse(null)`. */ fun data(data: Optional) = data(data.getOrNull()) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun data(data: JsonField) = apply { this.data = data } fun type(type: Type?) = type(JsonField.ofNullable(type)) + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt index a5a8cd75..f46637d2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt @@ -31,17 +31,44 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun body(): Optional = Optional.ofNullable(body.getNullable("body")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun code(): Optional = Optional.ofNullable(code.getNullable("code")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("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 @@ -89,14 +116,33 @@ private constructor( 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 } fun code(code: Long) = code(JsonField.of(code)) + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [Long] 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 } @@ -147,46 +193,90 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** If the benefit supports annual maximum, the amount in cents for this individual. */ + /** + * If the benefit supports annual maximum, the amount in cents for this individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun annualMaximum(): Optional = Optional.ofNullable(annualMaximum.getNullable("annual_maximum")) /** * If the benefit supports catch up (401k, 403b, etc.), whether catch up is enabled for this * individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun catchUp(): Optional = Optional.ofNullable(catchUp.getNullable("catch_up")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun companyContribution(): Optional = Optional.ofNullable(companyContribution.getNullable("company_contribution")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun employeeDeduction(): Optional = Optional.ofNullable(employeeDeduction.getNullable("employee_deduction")) - /** Type for HSA contribution limit if the benefit is a HSA. */ + /** + * Type for HSA contribution limit if the benefit is a HSA. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun hsaContributionLimit(): Optional = Optional.ofNullable(hsaContributionLimit.getNullable("hsa_contribution_limit")) - /** If the benefit supports annual maximum, the amount in cents for this individual. */ + /** + * 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 /** - * If the benefit supports catch up (401k, 403b, etc.), whether catch up is enabled for this - * individual. + * 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 [employeeDeduction]. + * + * Unlike [employeeDeduction], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("employee_deduction") @ExcludeMissing fun _employeeDeduction(): JsonField = employeeDeduction - /** Type for HSA contribution limit if the benefit is a HSA. */ + /** + * 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 @@ -242,14 +332,24 @@ private constructor( fun annualMaximum(annualMaximum: Long?) = annualMaximum(JsonField.ofNullable(annualMaximum)) - /** If the benefit supports annual maximum, the amount in cents for this individual. */ + /** + * Alias for [Builder.annualMaximum]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun annualMaximum(annualMaximum: Long) = annualMaximum(annualMaximum as Long?) - /** If the benefit supports annual maximum, the amount in cents for this individual. */ + /** Alias for calling [Builder.annualMaximum] with `annualMaximum.orElse(null)`. */ fun annualMaximum(annualMaximum: Optional) = annualMaximum(annualMaximum.getOrNull()) - /** If the benefit supports annual maximum, the amount in cents for this individual. */ + /** + * Sets [Builder.annualMaximum] to an arbitrary JSON value. + * + * You should usually call [Builder.annualMaximum] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun annualMaximum(annualMaximum: JsonField) = apply { this.annualMaximum = annualMaximum } @@ -261,29 +361,41 @@ private constructor( fun catchUp(catchUp: Boolean?) = catchUp(JsonField.ofNullable(catchUp)) /** - * If the benefit supports catch up (401k, 403b, etc.), whether catch up is enabled for - * this individual. + * Alias for [Builder.catchUp]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun catchUp(catchUp: Boolean) = catchUp(catchUp as Boolean?) - /** - * If the benefit supports catch up (401k, 403b, etc.), whether catch up is enabled for - * this individual. - */ + /** Alias for calling [Builder.catchUp] with `catchUp.orElse(null)`. */ fun catchUp(catchUp: Optional) = catchUp(catchUp.getOrNull()) /** - * If the benefit supports catch up (401k, 403b, etc.), whether catch up is enabled for - * this individual. + * Sets [Builder.catchUp] to an arbitrary JSON value. + * + * You should usually call [Builder.catchUp] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun catchUp(catchUp: JsonField) = apply { this.catchUp = catchUp } fun companyContribution(companyContribution: BenefitContribution?) = 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 + * [BenefitContribution] 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 } @@ -291,9 +403,19 @@ private constructor( fun employeeDeduction(employeeDeduction: BenefitContribution?) = 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 + * [BenefitContribution] 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 } @@ -302,11 +424,20 @@ private constructor( fun hsaContributionLimit(hsaContributionLimit: HsaContributionLimit?) = hsaContributionLimit(JsonField.ofNullable(hsaContributionLimit)) - /** Type for HSA contribution limit if the benefit is a HSA. */ + /** + * Alias for calling [Builder.hsaContributionLimit] with + * `hsaContributionLimit.orElse(null)`. + */ fun hsaContributionLimit(hsaContributionLimit: Optional) = hsaContributionLimit(hsaContributionLimit.getOrNull()) - /** Type for HSA contribution limit if the benefit is a HSA. */ + /** + * Sets [Builder.hsaContributionLimit] to an arbitrary JSON value. + * + * You should usually call [Builder.hsaContributionLimit] with a well-typed + * [HsaContributionLimit] 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt index 30c9fe11..5e904c3f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt @@ -15,6 +15,7 @@ import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @NoAutoDetect @@ -30,12 +31,30 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @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 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 individualIds(): List = individualIds.getRequired("individual_ids") + /** + * Returns the raw JSON value of [benefitId]. + * + * Unlike [benefitId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("benefit_id") @ExcludeMissing fun _benefitId(): JsonField = benefitId + /** + * Returns the raw JSON value of [individualIds]. + * + * Unlike [individualIds], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("individual_ids") @ExcludeMissing fun _individualIds(): JsonField> = individualIds @@ -89,14 +108,33 @@ private constructor( fun benefitId(benefitId: String) = benefitId(JsonField.of(benefitId)) + /** + * Sets [Builder.benefitId] to an arbitrary JSON value. + * + * You should usually call [Builder.benefitId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun benefitId(benefitId: JsonField) = apply { this.benefitId = benefitId } fun individualIds(individualIds: List) = individualIds(JsonField.of(individualIds)) + /** + * Sets [Builder.individualIds] to an arbitrary JSON value. + * + * You should usually call [Builder.individualIds] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun individualIds(individualIds: JsonField>) = apply { this.individualIds = individualIds.map { it.toMutableList() } } + /** + * Adds a single [String] to [individualIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addIndividualId(individualId: String) = apply { individualIds = (individualIds ?: JsonField.of(mutableListOf())).also { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt index b2329f70..39cb31e8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt @@ -42,26 +42,46 @@ private constructor( /** * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. + * + * @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). */ @Deprecated("deprecated") fun accountId(): String = accountId.getRequired("account_id") /** * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. + * + * @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). */ @Deprecated("deprecated") fun companyId(): String = companyId.getRequired("company_id") - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Unique Finch ID of the connection associated with the webhook event. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun connectionId(): Optional = Optional.ofNullable(connectionId.getNullable("connection_id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use - * `connection_id` instead to identify the connection associated with this event. + * Returns the raw JSON value of [accountId]. + * + * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("account_id") @@ -69,21 +89,36 @@ private constructor( fun _accountId(): JsonField = accountId /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use - * `connection_id` instead to identify the connection associated with this event. + * Returns the raw JSON value of [companyId]. + * + * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("company_id") @ExcludeMissing fun _companyId(): JsonField = companyId - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Returns the raw JSON value of [connectionId]. + * + * Unlike [connectionId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("connection_id") @ExcludeMissing fun _connectionId(): JsonField = connectionId + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [eventType]. + * + * Unlike [eventType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType @JsonAnyGetter @@ -156,8 +191,11 @@ private constructor( fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use - * `connection_id` instead to identify the connection associated with this event. + * Sets [Builder.accountId] to an arbitrary JSON value. + * + * You should usually call [Builder.accountId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun accountId(accountId: JsonField) = apply { this.accountId = accountId } @@ -170,8 +208,11 @@ private constructor( fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use - * `connection_id` instead to identify the connection associated with this event. + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun companyId(companyId: JsonField) = apply { this.companyId = companyId } @@ -179,17 +220,36 @@ private constructor( /** Unique Finch ID of the connection associated with the webhook event. */ fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Sets [Builder.connectionId] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun connectionId(connectionId: JsonField) = apply { this.connectionId = connectionId } fun data(data: Data) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Data] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun data(data: JsonField) = apply { this.data = data } fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + /** + * Sets [Builder.eventType] to an arbitrary JSON value. + * + * You should usually call [Builder.eventType] with a well-typed [EventType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun eventType(eventType: JsonField) = apply { this.eventType = eventType } fun additionalProperties(additionalProperties: Map) = apply { @@ -233,11 +293,21 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The ID of the individual related to the event. */ + /** + * The ID of the individual related to the event. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("individual_id")) - /** The ID of the individual related to the event. */ + /** + * 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 @@ -280,7 +350,13 @@ private constructor( /** The ID of the individual related to the event. */ fun individualId(individualId: String) = individualId(JsonField.of(individualId)) - /** The ID of the individual related to the event. */ + /** + * 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 } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt index 35f02fff..efa5bd79 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -43,49 +44,112 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A stable Finch id (UUID v4) for an individual in the company. */ + /** + * A stable Finch id (UUID v4) for an individual in the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) - /** The department object. */ + /** + * The department object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun department(): Optional = Optional.ofNullable(department.getNullable("department")) - /** The legal first name of the individual. */ + /** + * The legal first name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) - /** `true` if the individual is an active employee or contractor at the company. */ + /** + * `true` if the individual is an active employee or contractor at the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) - /** The legal last name of the individual. */ + /** + * The legal last name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) - /** The manager object. */ + /** + * The manager object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) - /** The legal middle name of the individual. */ + /** + * The legal middle name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) - /** A stable Finch id (UUID v4) for an individual in the company. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The department object. */ + /** + * Returns the raw JSON value of [department]. + * + * Unlike [department], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("department") @ExcludeMissing fun _department(): JsonField = department - /** The legal first name of the individual. */ + /** + * Returns the raw JSON value of [firstName]. + * + * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName - /** `true` if the individual is an active employee or contractor at the company. */ + /** + * Returns the raw JSON value of [isActive]. + * + * Unlike [isActive], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("is_active") @ExcludeMissing fun _isActive(): JsonField = isActive - /** The legal last name of the individual. */ + /** + * Returns the raw JSON value of [lastName]. + * + * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName - /** The manager object. */ + /** + * Returns the raw JSON value of [manager]. + * + * Unlike [manager], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("manager") @ExcludeMissing fun _manager(): JsonField = manager - /** The legal middle name of the individual. */ + /** + * Returns the raw JSON value of [middleName]. + * + * Unlike [middleName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("middle_name") @ExcludeMissing fun _middleName(): JsonField = middleName @JsonAnyGetter @@ -144,64 +208,107 @@ private constructor( /** A stable Finch id (UUID v4) for an individual in the company. */ fun id(id: String) = id(JsonField.of(id)) - /** A stable Finch id (UUID v4) for an individual in the company. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** The department object. */ fun department(department: Department?) = department(JsonField.ofNullable(department)) - /** The department object. */ + /** Alias for calling [Builder.department] with `department.orElse(null)`. */ fun department(department: Optional) = department(department.getOrNull()) - /** The department object. */ + /** + * Sets [Builder.department] to an arbitrary JSON value. + * + * You should usually call [Builder.department] with a well-typed [Department] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun department(department: JsonField) = apply { this.department = department } /** The legal first name of the individual. */ fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) - /** The legal first name of the individual. */ + /** Alias for calling [Builder.firstName] with `firstName.orElse(null)`. */ fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) - /** The legal first name of the individual. */ + /** + * Sets [Builder.firstName] to an arbitrary JSON value. + * + * You should usually call [Builder.firstName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } /** `true` if the individual is an active employee or contractor at the company. */ fun isActive(isActive: Boolean?) = isActive(JsonField.ofNullable(isActive)) - /** `true` if the individual is an active employee or contractor at the company. */ + /** + * Alias for [Builder.isActive]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun isActive(isActive: Boolean) = isActive(isActive as Boolean?) - /** `true` if the individual is an active employee or contractor at the company. */ + /** Alias for calling [Builder.isActive] with `isActive.orElse(null)`. */ fun isActive(isActive: Optional) = isActive(isActive.getOrNull()) - /** `true` if the individual is an active employee or contractor at the company. */ + /** + * Sets [Builder.isActive] to an arbitrary JSON value. + * + * You should usually call [Builder.isActive] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun isActive(isActive: JsonField) = apply { this.isActive = isActive } /** The legal last name of the individual. */ fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) - /** The legal last name of the individual. */ + /** Alias for calling [Builder.lastName] with `lastName.orElse(null)`. */ fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) - /** The legal last name of the individual. */ + /** + * Sets [Builder.lastName] to an arbitrary JSON value. + * + * You should usually call [Builder.lastName] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } /** The manager object. */ fun manager(manager: Manager?) = manager(JsonField.ofNullable(manager)) - /** The manager object. */ + /** Alias for calling [Builder.manager] with `manager.orElse(null)`. */ fun manager(manager: Optional) = manager(manager.getOrNull()) - /** The manager object. */ + /** + * Sets [Builder.manager] to an arbitrary JSON value. + * + * You should usually call [Builder.manager] with a well-typed [Manager] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun manager(manager: JsonField) = apply { this.manager = manager } /** The legal middle name of the individual. */ fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) - /** The legal middle name of the individual. */ + /** Alias for calling [Builder.middleName] with `middleName.orElse(null)`. */ fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) - /** The legal middle name of the individual. */ + /** + * Sets [Builder.middleName] to an arbitrary JSON value. + * + * You should usually call [Builder.middleName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } fun additionalProperties(additionalProperties: Map) = apply { @@ -248,10 +355,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The name of the department. */ + /** + * The name of the department. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The name of the department. */ + /** + * 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 @JsonAnyGetter @@ -292,10 +408,16 @@ private constructor( /** The name of the department. */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The name of the department. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The name of the department. */ + /** + * 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 { @@ -348,10 +470,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * A stable Finch `id` (UUID v4) for an individual in the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id @JsonAnyGetter @@ -392,7 +523,13 @@ private constructor( /** A stable Finch `id` (UUID v4) for an individual in the company. */ fun id(id: String) = id(JsonField.of(id)) - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt index f259e1f2..2a3b3d74 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional @@ -30,17 +31,44 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun body(): Optional = Optional.ofNullable(body.getNullable("body")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun code(): Optional = Optional.ofNullable(code.getNullable("code")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("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 @@ -88,14 +116,33 @@ private constructor( fun body(body: Individual) = body(JsonField.of(body)) + /** + * Sets [Builder.body] to an arbitrary JSON value. + * + * You should usually call [Builder.body] with a well-typed [Individual] 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 } fun code(code: Long) = code(JsonField.of(code)) + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [Long] 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 } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt index a01dc43f..e02bd4de 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt @@ -60,98 +60,203 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * A stable Finch `id` (UUID v4) for an individual in the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun emails(): Optional> = Optional.ofNullable(emails.getNullable("emails")) /** * Social Security Number of the individual in **encrypted** format. This field is only * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set in * the body. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun encryptedSsn(): Optional = Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) - /** The EEOC-defined ethnicity of the individual. */ + /** + * The EEOC-defined ethnicity of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun ethnicity(): Optional = Optional.ofNullable(ethnicity.getNullable("ethnicity")) - /** The legal first name of the individual. */ + /** + * The legal first name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) - /** The gender of the individual. */ + /** + * The gender of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun gender(): Optional = Optional.ofNullable(gender.getNullable("gender")) - /** The legal last name of the individual. */ + /** + * The legal last name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) - /** The legal middle name of the individual. */ + /** + * The legal middle name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun phoneNumbers(): Optional> = Optional.ofNullable(phoneNumbers.getNullable("phone_numbers")) - /** The preferred name of the individual. */ + /** + * The preferred name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun preferredName(): Optional = Optional.ofNullable(preferredName.getNullable("preferred_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun residence(): Optional = Optional.ofNullable(residence.getNullable("residence")) /** * Social Security Number of the individual. This field is only available with the `ssn` scope * enabled and the `options: { include: ['ssn'] }` param set in the body. * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [dob]. + * + * Unlike [dob], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dob") @ExcludeMissing fun _dob(): JsonField = dob + /** + * Returns the raw JSON value of [emails]. + * + * Unlike [emails], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("emails") @ExcludeMissing fun _emails(): JsonField> = emails /** - * Social Security Number of the individual in **encrypted** format. This field is only - * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set in - * the body. + * Returns the raw JSON value of [encryptedSsn]. + * + * Unlike [encryptedSsn], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("encrypted_ssn") @ExcludeMissing fun _encryptedSsn(): JsonField = encryptedSsn - /** The EEOC-defined ethnicity of the individual. */ + /** + * Returns the raw JSON value of [ethnicity]. + * + * Unlike [ethnicity], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("ethnicity") @ExcludeMissing fun _ethnicity(): JsonField = ethnicity - /** The legal first name of the individual. */ + /** + * Returns the raw JSON value of [firstName]. + * + * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName - /** The gender of the individual. */ + /** + * Returns the raw JSON value of [gender]. + * + * Unlike [gender], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gender") @ExcludeMissing fun _gender(): JsonField = gender - /** The legal last name of the individual. */ + /** + * Returns the raw JSON value of [lastName]. + * + * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName - /** The legal middle name of the individual. */ + /** + * Returns the raw JSON value of [middleName]. + * + * Unlike [middleName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("middle_name") @ExcludeMissing fun _middleName(): JsonField = middleName + /** + * Returns the raw JSON value of [phoneNumbers]. + * + * Unlike [phoneNumbers], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("phone_numbers") @ExcludeMissing fun _phoneNumbers(): JsonField> = phoneNumbers - /** The preferred name of the individual. */ + /** + * Returns the raw JSON value of [preferredName]. + * + * Unlike [preferredName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("preferred_name") @ExcludeMissing fun _preferredName(): JsonField = preferredName + /** + * Returns the raw JSON value of [residence]. + * + * Unlike [residence], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("residence") @ExcludeMissing fun _residence(): JsonField = residence /** - * Social Security Number of the individual. This field is only available with the `ssn` scope - * enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + * Returns the raw JSON value of [ssn]. + * + * Unlike [ssn], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("ssn") @ExcludeMissing fun _ssn(): JsonField = ssn @@ -229,23 +334,48 @@ private constructor( /** A stable Finch `id` (UUID v4) for an individual in the company. */ fun id(id: String) = id(JsonField.of(id)) - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun dob(dob: String?) = dob(JsonField.ofNullable(dob)) + /** Alias for calling [Builder.dob] with `dob.orElse(null)`. */ fun dob(dob: Optional) = dob(dob.getOrNull()) + /** + * Sets [Builder.dob] to an arbitrary JSON value. + * + * You should usually call [Builder.dob] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun dob(dob: JsonField) = apply { this.dob = dob } fun emails(emails: List?) = emails(JsonField.ofNullable(emails)) + /** Alias for calling [Builder.emails] with `emails.orElse(null)`. */ fun emails(emails: Optional>) = emails(emails.getOrNull()) + /** + * Sets [Builder.emails] to an arbitrary JSON value. + * + * You should usually call [Builder.emails] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun emails(emails: JsonField>) = apply { this.emails = emails.map { it.toMutableList() } } + /** + * Adds a single [Email] to [emails]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEmail(email: Email) = apply { emails = (emails ?: JsonField.of(mutableListOf())).also { @@ -260,17 +390,15 @@ private constructor( */ fun encryptedSsn(encryptedSsn: String?) = encryptedSsn(JsonField.ofNullable(encryptedSsn)) - /** - * Social Security Number of the individual in **encrypted** format. This field is only - * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set - * in the body. - */ + /** Alias for calling [Builder.encryptedSsn] with `encryptedSsn.orElse(null)`. */ fun encryptedSsn(encryptedSsn: Optional) = encryptedSsn(encryptedSsn.getOrNull()) /** - * Social Security Number of the individual in **encrypted** format. This field is only - * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set - * in the body. + * Sets [Builder.encryptedSsn] to an arbitrary JSON value. + * + * You should usually call [Builder.encryptedSsn] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun encryptedSsn(encryptedSsn: JsonField) = apply { this.encryptedSsn = encryptedSsn @@ -279,58 +407,99 @@ private constructor( /** The EEOC-defined ethnicity of the individual. */ fun ethnicity(ethnicity: Ethnicity?) = ethnicity(JsonField.ofNullable(ethnicity)) - /** The EEOC-defined ethnicity of the individual. */ + /** Alias for calling [Builder.ethnicity] with `ethnicity.orElse(null)`. */ fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.getOrNull()) - /** The EEOC-defined ethnicity of the individual. */ + /** + * Sets [Builder.ethnicity] to an arbitrary JSON value. + * + * You should usually call [Builder.ethnicity] with a well-typed [Ethnicity] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun ethnicity(ethnicity: JsonField) = apply { this.ethnicity = ethnicity } /** The legal first name of the individual. */ fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) - /** The legal first name of the individual. */ + /** Alias for calling [Builder.firstName] with `firstName.orElse(null)`. */ fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) - /** The legal first name of the individual. */ + /** + * Sets [Builder.firstName] to an arbitrary JSON value. + * + * You should usually call [Builder.firstName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } /** The gender of the individual. */ fun gender(gender: Gender?) = gender(JsonField.ofNullable(gender)) - /** The gender of the individual. */ + /** Alias for calling [Builder.gender] with `gender.orElse(null)`. */ fun gender(gender: Optional) = gender(gender.getOrNull()) - /** The gender of the individual. */ + /** + * Sets [Builder.gender] to an arbitrary JSON value. + * + * You should usually call [Builder.gender] with a well-typed [Gender] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun gender(gender: JsonField) = apply { this.gender = gender } /** The legal last name of the individual. */ fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) - /** The legal last name of the individual. */ + /** Alias for calling [Builder.lastName] with `lastName.orElse(null)`. */ fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) - /** The legal last name of the individual. */ + /** + * Sets [Builder.lastName] to an arbitrary JSON value. + * + * You should usually call [Builder.lastName] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } /** The legal middle name of the individual. */ fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) - /** The legal middle name of the individual. */ + /** Alias for calling [Builder.middleName] with `middleName.orElse(null)`. */ fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) - /** The legal middle name of the individual. */ + /** + * Sets [Builder.middleName] to an arbitrary JSON value. + * + * You should usually call [Builder.middleName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } fun phoneNumbers(phoneNumbers: List?) = phoneNumbers(JsonField.ofNullable(phoneNumbers)) + /** Alias for calling [Builder.phoneNumbers] with `phoneNumbers.orElse(null)`. */ fun phoneNumbers(phoneNumbers: Optional>) = phoneNumbers(phoneNumbers.getOrNull()) + /** + * Sets [Builder.phoneNumbers] to an arbitrary JSON value. + * + * You should usually call [Builder.phoneNumbers] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun phoneNumbers(phoneNumbers: JsonField>) = apply { this.phoneNumbers = phoneNumbers.map { it.toMutableList() } } + /** + * Adds a single [PhoneNumber] to [phoneNumbers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addPhoneNumber(phoneNumber: PhoneNumber) = apply { phoneNumbers = (phoneNumbers ?: JsonField.of(mutableListOf())).also { @@ -342,19 +511,33 @@ private constructor( fun preferredName(preferredName: String?) = preferredName(JsonField.ofNullable(preferredName)) - /** The preferred name of the individual. */ + /** Alias for calling [Builder.preferredName] with `preferredName.orElse(null)`. */ fun preferredName(preferredName: Optional) = preferredName(preferredName.getOrNull()) - /** The preferred name of the individual. */ + /** + * Sets [Builder.preferredName] to an arbitrary JSON value. + * + * You should usually call [Builder.preferredName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun preferredName(preferredName: JsonField) = apply { this.preferredName = preferredName } fun residence(residence: Location?) = residence(JsonField.ofNullable(residence)) + /** Alias for calling [Builder.residence] with `residence.orElse(null)`. */ fun residence(residence: Optional) = residence(residence.getOrNull()) + /** + * Sets [Builder.residence] to an arbitrary JSON value. + * + * You should usually call [Builder.residence] with a well-typed [Location] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun residence(residence: JsonField) = apply { this.residence = residence } /** @@ -364,17 +547,14 @@ private constructor( */ fun ssn(ssn: String?) = ssn(JsonField.ofNullable(ssn)) - /** - * Social Security Number of the individual. This field is only available with the `ssn` - * scope enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). - */ + /** Alias for calling [Builder.ssn] with `ssn.orElse(null)`. */ fun ssn(ssn: Optional) = ssn(ssn.getOrNull()) /** - * Social Security Number of the individual. This field is only available with the `ssn` - * scope enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + * Sets [Builder.ssn] to an arbitrary JSON value. + * + * You should usually call [Builder.ssn] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun ssn(ssn: JsonField) = apply { this.ssn = ssn } @@ -428,12 +608,30 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -476,12 +674,27 @@ private constructor( fun data(data: String) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun data(data: JsonField) = apply { this.data = data } fun type(type: Type?) = type(JsonField.ofNullable(type)) + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -883,12 +1096,30 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -931,12 +1162,27 @@ private constructor( fun data(data: String) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun data(data: JsonField) = apply { this.data = data } fun type(type: Type?) = type(JsonField.ofNullable(type)) + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt index 05c9a3a1..43ea9de3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt @@ -79,39 +79,74 @@ private constructor( /** * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of this * account 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). */ @Deprecated("deprecated") fun accountId(): String = accountId.getRequired("account_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 authenticationMethods(): List = authenticationMethods.getRequired("authentication_methods") - /** The client ID of the application associated with the `access_token`. */ + /** + * The client ID of the application associated with the `access_token`. + * + * @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 clientId(): String = clientId.getRequired("client_id") - /** The type of application associated with a token. */ + /** + * The type of application associated with a token. + * + * @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 clientType(): ClientType = clientType.getRequired("client_type") /** * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of this * company 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). */ @Deprecated("deprecated") fun companyId(): String = companyId.getRequired("company_id") - /** The Finch UUID of the connection associated with the `access_token`. */ + /** + * The Finch UUID of the connection associated with the `access_token`. + * + * @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 connectionId(): String = connectionId.getRequired("connection_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 connectionStatus(): ConnectionStatus = connectionStatus.getRequired("connection_status") /** * The type of the connection associated with the token. * - `provider` - connection to an external provider * - `finch` - finch-generated data. + * + * @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 connectionType(): ConnectionType = connectionType.getRequired("connection_type") /** * The email of your customer you provided to Finch when a connect session was created for this * connection. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun customerEmail(): Optional = Optional.ofNullable(customerEmail.getNullable("customer_email")) @@ -119,12 +154,18 @@ private constructor( /** * The ID of your customer you provided to Finch when a connect session was created for this * connection. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun customerId(): Optional = Optional.ofNullable(customerId.getNullable("customer_id")) /** * The name of your customer you provided to Finch when a connect session was created for this * connection. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun customerName(): Optional = Optional.ofNullable(customerName.getNullable("customer_name")) @@ -132,115 +173,181 @@ private constructor( /** * Whether the connection associated with the `access_token` uses the Assisted Connect Flow. * (`true` if using Assisted Connect, `false` if connection is automated) + * + * @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 manual(): Boolean = manual.getRequired("manual") /** * [DEPRECATED] Use `provider_id` to identify the provider instead of this payroll provider 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). */ @Deprecated("deprecated") fun payrollProviderId(): String = payrollProviderId.getRequired("payroll_provider_id") - /** An array of the authorized products associated with the `access_token`. */ + /** + * An array of the authorized products associated with the `access_token`. + * + * @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 products(): List = products.getRequired("products") - /** The ID of the provider associated with the `access_token`. */ + /** + * The ID of the provider associated with the `access_token`. + * + * @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 providerId(): String = providerId.getRequired("provider_id") - /** The account username used for login associated with the `access_token`. */ + /** + * The account username used for login associated with the `access_token`. + * + * @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 username(): String = username.getRequired("username") /** - * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of this - * account ID. + * Returns the raw JSON value of [accountId]. + * + * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("account_id") @ExcludeMissing fun _accountId(): JsonField = accountId + /** + * Returns the raw JSON value of [authenticationMethods]. + * + * Unlike [authenticationMethods], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("authentication_methods") @ExcludeMissing fun _authenticationMethods(): JsonField> = authenticationMethods - /** The client ID of the application associated with the `access_token`. */ + /** + * Returns the raw JSON value of [clientId]. + * + * Unlike [clientId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("client_id") @ExcludeMissing fun _clientId(): JsonField = clientId - /** The type of application associated with a token. */ + /** + * Returns the raw JSON value of [clientType]. + * + * Unlike [clientType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("client_type") @ExcludeMissing fun _clientType(): JsonField = clientType /** - * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of this - * company ID. + * Returns the raw JSON value of [companyId]. + * + * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("company_id") @ExcludeMissing fun _companyId(): JsonField = companyId - /** The Finch UUID of the connection associated with the `access_token`. */ + /** + * Returns the raw JSON value of [connectionId]. + * + * Unlike [connectionId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("connection_id") @ExcludeMissing fun _connectionId(): JsonField = connectionId + /** + * Returns the raw JSON value of [connectionStatus]. + * + * Unlike [connectionStatus], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("connection_status") @ExcludeMissing fun _connectionStatus(): JsonField = connectionStatus /** - * The type of the connection associated with the token. - * - `provider` - connection to an external provider - * - `finch` - finch-generated data. + * Returns the raw JSON value of [connectionType]. + * + * Unlike [connectionType], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("connection_type") @ExcludeMissing fun _connectionType(): JsonField = connectionType /** - * The email of your customer you provided to Finch when a connect session was created for this - * connection. + * Returns the raw JSON value of [customerEmail]. + * + * Unlike [customerEmail], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("customer_email") @ExcludeMissing fun _customerEmail(): JsonField = customerEmail /** - * The ID of your customer you provided to Finch when a connect session was created for this - * connection. + * Returns the raw JSON value of [customerId]. + * + * Unlike [customerId], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("customer_id") @ExcludeMissing fun _customerId(): JsonField = customerId /** - * The name of your customer you provided to Finch when a connect session was created for this - * connection. + * Returns the raw JSON value of [customerName]. + * + * Unlike [customerName], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("customer_name") @ExcludeMissing fun _customerName(): JsonField = customerName /** - * Whether the connection associated with the `access_token` uses the Assisted Connect Flow. - * (`true` if using Assisted Connect, `false` if connection is automated) + * Returns the raw JSON value of [manual]. + * + * Unlike [manual], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("manual") @ExcludeMissing fun _manual(): JsonField = manual /** - * [DEPRECATED] Use `provider_id` to identify the provider instead of this payroll provider ID. + * Returns the raw JSON value of [payrollProviderId]. + * + * Unlike [payrollProviderId], this method doesn't throw if the JSON field has an unexpected + * type. */ @Deprecated("deprecated") @JsonProperty("payroll_provider_id") @ExcludeMissing fun _payrollProviderId(): JsonField = payrollProviderId - /** An array of the authorized products associated with the `access_token`. */ + /** + * Returns the raw JSON value of [products]. + * + * Unlike [products], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("products") @ExcludeMissing fun _products(): JsonField> = products - /** The ID of the provider associated with the `access_token`. */ + /** + * Returns the raw JSON value of [providerId]. + * + * Unlike [providerId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("provider_id") @ExcludeMissing fun _providerId(): JsonField = providerId - /** The account username used for login associated with the `access_token`. */ + /** + * Returns the raw JSON value of [username]. + * + * Unlike [username], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("username") @ExcludeMissing fun _username(): JsonField = username @JsonAnyGetter @@ -353,8 +460,11 @@ private constructor( fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of - * this account ID. + * Sets [Builder.accountId] to an arbitrary JSON value. + * + * You should usually call [Builder.accountId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun accountId(accountId: JsonField) = apply { this.accountId = accountId } @@ -362,11 +472,23 @@ private constructor( fun authenticationMethods(authenticationMethods: List) = authenticationMethods(JsonField.of(authenticationMethods)) + /** + * Sets [Builder.authenticationMethods] to an arbitrary JSON value. + * + * You should usually call [Builder.authenticationMethods] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun authenticationMethods(authenticationMethods: JsonField>) = apply { this.authenticationMethods = authenticationMethods.map { it.toMutableList() } } + /** + * Adds a single [AuthenticationMethod] to [authenticationMethods]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addAuthenticationMethod(authenticationMethod: AuthenticationMethod) = apply { authenticationMethods = (authenticationMethods ?: JsonField.of(mutableListOf())).also { @@ -377,13 +499,24 @@ private constructor( /** The client ID of the application associated with the `access_token`. */ fun clientId(clientId: String) = clientId(JsonField.of(clientId)) - /** The client ID of the application associated with the `access_token`. */ + /** + * Sets [Builder.clientId] to an arbitrary JSON value. + * + * You should usually call [Builder.clientId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun clientId(clientId: JsonField) = apply { this.clientId = clientId } /** The type of application associated with a token. */ fun clientType(clientType: ClientType) = clientType(JsonField.of(clientType)) - /** The type of application associated with a token. */ + /** + * Sets [Builder.clientType] to an arbitrary JSON value. + * + * You should usually call [Builder.clientType] with a well-typed [ClientType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun clientType(clientType: JsonField) = apply { this.clientType = clientType } /** @@ -394,8 +527,11 @@ private constructor( fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of - * this company ID. + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun companyId(companyId: JsonField) = apply { this.companyId = companyId } @@ -403,7 +539,13 @@ private constructor( /** The Finch UUID of the connection associated with the `access_token`. */ fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - /** The Finch UUID of the connection associated with the `access_token`. */ + /** + * Sets [Builder.connectionId] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun connectionId(connectionId: JsonField) = apply { this.connectionId = connectionId } @@ -411,6 +553,13 @@ private constructor( fun connectionStatus(connectionStatus: ConnectionStatus) = connectionStatus(JsonField.of(connectionStatus)) + /** + * Sets [Builder.connectionStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionStatus] with a well-typed [ConnectionStatus] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun connectionStatus(connectionStatus: JsonField) = apply { this.connectionStatus = connectionStatus } @@ -424,9 +573,11 @@ private constructor( connectionType(JsonField.of(connectionType)) /** - * The type of the connection associated with the token. - * - `provider` - connection to an external provider - * - `finch` - finch-generated data. + * Sets [Builder.connectionType] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionType] with a well-typed [ConnectionType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun connectionType(connectionType: JsonField) = apply { this.connectionType = connectionType @@ -439,16 +590,16 @@ private constructor( fun customerEmail(customerEmail: String?) = customerEmail(JsonField.ofNullable(customerEmail)) - /** - * The email of your customer you provided to Finch when a connect session was created for - * this connection. - */ + /** Alias for calling [Builder.customerEmail] with `customerEmail.orElse(null)`. */ fun customerEmail(customerEmail: Optional) = customerEmail(customerEmail.getOrNull()) /** - * The email of your customer you provided to Finch when a connect session was created for - * this connection. + * Sets [Builder.customerEmail] to an arbitrary JSON value. + * + * You should usually call [Builder.customerEmail] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun customerEmail(customerEmail: JsonField) = apply { this.customerEmail = customerEmail @@ -460,15 +611,15 @@ private constructor( */ fun customerId(customerId: String?) = customerId(JsonField.ofNullable(customerId)) - /** - * The ID of your customer you provided to Finch when a connect session was created for this - * connection. - */ + /** Alias for calling [Builder.customerId] with `customerId.orElse(null)`. */ fun customerId(customerId: Optional) = customerId(customerId.getOrNull()) /** - * The ID of your customer you provided to Finch when a connect session was created for this - * connection. + * Sets [Builder.customerId] to an arbitrary JSON value. + * + * You should usually call [Builder.customerId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun customerId(customerId: JsonField) = apply { this.customerId = customerId } @@ -478,15 +629,15 @@ private constructor( */ fun customerName(customerName: String?) = customerName(JsonField.ofNullable(customerName)) - /** - * The name of your customer you provided to Finch when a connect session was created for - * this connection. - */ + /** Alias for calling [Builder.customerName] with `customerName.orElse(null)`. */ fun customerName(customerName: Optional) = customerName(customerName.getOrNull()) /** - * The name of your customer you provided to Finch when a connect session was created for - * this connection. + * Sets [Builder.customerName] to an arbitrary JSON value. + * + * You should usually call [Builder.customerName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun customerName(customerName: JsonField) = apply { this.customerName = customerName @@ -499,8 +650,10 @@ private constructor( fun manual(manual: Boolean) = manual(JsonField.of(manual)) /** - * Whether the connection associated with the `access_token` uses the Assisted Connect Flow. - * (`true` if using Assisted Connect, `false` if connection is automated) + * Sets [Builder.manual] to an arbitrary JSON value. + * + * You should usually call [Builder.manual] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun manual(manual: JsonField) = apply { this.manual = manual } @@ -513,8 +666,11 @@ private constructor( payrollProviderId(JsonField.of(payrollProviderId)) /** - * [DEPRECATED] Use `provider_id` to identify the provider instead of this payroll provider - * ID. + * Sets [Builder.payrollProviderId] to an arbitrary JSON value. + * + * You should usually call [Builder.payrollProviderId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ @Deprecated("deprecated") fun payrollProviderId(payrollProviderId: JsonField) = apply { @@ -524,12 +680,22 @@ private constructor( /** An array of the authorized products associated with the `access_token`. */ fun products(products: List) = products(JsonField.of(products)) - /** An array of the authorized products associated with the `access_token`. */ + /** + * Sets [Builder.products] to an arbitrary JSON value. + * + * You should usually call [Builder.products] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun products(products: JsonField>) = apply { this.products = products.map { it.toMutableList() } } - /** An array of the authorized products associated with the `access_token`. */ + /** + * Adds a single [String] to [products]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addProduct(product: String) = apply { products = (products ?: JsonField.of(mutableListOf())).also { @@ -540,13 +706,24 @@ private constructor( /** The ID of the provider associated with the `access_token`. */ fun providerId(providerId: String) = providerId(JsonField.of(providerId)) - /** The ID of the provider associated with the `access_token`. */ + /** + * Sets [Builder.providerId] to an arbitrary JSON value. + * + * You should usually call [Builder.providerId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun providerId(providerId: JsonField) = apply { this.providerId = providerId } /** The account username used for login associated with the `access_token`. */ fun username(username: String) = username(JsonField.of(username)) - /** The account username used for login associated with the `access_token`. */ + /** + * Sets [Builder.username] to an arbitrary JSON value. + * + * You should usually call [Builder.username] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun username(username: JsonField) = apply { this.username = username } fun additionalProperties(additionalProperties: Map) = apply { @@ -607,26 +784,54 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun connectionStatus(): Optional = Optional.ofNullable(connectionStatus.getNullable("connection_status")) - /** An array of the authorized products associated with the `access_token`. */ + /** + * An array of the authorized products associated with the `access_token`. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun products(): Optional> = Optional.ofNullable(products.getNullable("products")) - /** The type of authentication method. */ + /** + * The type of authentication method. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [connectionStatus]. + * + * Unlike [connectionStatus], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("connection_status") @ExcludeMissing fun _connectionStatus(): JsonField = connectionStatus - /** An array of the authorized products associated with the `access_token`. */ + /** + * Returns the raw JSON value of [products]. + * + * Unlike [products], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("products") @ExcludeMissing fun _products(): JsonField> = products - /** The type of authentication method. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -673,6 +878,13 @@ private constructor( fun connectionStatus(connectionStatus: ConnectionStatus) = connectionStatus(JsonField.of(connectionStatus)) + /** + * Sets [Builder.connectionStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionStatus] with a well-typed + * [ConnectionStatus] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun connectionStatus(connectionStatus: JsonField) = apply { this.connectionStatus = connectionStatus } @@ -680,12 +892,22 @@ private constructor( /** An array of the authorized products associated with the `access_token`. */ fun products(products: List) = products(JsonField.of(products)) - /** An array of the authorized products associated with the `access_token`. */ + /** + * Sets [Builder.products] to an arbitrary JSON value. + * + * You should usually call [Builder.products] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun products(products: JsonField>) = apply { this.products = products.map { it.toMutableList() } } - /** An array of the authorized products associated with the `access_token`. */ + /** + * Adds a single [String] to [products]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addProduct(product: String) = apply { products = (products ?: JsonField.of(mutableListOf())).also { @@ -696,7 +918,13 @@ private constructor( /** The type of authentication method. */ fun type(type: Type) = type(JsonField.of(type)) - /** The type of authentication method. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -741,13 +969,31 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun message(): Optional = Optional.ofNullable(message.getNullable("message")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun status(): Optional = Optional.ofNullable(status.getNullable("status")) + /** + * 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 [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status @@ -792,10 +1038,24 @@ private constructor( fun message(message: String) = message(JsonField.of(message)) + /** + * 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 } fun status(status: ConnectionStatusType) = status(JsonField.of(status)) + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [ConnectionStatusType] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ fun status(status: JsonField) = apply { this.status = status } fun additionalProperties(additionalProperties: Map) = apply { @@ -1099,13 +1359,31 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun message(): Optional = Optional.ofNullable(message.getNullable("message")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun status(): Optional = Optional.ofNullable(status.getNullable("status")) + /** + * 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 [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status @@ -1150,10 +1428,24 @@ private constructor( fun message(message: String) = message(JsonField.of(message)) + /** + * 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 } fun status(status: ConnectionStatusType) = status(JsonField.of(status)) + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [ConnectionStatusType] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun status(status: JsonField) = apply { this.status = status } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt index a93cd435..e176ec9c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt @@ -222,10 +222,20 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The type of job to start. */ + /** + * The type of job to start. + * + * @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 type(): Type = type.getRequired("type") - /** The type of job to start. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -273,7 +283,13 @@ private constructor( /** The type of job to start. */ fun type(type: Type) = type(JsonField.of(type)) - /** The type of job to start. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -432,14 +448,34 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @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 params(): Params = params.getRequired("params") - /** The type of job to start. */ + /** + * The type of job to start. + * + * @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 type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [params]. + * + * Unlike [params], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("params") @ExcludeMissing fun _params(): JsonField = params - /** The type of job to start. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -490,12 +526,25 @@ private constructor( fun params(params: Params) = params(JsonField.of(params)) + /** + * Sets [Builder.params] to an arbitrary JSON value. + * + * You should usually call [Builder.params] with a well-typed [Params] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun params(params: JsonField) = apply { this.params = params } /** The type of job to start. */ fun type(type: Type) = type(JsonField.of(type)) - /** The type of job to start. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -539,10 +588,21 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The unique ID of the individual for W-4 data sync. */ + /** + * The unique ID of the individual for W-4 data sync. + * + * @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 individualId(): String = individualId.getRequired("individual_id") - /** The unique ID of the individual for W-4 data sync. */ + /** + * 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 @@ -593,7 +653,13 @@ private constructor( fun individualId(individualId: String) = individualId(JsonField.of(individualId)) - /** The unique ID of the individual for W-4 data sync. */ + /** + * 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 } @@ -789,13 +855,25 @@ private constructor( fun body(body: Body?) = apply { this.body = body } + /** Alias for calling [Builder.body] with `body.orElse(null)`. */ fun body(body: Optional) = body(body.getOrNull()) + /** Alias for calling [body] with `Body.ofDataSyncAll(dataSyncAll)`. */ fun body(dataSyncAll: Body.DataSyncAll) = body(Body.ofDataSyncAll(dataSyncAll)) + /** Alias for calling [body] with `Body.ofW4FormEmployeeSync(w4FormEmployeeSync)`. */ fun body(w4FormEmployeeSync: Body.W4FormEmployeeSync) = body(Body.ofW4FormEmployeeSync(w4FormEmployeeSync)) + /** + * Alias for calling [body] with the following: + * ```java + * Body.W4FormEmployeeSync.builder() + * .type(JobAutomatedCreateParams.Body.W4FormEmployeeSync.Type.W4_FORM_EMPLOYEE_SYNC) + * .params(params) + * .build() + * ``` + */ fun w4FormEmployeeSyncBody(params: Body.W4FormEmployeeSync.Params) = body( Body.W4FormEmployeeSync.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt index 02cb83f7..0b38a895 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt @@ -73,19 +73,27 @@ private constructor( /** Number of items to return */ fun limit(limit: Long?) = apply { this.limit = limit } - /** Number of items to return */ + /** + * Alias for [Builder.limit]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun limit(limit: Long) = limit(limit as Long?) - /** Number of items to return */ + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) /** Index to start from (defaults to 0) */ fun offset(offset: Long?) = apply { this.offset = offset } - /** Index to start from (defaults to 0) */ + /** + * Alias for [Builder.offset]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun offset(offset: Long) = offset(offset as Long?) - /** Index to start from (defaults to 0) */ + /** Alias for calling [Builder.offset] with `offset.orElse(null)`. */ fun offset(offset: Optional) = offset(offset.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt index 1642ec99..c3ebbce3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt @@ -42,26 +42,46 @@ private constructor( /** * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. + * + * @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). */ @Deprecated("deprecated") fun accountId(): String = accountId.getRequired("account_id") /** * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. + * + * @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). */ @Deprecated("deprecated") fun companyId(): String = companyId.getRequired("company_id") - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Unique Finch ID of the connection associated with the webhook event. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun connectionId(): Optional = Optional.ofNullable(connectionId.getNullable("connection_id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use - * `connection_id` instead to identify the connection associated with this event. + * Returns the raw JSON value of [accountId]. + * + * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("account_id") @@ -69,21 +89,36 @@ private constructor( fun _accountId(): JsonField = accountId /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use - * `connection_id` instead to identify the connection associated with this event. + * Returns the raw JSON value of [companyId]. + * + * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("company_id") @ExcludeMissing fun _companyId(): JsonField = companyId - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Returns the raw JSON value of [connectionId]. + * + * Unlike [connectionId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("connection_id") @ExcludeMissing fun _connectionId(): JsonField = connectionId + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [eventType]. + * + * Unlike [eventType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType @JsonAnyGetter @@ -156,8 +191,11 @@ private constructor( fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use - * `connection_id` instead to identify the connection associated with this event. + * Sets [Builder.accountId] to an arbitrary JSON value. + * + * You should usually call [Builder.accountId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun accountId(accountId: JsonField) = apply { this.accountId = accountId } @@ -170,8 +208,11 @@ private constructor( fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use - * `connection_id` instead to identify the connection associated with this event. + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun companyId(companyId: JsonField) = apply { this.companyId = companyId } @@ -179,17 +220,36 @@ private constructor( /** Unique Finch ID of the connection associated with the webhook event. */ fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Sets [Builder.connectionId] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun connectionId(connectionId: JsonField) = apply { this.connectionId = connectionId } fun data(data: Data) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Data] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun data(data: JsonField) = apply { this.data = data } fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + /** + * Sets [Builder.eventType] to an arbitrary JSON value. + * + * You should usually call [Builder.eventType] with a well-typed [EventType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun eventType(eventType: JsonField) = apply { this.eventType = eventType } fun additionalProperties(additionalProperties: Map) = apply { @@ -236,16 +296,34 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the job which has completed. */ + /** + * The id of the job which has completed. + * + * @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") - /** The url to query the result of the job. */ + /** + * The url to query the result of the job. + * + * @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 jobUrl(): String = jobUrl.getRequired("job_url") - /** The id of the job which has completed. */ + /** + * 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 - /** The url to query the result of the job. */ + /** + * Returns the raw JSON value of [jobUrl]. + * + * Unlike [jobUrl], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("job_url") @ExcludeMissing fun _jobUrl(): JsonField = jobUrl @JsonAnyGetter @@ -297,13 +375,25 @@ private constructor( /** The id of the job which has completed. */ fun jobId(jobId: String) = jobId(JsonField.of(jobId)) - /** The id of the job which has completed. */ + /** + * 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 } /** The url to query the result of the job. */ fun jobUrl(jobUrl: String) = jobUrl(JsonField.of(jobUrl)) - /** The url to query the result of the job. */ + /** + * Sets [Builder.jobUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.jobUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun jobUrl(jobUrl: JsonField) = apply { this.jobUrl = jobUrl } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt index ea500558..dc222a4d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt @@ -14,6 +14,7 @@ import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @NoAutoDetect @@ -33,30 +34,68 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The number of allowed refreshes per hour (per hour, fixed window) */ + /** + * The number of allowed refreshes per hour (per hour, fixed window) + * + * @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 allowedRefreshes(): Long = allowedRefreshes.getRequired("allowed_refreshes") - /** The id of the job that has been created. */ + /** + * The id of the job that has been created. + * + * @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") - /** The url that can be used to retrieve the job status */ + /** + * The url that can be used to retrieve the job status + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly + * missing or null (e.g. if the server responded with an unexpected value). + */ fun jobUrl(): String = jobUrl.getRequired("job_url") - /** The number of remaining refreshes available (per hour, fixed window) */ + /** + * The number of remaining refreshes available (per hour, fixed window) + * + * @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 remainingRefreshes(): Long = remainingRefreshes.getRequired("remaining_refreshes") - /** The number of allowed refreshes per hour (per hour, fixed window) */ + /** + * Returns the raw JSON value of [allowedRefreshes]. + * + * Unlike [allowedRefreshes], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("allowed_refreshes") @ExcludeMissing fun _allowedRefreshes(): JsonField = allowedRefreshes - /** The id of the job that has been created. */ + /** + * 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 - /** The url that can be used to retrieve the job status */ + /** + * Returns the raw JSON value of [jobUrl]. + * + * Unlike [jobUrl], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("job_url") @ExcludeMissing fun _jobUrl(): JsonField = jobUrl - /** The number of remaining refreshes available (per hour, fixed window) */ + /** + * Returns the raw JSON value of [remainingRefreshes]. + * + * Unlike [remainingRefreshes], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("remaining_refreshes") @ExcludeMissing fun _remainingRefreshes(): JsonField = remainingRefreshes @@ -119,7 +158,13 @@ private constructor( fun allowedRefreshes(allowedRefreshes: Long) = allowedRefreshes(JsonField.of(allowedRefreshes)) - /** The number of allowed refreshes per hour (per hour, fixed window) */ + /** + * Sets [Builder.allowedRefreshes] to an arbitrary JSON value. + * + * You should usually call [Builder.allowedRefreshes] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun allowedRefreshes(allowedRefreshes: JsonField) = apply { this.allowedRefreshes = allowedRefreshes } @@ -127,20 +172,36 @@ private constructor( /** The id of the job that has been created. */ fun jobId(jobId: String) = jobId(JsonField.of(jobId)) - /** The id of the job that has been created. */ + /** + * 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 } /** The url that can be used to retrieve the job status */ fun jobUrl(jobUrl: String) = jobUrl(JsonField.of(jobUrl)) - /** The url that can be used to retrieve the job status */ + /** + * Sets [Builder.jobUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.jobUrl] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun jobUrl(jobUrl: JsonField) = apply { this.jobUrl = jobUrl } /** The number of remaining refreshes available (per hour, fixed window) */ fun remainingRefreshes(remainingRefreshes: Long) = remainingRefreshes(JsonField.of(remainingRefreshes)) - /** The number of remaining refreshes available (per hour, fixed window) */ + /** + * Sets [Builder.remainingRefreshes] to an arbitrary JSON value. + * + * You should usually call [Builder.remainingRefreshes] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun remainingRefreshes(remainingRefreshes: JsonField) = apply { this.remainingRefreshes = remainingRefreshes } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt index e1f267af..a7e56127 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -38,48 +39,120 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** City, district, suburb, town, or village. */ + /** + * City, district, suburb, town, or village. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun city(): Optional = Optional.ofNullable(city.getNullable("city")) - /** The 2-letter ISO 3166 country code. */ + /** + * The 2-letter ISO 3166 country code. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun country(): Optional = Optional.ofNullable(country.getNullable("country")) - /** Street address or PO box. */ + /** + * Street address or PO box. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) - /** Apartment, suite, unit, or building. */ + /** + * Apartment, suite, unit, or building. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The postal code or zip code. */ + /** + * The postal code or zip code. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun postalCode(): Optional = Optional.ofNullable(postalCode.getNullable("postal_code")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun sourceId(): Optional = Optional.ofNullable(sourceId.getNullable("source_id")) - /** The state code. */ + /** + * The state code. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun state(): Optional = Optional.ofNullable(state.getNullable("state")) - /** City, district, suburb, town, or village. */ + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city - /** The 2-letter ISO 3166 country code. */ + /** + * Returns the raw JSON value of [country]. + * + * Unlike [country], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country - /** Street address or PO box. */ + /** + * Returns the raw JSON value of [line1]. + * + * Unlike [line1], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("line1") @ExcludeMissing fun _line1(): JsonField = line1 - /** Apartment, suite, unit, or building. */ + /** + * Returns the raw JSON value of [line2]. + * + * Unlike [line2], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("line2") @ExcludeMissing fun _line2(): JsonField = line2 + /** + * 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 - /** The postal code or zip code. */ + /** + * Returns the raw JSON value of [postalCode]. + * + * Unlike [postalCode], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("postal_code") @ExcludeMissing fun _postalCode(): JsonField = postalCode + /** + * Returns the raw JSON value of [sourceId]. + * + * Unlike [sourceId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("source_id") @ExcludeMissing fun _sourceId(): JsonField = sourceId - /** The state code. */ + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state @JsonAnyGetter @@ -141,67 +214,112 @@ private constructor( /** City, district, suburb, town, or village. */ fun city(city: String?) = city(JsonField.ofNullable(city)) - /** City, district, suburb, town, or village. */ + /** Alias for calling [Builder.city] with `city.orElse(null)`. */ fun city(city: Optional) = city(city.getOrNull()) - /** City, district, suburb, town, or village. */ + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun city(city: JsonField) = apply { this.city = city } /** The 2-letter ISO 3166 country code. */ fun country(country: String?) = country(JsonField.ofNullable(country)) - /** The 2-letter ISO 3166 country code. */ + /** Alias for calling [Builder.country] with `country.orElse(null)`. */ fun country(country: Optional) = country(country.getOrNull()) - /** The 2-letter ISO 3166 country code. */ + /** + * Sets [Builder.country] to an arbitrary JSON value. + * + * You should usually call [Builder.country] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun country(country: JsonField) = apply { this.country = country } /** Street address or PO box. */ fun line1(line1: String?) = line1(JsonField.ofNullable(line1)) - /** Street address or PO box. */ + /** Alias for calling [Builder.line1] with `line1.orElse(null)`. */ fun line1(line1: Optional) = line1(line1.getOrNull()) - /** Street address or PO box. */ + /** + * Sets [Builder.line1] to an arbitrary JSON value. + * + * You should usually call [Builder.line1] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun line1(line1: JsonField) = apply { this.line1 = line1 } /** Apartment, suite, unit, or building. */ fun line2(line2: String?) = line2(JsonField.ofNullable(line2)) - /** Apartment, suite, unit, or building. */ + /** Alias for calling [Builder.line2] with `line2.orElse(null)`. */ fun line2(line2: Optional) = line2(line2.getOrNull()) - /** Apartment, suite, unit, or building. */ + /** + * Sets [Builder.line2] to an arbitrary JSON value. + * + * You should usually call [Builder.line2] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun line2(line2: JsonField) = apply { this.line2 = line2 } 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 } /** The postal code or zip code. */ fun postalCode(postalCode: String?) = postalCode(JsonField.ofNullable(postalCode)) - /** The postal code or zip code. */ + /** Alias for calling [Builder.postalCode] with `postalCode.orElse(null)`. */ fun postalCode(postalCode: Optional) = postalCode(postalCode.getOrNull()) - /** The postal code or zip code. */ + /** + * Sets [Builder.postalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.postalCode] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } fun sourceId(sourceId: String?) = sourceId(JsonField.ofNullable(sourceId)) + /** Alias for calling [Builder.sourceId] with `sourceId.orElse(null)`. */ fun sourceId(sourceId: Optional) = sourceId(sourceId.getOrNull()) + /** + * Sets [Builder.sourceId] to an arbitrary JSON value. + * + * You should usually call [Builder.sourceId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun sourceId(sourceId: JsonField) = apply { this.sourceId = sourceId } /** The state code. */ fun state(state: String?) = state(JsonField.ofNullable(state)) - /** The state code. */ + /** Alias for calling [Builder.state] with `state.orElse(null)`. */ fun state(state: Optional) = state(state.getOrNull()) - /** The state code. */ + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun state(state: JsonField) = apply { this.state = state } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt index 189a43c3..b81b5966 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt @@ -35,18 +35,45 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Specific information about the job, such as individual statuses for batch jobs. */ + /** + * Specific information about the job, such as individual statuses for batch jobs. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun body(): Optional> = Optional.ofNullable(body.getNullable("body")) + /** + * @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") + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly + * missing or null (e.g. if the server responded with an unexpected value). + */ fun status(): Status = status.getRequired("status") - /** Specific information about the job, such as individual statuses for batch jobs. */ + /** + * 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 [jobId]. + * + * Unlike [jobId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("job_id") @ExcludeMissing fun _jobId(): JsonField = jobId + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status @JsonAnyGetter @@ -102,15 +129,25 @@ private constructor( /** Specific information about the job, such as individual statuses for batch jobs. */ fun body(body: List?) = body(JsonField.ofNullable(body)) - /** Specific information about the job, such as individual statuses for batch jobs. */ + /** Alias for calling [Builder.body] with `body.orElse(null)`. */ fun body(body: Optional>) = body(body.getOrNull()) - /** Specific information about the job, such as individual statuses for batch jobs. */ + /** + * Sets [Builder.body] to an arbitrary JSON value. + * + * You should usually call [Builder.body] with a well-typed `List` 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.map { it.toMutableList() } } - /** Specific information about the job, such as individual statuses for batch jobs. */ + /** + * Adds a single [JsonValue] to [Builder.body]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addBody(body: JsonValue) = apply { this.body = (this.body ?: JsonField.of(mutableListOf())).also { @@ -120,10 +157,22 @@ private constructor( 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 status(status: Status) = status(JsonField.of(status)) + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun status(status: JsonField) = apply { this.status = status } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt index fccf9d99..021b5d20 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -28,14 +29,32 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Amount for money object (in cents) */ + /** + * Amount for money object (in cents) + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - /** Amount for money object (in cents) */ + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency @JsonAnyGetter @@ -79,17 +98,32 @@ private constructor( /** Amount for money object (in cents) */ fun amount(amount: Long?) = amount(JsonField.ofNullable(amount)) - /** Amount for money object (in cents) */ + /** + * Alias for [Builder.amount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun amount(amount: Long) = amount(amount as Long?) - /** Amount for money object (in cents) */ + /** Alias for calling [Builder.amount] with `amount.orElse(null)`. */ fun amount(amount: Optional) = amount(amount.getOrNull()) - /** Amount for money object (in cents) */ + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } fun currency(currency: String) = currency(JsonField.of(currency)) + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt index cdcee367..ed6b3e96 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional @@ -43,6 +44,9 @@ private constructor( * cannot support * - `client_access_only`: This behavior is supported by the provider, but only available to the * client and not to Finch + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun create(): Optional = Optional.ofNullable(create.getNullable("create")) @@ -54,6 +58,9 @@ private constructor( * cannot support * - `client_access_only`: This behavior is supported by the provider, but only available to the * client and not to Finch + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun delete(): Optional = Optional.ofNullable(delete.getNullable("delete")) @@ -65,6 +72,9 @@ private constructor( * cannot support * - `client_access_only`: This behavior is supported by the provider, but only available to the * client and not to Finch + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun read(): Optional = Optional.ofNullable(read.getNullable("read")) @@ -76,50 +86,37 @@ private constructor( * cannot support * - `client_access_only`: This behavior is supported by the provider, but only available to the * client and not to Finch + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun update(): Optional = Optional.ofNullable(update.getNullable("update")) /** - * - `supported`: This operation is supported by both the provider and Finch - * - `not_supported_by_finch`: This operation is not supported by Finch but supported by the - * provider - * - `not_supported_by_provider`: This operation is not supported by the provider, so Finch - * cannot support - * - `client_access_only`: This behavior is supported by the provider, but only available to the - * client and not to Finch + * Returns the raw JSON value of [create]. + * + * Unlike [create], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("create") @ExcludeMissing fun _create(): JsonField = create /** - * - `supported`: This operation is supported by both the provider and Finch - * - `not_supported_by_finch`: This operation is not supported by Finch but supported by the - * provider - * - `not_supported_by_provider`: This operation is not supported by the provider, so Finch - * cannot support - * - `client_access_only`: This behavior is supported by the provider, but only available to the - * client and not to Finch + * Returns the raw JSON value of [delete]. + * + * Unlike [delete], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("delete") @ExcludeMissing fun _delete(): JsonField = delete /** - * - `supported`: This operation is supported by both the provider and Finch - * - `not_supported_by_finch`: This operation is not supported by Finch but supported by the - * provider - * - `not_supported_by_provider`: This operation is not supported by the provider, so Finch - * cannot support - * - `client_access_only`: This behavior is supported by the provider, but only available to the - * client and not to Finch + * Returns the raw JSON value of [read]. + * + * Unlike [read], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("read") @ExcludeMissing fun _read(): JsonField = read /** - * - `supported`: This operation is supported by both the provider and Finch - * - `not_supported_by_finch`: This operation is not supported by Finch but supported by the - * provider - * - `not_supported_by_provider`: This operation is not supported by the provider, so Finch - * cannot support - * - `client_access_only`: This behavior is supported by the provider, but only available to the - * client and not to Finch + * Returns the raw JSON value of [update]. + * + * Unlike [update], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("update") @ExcludeMissing fun _update(): JsonField = update @@ -179,13 +176,11 @@ private constructor( fun create(create: OperationSupport) = create(JsonField.of(create)) /** - * - `supported`: This operation is supported by both the provider and Finch - * - `not_supported_by_finch`: This operation is not supported by Finch but supported by the - * provider - * - `not_supported_by_provider`: This operation is not supported by the provider, so Finch - * cannot support - * - `client_access_only`: This behavior is supported by the provider, but only available to - * the client and not to Finch + * Sets [Builder.create] to an arbitrary JSON value. + * + * You should usually call [Builder.create] with a well-typed [OperationSupport] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun create(create: JsonField) = apply { this.create = create } @@ -201,13 +196,11 @@ private constructor( fun delete(delete: OperationSupport) = delete(JsonField.of(delete)) /** - * - `supported`: This operation is supported by both the provider and Finch - * - `not_supported_by_finch`: This operation is not supported by Finch but supported by the - * provider - * - `not_supported_by_provider`: This operation is not supported by the provider, so Finch - * cannot support - * - `client_access_only`: This behavior is supported by the provider, but only available to - * the client and not to Finch + * Sets [Builder.delete] to an arbitrary JSON value. + * + * You should usually call [Builder.delete] with a well-typed [OperationSupport] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun delete(delete: JsonField) = apply { this.delete = delete } @@ -223,13 +216,11 @@ private constructor( fun read(read: OperationSupport) = read(JsonField.of(read)) /** - * - `supported`: This operation is supported by both the provider and Finch - * - `not_supported_by_finch`: This operation is not supported by Finch but supported by the - * provider - * - `not_supported_by_provider`: This operation is not supported by the provider, so Finch - * cannot support - * - `client_access_only`: This behavior is supported by the provider, but only available to - * the client and not to Finch + * Sets [Builder.read] to an arbitrary JSON value. + * + * You should usually call [Builder.read] with a well-typed [OperationSupport] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun read(read: JsonField) = apply { this.read = read } @@ -245,13 +236,11 @@ private constructor( fun update(update: OperationSupport) = update(JsonField.of(update)) /** - * - `supported`: This operation is supported by both the provider and Finch - * - `not_supported_by_finch`: This operation is not supported by Finch but supported by the - * provider - * - `not_supported_by_provider`: This operation is not supported by the provider, so Finch - * cannot support - * - `client_access_only`: This behavior is supported by the provider, but only available to - * the client and not to Finch + * Sets [Builder.update] to an arbitrary JSON value. + * + * You should usually call [Builder.update] with a well-typed [OperationSupport] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun update(update: JsonField) = apply { this.update = update } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt index c5563cad..0a3943a0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional @@ -25,16 +26,34 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The total number of elements for the entire query (not just the given page) */ + /** + * The total number of elements for the entire query (not just the given page) + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun count(): Optional = Optional.ofNullable(count.getNullable("count")) - /** The current start index of the returned list of elements */ + /** + * The current start index of the returned list of elements + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun offset(): Optional = Optional.ofNullable(offset.getNullable("offset")) - /** The total number of elements for the entire query (not just the given page) */ + /** + * Returns the raw JSON value of [count]. + * + * Unlike [count], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("count") @ExcludeMissing fun _count(): JsonField = count - /** The current start index of the returned list of elements */ + /** + * Returns the raw JSON value of [offset]. + * + * Unlike [offset], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("offset") @ExcludeMissing fun _offset(): JsonField = offset @JsonAnyGetter @@ -78,13 +97,23 @@ private constructor( /** The total number of elements for the entire query (not just the given page) */ fun count(count: Long) = count(JsonField.of(count)) - /** The total number of elements for the entire query (not just the given page) */ + /** + * Sets [Builder.count] to an arbitrary JSON value. + * + * You should usually call [Builder.count] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun count(count: JsonField) = apply { this.count = count } /** The current start index of the returned list of elements */ fun offset(offset: Long) = offset(JsonField.of(offset)) - /** The current start index of the returned list of elements */ + /** + * Sets [Builder.offset] to an arbitrary JSON value. + * + * You should usually call [Builder.offset] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun offset(offset: JsonField) = apply { this.offset = offset } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt index f98790a6..5dd3f862 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt @@ -31,23 +31,50 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Finch id (uuidv4) for the pay group */ + /** + * Finch id (uuidv4) for the pay group + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) - /** Name of the pay group */ + /** + * Name of the pay group + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** List of pay frequencies associated with this pay group */ + /** + * List of pay frequencies associated with this pay group + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun payFrequencies(): Optional> = Optional.ofNullable(payFrequencies.getNullable("pay_frequencies")) - /** Finch id (uuidv4) for the pay group */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** Name of the pay group */ + /** + * 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 - /** List of pay frequencies associated with this pay group */ + /** + * Returns the raw JSON value of [payFrequencies]. + * + * Unlike [payFrequencies], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("pay_frequencies") @ExcludeMissing fun _payFrequencies(): JsonField> = payFrequencies @@ -96,25 +123,45 @@ private constructor( /** Finch id (uuidv4) for the pay group */ fun id(id: String) = id(JsonField.of(id)) - /** Finch id (uuidv4) for the pay group */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** Name of the pay group */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the pay group */ + /** + * 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 } /** List of pay frequencies associated with this pay group */ fun payFrequencies(payFrequencies: List) = payFrequencies(JsonField.of(payFrequencies)) - /** List of pay frequencies associated with this pay group */ + /** + * Sets [Builder.payFrequencies] to an arbitrary JSON value. + * + * You should usually call [Builder.payFrequencies] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun payFrequencies(payFrequencies: JsonField>) = apply { this.payFrequencies = payFrequencies.map { it.toMutableList() } } - /** List of pay frequencies associated with this pay group */ + /** + * Adds a single [PayFrequency] to [payFrequencies]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addPayFrequency(payFrequency: PayFrequency) = apply { payFrequencies = (payFrequencies ?: JsonField.of(mutableListOf())).also { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt index a903f493..2948909b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt @@ -34,28 +34,64 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Finch id (uuidv4) for the pay group */ + /** + * Finch id (uuidv4) for the pay group + * + * @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 id(): String = id.getRequired("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 individualIds(): List = individualIds.getRequired("individual_ids") - /** Name of the pay group */ + /** + * Name of the pay group + * + * @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 name(): String = name.getRequired("name") - /** List of pay frequencies associated with this pay group */ + /** + * List of pay frequencies associated with this pay group + * + * @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 payFrequencies(): List = payFrequencies.getRequired("pay_frequencies") - /** Finch id (uuidv4) for the pay group */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [individualIds]. + * + * Unlike [individualIds], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("individual_ids") @ExcludeMissing fun _individualIds(): JsonField> = individualIds - /** Name of the pay group */ + /** + * 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 - /** List of pay frequencies associated with this pay group */ + /** + * Returns the raw JSON value of [payFrequencies]. + * + * Unlike [payFrequencies], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("pay_frequencies") @ExcludeMissing fun _payFrequencies(): JsonField> = payFrequencies @@ -117,15 +153,32 @@ private constructor( /** Finch id (uuidv4) for the pay group */ fun id(id: String) = id(JsonField.of(id)) - /** Finch id (uuidv4) for the pay group */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun individualIds(individualIds: List) = individualIds(JsonField.of(individualIds)) + /** + * Sets [Builder.individualIds] to an arbitrary JSON value. + * + * You should usually call [Builder.individualIds] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun individualIds(individualIds: JsonField>) = apply { this.individualIds = individualIds.map { it.toMutableList() } } + /** + * Adds a single [String] to [individualIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addIndividualId(individualId: String) = apply { individualIds = (individualIds ?: JsonField.of(mutableListOf())).also { @@ -136,19 +189,34 @@ private constructor( /** Name of the pay group */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the pay group */ + /** + * 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 } /** List of pay frequencies associated with this pay group */ fun payFrequencies(payFrequencies: List) = payFrequencies(JsonField.of(payFrequencies)) - /** List of pay frequencies associated with this pay group */ + /** + * Sets [Builder.payFrequencies] to an arbitrary JSON value. + * + * You should usually call [Builder.payFrequencies] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun payFrequencies(payFrequencies: JsonField>) = apply { this.payFrequencies = payFrequencies.map { it.toMutableList() } } - /** List of pay frequencies associated with this pay group */ + /** + * Adds a single [PayFrequency] to [payFrequencies]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addPayFrequency(payFrequency: PayFrequency) = apply { payFrequencies = (payFrequencies ?: JsonField.of(mutableListOf())).also { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt index 2189e134..20ad6137 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt @@ -55,70 +55,162 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The array of earnings objects associated with this pay statement */ + /** + * The array of earnings objects associated with this pay statement + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun earnings(): Optional> = Optional.ofNullable(earnings.getNullable("earnings")) - /** The array of deductions objects associated with this pay statement. */ + /** + * The array of deductions objects associated with this pay statement. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun employeeDeductions(): Optional> = Optional.ofNullable(employeeDeductions.getNullable("employee_deductions")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun employerContributions(): Optional> = Optional.ofNullable(employerContributions.getNullable("employer_contributions")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun grossPay(): Optional = Optional.ofNullable(grossPay.getNullable("gross_pay")) - /** A stable Finch `id` (UUID v4) for an individual in the company */ + /** + * A stable Finch `id` (UUID v4) for an individual in the company + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("individual_id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun netPay(): Optional = Optional.ofNullable(netPay.getNullable("net_pay")) - /** The payment method. */ + /** + * The payment method. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun paymentMethod(): Optional = Optional.ofNullable(paymentMethod.getNullable("payment_method")) - /** The array of taxes objects associated with this pay statement. */ + /** + * The array of taxes objects associated with this pay statement. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun taxes(): Optional> = Optional.ofNullable(taxes.getNullable("taxes")) - /** The number of hours worked for this pay period */ + /** + * The number of hours worked for this pay period + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun totalHours(): Optional = Optional.ofNullable(totalHours.getNullable("total_hours")) - /** The type of the payment associated with the pay statement. */ + /** + * The type of the payment associated with the pay statement. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** The array of earnings objects associated with this pay statement */ + /** + * Returns the raw JSON value of [earnings]. + * + * Unlike [earnings], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("earnings") @ExcludeMissing fun _earnings(): JsonField> = earnings - /** The array of deductions objects associated with this pay statement. */ + /** + * Returns the raw JSON value of [employeeDeductions]. + * + * Unlike [employeeDeductions], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("employee_deductions") @ExcludeMissing fun _employeeDeductions(): JsonField> = employeeDeductions + /** + * Returns the raw JSON value of [employerContributions]. + * + * Unlike [employerContributions], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("employer_contributions") @ExcludeMissing fun _employerContributions(): JsonField> = employerContributions + /** + * Returns the raw JSON value of [grossPay]. + * + * Unlike [grossPay], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gross_pay") @ExcludeMissing fun _grossPay(): JsonField = grossPay - /** A stable Finch `id` (UUID v4) for an individual in the company */ + /** + * 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 + /** + * Returns the raw JSON value of [netPay]. + * + * Unlike [netPay], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("net_pay") @ExcludeMissing fun _netPay(): JsonField = netPay - /** The payment method. */ + /** + * Returns the raw JSON value of [paymentMethod]. + * + * Unlike [paymentMethod], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("payment_method") @ExcludeMissing fun _paymentMethod(): JsonField = paymentMethod - /** The array of taxes objects associated with this pay statement. */ + /** + * Returns the raw JSON value of [taxes]. + * + * Unlike [taxes], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("taxes") @ExcludeMissing fun _taxes(): JsonField> = taxes - /** The number of hours worked for this pay period */ + /** + * Returns the raw JSON value of [totalHours]. + * + * Unlike [totalHours], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("total_hours") @ExcludeMissing fun _totalHours(): JsonField = totalHours - /** The type of the payment associated with the pay statement. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -186,15 +278,25 @@ private constructor( /** The array of earnings objects associated with this pay statement */ fun earnings(earnings: List?) = earnings(JsonField.ofNullable(earnings)) - /** The array of earnings objects associated with this pay statement */ + /** Alias for calling [Builder.earnings] with `earnings.orElse(null)`. */ fun earnings(earnings: Optional>) = earnings(earnings.getOrNull()) - /** The array of earnings objects associated with this pay statement */ + /** + * Sets [Builder.earnings] to an arbitrary JSON value. + * + * You should usually call [Builder.earnings] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun earnings(earnings: JsonField>) = apply { this.earnings = earnings.map { it.toMutableList() } } - /** The array of earnings objects associated with this pay statement */ + /** + * Adds a single [Earning] to [earnings]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEarning(earning: Earning) = apply { earnings = (earnings ?: JsonField.of(mutableListOf())).also { @@ -206,16 +308,28 @@ private constructor( fun employeeDeductions(employeeDeductions: List?) = employeeDeductions(JsonField.ofNullable(employeeDeductions)) - /** The array of deductions objects associated with this pay statement. */ + /** + * Alias for calling [Builder.employeeDeductions] with `employeeDeductions.orElse(null)`. + */ fun employeeDeductions(employeeDeductions: Optional>) = employeeDeductions(employeeDeductions.getOrNull()) - /** The array of deductions objects associated with this pay statement. */ + /** + * Sets [Builder.employeeDeductions] to an arbitrary JSON value. + * + * You should usually call [Builder.employeeDeductions] with a well-typed + * `List` value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun employeeDeductions(employeeDeductions: JsonField>) = apply { this.employeeDeductions = employeeDeductions.map { it.toMutableList() } } - /** The array of deductions objects associated with this pay statement. */ + /** + * Adds a single [EmployeeDeduction] to [employeeDeductions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEmployeeDeduction(employeeDeduction: EmployeeDeduction) = apply { employeeDeductions = (employeeDeductions ?: JsonField.of(mutableListOf())).also { @@ -226,14 +340,30 @@ private constructor( fun employerContributions(employerContributions: List?) = employerContributions(JsonField.ofNullable(employerContributions)) + /** + * Alias for calling [Builder.employerContributions] with + * `employerContributions.orElse(null)`. + */ fun employerContributions(employerContributions: Optional>) = employerContributions(employerContributions.getOrNull()) + /** + * Sets [Builder.employerContributions] to an arbitrary JSON value. + * + * You should usually call [Builder.employerContributions] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun employerContributions(employerContributions: JsonField>) = apply { this.employerContributions = employerContributions.map { it.toMutableList() } } + /** + * Adds a single [EmployerContribution] to [employerContributions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEmployerContribution(employerContribution: EmployerContribution) = apply { employerContributions = (employerContributions ?: JsonField.of(mutableListOf())).also { @@ -243,33 +373,59 @@ private constructor( fun grossPay(grossPay: Money?) = grossPay(JsonField.ofNullable(grossPay)) + /** Alias for calling [Builder.grossPay] with `grossPay.orElse(null)`. */ fun grossPay(grossPay: Optional) = grossPay(grossPay.getOrNull()) + /** + * Sets [Builder.grossPay] to an arbitrary JSON value. + * + * You should usually call [Builder.grossPay] with a well-typed [Money] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun grossPay(grossPay: JsonField) = apply { this.grossPay = grossPay } /** A stable Finch `id` (UUID v4) for an individual in the company */ fun individualId(individualId: String) = individualId(JsonField.of(individualId)) - /** A stable Finch `id` (UUID v4) for an individual in the company */ + /** + * 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 netPay(netPay: Money?) = netPay(JsonField.ofNullable(netPay)) + /** Alias for calling [Builder.netPay] with `netPay.orElse(null)`. */ fun netPay(netPay: Optional) = netPay(netPay.getOrNull()) + /** + * Sets [Builder.netPay] to an arbitrary JSON value. + * + * You should usually call [Builder.netPay] with a well-typed [Money] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun netPay(netPay: JsonField) = apply { this.netPay = netPay } /** The payment method. */ fun paymentMethod(paymentMethod: PaymentMethod?) = paymentMethod(JsonField.ofNullable(paymentMethod)) - /** The payment method. */ + /** Alias for calling [Builder.paymentMethod] with `paymentMethod.orElse(null)`. */ fun paymentMethod(paymentMethod: Optional) = paymentMethod(paymentMethod.getOrNull()) - /** The payment method. */ + /** + * Sets [Builder.paymentMethod] to an arbitrary JSON value. + * + * You should usually call [Builder.paymentMethod] with a well-typed [PaymentMethod] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun paymentMethod(paymentMethod: JsonField) = apply { this.paymentMethod = paymentMethod } @@ -277,15 +433,25 @@ private constructor( /** The array of taxes objects associated with this pay statement. */ fun taxes(taxes: List?) = taxes(JsonField.ofNullable(taxes)) - /** The array of taxes objects associated with this pay statement. */ + /** Alias for calling [Builder.taxes] with `taxes.orElse(null)`. */ fun taxes(taxes: Optional>) = taxes(taxes.getOrNull()) - /** The array of taxes objects associated with this pay statement. */ + /** + * Sets [Builder.taxes] to an arbitrary JSON value. + * + * You should usually call [Builder.taxes] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun taxes(taxes: JsonField>) = apply { this.taxes = taxes.map { it.toMutableList() } } - /** The array of taxes objects associated with this pay statement. */ + /** + * Adds a single [Tax] to [taxes]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTax(tax: Tax) = apply { taxes = (taxes ?: JsonField.of(mutableListOf())).also { checkKnown("taxes", it).add(tax) } @@ -294,22 +460,37 @@ private constructor( /** The number of hours worked for this pay period */ fun totalHours(totalHours: Double?) = totalHours(JsonField.ofNullable(totalHours)) - /** The number of hours worked for this pay period */ + /** + * Alias for [Builder.totalHours]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun totalHours(totalHours: Double) = totalHours(totalHours as Double?) - /** The number of hours worked for this pay period */ + /** Alias for calling [Builder.totalHours] with `totalHours.orElse(null)`. */ fun totalHours(totalHours: Optional) = totalHours(totalHours.getOrNull()) - /** The number of hours worked for this pay period */ + /** + * Sets [Builder.totalHours] to an arbitrary JSON value. + * + * You should usually call [Builder.totalHours] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun totalHours(totalHours: JsonField) = apply { this.totalHours = totalHours } /** The type of the payment associated with the pay statement. */ fun type(type: Type?) = type(JsonField.ofNullable(type)) - /** The type of the payment associated with the pay statement. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** The type of the payment associated with the pay statement. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -371,47 +552,96 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The earnings amount in cents. */ + /** + * The earnings amount in cents. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun attributes(): Optional = Optional.ofNullable(attributes.getNullable("attributes")) - /** The earnings currency code. */ + /** + * The earnings currency code. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) /** * The number of hours associated with this earning. (For salaried employees, this could be * hours per pay period, `0` or `null`, depending on the provider). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun hours(): Optional = Optional.ofNullable(hours.getNullable("hours")) - /** The exact name of the deduction from the pay statement. */ + /** + * The exact name of the deduction from the pay statement. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The type of earning. */ + /** + * The type of earning. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** The earnings amount in cents. */ + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [attributes]. + * + * Unlike [attributes], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("attributes") @ExcludeMissing fun _attributes(): JsonField = attributes - /** The earnings currency code. */ + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency /** - * The number of hours associated with this earning. (For salaried employees, this could be - * hours per pay period, `0` or `null`, depending on the provider). + * Returns the raw JSON value of [hours]. + * + * Unlike [hours], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("hours") @ExcludeMissing fun _hours(): JsonField = hours - /** The exact name of the deduction from the pay statement. */ + /** + * 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 - /** The type of earning. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -467,19 +697,37 @@ private constructor( /** The earnings amount in cents. */ fun amount(amount: Long?) = amount(JsonField.ofNullable(amount)) - /** The earnings amount in cents. */ + /** + * Alias for [Builder.amount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun amount(amount: Long) = amount(amount as Long?) - /** The earnings amount in cents. */ + /** Alias for calling [Builder.amount] with `amount.orElse(null)`. */ fun amount(amount: Optional) = amount(amount.getOrNull()) - /** The earnings amount in cents. */ + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } fun attributes(attributes: Attributes?) = attributes(JsonField.ofNullable(attributes)) + /** Alias for calling [Builder.attributes] with `attributes.orElse(null)`. */ fun attributes(attributes: Optional) = attributes(attributes.getOrNull()) + /** + * Sets [Builder.attributes] to an arbitrary JSON value. + * + * You should usually call [Builder.attributes] with a well-typed [Attributes] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun attributes(attributes: JsonField) = apply { this.attributes = attributes } @@ -487,10 +735,16 @@ private constructor( /** The earnings currency code. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) - /** The earnings currency code. */ + /** Alias for calling [Builder.currency] with `currency.orElse(null)`. */ fun currency(currency: Optional) = currency(currency.getOrNull()) - /** The earnings currency code. */ + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } /** @@ -500,39 +754,52 @@ private constructor( fun hours(hours: Double?) = hours(JsonField.ofNullable(hours)) /** - * The number of hours associated with this earning. (For salaried employees, this could - * be hours per pay period, `0` or `null`, depending on the provider). + * Alias for [Builder.hours]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun hours(hours: Double) = hours(hours as Double?) - /** - * The number of hours associated with this earning. (For salaried employees, this could - * be hours per pay period, `0` or `null`, depending on the provider). - */ + /** Alias for calling [Builder.hours] with `hours.orElse(null)`. */ fun hours(hours: Optional) = hours(hours.getOrNull()) /** - * The number of hours associated with this earning. (For salaried employees, this could - * be hours per pay period, `0` or `null`, depending on the provider). + * Sets [Builder.hours] to an arbitrary JSON value. + * + * You should usually call [Builder.hours] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun hours(hours: JsonField) = apply { this.hours = hours } /** The exact name of the deduction from the pay statement. */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The exact name of the deduction from the pay statement. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The exact name of the deduction from the pay statement. */ + /** + * 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 } /** The type of earning. */ fun type(type: Type?) = type(JsonField.ofNullable(type)) - /** The type of earning. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** The type of earning. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -577,9 +844,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata @@ -621,6 +898,13 @@ private constructor( fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { @@ -663,14 +947,18 @@ private constructor( * The metadata to be attached to the entity by existing rules. It is a key-value * pairs where the values can be of any type (string, number, boolean, object, * array, etc.). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("metadata") @ExcludeMissing @@ -719,9 +1007,11 @@ private constructor( fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, boolean, - * object, array, etc.). + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [InnerMetadata] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata @@ -1092,41 +1382,95 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The deduction amount in cents. */ + /** + * The deduction amount in cents. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun attributes(): Optional = Optional.ofNullable(attributes.getNullable("attributes")) - /** The deduction currency. */ + /** + * The deduction currency. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - /** The deduction name from the pay statement. */ + /** + * The deduction name from the pay statement. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** Boolean indicating if the deduction is pre-tax. */ + /** + * Boolean indicating if the deduction is pre-tax. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun preTax(): Optional = Optional.ofNullable(preTax.getNullable("pre_tax")) - /** Type of benefit. */ + /** + * Type of benefit. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** The deduction amount in cents. */ + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [attributes]. + * + * Unlike [attributes], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("attributes") @ExcludeMissing fun _attributes(): JsonField = attributes - /** The deduction currency. */ + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** The deduction name from the pay statement. */ + /** + * 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 - /** Boolean indicating if the deduction is pre-tax. */ + /** + * Returns the raw JSON value of [preTax]. + * + * Unlike [preTax], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("pre_tax") @ExcludeMissing fun _preTax(): JsonField = preTax - /** Type of benefit. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1182,19 +1526,37 @@ private constructor( /** The deduction amount in cents. */ fun amount(amount: Long?) = amount(JsonField.ofNullable(amount)) - /** The deduction amount in cents. */ + /** + * Alias for [Builder.amount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun amount(amount: Long) = amount(amount as Long?) - /** The deduction amount in cents. */ + /** Alias for calling [Builder.amount] with `amount.orElse(null)`. */ fun amount(amount: Optional) = amount(amount.getOrNull()) - /** The deduction amount in cents. */ + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } fun attributes(attributes: Attributes?) = attributes(JsonField.ofNullable(attributes)) + /** Alias for calling [Builder.attributes] with `attributes.orElse(null)`. */ fun attributes(attributes: Optional) = attributes(attributes.getOrNull()) + /** + * Sets [Builder.attributes] to an arbitrary JSON value. + * + * You should usually call [Builder.attributes] with a well-typed [Attributes] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun attributes(attributes: JsonField) = apply { this.attributes = attributes } @@ -1202,40 +1564,68 @@ private constructor( /** The deduction currency. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) - /** The deduction currency. */ + /** Alias for calling [Builder.currency] with `currency.orElse(null)`. */ fun currency(currency: Optional) = currency(currency.getOrNull()) - /** The deduction currency. */ + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } /** The deduction name from the pay statement. */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The deduction name from the pay statement. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The deduction name from the pay statement. */ + /** + * 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 } /** Boolean indicating if the deduction is pre-tax. */ fun preTax(preTax: Boolean?) = preTax(JsonField.ofNullable(preTax)) - /** Boolean indicating if the deduction is pre-tax. */ + /** + * Alias for [Builder.preTax]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun preTax(preTax: Boolean) = preTax(preTax as Boolean?) - /** Boolean indicating if the deduction is pre-tax. */ + /** Alias for calling [Builder.preTax] with `preTax.orElse(null)`. */ fun preTax(preTax: Optional) = preTax(preTax.getOrNull()) - /** Boolean indicating if the deduction is pre-tax. */ + /** + * Sets [Builder.preTax] to an arbitrary JSON value. + * + * You should usually call [Builder.preTax] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun preTax(preTax: JsonField) = apply { this.preTax = preTax } /** Type of benefit. */ fun type(type: BenefitType?) = type(JsonField.ofNullable(type)) - /** Type of benefit. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** Type of benefit. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [BenefitType] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -1280,9 +1670,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata @@ -1324,6 +1724,13 @@ private constructor( fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { @@ -1366,14 +1773,18 @@ private constructor( * The metadata to be attached to the entity by existing rules. It is a key-value * pairs where the values can be of any type (string, number, boolean, object, * array, etc.). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("metadata") @ExcludeMissing @@ -1422,9 +1833,11 @@ private constructor( fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, boolean, - * object, array, etc.). + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [InnerMetadata] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata @@ -1625,35 +2038,80 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The contribution amount in cents. */ + /** + * The contribution amount in cents. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun attributes(): Optional = Optional.ofNullable(attributes.getNullable("attributes")) - /** The contribution currency. */ + /** + * The contribution currency. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - /** The contribution name from the pay statement. */ + /** + * The contribution name from the pay statement. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** Type of benefit. */ + /** + * Type of benefit. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** The contribution amount in cents. */ + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [attributes]. + * + * Unlike [attributes], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("attributes") @ExcludeMissing fun _attributes(): JsonField = attributes - /** The contribution currency. */ + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** The contribution name from the pay statement. */ + /** + * 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 - /** Type of benefit. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1706,19 +2164,37 @@ private constructor( /** The contribution amount in cents. */ fun amount(amount: Long?) = amount(JsonField.ofNullable(amount)) - /** The contribution amount in cents. */ + /** + * Alias for [Builder.amount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun amount(amount: Long) = amount(amount as Long?) - /** The contribution amount in cents. */ + /** Alias for calling [Builder.amount] with `amount.orElse(null)`. */ fun amount(amount: Optional) = amount(amount.getOrNull()) - /** The contribution amount in cents. */ + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } fun attributes(attributes: Attributes?) = attributes(JsonField.ofNullable(attributes)) + /** Alias for calling [Builder.attributes] with `attributes.orElse(null)`. */ fun attributes(attributes: Optional) = attributes(attributes.getOrNull()) + /** + * Sets [Builder.attributes] to an arbitrary JSON value. + * + * You should usually call [Builder.attributes] with a well-typed [Attributes] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun attributes(attributes: JsonField) = apply { this.attributes = attributes } @@ -1726,28 +2202,46 @@ private constructor( /** The contribution currency. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) - /** The contribution currency. */ + /** Alias for calling [Builder.currency] with `currency.orElse(null)`. */ fun currency(currency: Optional) = currency(currency.getOrNull()) - /** The contribution currency. */ + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } /** The contribution name from the pay statement. */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The contribution name from the pay statement. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The contribution name from the pay statement. */ + /** + * 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 } /** Type of benefit. */ fun type(type: BenefitType?) = type(JsonField.ofNullable(type)) - /** Type of benefit. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** Type of benefit. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [BenefitType] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -1791,9 +2285,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata @@ -1835,6 +2339,13 @@ private constructor( fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { @@ -1877,14 +2388,18 @@ private constructor( * The metadata to be attached to the entity by existing rules. It is a key-value * pairs where the values can be of any type (string, number, boolean, object, * array, etc.). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("metadata") @ExcludeMissing @@ -1933,9 +2448,11 @@ private constructor( fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, boolean, - * object, array, etc.). + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [InnerMetadata] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata @@ -2239,41 +2756,95 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The tax amount in cents. */ + /** + * The tax amount in cents. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun attributes(): Optional = Optional.ofNullable(attributes.getNullable("attributes")) - /** The currency code. */ + /** + * The currency code. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - /** `true` if the amount is paid by the employers. */ + /** + * `true` if the amount is paid by the employers. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun employer(): Optional = Optional.ofNullable(employer.getNullable("employer")) - /** The exact name of tax from the pay statement. */ + /** + * The exact name of tax from the pay statement. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The type of taxes. */ + /** + * The type of taxes. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** The tax amount in cents. */ + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [attributes]. + * + * Unlike [attributes], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("attributes") @ExcludeMissing fun _attributes(): JsonField = attributes - /** The currency code. */ + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** `true` if the amount is paid by the employers. */ + /** + * Returns the raw JSON value of [employer]. + * + * Unlike [employer], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("employer") @ExcludeMissing fun _employer(): JsonField = employer - /** The exact name of tax from the pay statement. */ + /** + * 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 - /** The type of taxes. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -2329,19 +2900,37 @@ private constructor( /** The tax amount in cents. */ fun amount(amount: Long?) = amount(JsonField.ofNullable(amount)) - /** The tax amount in cents. */ + /** + * Alias for [Builder.amount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun amount(amount: Long) = amount(amount as Long?) - /** The tax amount in cents. */ + /** Alias for calling [Builder.amount] with `amount.orElse(null)`. */ fun amount(amount: Optional) = amount(amount.getOrNull()) - /** The tax amount in cents. */ + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } fun attributes(attributes: Attributes?) = attributes(JsonField.ofNullable(attributes)) + /** Alias for calling [Builder.attributes] with `attributes.orElse(null)`. */ fun attributes(attributes: Optional) = attributes(attributes.getOrNull()) + /** + * Sets [Builder.attributes] to an arbitrary JSON value. + * + * You should usually call [Builder.attributes] with a well-typed [Attributes] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun attributes(attributes: JsonField) = apply { this.attributes = attributes } @@ -2349,40 +2938,68 @@ private constructor( /** The currency code. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) - /** The currency code. */ + /** Alias for calling [Builder.currency] with `currency.orElse(null)`. */ fun currency(currency: Optional) = currency(currency.getOrNull()) - /** The currency code. */ + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } /** `true` if the amount is paid by the employers. */ fun employer(employer: Boolean?) = employer(JsonField.ofNullable(employer)) - /** `true` if the amount is paid by the employers. */ + /** + * Alias for [Builder.employer]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun employer(employer: Boolean) = employer(employer as Boolean?) - /** `true` if the amount is paid by the employers. */ + /** Alias for calling [Builder.employer] with `employer.orElse(null)`. */ fun employer(employer: Optional) = employer(employer.getOrNull()) - /** `true` if the amount is paid by the employers. */ + /** + * Sets [Builder.employer] to an arbitrary JSON value. + * + * You should usually call [Builder.employer] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun employer(employer: JsonField) = apply { this.employer = employer } /** The exact name of tax from the pay statement. */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The exact name of tax from the pay statement. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The exact name of tax from the pay statement. */ + /** + * 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 } /** The type of taxes. */ fun type(type: Type?) = type(JsonField.ofNullable(type)) - /** The type of taxes. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** The type of taxes. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -2427,9 +3044,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata @@ -2471,6 +3098,13 @@ private constructor( fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { @@ -2513,14 +3147,18 @@ private constructor( * The metadata to be attached to the entity by existing rules. It is a key-value * pairs where the values can be of any type (string, number, boolean, object, * array, etc.). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("metadata") @ExcludeMissing @@ -2569,9 +3207,11 @@ private constructor( fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, boolean, - * object, array, etc.). + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [InnerMetadata] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt index 162aee87..fefa3771 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt @@ -42,26 +42,46 @@ private constructor( /** * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. + * + * @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). */ @Deprecated("deprecated") fun accountId(): String = accountId.getRequired("account_id") /** * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. + * + * @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). */ @Deprecated("deprecated") fun companyId(): String = companyId.getRequired("company_id") - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Unique Finch ID of the connection associated with the webhook event. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun connectionId(): Optional = Optional.ofNullable(connectionId.getNullable("connection_id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use - * `connection_id` instead to identify the connection associated with this event. + * Returns the raw JSON value of [accountId]. + * + * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("account_id") @@ -69,21 +89,36 @@ private constructor( fun _accountId(): JsonField = accountId /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use - * `connection_id` instead to identify the connection associated with this event. + * Returns the raw JSON value of [companyId]. + * + * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("company_id") @ExcludeMissing fun _companyId(): JsonField = companyId - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Returns the raw JSON value of [connectionId]. + * + * Unlike [connectionId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("connection_id") @ExcludeMissing fun _connectionId(): JsonField = connectionId + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [eventType]. + * + * Unlike [eventType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType @JsonAnyGetter @@ -156,8 +191,11 @@ private constructor( fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use - * `connection_id` instead to identify the connection associated with this event. + * Sets [Builder.accountId] to an arbitrary JSON value. + * + * You should usually call [Builder.accountId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun accountId(accountId: JsonField) = apply { this.accountId = accountId } @@ -170,8 +208,11 @@ private constructor( fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use - * `connection_id` instead to identify the connection associated with this event. + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun companyId(companyId: JsonField) = apply { this.companyId = companyId } @@ -179,17 +220,36 @@ private constructor( /** Unique Finch ID of the connection associated with the webhook event. */ fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Sets [Builder.connectionId] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun connectionId(connectionId: JsonField) = apply { this.connectionId = connectionId } fun data(data: Data) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Data] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun data(data: JsonField) = apply { this.data = data } fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + /** + * Sets [Builder.eventType] to an arbitrary JSON value. + * + * You should usually call [Builder.eventType] with a well-typed [EventType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun eventType(eventType: JsonField) = apply { this.eventType = eventType } fun additionalProperties(additionalProperties: Map) = apply { @@ -236,19 +296,38 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The ID of the individual associated with the pay statement. */ + /** + * The ID of the individual associated with the pay statement. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("individual_id")) - /** The ID of the payment associated with the pay statement. */ + /** + * The ID of the payment associated with the pay statement. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun paymentId(): Optional = Optional.ofNullable(paymentId.getNullable("payment_id")) - /** The ID of the individual associated with the pay statement. */ + /** + * 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 - /** The ID of the payment associated with the pay statement. */ + /** + * Returns the raw JSON value of [paymentId]. + * + * Unlike [paymentId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("payment_id") @ExcludeMissing fun _paymentId(): JsonField = paymentId @JsonAnyGetter @@ -292,7 +371,13 @@ private constructor( /** The ID of the individual associated with the pay statement. */ fun individualId(individualId: String) = individualId(JsonField.of(individualId)) - /** The ID of the individual associated with the pay statement. */ + /** + * 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 } @@ -300,7 +385,13 @@ private constructor( /** The ID of the payment associated with the pay statement. */ fun paymentId(paymentId: String) = paymentId(JsonField.of(paymentId)) - /** The ID of the payment associated with the pay statement. */ + /** + * Sets [Builder.paymentId] to an arbitrary JSON value. + * + * You should usually call [Builder.paymentId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun paymentId(paymentId: JsonField) = apply { this.paymentId = paymentId } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt index 83364349..95324f57 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional @@ -30,16 +31,43 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun body(): Optional = Optional.ofNullable(body.getNullable("body")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun code(): Optional = Optional.ofNullable(code.getNullable("code")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun paymentId(): Optional = Optional.ofNullable(paymentId.getNullable("payment_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 [paymentId]. + * + * Unlike [paymentId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("payment_id") @ExcludeMissing fun _paymentId(): JsonField = paymentId @JsonAnyGetter @@ -85,14 +113,34 @@ private constructor( fun body(body: PayStatementResponseBody) = body(JsonField.of(body)) + /** + * Sets [Builder.body] to an arbitrary JSON value. + * + * You should usually call [Builder.body] with a well-typed [PayStatementResponseBody] 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 } fun code(code: Long) = code(JsonField.of(code)) + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [Long] 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 paymentId(paymentId: String) = paymentId(JsonField.of(paymentId)) + /** + * Sets [Builder.paymentId] to an arbitrary JSON value. + * + * You should usually call [Builder.paymentId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun paymentId(paymentId: JsonField) = apply { this.paymentId = paymentId } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt index 2d782bb4..140addd8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt @@ -14,6 +14,7 @@ import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional @@ -30,15 +31,33 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) - /** The array of pay statements for the current payment. */ + /** + * The array of pay statements for the current payment. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun payStatements(): Optional> = Optional.ofNullable(payStatements.getNullable("pay_statements")) + /** + * Returns the raw JSON value of [paging]. + * + * Unlike [paging], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("paging") @ExcludeMissing fun _paging(): JsonField = paging - /** The array of pay statements for the current payment. */ + /** + * Returns the raw JSON value of [payStatements]. + * + * Unlike [payStatements], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("pay_statements") @ExcludeMissing fun _payStatements(): JsonField> = payStatements @@ -83,18 +102,34 @@ private constructor( fun paging(paging: Paging) = paging(JsonField.of(paging)) + /** + * Sets [Builder.paging] to an arbitrary JSON value. + * + * You should usually call [Builder.paging] with a well-typed [Paging] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun paging(paging: JsonField) = apply { this.paging = paging } /** The array of pay statements for the current payment. */ fun payStatements(payStatements: List) = payStatements(JsonField.of(payStatements)) - /** The array of pay statements for the current payment. */ + /** + * Sets [Builder.payStatements] to an arbitrary JSON value. + * + * You should usually call [Builder.payStatements] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun payStatements(payStatements: JsonField>) = apply { this.payStatements = payStatements.map { it.toMutableList() } } - /** The array of pay statements for the current payment. */ + /** + * Adds a single [PayStatement] to [payStatements]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addPayStatement(payStatement: PayStatement) = apply { payStatements = (payStatements ?: JsonField.of(mutableListOf())).also { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt index 6ec399ef..f53e5403 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt @@ -61,80 +61,188 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The unique id for the payment. */ + /** + * The unique id for the payment. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun companyDebit(): Optional = Optional.ofNullable(companyDebit.getNullable("company_debit")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun debitDate(): Optional = Optional.ofNullable(debitDate.getNullable("debit_date")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun employeeTaxes(): Optional = Optional.ofNullable(employeeTaxes.getNullable("employee_taxes")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun employerTaxes(): Optional = Optional.ofNullable(employerTaxes.getNullable("employer_taxes")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun grossPay(): Optional = Optional.ofNullable(grossPay.getNullable("gross_pay")) - /** Array of every individual on this payment. */ + /** + * Array of every individual on this payment. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun individualIds(): Optional> = Optional.ofNullable(individualIds.getNullable("individual_ids")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun netPay(): Optional = Optional.ofNullable(netPay.getNullable("net_pay")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun payDate(): Optional = Optional.ofNullable(payDate.getNullable("pay_date")) - /** List of pay frequencies associated with this payment. */ + /** + * List of pay frequencies associated with this payment. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun payFrequencies(): Optional> = Optional.ofNullable(payFrequencies.getNullable("pay_frequencies")) - /** Array of the Finch id (uuidv4) of every pay group associated with this payment. */ + /** + * Array of the Finch id (uuidv4) of every pay group associated with this payment. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun payGroupIds(): Optional> = Optional.ofNullable(payGroupIds.getNullable("pay_group_ids")) - /** The pay period object. */ + /** + * The pay period object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun payPeriod(): Optional = Optional.ofNullable(payPeriod.getNullable("pay_period")) - /** The unique id for the payment. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [companyDebit]. + * + * Unlike [companyDebit], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("company_debit") @ExcludeMissing fun _companyDebit(): JsonField = companyDebit + /** + * Returns the raw JSON value of [debitDate]. + * + * Unlike [debitDate], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("debit_date") @ExcludeMissing fun _debitDate(): JsonField = debitDate + /** + * Returns the raw JSON value of [employeeTaxes]. + * + * Unlike [employeeTaxes], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("employee_taxes") @ExcludeMissing fun _employeeTaxes(): JsonField = employeeTaxes + /** + * Returns the raw JSON value of [employerTaxes]. + * + * Unlike [employerTaxes], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("employer_taxes") @ExcludeMissing fun _employerTaxes(): JsonField = employerTaxes + /** + * Returns the raw JSON value of [grossPay]. + * + * Unlike [grossPay], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gross_pay") @ExcludeMissing fun _grossPay(): JsonField = grossPay - /** Array of every individual on this payment. */ + /** + * Returns the raw JSON value of [individualIds]. + * + * Unlike [individualIds], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("individual_ids") @ExcludeMissing fun _individualIds(): JsonField> = individualIds + /** + * Returns the raw JSON value of [netPay]. + * + * Unlike [netPay], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("net_pay") @ExcludeMissing fun _netPay(): JsonField = netPay + /** + * Returns the raw JSON value of [payDate]. + * + * Unlike [payDate], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("pay_date") @ExcludeMissing fun _payDate(): JsonField = payDate - /** List of pay frequencies associated with this payment. */ + /** + * Returns the raw JSON value of [payFrequencies]. + * + * Unlike [payFrequencies], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("pay_frequencies") @ExcludeMissing fun _payFrequencies(): JsonField> = payFrequencies - /** Array of the Finch id (uuidv4) of every pay group associated with this payment. */ + /** + * Returns the raw JSON value of [payGroupIds]. + * + * Unlike [payGroupIds], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("pay_group_ids") @ExcludeMissing fun _payGroupIds(): JsonField> = payGroupIds - /** The pay period object. */ + /** + * Returns the raw JSON value of [payPeriod]. + * + * Unlike [payPeriod], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("pay_period") @ExcludeMissing fun _payPeriod(): JsonField = payPeriod @JsonAnyGetter @@ -208,28 +316,57 @@ private constructor( /** The unique id for the payment. */ fun id(id: String) = id(JsonField.of(id)) - /** The unique id for the payment. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun companyDebit(companyDebit: Money?) = companyDebit(JsonField.ofNullable(companyDebit)) + /** Alias for calling [Builder.companyDebit] with `companyDebit.orElse(null)`. */ fun companyDebit(companyDebit: Optional) = companyDebit(companyDebit.getOrNull()) + /** + * Sets [Builder.companyDebit] to an arbitrary JSON value. + * + * You should usually call [Builder.companyDebit] with a well-typed [Money] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun companyDebit(companyDebit: JsonField) = apply { this.companyDebit = companyDebit } fun debitDate(debitDate: String?) = debitDate(JsonField.ofNullable(debitDate)) + /** Alias for calling [Builder.debitDate] with `debitDate.orElse(null)`. */ fun debitDate(debitDate: Optional) = debitDate(debitDate.getOrNull()) + /** + * Sets [Builder.debitDate] to an arbitrary JSON value. + * + * You should usually call [Builder.debitDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun debitDate(debitDate: JsonField) = apply { this.debitDate = debitDate } fun employeeTaxes(employeeTaxes: Money?) = employeeTaxes(JsonField.ofNullable(employeeTaxes)) + /** Alias for calling [Builder.employeeTaxes] with `employeeTaxes.orElse(null)`. */ fun employeeTaxes(employeeTaxes: Optional) = employeeTaxes(employeeTaxes.getOrNull()) + /** + * Sets [Builder.employeeTaxes] to an arbitrary JSON value. + * + * You should usually call [Builder.employeeTaxes] with a well-typed [Money] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun employeeTaxes(employeeTaxes: JsonField) = apply { this.employeeTaxes = employeeTaxes } @@ -237,32 +374,57 @@ private constructor( fun employerTaxes(employerTaxes: Money?) = employerTaxes(JsonField.ofNullable(employerTaxes)) + /** Alias for calling [Builder.employerTaxes] with `employerTaxes.orElse(null)`. */ fun employerTaxes(employerTaxes: Optional) = employerTaxes(employerTaxes.getOrNull()) + /** + * Sets [Builder.employerTaxes] to an arbitrary JSON value. + * + * You should usually call [Builder.employerTaxes] with a well-typed [Money] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun employerTaxes(employerTaxes: JsonField) = apply { this.employerTaxes = employerTaxes } fun grossPay(grossPay: Money?) = grossPay(JsonField.ofNullable(grossPay)) + /** Alias for calling [Builder.grossPay] with `grossPay.orElse(null)`. */ fun grossPay(grossPay: Optional) = grossPay(grossPay.getOrNull()) + /** + * Sets [Builder.grossPay] to an arbitrary JSON value. + * + * You should usually call [Builder.grossPay] with a well-typed [Money] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun grossPay(grossPay: JsonField) = apply { this.grossPay = grossPay } /** Array of every individual on this payment. */ fun individualIds(individualIds: List?) = individualIds(JsonField.ofNullable(individualIds)) - /** Array of every individual on this payment. */ + /** Alias for calling [Builder.individualIds] with `individualIds.orElse(null)`. */ fun individualIds(individualIds: Optional>) = individualIds(individualIds.getOrNull()) - /** Array of every individual on this payment. */ + /** + * Sets [Builder.individualIds] to an arbitrary JSON value. + * + * You should usually call [Builder.individualIds] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun individualIds(individualIds: JsonField>) = apply { this.individualIds = individualIds.map { it.toMutableList() } } - /** Array of every individual on this payment. */ + /** + * Adds a single [String] to [individualIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addIndividualId(individualId: String) = apply { individualIds = (individualIds ?: JsonField.of(mutableListOf())).also { @@ -272,30 +434,54 @@ private constructor( fun netPay(netPay: Money?) = netPay(JsonField.ofNullable(netPay)) + /** Alias for calling [Builder.netPay] with `netPay.orElse(null)`. */ fun netPay(netPay: Optional) = netPay(netPay.getOrNull()) + /** + * Sets [Builder.netPay] to an arbitrary JSON value. + * + * You should usually call [Builder.netPay] with a well-typed [Money] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun netPay(netPay: JsonField) = apply { this.netPay = netPay } fun payDate(payDate: String?) = payDate(JsonField.ofNullable(payDate)) + /** Alias for calling [Builder.payDate] with `payDate.orElse(null)`. */ fun payDate(payDate: Optional) = payDate(payDate.getOrNull()) + /** + * Sets [Builder.payDate] to an arbitrary JSON value. + * + * You should usually call [Builder.payDate] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun payDate(payDate: JsonField) = apply { this.payDate = payDate } /** List of pay frequencies associated with this payment. */ fun payFrequencies(payFrequencies: List?) = payFrequencies(JsonField.ofNullable(payFrequencies)) - /** List of pay frequencies associated with this payment. */ + /** Alias for calling [Builder.payFrequencies] with `payFrequencies.orElse(null)`. */ fun payFrequencies(payFrequencies: Optional>) = payFrequencies(payFrequencies.getOrNull()) - /** List of pay frequencies associated with this payment. */ + /** + * Sets [Builder.payFrequencies] to an arbitrary JSON value. + * + * You should usually call [Builder.payFrequencies] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun payFrequencies(payFrequencies: JsonField>) = apply { this.payFrequencies = payFrequencies.map { it.toMutableList() } } - /** List of pay frequencies associated with this payment. */ + /** + * Adds a single [PayFrequency] to [payFrequencies]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addPayFrequency(payFrequency: PayFrequency) = apply { payFrequencies = (payFrequencies ?: JsonField.of(mutableListOf())).also { @@ -306,15 +492,25 @@ private constructor( /** Array of the Finch id (uuidv4) of every pay group associated with this payment. */ fun payGroupIds(payGroupIds: List?) = payGroupIds(JsonField.ofNullable(payGroupIds)) - /** Array of the Finch id (uuidv4) of every pay group associated with this payment. */ + /** Alias for calling [Builder.payGroupIds] with `payGroupIds.orElse(null)`. */ fun payGroupIds(payGroupIds: Optional>) = payGroupIds(payGroupIds.getOrNull()) - /** Array of the Finch id (uuidv4) of every pay group associated with this payment. */ + /** + * Sets [Builder.payGroupIds] to an arbitrary JSON value. + * + * You should usually call [Builder.payGroupIds] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun payGroupIds(payGroupIds: JsonField>) = apply { this.payGroupIds = payGroupIds.map { it.toMutableList() } } - /** Array of the Finch id (uuidv4) of every pay group associated with this payment. */ + /** + * Adds a single [String] to [payGroupIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addPayGroupId(payGroupId: String) = apply { payGroupIds = (payGroupIds ?: JsonField.of(mutableListOf())).also { @@ -325,10 +521,16 @@ private constructor( /** The pay period object. */ fun payPeriod(payPeriod: PayPeriod?) = payPeriod(JsonField.ofNullable(payPeriod)) - /** The pay period object. */ + /** Alias for calling [Builder.payPeriod] with `payPeriod.orElse(null)`. */ fun payPeriod(payPeriod: Optional) = payPeriod(payPeriod.getOrNull()) - /** The pay period object. */ + /** + * Sets [Builder.payPeriod] to an arbitrary JSON value. + * + * You should usually call [Builder.payPeriod] with a well-typed [PayPeriod] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun payPeriod(payPeriod: JsonField) = apply { this.payPeriod = payPeriod } fun additionalProperties(additionalProperties: Map) = apply { @@ -525,12 +727,30 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) + /** + * Returns the raw JSON value of [endDate]. + * + * Unlike [endDate], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("end_date") @ExcludeMissing fun _endDate(): JsonField = endDate + /** + * Returns the raw JSON value of [startDate]. + * + * Unlike [startDate], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("start_date") @ExcludeMissing fun _startDate(): JsonField = startDate @JsonAnyGetter @@ -573,14 +793,30 @@ private constructor( fun endDate(endDate: String?) = endDate(JsonField.ofNullable(endDate)) + /** Alias for calling [Builder.endDate] with `endDate.orElse(null)`. */ fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) + /** + * Sets [Builder.endDate] to an arbitrary JSON value. + * + * You should usually call [Builder.endDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } fun startDate(startDate: String?) = startDate(JsonField.ofNullable(startDate)) + /** Alias for calling [Builder.startDate] with `startDate.orElse(null)`. */ fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) + /** + * Sets [Builder.startDate] to an arbitrary JSON value. + * + * You should usually call [Builder.startDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun startDate(startDate: JsonField) = apply { this.startDate = startDate } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt index 1125691f..6a37f9be 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt @@ -14,6 +14,7 @@ import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @NoAutoDetect @@ -29,16 +30,34 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The date of the payment. */ + /** + * The date of the payment. + * + * @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 payDate(): String = payDate.getRequired("pay_date") - /** The ID of the payment. */ + /** + * The ID of the payment. + * + * @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 paymentId(): String = paymentId.getRequired("payment_id") - /** The date of the payment. */ + /** + * Returns the raw JSON value of [payDate]. + * + * Unlike [payDate], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("pay_date") @ExcludeMissing fun _payDate(): JsonField = payDate - /** The ID of the payment. */ + /** + * Returns the raw JSON value of [paymentId]. + * + * Unlike [paymentId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("payment_id") @ExcludeMissing fun _paymentId(): JsonField = paymentId @JsonAnyGetter @@ -90,13 +109,24 @@ private constructor( /** The date of the payment. */ fun payDate(payDate: String) = payDate(JsonField.of(payDate)) - /** The date of the payment. */ + /** + * Sets [Builder.payDate] to an arbitrary JSON value. + * + * You should usually call [Builder.payDate] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun payDate(payDate: JsonField) = apply { this.payDate = payDate } /** The ID of the payment. */ fun paymentId(paymentId: String) = paymentId(JsonField.of(paymentId)) - /** The ID of the payment. */ + /** + * Sets [Builder.paymentId] to an arbitrary JSON value. + * + * You should usually call [Builder.paymentId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun paymentId(paymentId: JsonField) = apply { this.paymentId = paymentId } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt index ec35d6cf..b7e05b37 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt @@ -44,26 +44,46 @@ private constructor( /** * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. + * + * @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). */ @Deprecated("deprecated") fun accountId(): String = accountId.getRequired("account_id") /** * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. + * + * @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). */ @Deprecated("deprecated") fun companyId(): String = companyId.getRequired("company_id") - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Unique Finch ID of the connection associated with the webhook event. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun connectionId(): Optional = Optional.ofNullable(connectionId.getNullable("connection_id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use - * `connection_id` instead to identify the connection associated with this event. + * Returns the raw JSON value of [accountId]. + * + * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("account_id") @@ -71,21 +91,36 @@ private constructor( fun _accountId(): JsonField = accountId /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use - * `connection_id` instead to identify the connection associated with this event. + * Returns the raw JSON value of [companyId]. + * + * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected type. */ @Deprecated("deprecated") @JsonProperty("company_id") @ExcludeMissing fun _companyId(): JsonField = companyId - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Returns the raw JSON value of [connectionId]. + * + * Unlike [connectionId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("connection_id") @ExcludeMissing fun _connectionId(): JsonField = connectionId + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [eventType]. + * + * Unlike [eventType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType @JsonAnyGetter @@ -158,8 +193,11 @@ private constructor( fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use - * `connection_id` instead to identify the connection associated with this event. + * Sets [Builder.accountId] to an arbitrary JSON value. + * + * You should usually call [Builder.accountId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun accountId(accountId: JsonField) = apply { this.accountId = accountId } @@ -172,8 +210,11 @@ private constructor( fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use - * `connection_id` instead to identify the connection associated with this event. + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ @Deprecated("deprecated") fun companyId(companyId: JsonField) = apply { this.companyId = companyId } @@ -181,17 +222,37 @@ private constructor( /** Unique Finch ID of the connection associated with the webhook event. */ fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - /** Unique Finch ID of the connection associated with the webhook event. */ + /** + * Sets [Builder.connectionId] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun connectionId(connectionId: JsonField) = apply { this.connectionId = connectionId } fun data(data: PaymentIdentifiers) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [PaymentIdentifiers] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun data(data: JsonField) = apply { this.data = data } fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + /** + * Sets [Builder.eventType] to an arbitrary JSON value. + * + * You should usually call [Builder.eventType] with a well-typed [EventType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun eventType(eventType: JsonField) = apply { this.eventType = eventType } fun additionalProperties(additionalProperties: Map) = apply { @@ -238,16 +299,34 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The date of the payment. */ + /** + * The date of the payment. + * + * @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 payDate(): String = payDate.getRequired("pay_date") - /** The ID of the payment. */ + /** + * The ID of the payment. + * + * @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 paymentId(): String = paymentId.getRequired("payment_id") - /** The date of the payment. */ + /** + * Returns the raw JSON value of [payDate]. + * + * Unlike [payDate], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("pay_date") @ExcludeMissing fun _payDate(): JsonField = payDate - /** The ID of the payment. */ + /** + * Returns the raw JSON value of [paymentId]. + * + * Unlike [paymentId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("payment_id") @ExcludeMissing fun _paymentId(): JsonField = paymentId @JsonAnyGetter @@ -299,13 +378,25 @@ private constructor( /** The date of the payment. */ fun payDate(payDate: String) = payDate(JsonField.of(payDate)) - /** The date of the payment. */ + /** + * Sets [Builder.payDate] to an arbitrary JSON value. + * + * You should usually call [Builder.payDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun payDate(payDate: JsonField) = apply { this.payDate = payDate } /** The ID of the payment. */ fun paymentId(paymentId: String) = paymentId(JsonField.of(paymentId)) - /** The ID of the payment. */ + /** + * Sets [Builder.paymentId] to an arbitrary JSON value. + * + * You should usually call [Builder.paymentId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun paymentId(paymentId: JsonField) = apply { this.paymentId = paymentId } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt index 326920d5..6045ed03 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt @@ -69,15 +69,22 @@ private constructor( fun individualId(individualId: String?) = apply { this.individualId = individualId } + /** Alias for calling [Builder.individualId] with `individualId.orElse(null)`. */ fun individualId(individualId: Optional) = individualId(individualId.getOrNull()) fun payFrequencies(payFrequencies: List?) = apply { this.payFrequencies = payFrequencies?.toMutableList() } + /** Alias for calling [Builder.payFrequencies] with `payFrequencies.orElse(null)`. */ fun payFrequencies(payFrequencies: Optional>) = payFrequencies(payFrequencies.getOrNull()) + /** + * Adds a single [String] to [payFrequencies]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addPayFrequency(payFrequency: String) = apply { payFrequencies = (payFrequencies ?: mutableListOf()).apply { add(payFrequency) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt index 7a345e2c..52e8fa5f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt @@ -50,84 +50,169 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the payroll provider used in Connect. */ + /** + * The id of the payroll provider used in Connect. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) - /** The list of authentication methods supported by the provider. */ + /** + * The list of authentication methods supported by the provider. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun authenticationMethods(): Optional> = Optional.ofNullable(authenticationMethods.getNullable("authentication_methods")) - /** `true` if the integration is in a beta state, `false` otherwise */ + /** + * `true` if the integration is in a beta state, `false` otherwise + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun beta(): Optional = Optional.ofNullable(beta.getNullable("beta")) - /** The display name of the payroll provider. */ + /** + * The display name of the payroll provider. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun displayName(): Optional = Optional.ofNullable(displayName.getNullable("display_name")) - /** The url to the official icon of the payroll provider. */ + /** + * The url to the official icon of the payroll provider. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun icon(): Optional = Optional.ofNullable(icon.getNullable("icon")) - /** The url to the official logo of the payroll provider. */ + /** + * The url to the official logo of the payroll provider. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun logo(): Optional = Optional.ofNullable(logo.getNullable("logo")) /** * [DEPRECATED] Whether the Finch integration with this provider uses the Assisted Connect Flow * by default. This field is now deprecated. Please check for a `type` of `assisted` in the * `authentication_methods` field instead. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun manual(): Optional = Optional.ofNullable(manual.getNullable("manual")) - /** whether MFA is required for the provider. */ + /** + * whether MFA is required for the provider. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun mfaRequired(): Optional = Optional.ofNullable(mfaRequired.getNullable("mfa_required")) - /** The hex code for the primary color of the payroll provider. */ + /** + * The hex code for the primary color of the payroll provider. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun primaryColor(): Optional = Optional.ofNullable(primaryColor.getNullable("primary_color")) - /** The list of Finch products supported on this payroll provider. */ + /** + * The list of Finch products supported on this payroll provider. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun products(): Optional> = Optional.ofNullable(products.getNullable("products")) - /** The id of the payroll provider used in Connect. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** The list of authentication methods supported by the provider. */ + /** + * Returns the raw JSON value of [authenticationMethods]. + * + * Unlike [authenticationMethods], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("authentication_methods") @ExcludeMissing fun _authenticationMethods(): JsonField> = authenticationMethods - /** `true` if the integration is in a beta state, `false` otherwise */ + /** + * Returns the raw JSON value of [beta]. + * + * Unlike [beta], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("beta") @ExcludeMissing fun _beta(): JsonField = beta - /** The display name of the payroll provider. */ + /** + * Returns the raw JSON value of [displayName]. + * + * Unlike [displayName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("display_name") @ExcludeMissing fun _displayName(): JsonField = displayName - /** The url to the official icon of the payroll provider. */ + /** + * Returns the raw JSON value of [icon]. + * + * Unlike [icon], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("icon") @ExcludeMissing fun _icon(): JsonField = icon - /** The url to the official logo of the payroll provider. */ + /** + * Returns the raw JSON value of [logo]. + * + * Unlike [logo], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("logo") @ExcludeMissing fun _logo(): JsonField = logo /** - * [DEPRECATED] Whether the Finch integration with this provider uses the Assisted Connect Flow - * by default. This field is now deprecated. Please check for a `type` of `assisted` in the - * `authentication_methods` field instead. + * Returns the raw JSON value of [manual]. + * + * Unlike [manual], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("manual") @ExcludeMissing fun _manual(): JsonField = manual - /** whether MFA is required for the provider. */ + /** + * Returns the raw JSON value of [mfaRequired]. + * + * Unlike [mfaRequired], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("mfa_required") @ExcludeMissing fun _mfaRequired(): JsonField = mfaRequired - /** The hex code for the primary color of the payroll provider. */ + /** + * Returns the raw JSON value of [primaryColor]. + * + * Unlike [primaryColor], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("primary_color") @ExcludeMissing fun _primaryColor(): JsonField = primaryColor - /** The list of Finch products supported on this payroll provider. */ + /** + * Returns the raw JSON value of [products]. + * + * Unlike [products], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("products") @ExcludeMissing fun _products(): JsonField> = products @JsonAnyGetter @@ -195,20 +280,35 @@ private constructor( /** The id of the payroll provider used in Connect. */ fun id(id: String) = id(JsonField.of(id)) - /** The id of the payroll provider used in Connect. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } /** The list of authentication methods supported by the provider. */ fun authenticationMethods(authenticationMethods: List) = authenticationMethods(JsonField.of(authenticationMethods)) - /** The list of authentication methods supported by the provider. */ + /** + * Sets [Builder.authenticationMethods] to an arbitrary JSON value. + * + * You should usually call [Builder.authenticationMethods] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun authenticationMethods(authenticationMethods: JsonField>) = apply { this.authenticationMethods = authenticationMethods.map { it.toMutableList() } } - /** The list of authentication methods supported by the provider. */ + /** + * Adds a single [AuthenticationMethod] to [authenticationMethods]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addAuthenticationMethod(authenticationMethod: AuthenticationMethod) = apply { authenticationMethods = (authenticationMethods ?: JsonField.of(mutableListOf())).also { @@ -219,25 +319,46 @@ private constructor( /** `true` if the integration is in a beta state, `false` otherwise */ fun beta(beta: Boolean) = beta(JsonField.of(beta)) - /** `true` if the integration is in a beta state, `false` otherwise */ + /** + * Sets [Builder.beta] to an arbitrary JSON value. + * + * You should usually call [Builder.beta] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun beta(beta: JsonField) = apply { this.beta = beta } /** The display name of the payroll provider. */ fun displayName(displayName: String) = displayName(JsonField.of(displayName)) - /** The display name of the payroll provider. */ + /** + * Sets [Builder.displayName] to an arbitrary JSON value. + * + * You should usually call [Builder.displayName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun displayName(displayName: JsonField) = apply { this.displayName = displayName } /** The url to the official icon of the payroll provider. */ fun icon(icon: String) = icon(JsonField.of(icon)) - /** The url to the official icon of the payroll provider. */ + /** + * Sets [Builder.icon] to an arbitrary JSON value. + * + * You should usually call [Builder.icon] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun icon(icon: JsonField) = apply { this.icon = icon } /** The url to the official logo of the payroll provider. */ fun logo(logo: String) = logo(JsonField.of(logo)) - /** The url to the official logo of the payroll provider. */ + /** + * Sets [Builder.logo] to an arbitrary JSON value. + * + * You should usually call [Builder.logo] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun logo(logo: JsonField) = apply { this.logo = logo } /** @@ -248,22 +369,35 @@ private constructor( fun manual(manual: Boolean) = manual(JsonField.of(manual)) /** - * [DEPRECATED] Whether the Finch integration with this provider uses the Assisted Connect - * Flow by default. This field is now deprecated. Please check for a `type` of `assisted` in - * the `authentication_methods` field instead. + * Sets [Builder.manual] to an arbitrary JSON value. + * + * You should usually call [Builder.manual] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun manual(manual: JsonField) = apply { this.manual = manual } /** whether MFA is required for the provider. */ fun mfaRequired(mfaRequired: Boolean) = mfaRequired(JsonField.of(mfaRequired)) - /** whether MFA is required for the provider. */ + /** + * Sets [Builder.mfaRequired] to an arbitrary JSON value. + * + * You should usually call [Builder.mfaRequired] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun mfaRequired(mfaRequired: JsonField) = apply { this.mfaRequired = mfaRequired } /** The hex code for the primary color of the payroll provider. */ fun primaryColor(primaryColor: String) = primaryColor(JsonField.of(primaryColor)) - /** The hex code for the primary color of the payroll provider. */ + /** + * Sets [Builder.primaryColor] to an arbitrary JSON value. + * + * You should usually call [Builder.primaryColor] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun primaryColor(primaryColor: JsonField) = apply { this.primaryColor = primaryColor } @@ -271,12 +405,22 @@ private constructor( /** The list of Finch products supported on this payroll provider. */ fun products(products: List) = products(JsonField.of(products)) - /** The list of Finch products supported on this payroll provider. */ + /** + * Sets [Builder.products] to an arbitrary JSON value. + * + * You should usually call [Builder.products] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun products(products: JsonField>) = apply { this.products = products.map { it.toMutableList() } } - /** The list of Finch products supported on this payroll provider. */ + /** + * Adds a single [String] to [products]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addProduct(product: String) = apply { products = (products ?: JsonField.of(mutableListOf())).also { @@ -337,31 +481,55 @@ private constructor( /** * Each benefit type and their supported features. If the benefit type is not supported, the * property will be null + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun benefitsSupport(): Optional = Optional.ofNullable(benefitsSupport.getNullable("benefits_support")) - /** The supported data fields returned by our HR and payroll endpoints */ + /** + * The supported data fields returned by our HR and payroll endpoints + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun supportedFields(): Optional = Optional.ofNullable(supportedFields.getNullable("supported_fields")) - /** The type of authentication method. */ + /** + * The type of authentication method. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) /** - * Each benefit type and their supported features. If the benefit type is not supported, the - * property will be null + * Returns the raw JSON value of [benefitsSupport]. + * + * Unlike [benefitsSupport], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("benefits_support") @ExcludeMissing fun _benefitsSupport(): JsonField = benefitsSupport - /** The supported data fields returned by our HR and payroll endpoints */ + /** + * Returns the raw JSON value of [supportedFields]. + * + * Unlike [supportedFields], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("supported_fields") @ExcludeMissing fun _supportedFields(): JsonField = supportedFields - /** The type of authentication method. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -412,16 +580,16 @@ private constructor( fun benefitsSupport(benefitsSupport: BenefitsSupport?) = benefitsSupport(JsonField.ofNullable(benefitsSupport)) - /** - * Each benefit type and their supported features. If the benefit type is not supported, - * the property will be null - */ + /** Alias for calling [Builder.benefitsSupport] with `benefitsSupport.orElse(null)`. */ fun benefitsSupport(benefitsSupport: Optional) = benefitsSupport(benefitsSupport.getOrNull()) /** - * Each benefit type and their supported features. If the benefit type is not supported, - * the property will be null + * Sets [Builder.benefitsSupport] to an arbitrary JSON value. + * + * You should usually call [Builder.benefitsSupport] with a well-typed [BenefitsSupport] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ fun benefitsSupport(benefitsSupport: JsonField) = apply { this.benefitsSupport = benefitsSupport @@ -431,11 +599,17 @@ private constructor( fun supportedFields(supportedFields: SupportedFields?) = supportedFields(JsonField.ofNullable(supportedFields)) - /** The supported data fields returned by our HR and payroll endpoints */ + /** Alias for calling [Builder.supportedFields] with `supportedFields.orElse(null)`. */ fun supportedFields(supportedFields: Optional) = supportedFields(supportedFields.getOrNull()) - /** The supported data fields returned by our HR and payroll endpoints */ + /** + * Sets [Builder.supportedFields] to an arbitrary JSON value. + * + * You should usually call [Builder.supportedFields] with a well-typed [SupportedFields] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun supportedFields(supportedFields: JsonField) = apply { this.supportedFields = supportedFields } @@ -443,7 +617,13 @@ private constructor( /** The type of authentication method. */ fun type(type: Type) = type(JsonField.of(type)) - /** The type of authentication method. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -504,51 +684,119 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun company(): Optional = Optional.ofNullable(company.getNullable("company")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun directory(): Optional = Optional.ofNullable(directory.getNullable("directory")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun employment(): Optional = Optional.ofNullable(employment.getNullable("employment")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun individual(): Optional = Optional.ofNullable(individual.getNullable("individual")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun payGroup(): Optional = Optional.ofNullable(payGroup.getNullable("pay_group")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun payStatement(): Optional = Optional.ofNullable(payStatement.getNullable("pay_statement")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun payment(): Optional = Optional.ofNullable(payment.getNullable("payment")) + /** + * Returns the raw JSON value of [company]. + * + * Unlike [company], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("company") @ExcludeMissing fun _company(): JsonField = company + /** + * Returns the raw JSON value of [directory]. + * + * Unlike [directory], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("directory") @ExcludeMissing fun _directory(): JsonField = directory + /** + * Returns the raw JSON value of [employment]. + * + * Unlike [employment], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("employment") @ExcludeMissing fun _employment(): JsonField = employment + /** + * Returns the raw JSON value of [individual]. + * + * Unlike [individual], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("individual") @ExcludeMissing fun _individual(): JsonField = individual + /** + * Returns the raw JSON value of [payGroup]. + * + * Unlike [payGroup], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("pay_group") @ExcludeMissing fun _payGroup(): JsonField = payGroup + /** + * Returns the raw JSON value of [payStatement]. + * + * Unlike [payStatement], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("pay_statement") @ExcludeMissing fun _payStatement(): JsonField = payStatement + /** + * Returns the raw JSON value of [payment]. + * + * Unlike [payment], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("payment") @ExcludeMissing fun _payment(): JsonField = payment @@ -608,6 +856,13 @@ private constructor( fun company(company: SupportedCompanyFields) = company(JsonField.of(company)) + /** + * Sets [Builder.company] to an arbitrary JSON value. + * + * You should usually call [Builder.company] with a well-typed + * [SupportedCompanyFields] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun company(company: JsonField) = apply { this.company = company } @@ -615,6 +870,13 @@ private constructor( fun directory(directory: SupportedDirectoryFields) = directory(JsonField.of(directory)) + /** + * Sets [Builder.directory] to an arbitrary JSON value. + * + * You should usually call [Builder.directory] with a well-typed + * [SupportedDirectoryFields] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ fun directory(directory: JsonField) = apply { this.directory = directory } @@ -622,6 +884,13 @@ private constructor( fun employment(employment: SupportedEmploymentFields) = employment(JsonField.of(employment)) + /** + * Sets [Builder.employment] to an arbitrary JSON value. + * + * You should usually call [Builder.employment] with a well-typed + * [SupportedEmploymentFields] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ fun employment(employment: JsonField) = apply { this.employment = employment } @@ -629,12 +898,26 @@ private constructor( fun individual(individual: SupportedIndividualFields) = individual(JsonField.of(individual)) + /** + * Sets [Builder.individual] to an arbitrary JSON value. + * + * You should usually call [Builder.individual] with a well-typed + * [SupportedIndividualFields] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ fun individual(individual: JsonField) = apply { this.individual = individual } fun payGroup(payGroup: SupportedPayGroupFields) = payGroup(JsonField.of(payGroup)) + /** + * Sets [Builder.payGroup] to an arbitrary JSON value. + * + * You should usually call [Builder.payGroup] with a well-typed + * [SupportedPayGroupFields] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun payGroup(payGroup: JsonField) = apply { this.payGroup = payGroup } @@ -642,12 +925,26 @@ private constructor( fun payStatement(payStatement: SupportedPayStatementFields) = payStatement(JsonField.of(payStatement)) + /** + * Sets [Builder.payStatement] to an arbitrary JSON value. + * + * You should usually call [Builder.payStatement] with a well-typed + * [SupportedPayStatementFields] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ fun payStatement(payStatement: JsonField) = apply { this.payStatement = payStatement } fun payment(payment: SupportedPaymentFields) = payment(JsonField.of(payment)) + /** + * Sets [Builder.payment] to an arbitrary JSON value. + * + * You should usually call [Builder.payment] with a well-typed + * [SupportedPaymentFields] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun payment(payment: JsonField) = apply { this.payment = payment } @@ -722,56 +1019,144 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun accounts(): Optional = Optional.ofNullable(accounts.getNullable("accounts")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun departments(): Optional = Optional.ofNullable(departments.getNullable("departments")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun ein(): Optional = Optional.ofNullable(ein.getNullable("ein")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun entity(): Optional = Optional.ofNullable(entity.getNullable("entity")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun legalName(): Optional = Optional.ofNullable(legalName.getNullable("legal_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun locations(): Optional = Optional.ofNullable(locations.getNullable("locations")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun primaryEmail(): Optional = Optional.ofNullable(primaryEmail.getNullable("primary_email")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun primaryPhoneNumber(): Optional = Optional.ofNullable(primaryPhoneNumber.getNullable("primary_phone_number")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [accounts]. + * + * Unlike [accounts], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("accounts") @ExcludeMissing fun _accounts(): JsonField = accounts + /** + * Returns the raw JSON value of [departments]. + * + * Unlike [departments], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("departments") @ExcludeMissing fun _departments(): JsonField = departments + /** + * Returns the raw JSON value of [ein]. + * + * Unlike [ein], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("ein") @ExcludeMissing fun _ein(): JsonField = ein + /** + * Returns the raw JSON value of [entity]. + * + * Unlike [entity], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("entity") @ExcludeMissing fun _entity(): JsonField = entity + /** + * Returns the raw JSON value of [legalName]. + * + * Unlike [legalName], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("legal_name") @ExcludeMissing fun _legalName(): JsonField = legalName + /** + * Returns the raw JSON value of [locations]. + * + * Unlike [locations], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("locations") @ExcludeMissing fun _locations(): JsonField = locations + /** + * Returns the raw JSON value of [primaryEmail]. + * + * Unlike [primaryEmail], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("primary_email") @ExcludeMissing fun _primaryEmail(): JsonField = primaryEmail + /** + * Returns the raw JSON value of [primaryPhoneNumber]. + * + * Unlike [primaryPhoneNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("primary_phone_number") @ExcludeMissing fun _primaryPhoneNumber(): JsonField = primaryPhoneNumber @@ -841,35 +1226,84 @@ private constructor( fun id(id: Boolean) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun accounts(accounts: Accounts) = accounts(JsonField.of(accounts)) + /** + * Sets [Builder.accounts] to an arbitrary JSON value. + * + * You should usually call [Builder.accounts] with a well-typed [Accounts] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun accounts(accounts: JsonField) = apply { this.accounts = accounts } fun departments(departments: Departments) = departments(JsonField.of(departments)) + /** + * Sets [Builder.departments] to an arbitrary JSON value. + * + * You should usually call [Builder.departments] with a well-typed [Departments] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun departments(departments: JsonField) = apply { this.departments = departments } fun ein(ein: Boolean) = ein(JsonField.of(ein)) + /** + * Sets [Builder.ein] to an arbitrary JSON value. + * + * You should usually call [Builder.ein] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun ein(ein: JsonField) = apply { this.ein = ein } fun entity(entity: Entity) = entity(JsonField.of(entity)) + /** + * Sets [Builder.entity] to an arbitrary JSON value. + * + * You should usually call [Builder.entity] with a well-typed [Entity] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun entity(entity: JsonField) = apply { this.entity = entity } fun legalName(legalName: Boolean) = legalName(JsonField.of(legalName)) + /** + * Sets [Builder.legalName] to an arbitrary JSON value. + * + * You should usually call [Builder.legalName] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun legalName(legalName: JsonField) = apply { this.legalName = legalName } fun locations(locations: Locations) = locations(JsonField.of(locations)) + /** + * Sets [Builder.locations] to an arbitrary JSON value. + * + * You should usually call [Builder.locations] with a well-typed [Locations] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun locations(locations: JsonField) = apply { this.locations = locations } @@ -877,6 +1311,13 @@ private constructor( fun primaryEmail(primaryEmail: Boolean) = primaryEmail(JsonField.of(primaryEmail)) + /** + * Sets [Builder.primaryEmail] to an arbitrary JSON value. + * + * You should usually call [Builder.primaryEmail] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun primaryEmail(primaryEmail: JsonField) = apply { this.primaryEmail = primaryEmail } @@ -884,6 +1325,13 @@ private constructor( fun primaryPhoneNumber(primaryPhoneNumber: Boolean) = primaryPhoneNumber(JsonField.of(primaryPhoneNumber)) + /** + * Sets [Builder.primaryPhoneNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.primaryPhoneNumber] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun primaryPhoneNumber(primaryPhoneNumber: JsonField) = apply { this.primaryPhoneNumber = primaryPhoneNumber } @@ -948,37 +1396,87 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun accountName(): Optional = Optional.ofNullable(accountName.getNullable("account_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun accountNumber(): Optional = Optional.ofNullable(accountNumber.getNullable("account_number")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun accountType(): Optional = Optional.ofNullable(accountType.getNullable("account_type")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun institutionName(): Optional = Optional.ofNullable(institutionName.getNullable("institution_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun routingNumber(): Optional = Optional.ofNullable(routingNumber.getNullable("routing_number")) + /** + * Returns the raw JSON value of [accountName]. + * + * Unlike [accountName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("account_name") @ExcludeMissing fun _accountName(): JsonField = accountName + /** + * Returns the raw JSON value of [accountNumber]. + * + * Unlike [accountNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("account_number") @ExcludeMissing fun _accountNumber(): JsonField = accountNumber + /** + * Returns the raw JSON value of [accountType]. + * + * Unlike [accountType], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("account_type") @ExcludeMissing fun _accountType(): JsonField = accountType + /** + * Returns the raw JSON value of [institutionName]. + * + * Unlike [institutionName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("institution_name") @ExcludeMissing fun _institutionName(): JsonField = institutionName + /** + * Returns the raw JSON value of [routingNumber]. + * + * Unlike [routingNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("routing_number") @ExcludeMissing fun _routingNumber(): JsonField = routingNumber @@ -1034,6 +1532,13 @@ private constructor( fun accountName(accountName: Boolean) = accountName(JsonField.of(accountName)) + /** + * Sets [Builder.accountName] to an arbitrary JSON value. + * + * You should usually call [Builder.accountName] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun accountName(accountName: JsonField) = apply { this.accountName = accountName } @@ -1041,6 +1546,13 @@ private constructor( fun accountNumber(accountNumber: Boolean) = accountNumber(JsonField.of(accountNumber)) + /** + * Sets [Builder.accountNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.accountNumber] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun accountNumber(accountNumber: JsonField) = apply { this.accountNumber = accountNumber } @@ -1048,6 +1560,13 @@ private constructor( fun accountType(accountType: Boolean) = accountType(JsonField.of(accountType)) + /** + * Sets [Builder.accountType] to an arbitrary JSON value. + * + * You should usually call [Builder.accountType] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun accountType(accountType: JsonField) = apply { this.accountType = accountType } @@ -1055,6 +1574,13 @@ private constructor( fun institutionName(institutionName: Boolean) = institutionName(JsonField.of(institutionName)) + /** + * Sets [Builder.institutionName] to an arbitrary JSON value. + * + * You should usually call [Builder.institutionName] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun institutionName(institutionName: JsonField) = apply { this.institutionName = institutionName } @@ -1062,6 +1588,13 @@ private constructor( fun routingNumber(routingNumber: Boolean) = routingNumber(JsonField.of(routingNumber)) + /** + * Sets [Builder.routingNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.routingNumber] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun routingNumber(routingNumber: JsonField) = apply { this.routingNumber = routingNumber } @@ -1131,13 +1664,33 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun parent(): Optional = Optional.ofNullable(parent.getNullable("parent")) + /** + * 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 + /** + * Returns the raw JSON value of [parent]. + * + * Unlike [parent], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("parent") @ExcludeMissing fun _parent(): JsonField = parent @@ -1185,10 +1738,24 @@ private constructor( fun name(name: Boolean) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [Boolean] 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 parent(parent: Parent) = parent(JsonField.of(parent)) + /** + * Sets [Builder.parent] to an arbitrary JSON value. + * + * You should usually call [Builder.parent] with a well-typed [Parent] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun parent(parent: JsonField) = apply { this.parent = parent } fun additionalProperties(additionalProperties: Map) = @@ -1229,9 +1796,19 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * 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 @JsonAnyGetter @@ -1274,6 +1851,13 @@ private constructor( fun name(name: Boolean) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [Boolean] + * 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) = @@ -1351,15 +1935,35 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [subtype]. + * + * Unlike [subtype], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1403,10 +2007,24 @@ private constructor( fun subtype(subtype: Boolean) = subtype(JsonField.of(subtype)) + /** + * Sets [Builder.subtype] to an arbitrary JSON value. + * + * You should usually call [Builder.subtype] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun subtype(subtype: JsonField) = apply { this.subtype = subtype } fun type(type: Boolean) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -1479,34 +2097,94 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun postalCode(): Optional = Optional.ofNullable(postalCode.getNullable("postal_code")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun state(): Optional = Optional.ofNullable(state.getNullable("state")) + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city + /** + * Returns the raw JSON value of [country]. + * + * Unlike [country], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country + /** + * Returns the raw JSON value of [line1]. + * + * Unlike [line1], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("line1") @ExcludeMissing fun _line1(): JsonField = line1 + /** + * Returns the raw JSON value of [line2]. + * + * Unlike [line2], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("line2") @ExcludeMissing fun _line2(): JsonField = line2 + /** + * Returns the raw JSON value of [postalCode]. + * + * Unlike [postalCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("postal_code") @ExcludeMissing fun _postalCode(): JsonField = postalCode + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state @JsonAnyGetter @@ -1564,28 +2242,70 @@ private constructor( fun city(city: Boolean) = city(JsonField.of(city)) + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun city(city: JsonField) = apply { this.city = city } fun country(country: Boolean) = country(JsonField.of(country)) + /** + * Sets [Builder.country] to an arbitrary JSON value. + * + * You should usually call [Builder.country] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun country(country: JsonField) = apply { this.country = country } fun line1(line1: Boolean) = line1(JsonField.of(line1)) + /** + * Sets [Builder.line1] to an arbitrary JSON value. + * + * You should usually call [Builder.line1] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun line1(line1: JsonField) = apply { this.line1 = line1 } fun line2(line2: Boolean) = line2(JsonField.of(line2)) + /** + * Sets [Builder.line2] to an arbitrary JSON value. + * + * You should usually call [Builder.line2] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun line2(line2: JsonField) = apply { this.line2 = line2 } fun postalCode(postalCode: Boolean) = postalCode(JsonField.of(postalCode)) + /** + * Sets [Builder.postalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.postalCode] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } fun state(state: Boolean) = state(JsonField.of(state)) + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun state(state: JsonField) = apply { this.state = state } fun additionalProperties(additionalProperties: Map) = @@ -1672,15 +2392,35 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun individuals(): Optional = Optional.ofNullable(individuals.getNullable("individuals")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) + /** + * Returns the raw JSON value of [individuals]. + * + * Unlike [individuals], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("individuals") @ExcludeMissing fun _individuals(): JsonField = individuals + /** + * Returns the raw JSON value of [paging]. + * + * Unlike [paging], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("paging") @ExcludeMissing fun _paging(): JsonField = paging @JsonAnyGetter @@ -1728,12 +2468,26 @@ private constructor( fun individuals(individuals: Individuals) = individuals(JsonField.of(individuals)) + /** + * Sets [Builder.individuals] to an arbitrary JSON value. + * + * You should usually call [Builder.individuals] with a well-typed [Individuals] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun individuals(individuals: JsonField) = apply { this.individuals = individuals } fun paging(paging: Paging) = paging(JsonField.of(paging)) + /** + * Sets [Builder.paging] to an arbitrary JSON value. + * + * You should usually call [Builder.paging] with a well-typed [Paging] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun paging(paging: JsonField) = apply { this.paging = paging } fun additionalProperties(additionalProperties: Map) = apply { @@ -1795,48 +2549,118 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun department(): Optional = Optional.ofNullable(department.getNullable("department")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [department]. + * + * Unlike [department], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("department") @ExcludeMissing fun _department(): JsonField = department + /** + * Returns the raw JSON value of [firstName]. + * + * Unlike [firstName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName + /** + * Returns the raw JSON value of [isActive]. + * + * Unlike [isActive], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("is_active") @ExcludeMissing fun _isActive(): JsonField = isActive + /** + * Returns the raw JSON value of [lastName]. + * + * Unlike [lastName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName + /** + * Returns the raw JSON value of [manager]. + * + * Unlike [manager], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("manager") @ExcludeMissing fun _manager(): JsonField = manager + /** + * Returns the raw JSON value of [middleName]. + * + * Unlike [middleName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("middle_name") @ExcludeMissing fun _middleName(): JsonField = middleName @@ -1899,38 +2723,87 @@ private constructor( fun id(id: Boolean) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun department(department: Boolean) = department(JsonField.of(department)) + /** + * Sets [Builder.department] to an arbitrary JSON value. + * + * You should usually call [Builder.department] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun department(department: JsonField) = apply { this.department = department } fun firstName(firstName: Boolean) = firstName(JsonField.of(firstName)) + /** + * Sets [Builder.firstName] to an arbitrary JSON value. + * + * You should usually call [Builder.firstName] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) + /** + * Sets [Builder.isActive] to an arbitrary JSON value. + * + * You should usually call [Builder.isActive] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun isActive(isActive: JsonField) = apply { this.isActive = isActive } fun lastName(lastName: Boolean) = lastName(JsonField.of(lastName)) + /** + * Sets [Builder.lastName] to an arbitrary JSON value. + * + * You should usually call [Builder.lastName] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } fun manager(manager: Manager) = manager(JsonField.of(manager)) + /** + * Sets [Builder.manager] to an arbitrary JSON value. + * + * You should usually call [Builder.manager] with a well-typed [Manager] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun manager(manager: JsonField) = apply { this.manager = manager } fun middleName(middleName: Boolean) = middleName(JsonField.of(middleName)) + /** + * Sets [Builder.middleName] to an arbitrary JSON value. + * + * You should usually call [Builder.middleName] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } @@ -1982,8 +2855,18 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id @JsonAnyGetter @@ -2026,6 +2909,13 @@ private constructor( fun id(id: Boolean) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun additionalProperties(additionalProperties: Map) = @@ -2103,13 +2993,33 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun count(): Optional = Optional.ofNullable(count.getNullable("count")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun offset(): Optional = Optional.ofNullable(offset.getNullable("offset")) + /** + * Returns the raw JSON value of [count]. + * + * Unlike [count], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("count") @ExcludeMissing fun _count(): JsonField = count + /** + * Returns the raw JSON value of [offset]. + * + * Unlike [offset], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("offset") @ExcludeMissing fun _offset(): JsonField = offset @@ -2155,10 +3065,24 @@ private constructor( fun count(count: Boolean) = count(JsonField.of(count)) + /** + * Sets [Builder.count] to an arbitrary JSON value. + * + * You should usually call [Builder.count] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun count(count: JsonField) = apply { this.count = count } fun offset(offset: Boolean) = offset(JsonField.of(offset)) + /** + * Sets [Builder.offset] to an arbitrary JSON value. + * + * You should usually call [Builder.offset] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun offset(offset: JsonField) = apply { this.offset = offset } fun additionalProperties(additionalProperties: Map) = @@ -2282,114 +3206,283 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun classCode(): Optional = Optional.ofNullable(classCode.getNullable("class_code")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun customFields(): Optional = Optional.ofNullable(customFields.getNullable("custom_fields")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun department(): Optional = Optional.ofNullable(department.getNullable("department")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun employment(): Optional = Optional.ofNullable(employment.getNullable("employment")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun employmentStatus(): Optional = Optional.ofNullable(employmentStatus.getNullable("employment_status")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun income(): Optional = Optional.ofNullable(income.getNullable("income")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun incomeHistory(): Optional = Optional.ofNullable(incomeHistory.getNullable("income_history")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun location(): Optional = Optional.ofNullable(location.getNullable("location")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun title(): Optional = Optional.ofNullable(title.getNullable("title")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [classCode]. + * + * Unlike [classCode], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("class_code") @ExcludeMissing fun _classCode(): JsonField = classCode + /** + * Returns the raw JSON value of [customFields]. + * + * Unlike [customFields], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("custom_fields") @ExcludeMissing fun _customFields(): JsonField = customFields + /** + * Returns the raw JSON value of [department]. + * + * Unlike [department], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("department") @ExcludeMissing fun _department(): JsonField = department + /** + * Returns the raw JSON value of [employment]. + * + * Unlike [employment], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("employment") @ExcludeMissing fun _employment(): JsonField = employment + /** + * Returns the raw JSON value of [employmentStatus]. + * + * Unlike [employmentStatus], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("employment_status") @ExcludeMissing fun _employmentStatus(): JsonField = employmentStatus + /** + * Returns the raw JSON value of [endDate]. + * + * Unlike [endDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("end_date") @ExcludeMissing fun _endDate(): JsonField = endDate + /** + * Returns the raw JSON value of [firstName]. + * + * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName + /** + * Returns the raw JSON value of [income]. + * + * Unlike [income], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("income") @ExcludeMissing fun _income(): JsonField = income + /** + * Returns the raw JSON value of [incomeHistory]. + * + * Unlike [incomeHistory], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("income_history") @ExcludeMissing fun _incomeHistory(): JsonField = incomeHistory + /** + * Returns the raw JSON value of [isActive]. + * + * Unlike [isActive], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("is_active") @ExcludeMissing fun _isActive(): JsonField = isActive + /** + * Returns the raw JSON value of [lastName]. + * + * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName + /** + * Returns the raw JSON value of [location]. + * + * Unlike [location], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("location") @ExcludeMissing fun _location(): JsonField = location + /** + * Returns the raw JSON value of [manager]. + * + * Unlike [manager], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("manager") @ExcludeMissing fun _manager(): JsonField = manager + /** + * Returns the raw JSON value of [middleName]. + * + * Unlike [middleName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("middle_name") @ExcludeMissing fun _middleName(): JsonField = middleName + /** + * Returns the raw JSON value of [startDate]. + * + * Unlike [startDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("start_date") @ExcludeMissing fun _startDate(): JsonField = startDate + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title @JsonAnyGetter @@ -2482,10 +3575,24 @@ private constructor( fun id(id: Boolean) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun classCode(classCode: Boolean) = classCode(JsonField.of(classCode)) + /** + * Sets [Builder.classCode] to an arbitrary JSON value. + * + * You should usually call [Builder.classCode] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun classCode(classCode: JsonField) = apply { this.classCode = classCode } @@ -2493,18 +3600,39 @@ private constructor( fun customFields(customFields: Boolean) = customFields(JsonField.of(customFields)) + /** + * Sets [Builder.customFields] to an arbitrary JSON value. + * + * You should usually call [Builder.customFields] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun customFields(customFields: JsonField) = apply { this.customFields = customFields } fun department(department: Department) = department(JsonField.of(department)) + /** + * Sets [Builder.department] to an arbitrary JSON value. + * + * You should usually call [Builder.department] with a well-typed [Department] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun department(department: JsonField) = apply { this.department = department } fun employment(employment: Employment) = employment(JsonField.of(employment)) + /** + * Sets [Builder.employment] to an arbitrary JSON value. + * + * You should usually call [Builder.employment] with a well-typed [Employment] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun employment(employment: JsonField) = apply { this.employment = employment } @@ -2512,61 +3640,145 @@ private constructor( fun employmentStatus(employmentStatus: Boolean) = employmentStatus(JsonField.of(employmentStatus)) + /** + * Sets [Builder.employmentStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.employmentStatus] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun employmentStatus(employmentStatus: JsonField) = apply { this.employmentStatus = employmentStatus } fun endDate(endDate: Boolean) = endDate(JsonField.of(endDate)) + /** + * Sets [Builder.endDate] to an arbitrary JSON value. + * + * You should usually call [Builder.endDate] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } fun firstName(firstName: Boolean) = firstName(JsonField.of(firstName)) + /** + * Sets [Builder.firstName] to an arbitrary JSON value. + * + * You should usually call [Builder.firstName] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } fun income(income: Income) = income(JsonField.of(income)) + /** + * Sets [Builder.income] to an arbitrary JSON value. + * + * You should usually call [Builder.income] with a well-typed [Income] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun income(income: JsonField) = apply { this.income = income } fun incomeHistory(incomeHistory: Boolean) = incomeHistory(JsonField.of(incomeHistory)) + /** + * Sets [Builder.incomeHistory] to an arbitrary JSON value. + * + * You should usually call [Builder.incomeHistory] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun incomeHistory(incomeHistory: JsonField) = apply { this.incomeHistory = incomeHistory } fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) + /** + * Sets [Builder.isActive] to an arbitrary JSON value. + * + * You should usually call [Builder.isActive] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun isActive(isActive: JsonField) = apply { this.isActive = isActive } fun lastName(lastName: Boolean) = lastName(JsonField.of(lastName)) + /** + * Sets [Builder.lastName] to an arbitrary JSON value. + * + * You should usually call [Builder.lastName] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } fun location(location: Location) = location(JsonField.of(location)) + /** + * Sets [Builder.location] to an arbitrary JSON value. + * + * You should usually call [Builder.location] with a well-typed [Location] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun location(location: JsonField) = apply { this.location = location } fun manager(manager: Manager) = manager(JsonField.of(manager)) + /** + * Sets [Builder.manager] to an arbitrary JSON value. + * + * You should usually call [Builder.manager] with a well-typed [Manager] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun manager(manager: JsonField) = apply { this.manager = manager } fun middleName(middleName: Boolean) = middleName(JsonField.of(middleName)) + /** + * Sets [Builder.middleName] to an arbitrary JSON value. + * + * You should usually call [Builder.middleName] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } fun startDate(startDate: Boolean) = startDate(JsonField.of(startDate)) + /** + * Sets [Builder.startDate] to an arbitrary JSON value. + * + * You should usually call [Builder.startDate] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun startDate(startDate: JsonField) = apply { this.startDate = startDate } fun title(title: Boolean) = title(JsonField.of(title)) + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun title(title: JsonField) = apply { this.title = title } fun additionalProperties(additionalProperties: Map) = apply { @@ -2625,8 +3837,18 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * 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 @JsonAnyGetter @@ -2669,6 +3891,13 @@ private constructor( fun name(name: Boolean) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [Boolean] 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) = @@ -2729,15 +3958,35 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [subtype]. + * + * Unlike [subtype], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -2783,10 +4032,24 @@ private constructor( fun subtype(subtype: Boolean) = subtype(JsonField.of(subtype)) + /** + * Sets [Builder.subtype] to an arbitrary JSON value. + * + * You should usually call [Builder.subtype] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun subtype(subtype: JsonField) = apply { this.subtype = subtype } fun type(type: Boolean) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -2850,22 +4113,52 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun unit(): Optional = Optional.ofNullable(unit.getNullable("unit")) + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + /** + * Returns the raw JSON value of [unit]. + * + * Unlike [unit], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("unit") @ExcludeMissing fun _unit(): JsonField = unit @JsonAnyGetter @@ -2912,16 +4205,37 @@ private constructor( fun amount(amount: Boolean) = amount(JsonField.of(amount)) + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } fun currency(currency: Boolean) = currency(JsonField.of(currency)) + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } fun unit(unit: Boolean) = unit(JsonField.of(unit)) + /** + * Sets [Builder.unit] to an arbitrary JSON value. + * + * You should usually call [Builder.unit] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun unit(unit: JsonField) = apply { this.unit = unit } fun additionalProperties(additionalProperties: Map) = @@ -2994,34 +4308,94 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun postalCode(): Optional = Optional.ofNullable(postalCode.getNullable("postal_code")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun state(): Optional = Optional.ofNullable(state.getNullable("state")) + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city + /** + * Returns the raw JSON value of [country]. + * + * Unlike [country], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country + /** + * Returns the raw JSON value of [line1]. + * + * Unlike [line1], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("line1") @ExcludeMissing fun _line1(): JsonField = line1 + /** + * Returns the raw JSON value of [line2]. + * + * Unlike [line2], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("line2") @ExcludeMissing fun _line2(): JsonField = line2 + /** + * Returns the raw JSON value of [postalCode]. + * + * Unlike [postalCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("postal_code") @ExcludeMissing fun _postalCode(): JsonField = postalCode + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state @JsonAnyGetter @@ -3077,28 +4451,70 @@ private constructor( fun city(city: Boolean) = city(JsonField.of(city)) + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun city(city: JsonField) = apply { this.city = city } fun country(country: Boolean) = country(JsonField.of(country)) + /** + * Sets [Builder.country] to an arbitrary JSON value. + * + * You should usually call [Builder.country] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun country(country: JsonField) = apply { this.country = country } fun line1(line1: Boolean) = line1(JsonField.of(line1)) + /** + * Sets [Builder.line1] to an arbitrary JSON value. + * + * You should usually call [Builder.line1] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun line1(line1: JsonField) = apply { this.line1 = line1 } fun line2(line2: Boolean) = line2(JsonField.of(line2)) + /** + * Sets [Builder.line2] to an arbitrary JSON value. + * + * You should usually call [Builder.line2] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun line2(line2: JsonField) = apply { this.line2 = line2 } fun postalCode(postalCode: Boolean) = postalCode(JsonField.of(postalCode)) + /** + * Sets [Builder.postalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.postalCode] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } fun state(state: Boolean) = state(JsonField.of(state)) + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun state(state: JsonField) = apply { this.state = state } fun additionalProperties(additionalProperties: Map) = @@ -3164,8 +4580,18 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id @JsonAnyGetter @@ -3206,6 +4632,13 @@ private constructor( fun id(id: Boolean) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun additionalProperties(additionalProperties: Map) = @@ -3316,80 +4749,207 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun emails(): Optional = Optional.ofNullable(emails.getNullable("emails")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun encryptedSsn(): Optional = Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun ethnicity(): Optional = Optional.ofNullable(ethnicity.getNullable("ethnicity")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun gender(): Optional = Optional.ofNullable(gender.getNullable("gender")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun phoneNumbers(): Optional = Optional.ofNullable(phoneNumbers.getNullable("phone_numbers")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun preferredName(): Optional = Optional.ofNullable(preferredName.getNullable("preferred_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun residence(): Optional = Optional.ofNullable(residence.getNullable("residence")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [dob]. + * + * Unlike [dob], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dob") @ExcludeMissing fun _dob(): JsonField = dob + /** + * Returns the raw JSON value of [emails]. + * + * Unlike [emails], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("emails") @ExcludeMissing fun _emails(): JsonField = emails + /** + * Returns the raw JSON value of [encryptedSsn]. + * + * Unlike [encryptedSsn], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("encrypted_ssn") @ExcludeMissing fun _encryptedSsn(): JsonField = encryptedSsn + /** + * Returns the raw JSON value of [ethnicity]. + * + * Unlike [ethnicity], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("ethnicity") @ExcludeMissing fun _ethnicity(): JsonField = ethnicity + /** + * Returns the raw JSON value of [firstName]. + * + * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName + /** + * Returns the raw JSON value of [gender]. + * + * Unlike [gender], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gender") @ExcludeMissing fun _gender(): JsonField = gender + /** + * Returns the raw JSON value of [lastName]. + * + * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName + /** + * Returns the raw JSON value of [middleName]. + * + * Unlike [middleName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("middle_name") @ExcludeMissing fun _middleName(): JsonField = middleName + /** + * Returns the raw JSON value of [phoneNumbers]. + * + * Unlike [phoneNumbers], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("phone_numbers") @ExcludeMissing fun _phoneNumbers(): JsonField = phoneNumbers + /** + * Returns the raw JSON value of [preferredName]. + * + * Unlike [preferredName], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("preferred_name") @ExcludeMissing fun _preferredName(): JsonField = preferredName + /** + * Returns the raw JSON value of [residence]. + * + * Unlike [residence], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("residence") @ExcludeMissing fun _residence(): JsonField = residence + /** + * Returns the raw JSON value of [ssn]. + * + * Unlike [ssn], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("ssn") @ExcludeMissing fun _ssn(): JsonField = ssn @JsonAnyGetter @@ -3470,45 +5030,108 @@ private constructor( fun id(id: Boolean) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun dob(dob: Boolean) = dob(JsonField.of(dob)) + /** + * Sets [Builder.dob] to an arbitrary JSON value. + * + * You should usually call [Builder.dob] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun dob(dob: JsonField) = apply { this.dob = dob } fun emails(emails: Emails) = emails(JsonField.of(emails)) + /** + * Sets [Builder.emails] to an arbitrary JSON value. + * + * You should usually call [Builder.emails] with a well-typed [Emails] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun emails(emails: JsonField) = apply { this.emails = emails } fun encryptedSsn(encryptedSsn: Boolean) = encryptedSsn(JsonField.of(encryptedSsn)) + /** + * Sets [Builder.encryptedSsn] to an arbitrary JSON value. + * + * You should usually call [Builder.encryptedSsn] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun encryptedSsn(encryptedSsn: JsonField) = apply { this.encryptedSsn = encryptedSsn } fun ethnicity(ethnicity: Boolean) = ethnicity(JsonField.of(ethnicity)) + /** + * Sets [Builder.ethnicity] to an arbitrary JSON value. + * + * You should usually call [Builder.ethnicity] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun ethnicity(ethnicity: JsonField) = apply { this.ethnicity = ethnicity } fun firstName(firstName: Boolean) = firstName(JsonField.of(firstName)) + /** + * Sets [Builder.firstName] to an arbitrary JSON value. + * + * You should usually call [Builder.firstName] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } fun gender(gender: Boolean) = gender(JsonField.of(gender)) + /** + * Sets [Builder.gender] to an arbitrary JSON value. + * + * You should usually call [Builder.gender] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun gender(gender: JsonField) = apply { this.gender = gender } fun lastName(lastName: Boolean) = lastName(JsonField.of(lastName)) + /** + * Sets [Builder.lastName] to an arbitrary JSON value. + * + * You should usually call [Builder.lastName] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } fun middleName(middleName: Boolean) = middleName(JsonField.of(middleName)) + /** + * Sets [Builder.middleName] to an arbitrary JSON value. + * + * You should usually call [Builder.middleName] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } @@ -3516,6 +5139,13 @@ private constructor( fun phoneNumbers(phoneNumbers: PhoneNumbers) = phoneNumbers(JsonField.of(phoneNumbers)) + /** + * Sets [Builder.phoneNumbers] to an arbitrary JSON value. + * + * You should usually call [Builder.phoneNumbers] with a well-typed + * [PhoneNumbers] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun phoneNumbers(phoneNumbers: JsonField) = apply { this.phoneNumbers = phoneNumbers } @@ -3523,18 +5153,39 @@ private constructor( fun preferredName(preferredName: Boolean) = preferredName(JsonField.of(preferredName)) + /** + * Sets [Builder.preferredName] to an arbitrary JSON value. + * + * You should usually call [Builder.preferredName] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun preferredName(preferredName: JsonField) = apply { this.preferredName = preferredName } fun residence(residence: Residence) = residence(JsonField.of(residence)) + /** + * Sets [Builder.residence] to an arbitrary JSON value. + * + * You should usually call [Builder.residence] with a well-typed [Residence] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun residence(residence: JsonField) = apply { this.residence = residence } fun ssn(ssn: Boolean) = ssn(JsonField.of(ssn)) + /** + * Sets [Builder.ssn] to an arbitrary JSON value. + * + * You should usually call [Builder.ssn] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun ssn(ssn: JsonField) = apply { this.ssn = ssn } fun additionalProperties(additionalProperties: Map) = apply { @@ -3592,12 +5243,32 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -3641,10 +5312,24 @@ private constructor( fun data(data: Boolean) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun data(data: JsonField) = apply { this.data = data } fun type(type: Boolean) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -3704,12 +5389,32 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -3755,10 +5460,24 @@ private constructor( fun data(data: Boolean) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun data(data: JsonField) = apply { this.data = data } fun type(type: Boolean) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -3831,34 +5550,94 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun postalCode(): Optional = Optional.ofNullable(postalCode.getNullable("postal_code")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun state(): Optional = Optional.ofNullable(state.getNullable("state")) + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city + /** + * Returns the raw JSON value of [country]. + * + * Unlike [country], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country + /** + * Returns the raw JSON value of [line1]. + * + * Unlike [line1], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("line1") @ExcludeMissing fun _line1(): JsonField = line1 + /** + * Returns the raw JSON value of [line2]. + * + * Unlike [line2], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("line2") @ExcludeMissing fun _line2(): JsonField = line2 + /** + * Returns the raw JSON value of [postalCode]. + * + * Unlike [postalCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("postal_code") @ExcludeMissing fun _postalCode(): JsonField = postalCode + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state @JsonAnyGetter @@ -3916,28 +5695,70 @@ private constructor( fun city(city: Boolean) = city(JsonField.of(city)) + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun city(city: JsonField) = apply { this.city = city } fun country(country: Boolean) = country(JsonField.of(country)) + /** + * Sets [Builder.country] to an arbitrary JSON value. + * + * You should usually call [Builder.country] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun country(country: JsonField) = apply { this.country = country } fun line1(line1: Boolean) = line1(JsonField.of(line1)) + /** + * Sets [Builder.line1] to an arbitrary JSON value. + * + * You should usually call [Builder.line1] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun line1(line1: JsonField) = apply { this.line1 = line1 } fun line2(line2: Boolean) = line2(JsonField.of(line2)) + /** + * Sets [Builder.line2] to an arbitrary JSON value. + * + * You should usually call [Builder.line2] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun line2(line2: JsonField) = apply { this.line2 = line2 } fun postalCode(postalCode: Boolean) = postalCode(JsonField.of(postalCode)) + /** + * Sets [Builder.postalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.postalCode] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } fun state(state: Boolean) = state(JsonField.of(state)) + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun state(state: JsonField) = apply { this.state = state } fun additionalProperties(additionalProperties: Map) = @@ -4030,24 +5851,63 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun individualIds(): Optional = Optional.ofNullable(individualIds.getNullable("individual_ids")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun payFrequencies(): Optional = Optional.ofNullable(payFrequencies.getNullable("pay_frequencies")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [individualIds]. + * + * Unlike [individualIds], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("individual_ids") @ExcludeMissing fun _individualIds(): JsonField = individualIds + /** + * 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 + /** + * Returns the raw JSON value of [payFrequencies]. + * + * Unlike [payFrequencies], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("pay_frequencies") @ExcludeMissing fun _payFrequencies(): JsonField = payFrequencies @@ -4102,22 +5962,50 @@ private constructor( fun id(id: Boolean) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun individualIds(individualIds: Boolean) = individualIds(JsonField.of(individualIds)) + /** + * Sets [Builder.individualIds] to an arbitrary JSON value. + * + * You should usually call [Builder.individualIds] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun individualIds(individualIds: JsonField) = apply { this.individualIds = individualIds } fun name(name: Boolean) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [Boolean] 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 payFrequencies(payFrequencies: Boolean) = payFrequencies(JsonField.of(payFrequencies)) + /** + * Sets [Builder.payFrequencies] to an arbitrary JSON value. + * + * You should usually call [Builder.payFrequencies] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun payFrequencies(payFrequencies: JsonField) = apply { this.payFrequencies = payFrequencies } @@ -4186,13 +6074,33 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun payStatements(): Optional = Optional.ofNullable(payStatements.getNullable("pay_statements")) + /** + * Returns the raw JSON value of [paging]. + * + * Unlike [paging], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("paging") @ExcludeMissing fun _paging(): JsonField = paging + /** + * Returns the raw JSON value of [payStatements]. + * + * Unlike [payStatements], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("pay_statements") @ExcludeMissing fun _payStatements(): JsonField = payStatements @@ -4242,11 +6150,25 @@ private constructor( fun paging(paging: Paging) = paging(JsonField.of(paging)) + /** + * Sets [Builder.paging] to an arbitrary JSON value. + * + * You should usually call [Builder.paging] with a well-typed [Paging] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun paging(paging: JsonField) = apply { this.paging = paging } fun payStatements(payStatements: PayStatements) = payStatements(JsonField.of(payStatements)) + /** + * Sets [Builder.payStatements] to an arbitrary JSON value. + * + * You should usually call [Builder.payStatements] with a well-typed + * [PayStatements] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun payStatements(payStatements: JsonField) = apply { this.payStatements = payStatements } @@ -4295,12 +6217,34 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @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 count(): Boolean = count.getRequired("count") + /** + * @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 offset(): Boolean = offset.getRequired("offset") + /** + * Returns the raw JSON value of [count]. + * + * Unlike [count], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("count") @ExcludeMissing fun _count(): JsonField = count + /** + * Returns the raw JSON value of [offset]. + * + * Unlike [offset], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("offset") @ExcludeMissing fun _offset(): JsonField = offset @@ -4354,10 +6298,24 @@ private constructor( fun count(count: Boolean) = count(JsonField.of(count)) + /** + * Sets [Builder.count] to an arbitrary JSON value. + * + * You should usually call [Builder.count] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun count(count: JsonField) = apply { this.count = count } fun offset(offset: Boolean) = offset(JsonField.of(offset)) + /** + * Sets [Builder.offset] to an arbitrary JSON value. + * + * You should usually call [Builder.offset] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun offset(offset: JsonField) = apply { this.offset = offset } fun additionalProperties(additionalProperties: Map) = @@ -4448,71 +6406,171 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun earnings(): Optional = Optional.ofNullable(earnings.getNullable("earnings")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun employeeDeductions(): Optional = Optional.ofNullable(employeeDeductions.getNullable("employee_deductions")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun employerContributions(): Optional = Optional.ofNullable( employerContributions.getNullable("employer_contributions") ) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun grossPay(): Optional = Optional.ofNullable(grossPay.getNullable("gross_pay")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("individual_id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun netPay(): Optional = Optional.ofNullable(netPay.getNullable("net_pay")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun paymentMethod(): Optional = Optional.ofNullable(paymentMethod.getNullable("payment_method")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun taxes(): Optional = Optional.ofNullable(taxes.getNullable("taxes")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun totalHours(): Optional = Optional.ofNullable(totalHours.getNullable("total_hours")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [earnings]. + * + * Unlike [earnings], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("earnings") @ExcludeMissing fun _earnings(): JsonField = earnings + /** + * Returns the raw JSON value of [employeeDeductions]. + * + * Unlike [employeeDeductions], this method doesn't throw if the JSON field has + * an unexpected type. + */ @JsonProperty("employee_deductions") @ExcludeMissing fun _employeeDeductions(): JsonField = employeeDeductions + /** + * Returns the raw JSON value of [employerContributions]. + * + * Unlike [employerContributions], this method doesn't throw if the JSON field + * has an unexpected type. + */ @JsonProperty("employer_contributions") @ExcludeMissing fun _employerContributions(): JsonField = employerContributions + /** + * Returns the raw JSON value of [grossPay]. + * + * Unlike [grossPay], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("gross_pay") @ExcludeMissing fun _grossPay(): JsonField = grossPay + /** + * 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 + /** + * Returns the raw JSON value of [netPay]. + * + * Unlike [netPay], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("net_pay") @ExcludeMissing fun _netPay(): JsonField = netPay + /** + * Returns the raw JSON value of [paymentMethod]. + * + * Unlike [paymentMethod], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("payment_method") @ExcludeMissing fun _paymentMethod(): JsonField = paymentMethod + /** + * Returns the raw JSON value of [taxes]. + * + * Unlike [taxes], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("taxes") @ExcludeMissing fun _taxes(): JsonField = taxes + /** + * Returns the raw JSON value of [totalHours]. + * + * Unlike [totalHours], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("total_hours") @ExcludeMissing fun _totalHours(): JsonField = totalHours + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -4585,6 +6643,13 @@ private constructor( fun earnings(earnings: Earnings) = earnings(JsonField.of(earnings)) + /** + * Sets [Builder.earnings] to an arbitrary JSON value. + * + * You should usually call [Builder.earnings] with a well-typed [Earnings] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun earnings(earnings: JsonField) = apply { this.earnings = earnings } @@ -4592,6 +6657,13 @@ private constructor( fun employeeDeductions(employeeDeductions: EmployeeDeductions) = employeeDeductions(JsonField.of(employeeDeductions)) + /** + * Sets [Builder.employeeDeductions] to an arbitrary JSON value. + * + * You should usually call [Builder.employeeDeductions] with a well-typed + * [EmployeeDeductions] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ fun employeeDeductions(employeeDeductions: JsonField) = apply { this.employeeDeductions = employeeDeductions @@ -4600,12 +6672,26 @@ private constructor( fun employerContributions(employerContributions: EmployerContributions) = employerContributions(JsonField.of(employerContributions)) + /** + * Sets [Builder.employerContributions] to an arbitrary JSON value. + * + * You should usually call [Builder.employerContributions] with a well-typed + * [EmployerContributions] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ fun employerContributions( employerContributions: JsonField ) = apply { this.employerContributions = employerContributions } fun grossPay(grossPay: Boolean) = grossPay(JsonField.of(grossPay)) + /** + * Sets [Builder.grossPay] to an arbitrary JSON value. + * + * You should usually call [Builder.grossPay] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun grossPay(grossPay: JsonField) = apply { this.grossPay = grossPay } @@ -4613,33 +6699,75 @@ private constructor( fun individualId(individualId: Boolean) = individualId(JsonField.of(individualId)) + /** + * Sets [Builder.individualId] to an arbitrary JSON value. + * + * You should usually call [Builder.individualId] with a well-typed + * [Boolean] 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 netPay(netPay: Boolean) = netPay(JsonField.of(netPay)) + /** + * Sets [Builder.netPay] to an arbitrary JSON value. + * + * You should usually call [Builder.netPay] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun netPay(netPay: JsonField) = apply { this.netPay = netPay } fun paymentMethod(paymentMethod: Boolean) = paymentMethod(JsonField.of(paymentMethod)) + /** + * Sets [Builder.paymentMethod] to an arbitrary JSON value. + * + * You should usually call [Builder.paymentMethod] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun paymentMethod(paymentMethod: JsonField) = apply { this.paymentMethod = paymentMethod } fun taxes(taxes: Taxes) = taxes(JsonField.of(taxes)) + /** + * Sets [Builder.taxes] to an arbitrary JSON value. + * + * You should usually call [Builder.taxes] with a well-typed [Taxes] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun taxes(taxes: JsonField) = apply { this.taxes = taxes } fun totalHours(totalHours: Boolean) = totalHours(JsonField.of(totalHours)) + /** + * Sets [Builder.totalHours] to an arbitrary JSON value. + * + * You should usually call [Builder.totalHours] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun totalHours(totalHours: JsonField) = apply { this.totalHours = totalHours } fun type(type: Boolean) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -4701,28 +6829,68 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -4774,20 +6942,48 @@ private constructor( fun amount(amount: Boolean) = amount(JsonField.of(amount)) + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } fun currency(currency: Boolean) = currency(JsonField.of(currency)) + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } fun name(name: Boolean) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [Boolean] + * 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 type(type: Boolean) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -4864,35 +7060,85 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun preTax(): Optional = Optional.ofNullable(preTax.getNullable("pre_tax")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [preTax]. + * + * Unlike [preTax], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("pre_tax") @ExcludeMissing fun _preTax(): JsonField = preTax + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -4949,24 +7195,59 @@ private constructor( fun amount(amount: Boolean) = amount(JsonField.of(amount)) + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } fun currency(currency: Boolean) = currency(JsonField.of(currency)) + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } fun name(name: Boolean) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [Boolean] + * 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 preTax(preTax: Boolean) = preTax(JsonField.of(preTax)) + /** + * Sets [Builder.preTax] to an arbitrary JSON value. + * + * You should usually call [Builder.preTax] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun preTax(preTax: JsonField) = apply { this.preTax = preTax } fun type(type: Boolean) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -5038,23 +7319,53 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name @JsonAnyGetter @@ -5106,16 +7417,37 @@ private constructor( fun amount(amount: Boolean) = amount(JsonField.of(amount)) + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } fun currency(currency: Boolean) = currency(JsonField.of(currency)) + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } fun name(name: Boolean) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [Boolean] + * 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) = @@ -5191,35 +7523,85 @@ private constructor( immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun employer(): Optional = Optional.ofNullable(employer.getNullable("employer")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + /** + * Returns the raw JSON value of [employer]. + * + * Unlike [employer], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("employer") @ExcludeMissing fun _employer(): JsonField = employer + /** + * 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 + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -5274,26 +7656,61 @@ private constructor( fun amount(amount: Boolean) = amount(JsonField.of(amount)) + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } fun currency(currency: Boolean) = currency(JsonField.of(currency)) + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } fun employer(employer: Boolean) = employer(JsonField.of(employer)) + /** + * Sets [Builder.employer] to an arbitrary JSON value. + * + * You should usually call [Builder.employer] with a well-typed + * [Boolean] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun employer(employer: JsonField) = apply { this.employer = employer } fun name(name: Boolean) = name(JsonField.of(name)) + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [Boolean] + * 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 type(type: Boolean) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = @@ -5427,80 +7844,199 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun companyDebit(): Optional = Optional.ofNullable(companyDebit.getNullable("company_debit")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun debitDate(): Optional = Optional.ofNullable(debitDate.getNullable("debit_date")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun employeeTaxes(): Optional = Optional.ofNullable(employeeTaxes.getNullable("employee_taxes")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun employerTaxes(): Optional = Optional.ofNullable(employerTaxes.getNullable("employer_taxes")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun grossPay(): Optional = Optional.ofNullable(grossPay.getNullable("gross_pay")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun individualIds(): Optional = Optional.ofNullable(individualIds.getNullable("individual_ids")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun netPay(): Optional = Optional.ofNullable(netPay.getNullable("net_pay")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun payDate(): Optional = Optional.ofNullable(payDate.getNullable("pay_date")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun payFrequencies(): Optional = Optional.ofNullable(payFrequencies.getNullable("pay_frequencies")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun payGroupIds(): Optional = Optional.ofNullable(payGroupIds.getNullable("pay_group_ids")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun payPeriod(): Optional = Optional.ofNullable(payPeriod.getNullable("pay_period")) + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [companyDebit]. + * + * Unlike [companyDebit], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("company_debit") @ExcludeMissing fun _companyDebit(): JsonField = companyDebit + /** + * Returns the raw JSON value of [debitDate]. + * + * Unlike [debitDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("debit_date") @ExcludeMissing fun _debitDate(): JsonField = debitDate + /** + * Returns the raw JSON value of [employeeTaxes]. + * + * Unlike [employeeTaxes], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("employee_taxes") @ExcludeMissing fun _employeeTaxes(): JsonField = employeeTaxes + /** + * Returns the raw JSON value of [employerTaxes]. + * + * Unlike [employerTaxes], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("employer_taxes") @ExcludeMissing fun _employerTaxes(): JsonField = employerTaxes + /** + * Returns the raw JSON value of [grossPay]. + * + * Unlike [grossPay], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("gross_pay") @ExcludeMissing fun _grossPay(): JsonField = grossPay + /** + * Returns the raw JSON value of [individualIds]. + * + * Unlike [individualIds], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("individual_ids") @ExcludeMissing fun _individualIds(): JsonField = individualIds + /** + * Returns the raw JSON value of [netPay]. + * + * Unlike [netPay], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("net_pay") @ExcludeMissing fun _netPay(): JsonField = netPay + /** + * Returns the raw JSON value of [payDate]. + * + * Unlike [payDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("pay_date") @ExcludeMissing fun _payDate(): JsonField = payDate + /** + * Returns the raw JSON value of [payFrequencies]. + * + * Unlike [payFrequencies], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("pay_frequencies") @ExcludeMissing fun _payFrequencies(): JsonField = payFrequencies + /** + * Returns the raw JSON value of [payGroupIds]. + * + * Unlike [payGroupIds], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("pay_group_ids") @ExcludeMissing fun _payGroupIds(): JsonField = payGroupIds + /** + * Returns the raw JSON value of [payPeriod]. + * + * Unlike [payPeriod], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("pay_period") @ExcludeMissing fun _payPeriod(): JsonField = payPeriod @@ -5579,17 +8115,38 @@ private constructor( fun id(id: Boolean) = id(JsonField.of(id)) + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun companyDebit(companyDebit: Boolean) = companyDebit(JsonField.of(companyDebit)) + /** + * Sets [Builder.companyDebit] to an arbitrary JSON value. + * + * You should usually call [Builder.companyDebit] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun companyDebit(companyDebit: JsonField) = apply { this.companyDebit = companyDebit } fun debitDate(debitDate: Boolean) = debitDate(JsonField.of(debitDate)) + /** + * Sets [Builder.debitDate] to an arbitrary JSON value. + * + * You should usually call [Builder.debitDate] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun debitDate(debitDate: JsonField) = apply { this.debitDate = debitDate } @@ -5597,6 +8154,13 @@ private constructor( fun employeeTaxes(employeeTaxes: Boolean) = employeeTaxes(JsonField.of(employeeTaxes)) + /** + * Sets [Builder.employeeTaxes] to an arbitrary JSON value. + * + * You should usually call [Builder.employeeTaxes] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun employeeTaxes(employeeTaxes: JsonField) = apply { this.employeeTaxes = employeeTaxes } @@ -5604,44 +8168,100 @@ private constructor( fun employerTaxes(employerTaxes: Boolean) = employerTaxes(JsonField.of(employerTaxes)) + /** + * Sets [Builder.employerTaxes] to an arbitrary JSON value. + * + * You should usually call [Builder.employerTaxes] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun employerTaxes(employerTaxes: JsonField) = apply { this.employerTaxes = employerTaxes } fun grossPay(grossPay: Boolean) = grossPay(JsonField.of(grossPay)) + /** + * Sets [Builder.grossPay] to an arbitrary JSON value. + * + * You should usually call [Builder.grossPay] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun grossPay(grossPay: JsonField) = apply { this.grossPay = grossPay } fun individualIds(individualIds: Boolean) = individualIds(JsonField.of(individualIds)) + /** + * Sets [Builder.individualIds] to an arbitrary JSON value. + * + * You should usually call [Builder.individualIds] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun individualIds(individualIds: JsonField) = apply { this.individualIds = individualIds } fun netPay(netPay: Boolean) = netPay(JsonField.of(netPay)) + /** + * Sets [Builder.netPay] to an arbitrary JSON value. + * + * You should usually call [Builder.netPay] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun netPay(netPay: JsonField) = apply { this.netPay = netPay } fun payDate(payDate: Boolean) = payDate(JsonField.of(payDate)) + /** + * Sets [Builder.payDate] to an arbitrary JSON value. + * + * You should usually call [Builder.payDate] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun payDate(payDate: JsonField) = apply { this.payDate = payDate } fun payFrequencies(payFrequencies: Boolean) = payFrequencies(JsonField.of(payFrequencies)) + /** + * Sets [Builder.payFrequencies] to an arbitrary JSON value. + * + * You should usually call [Builder.payFrequencies] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun payFrequencies(payFrequencies: JsonField) = apply { this.payFrequencies = payFrequencies } fun payGroupIds(payGroupIds: Boolean) = payGroupIds(JsonField.of(payGroupIds)) + /** + * Sets [Builder.payGroupIds] to an arbitrary JSON value. + * + * You should usually call [Builder.payGroupIds] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun payGroupIds(payGroupIds: JsonField) = apply { this.payGroupIds = payGroupIds } fun payPeriod(payPeriod: PayPeriod) = payPeriod(JsonField.of(payPeriod)) + /** + * Sets [Builder.payPeriod] to an arbitrary JSON value. + * + * You should usually call [Builder.payPeriod] with a well-typed [PayPeriod] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun payPeriod(payPeriod: JsonField) = apply { this.payPeriod = payPeriod } @@ -5700,16 +8320,36 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) + /** + * Returns the raw JSON value of [endDate]. + * + * Unlike [endDate], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("end_date") @ExcludeMissing fun _endDate(): JsonField = endDate + /** + * Returns the raw JSON value of [startDate]. + * + * Unlike [startDate], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("start_date") @ExcludeMissing fun _startDate(): JsonField = startDate @@ -5757,10 +8397,24 @@ private constructor( fun endDate(endDate: Boolean) = endDate(JsonField.of(endDate)) + /** + * Sets [Builder.endDate] to an arbitrary JSON value. + * + * You should usually call [Builder.endDate] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } fun startDate(startDate: Boolean) = startDate(JsonField.of(startDate)) + /** + * Sets [Builder.startDate] to an arbitrary JSON value. + * + * You should usually call [Builder.startDate] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun startDate(startDate: JsonField) = apply { this.startDate = startDate } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt index 292cc81d..3c4f2f35 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt @@ -17,6 +17,7 @@ import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -36,18 +37,27 @@ private constructor( /** * The HTTP method for the forwarded request. Valid values include: `GET` , `POST` , `PUT` , * `DELETE` , and `PATCH`. + * + * @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 method(): String = body.method() /** * The URL route path for the forwarded request. This value must begin with a forward-slash ( / * ) and may only contain alphanumeric characters, hyphens, and underscores. + * + * @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 route(): String = body.route() /** * The body for the forwarded request. This value must be specified as either a string or a * valid JSON object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun data(): Optional = body.data() @@ -65,20 +75,23 @@ private constructor( fun _params(): JsonValue = body._params() /** - * The HTTP method for the forwarded request. Valid values include: `GET` , `POST` , `PUT` , - * `DELETE` , and `PATCH`. + * Returns the raw JSON value of [method]. + * + * Unlike [method], this method doesn't throw if the JSON field has an unexpected type. */ fun _method(): JsonField = body._method() /** - * The URL route path for the forwarded request. This value must begin with a forward-slash ( / - * ) and may only contain alphanumeric characters, hyphens, and underscores. + * Returns the raw JSON value of [route]. + * + * Unlike [route], this method doesn't throw if the JSON field has an unexpected type. */ fun _route(): JsonField = body._route() /** - * The body for the forwarded request. This value must be specified as either a string or a - * valid JSON object. + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. */ fun _data(): JsonField = body._data() @@ -117,18 +130,27 @@ private constructor( /** * The HTTP method for the forwarded request. Valid values include: `GET` , `POST` , `PUT` , * `DELETE` , and `PATCH`. + * + * @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 method(): String = method.getRequired("method") /** * The URL route path for the forwarded request. This value must begin with a forward-slash * ( / ) and may only contain alphanumeric characters, hyphens, and underscores. + * + * @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 route(): String = route.getRequired("route") /** * The body for the forwarded request. This value must be specified as either a string or a * valid JSON object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) @@ -146,20 +168,23 @@ private constructor( @JsonProperty("params") @ExcludeMissing fun _params(): JsonValue = params /** - * The HTTP method for the forwarded request. Valid values include: `GET` , `POST` , `PUT` , - * `DELETE` , and `PATCH`. + * Returns the raw JSON value of [method]. + * + * Unlike [method], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("method") @ExcludeMissing fun _method(): JsonField = method /** - * The URL route path for the forwarded request. This value must begin with a forward-slash - * ( / ) and may only contain alphanumeric characters, hyphens, and underscores. + * Returns the raw JSON value of [route]. + * + * Unlike [route], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("route") @ExcludeMissing fun _route(): JsonField = route /** - * The body for the forwarded request. This value must be specified as either a string or a - * valid JSON object. + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data @@ -223,8 +248,11 @@ private constructor( fun method(method: String) = method(JsonField.of(method)) /** - * The HTTP method for the forwarded request. Valid values include: `GET` , `POST` , - * `PUT` , `DELETE` , and `PATCH`. + * Sets [Builder.method] to an arbitrary JSON value. + * + * You should usually call [Builder.method] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun method(method: JsonField) = apply { this.method = method } @@ -236,9 +264,11 @@ private constructor( fun route(route: String) = route(JsonField.of(route)) /** - * The URL route path for the forwarded request. This value must begin with a - * forward-slash ( / ) and may only contain alphanumeric characters, hyphens, and - * underscores. + * Sets [Builder.route] to an arbitrary JSON value. + * + * You should usually call [Builder.route] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun route(route: JsonField) = apply { this.route = route } @@ -248,15 +278,15 @@ private constructor( */ fun data(data: String?) = data(JsonField.ofNullable(data)) - /** - * The body for the forwarded request. This value must be specified as either a string - * or a valid JSON object. - */ + /** Alias for calling [Builder.data] with `data.orElse(null)`. */ fun data(data: Optional) = data(data.getOrNull()) /** - * The body for the forwarded request. This value must be specified as either a string - * or a valid JSON object. + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun data(data: JsonField) = apply { this.data = data } @@ -360,8 +390,10 @@ private constructor( fun method(method: String) = apply { body.method(method) } /** - * The HTTP method for the forwarded request. Valid values include: `GET` , `POST` , `PUT` , - * `DELETE` , and `PATCH`. + * Sets [Builder.method] to an arbitrary JSON value. + * + * You should usually call [Builder.method] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun method(method: JsonField) = apply { body.method(method) } @@ -372,8 +404,10 @@ private constructor( fun route(route: String) = apply { body.route(route) } /** - * The URL route path for the forwarded request. This value must begin with a forward-slash - * ( / ) and may only contain alphanumeric characters, hyphens, and underscores. + * Sets [Builder.route] to an arbitrary JSON value. + * + * You should usually call [Builder.route] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun route(route: JsonField) = apply { body.route(route) } @@ -383,15 +417,14 @@ private constructor( */ fun data(data: String?) = apply { body.data(data) } - /** - * The body for the forwarded request. This value must be specified as either a string or a - * valid JSON object. - */ + /** Alias for calling [Builder.data] with `data.orElse(null)`. */ fun data(data: Optional) = data(data.getOrNull()) /** - * The body for the forwarded request. This value must be specified as either a string or a - * valid JSON object. + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun data(data: JsonField) = apply { body.data(data) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt index 23ab8bec..26801293 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt @@ -14,6 +14,7 @@ import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -37,6 +38,9 @@ private constructor( * A string representation of the HTTP response body of the forwarded request’s response * received from the underlying integration’s API. This field may be null in the case where the * upstream system’s response is empty. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) @@ -48,30 +52,39 @@ private constructor( /** * An object containing details of your original forwarded request, for your ease of reference. + * + * @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 request(): Request = request.getRequired("request") /** * The HTTP status code of the forwarded request’s response, exactly received from the * underlying integration’s API. This value will be returned as an integer. + * + * @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 statusCode(): Long = statusCode.getRequired("statusCode") /** - * A string representation of the HTTP response body of the forwarded request’s response - * received from the underlying integration’s API. This field may be null in the case where the - * upstream system’s response is empty. + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data /** - * An object containing details of your original forwarded request, for your ease of reference. + * Returns the raw JSON value of [request]. + * + * Unlike [request], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("request") @ExcludeMissing fun _request(): JsonField = request /** - * The HTTP status code of the forwarded request’s response, exactly received from the - * underlying integration’s API. This value will be returned as an integer. + * Returns the raw JSON value of [statusCode]. + * + * Unlike [statusCode], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("statusCode") @ExcludeMissing fun _statusCode(): JsonField = statusCode @@ -138,17 +151,14 @@ private constructor( */ fun data(data: String?) = data(JsonField.ofNullable(data)) - /** - * A string representation of the HTTP response body of the forwarded request’s response - * received from the underlying integration’s API. This field may be null in the case where - * the upstream system’s response is empty. - */ + /** Alias for calling [Builder.data] with `data.orElse(null)`. */ fun data(data: Optional) = data(data.getOrNull()) /** - * A string representation of the HTTP response body of the forwarded request’s response - * received from the underlying integration’s API. This field may be null in the case where - * the upstream system’s response is empty. + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun data(data: JsonField) = apply { this.data = data } @@ -165,8 +175,10 @@ private constructor( fun request(request: Request) = request(JsonField.of(request)) /** - * An object containing details of your original forwarded request, for your ease of - * reference. + * Sets [Builder.request] to an arbitrary JSON value. + * + * You should usually call [Builder.request] with a well-typed [Request] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun request(request: JsonField) = apply { this.request = request } @@ -177,8 +189,10 @@ private constructor( fun statusCode(statusCode: Long) = statusCode(JsonField.of(statusCode)) /** - * The HTTP status code of the forwarded request’s response, exactly received from the - * underlying integration’s API. This value will be returned as an integer. + * Sets [Builder.statusCode] to an arbitrary JSON value. + * + * You should usually call [Builder.statusCode] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun statusCode(statusCode: JsonField) = apply { this.statusCode = statusCode } @@ -237,6 +251,9 @@ private constructor( * The body that was specified for the forwarded request. If a value was not specified in * the original request, this value will be returned as null ; otherwise, this value will * always be returned as a string. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) @@ -249,6 +266,9 @@ private constructor( /** * The HTTP method that was specified for the forwarded request. Valid values include: `GET` * , `POST` , `PUT` , `DELETE` , and `PATCH`. + * + * @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 method(): String = method.getRequired("method") @@ -258,23 +278,33 @@ private constructor( */ @JsonProperty("params") @ExcludeMissing fun _params(): JsonValue = params - /** The URL route path that was specified for the forwarded request. */ + /** + * The URL route path that was specified for the forwarded request. + * + * @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 route(): String = route.getRequired("route") /** - * The body that was specified for the forwarded request. If a value was not specified in - * the original request, this value will be returned as null ; otherwise, this value will - * always be returned as a string. + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data /** - * The HTTP method that was specified for the forwarded request. Valid values include: `GET` - * , `POST` , `PUT` , `DELETE` , and `PATCH`. + * Returns the raw JSON value of [method]. + * + * Unlike [method], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("method") @ExcludeMissing fun _method(): JsonField = method - /** The URL route path that was specified for the forwarded request. */ + /** + * Returns the raw JSON value of [route]. + * + * Unlike [route], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("route") @ExcludeMissing fun _route(): JsonField = route @JsonAnyGetter @@ -340,17 +370,15 @@ private constructor( */ fun data(data: String?) = data(JsonField.ofNullable(data)) - /** - * The body that was specified for the forwarded request. If a value was not specified - * in the original request, this value will be returned as null ; otherwise, this value - * will always be returned as a string. - */ + /** Alias for calling [Builder.data] with `data.orElse(null)`. */ fun data(data: Optional) = data(data.getOrNull()) /** - * The body that was specified for the forwarded request. If a value was not specified - * in the original request, this value will be returned as null ; otherwise, this value - * will always be returned as a string. + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun data(data: JsonField) = apply { this.data = data } @@ -367,8 +395,11 @@ private constructor( fun method(method: String) = method(JsonField.of(method)) /** - * The HTTP method that was specified for the forwarded request. Valid values include: - * `GET` , `POST` , `PUT` , `DELETE` , and `PATCH`. + * Sets [Builder.method] to an arbitrary JSON value. + * + * You should usually call [Builder.method] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun method(method: JsonField) = apply { this.method = method } @@ -381,7 +412,13 @@ private constructor( /** The URL route path that was specified for the forwarded request. */ fun route(route: String) = route(JsonField.of(route)) - /** The URL route path that was specified for the forwarded request. */ + /** + * Sets [Builder.route] to an arbitrary JSON value. + * + * You should usually call [Builder.route] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun route(route: JsonField) = apply { this.route = route } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt index 2d83b36e..b497f3ce 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt @@ -32,50 +32,123 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** + * An array of bank account objects associated with the payroll/HRIS system. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun accounts(): Optional> = body.accounts() - /** The array of company departments. */ + /** + * The array of company departments. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun departments(): Optional> = body.departments() - /** The employer identification number. */ + /** + * The employer identification number. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun ein(): Optional = body.ein() - /** The entity type object. */ + /** + * The entity type object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun entity(): Optional = body.entity() - /** The legal name of the company. */ + /** + * The legal name of the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun legalName(): Optional = body.legalName() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun locations(): Optional> = body.locations() - /** The email of the main administrator on the account. */ + /** + * The email of the main administrator on the account. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun primaryEmail(): Optional = body.primaryEmail() - /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + /** + * The phone number of the main administrator on the account. Format: `XXXXXXXXXX` + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun primaryPhoneNumber(): Optional = body.primaryPhoneNumber() - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** + * Returns the raw JSON value of [accounts]. + * + * Unlike [accounts], this method doesn't throw if the JSON field has an unexpected type. + */ fun _accounts(): JsonField> = body._accounts() - /** The array of company departments. */ + /** + * Returns the raw JSON value of [departments]. + * + * Unlike [departments], this method doesn't throw if the JSON field has an unexpected type. + */ fun _departments(): JsonField> = body._departments() - /** The employer identification number. */ + /** + * Returns the raw JSON value of [ein]. + * + * Unlike [ein], this method doesn't throw if the JSON field has an unexpected type. + */ fun _ein(): JsonField = body._ein() - /** The entity type object. */ + /** + * Returns the raw JSON value of [entity]. + * + * Unlike [entity], this method doesn't throw if the JSON field has an unexpected type. + */ fun _entity(): JsonField = body._entity() - /** The legal name of the company. */ + /** + * Returns the raw JSON value of [legalName]. + * + * Unlike [legalName], this method doesn't throw if the JSON field has an unexpected type. + */ fun _legalName(): JsonField = body._legalName() + /** + * Returns the raw JSON value of [locations]. + * + * Unlike [locations], this method doesn't throw if the JSON field has an unexpected type. + */ fun _locations(): JsonField> = body._locations() - /** The email of the main administrator on the account. */ + /** + * Returns the raw JSON value of [primaryEmail]. + * + * Unlike [primaryEmail], this method doesn't throw if the JSON field has an unexpected type. + */ fun _primaryEmail(): JsonField = body._primaryEmail() - /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + /** + * Returns the raw JSON value of [primaryPhoneNumber]. + * + * Unlike [primaryPhoneNumber], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _primaryPhoneNumber(): JsonField = body._primaryPhoneNumber() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -120,63 +193,137 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** + * An array of bank account objects associated with the payroll/HRIS system. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun accounts(): Optional> = Optional.ofNullable(accounts.getNullable("accounts")) - /** The array of company departments. */ + /** + * The array of company departments. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun departments(): Optional> = Optional.ofNullable(departments.getNullable("departments")) - /** The employer identification number. */ + /** + * The employer identification number. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun ein(): Optional = Optional.ofNullable(ein.getNullable("ein")) - /** The entity type object. */ + /** + * The entity type object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun entity(): Optional = Optional.ofNullable(entity.getNullable("entity")) - /** The legal name of the company. */ + /** + * The legal name of the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun legalName(): Optional = Optional.ofNullable(legalName.getNullable("legal_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun locations(): Optional> = Optional.ofNullable(locations.getNullable("locations")) - /** The email of the main administrator on the account. */ + /** + * The email of the main administrator on the account. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun primaryEmail(): Optional = Optional.ofNullable(primaryEmail.getNullable("primary_email")) - /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + /** + * The phone number of the main administrator on the account. Format: `XXXXXXXXXX` + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun primaryPhoneNumber(): Optional = Optional.ofNullable(primaryPhoneNumber.getNullable("primary_phone_number")) - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** + * Returns the raw JSON value of [accounts]. + * + * Unlike [accounts], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("accounts") @ExcludeMissing fun _accounts(): JsonField> = accounts - /** The array of company departments. */ + /** + * Returns the raw JSON value of [departments]. + * + * Unlike [departments], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("departments") @ExcludeMissing fun _departments(): JsonField> = departments - /** The employer identification number. */ + /** + * Returns the raw JSON value of [ein]. + * + * Unlike [ein], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("ein") @ExcludeMissing fun _ein(): JsonField = ein - /** The entity type object. */ + /** + * Returns the raw JSON value of [entity]. + * + * Unlike [entity], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("entity") @ExcludeMissing fun _entity(): JsonField = entity - /** The legal name of the company. */ + /** + * Returns the raw JSON value of [legalName]. + * + * Unlike [legalName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("legal_name") @ExcludeMissing fun _legalName(): JsonField = legalName + /** + * Returns the raw JSON value of [locations]. + * + * Unlike [locations], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("locations") @ExcludeMissing fun _locations(): JsonField> = locations - /** The email of the main administrator on the account. */ + /** + * Returns the raw JSON value of [primaryEmail]. + * + * Unlike [primaryEmail], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("primary_email") @ExcludeMissing fun _primaryEmail(): JsonField = primaryEmail - /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + /** + * Returns the raw JSON value of [primaryPhoneNumber]. + * + * Unlike [primaryPhoneNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("primary_phone_number") @ExcludeMissing fun _primaryPhoneNumber(): JsonField = primaryPhoneNumber @@ -254,15 +401,25 @@ private constructor( /** An array of bank account objects associated with the payroll/HRIS system. */ fun accounts(accounts: List?) = accounts(JsonField.ofNullable(accounts)) - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** Alias for calling [Builder.accounts] with `accounts.orElse(null)`. */ fun accounts(accounts: Optional>) = accounts(accounts.getOrNull()) - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** + * Sets [Builder.accounts] to an arbitrary JSON value. + * + * You should usually call [Builder.accounts] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun accounts(accounts: JsonField>) = apply { this.accounts = accounts.map { it.toMutableList() } } - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** + * Adds a single [Account] to [accounts]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addAccount(account: Account) = apply { accounts = (accounts ?: JsonField.of(mutableListOf())).also { @@ -274,16 +431,26 @@ private constructor( fun departments(departments: List?) = departments(JsonField.ofNullable(departments)) - /** The array of company departments. */ + /** Alias for calling [Builder.departments] with `departments.orElse(null)`. */ fun departments(departments: Optional>) = departments(departments.getOrNull()) - /** The array of company departments. */ + /** + * Sets [Builder.departments] to an arbitrary JSON value. + * + * You should usually call [Builder.departments] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun departments(departments: JsonField>) = apply { this.departments = departments.map { it.toMutableList() } } - /** The array of company departments. */ + /** + * Adds a single [Department] to [departments]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addDepartment(department: Department) = apply { departments = (departments ?: JsonField.of(mutableListOf())).also { @@ -294,38 +461,69 @@ private constructor( /** The employer identification number. */ fun ein(ein: String?) = ein(JsonField.ofNullable(ein)) - /** The employer identification number. */ + /** Alias for calling [Builder.ein] with `ein.orElse(null)`. */ fun ein(ein: Optional) = ein(ein.getOrNull()) - /** The employer identification number. */ + /** + * Sets [Builder.ein] to an arbitrary JSON value. + * + * You should usually call [Builder.ein] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun ein(ein: JsonField) = apply { this.ein = ein } /** The entity type object. */ fun entity(entity: Entity?) = entity(JsonField.ofNullable(entity)) - /** The entity type object. */ + /** Alias for calling [Builder.entity] with `entity.orElse(null)`. */ fun entity(entity: Optional) = entity(entity.getOrNull()) - /** The entity type object. */ + /** + * Sets [Builder.entity] to an arbitrary JSON value. + * + * You should usually call [Builder.entity] with a well-typed [Entity] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun entity(entity: JsonField) = apply { this.entity = entity } /** The legal name of the company. */ fun legalName(legalName: String?) = legalName(JsonField.ofNullable(legalName)) - /** The legal name of the company. */ + /** Alias for calling [Builder.legalName] with `legalName.orElse(null)`. */ fun legalName(legalName: Optional) = legalName(legalName.getOrNull()) - /** The legal name of the company. */ + /** + * Sets [Builder.legalName] to an arbitrary JSON value. + * + * You should usually call [Builder.legalName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun legalName(legalName: JsonField) = apply { this.legalName = legalName } fun locations(locations: List?) = locations(JsonField.ofNullable(locations)) + /** Alias for calling [Builder.locations] with `locations.orElse(null)`. */ fun locations(locations: Optional>) = locations(locations.getOrNull()) + /** + * Sets [Builder.locations] to an arbitrary JSON value. + * + * You should usually call [Builder.locations] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun locations(locations: JsonField>) = apply { this.locations = locations.map { it.toMutableList() } } + /** + * Adds a single [Location] to [locations]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addLocation(location: Location) = apply { locations = (locations ?: JsonField.of(mutableListOf())).also { @@ -337,11 +535,17 @@ private constructor( fun primaryEmail(primaryEmail: String?) = primaryEmail(JsonField.ofNullable(primaryEmail)) - /** The email of the main administrator on the account. */ + /** Alias for calling [Builder.primaryEmail] with `primaryEmail.orElse(null)`. */ fun primaryEmail(primaryEmail: Optional) = primaryEmail(primaryEmail.getOrNull()) - /** The email of the main administrator on the account. */ + /** + * Sets [Builder.primaryEmail] to an arbitrary JSON value. + * + * You should usually call [Builder.primaryEmail] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun primaryEmail(primaryEmail: JsonField) = apply { this.primaryEmail = primaryEmail } @@ -350,11 +554,20 @@ private constructor( fun primaryPhoneNumber(primaryPhoneNumber: String?) = primaryPhoneNumber(JsonField.ofNullable(primaryPhoneNumber)) - /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + /** + * Alias for calling [Builder.primaryPhoneNumber] with + * `primaryPhoneNumber.orElse(null)`. + */ fun primaryPhoneNumber(primaryPhoneNumber: Optional) = primaryPhoneNumber(primaryPhoneNumber.getOrNull()) - /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + /** + * Sets [Builder.primaryPhoneNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.primaryPhoneNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun primaryPhoneNumber(primaryPhoneNumber: JsonField) = apply { this.primaryPhoneNumber = primaryPhoneNumber } @@ -450,72 +663,127 @@ private constructor( /** An array of bank account objects associated with the payroll/HRIS system. */ fun accounts(accounts: List?) = apply { body.accounts(accounts) } - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** Alias for calling [Builder.accounts] with `accounts.orElse(null)`. */ fun accounts(accounts: Optional>) = accounts(accounts.getOrNull()) - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** + * Sets [Builder.accounts] to an arbitrary JSON value. + * + * You should usually call [Builder.accounts] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun accounts(accounts: JsonField>) = apply { body.accounts(accounts) } - /** An array of bank account objects associated with the payroll/HRIS system. */ + /** + * Adds a single [Account] to [accounts]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addAccount(account: Account) = apply { body.addAccount(account) } /** The array of company departments. */ fun departments(departments: List?) = apply { body.departments(departments) } - /** The array of company departments. */ + /** Alias for calling [Builder.departments] with `departments.orElse(null)`. */ fun departments(departments: Optional>) = departments(departments.getOrNull()) - /** The array of company departments. */ + /** + * Sets [Builder.departments] to an arbitrary JSON value. + * + * You should usually call [Builder.departments] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun departments(departments: JsonField>) = apply { body.departments(departments) } - /** The array of company departments. */ + /** + * Adds a single [Department] to [departments]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addDepartment(department: Department) = apply { body.addDepartment(department) } /** The employer identification number. */ fun ein(ein: String?) = apply { body.ein(ein) } - /** The employer identification number. */ + /** Alias for calling [Builder.ein] with `ein.orElse(null)`. */ fun ein(ein: Optional) = ein(ein.getOrNull()) - /** The employer identification number. */ + /** + * Sets [Builder.ein] to an arbitrary JSON value. + * + * You should usually call [Builder.ein] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun ein(ein: JsonField) = apply { body.ein(ein) } /** The entity type object. */ fun entity(entity: Entity?) = apply { body.entity(entity) } - /** The entity type object. */ + /** Alias for calling [Builder.entity] with `entity.orElse(null)`. */ fun entity(entity: Optional) = entity(entity.getOrNull()) - /** The entity type object. */ + /** + * Sets [Builder.entity] to an arbitrary JSON value. + * + * You should usually call [Builder.entity] with a well-typed [Entity] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun entity(entity: JsonField) = apply { body.entity(entity) } /** The legal name of the company. */ fun legalName(legalName: String?) = apply { body.legalName(legalName) } - /** The legal name of the company. */ + /** Alias for calling [Builder.legalName] with `legalName.orElse(null)`. */ fun legalName(legalName: Optional) = legalName(legalName.getOrNull()) - /** The legal name of the company. */ + /** + * Sets [Builder.legalName] to an arbitrary JSON value. + * + * You should usually call [Builder.legalName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun legalName(legalName: JsonField) = apply { body.legalName(legalName) } fun locations(locations: List?) = apply { body.locations(locations) } + /** Alias for calling [Builder.locations] with `locations.orElse(null)`. */ fun locations(locations: Optional>) = locations(locations.getOrNull()) + /** + * Sets [Builder.locations] to an arbitrary JSON value. + * + * You should usually call [Builder.locations] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun locations(locations: JsonField>) = apply { body.locations(locations) } + /** + * Adds a single [Location] to [locations]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addLocation(location: Location) = apply { body.addLocation(location) } /** The email of the main administrator on the account. */ fun primaryEmail(primaryEmail: String?) = apply { body.primaryEmail(primaryEmail) } - /** The email of the main administrator on the account. */ + /** Alias for calling [Builder.primaryEmail] with `primaryEmail.orElse(null)`. */ fun primaryEmail(primaryEmail: Optional) = primaryEmail(primaryEmail.getOrNull()) - /** The email of the main administrator on the account. */ + /** + * Sets [Builder.primaryEmail] to an arbitrary JSON value. + * + * You should usually call [Builder.primaryEmail] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun primaryEmail(primaryEmail: JsonField) = apply { body.primaryEmail(primaryEmail) } @@ -525,11 +793,19 @@ private constructor( body.primaryPhoneNumber(primaryPhoneNumber) } - /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + /** + * Alias for calling [Builder.primaryPhoneNumber] with `primaryPhoneNumber.orElse(null)`. + */ fun primaryPhoneNumber(primaryPhoneNumber: Optional) = primaryPhoneNumber(primaryPhoneNumber.getOrNull()) - /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + /** + * Sets [Builder.primaryPhoneNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.primaryPhoneNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun primaryPhoneNumber(primaryPhoneNumber: JsonField) = apply { body.primaryPhoneNumber(primaryPhoneNumber) } @@ -682,50 +958,94 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The name of the bank associated in the payroll/HRIS system. */ + /** + * The name of the bank associated in the payroll/HRIS system. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun accountName(): Optional = Optional.ofNullable(accountName.getNullable("account_name")) - /** 10-12 digit number to specify the bank account */ + /** + * 10-12 digit number to specify the bank account + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun accountNumber(): Optional = Optional.ofNullable(accountNumber.getNullable("account_number")) - /** The type of bank account. */ + /** + * The type of bank account. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun accountType(): Optional = Optional.ofNullable(accountType.getNullable("account_type")) - /** Name of the banking institution. */ + /** + * Name of the banking institution. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun institutionName(): Optional = Optional.ofNullable(institutionName.getNullable("institution_name")) /** * A nine-digit code that's based on the U.S. Bank location where your account was opened. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun routingNumber(): Optional = Optional.ofNullable(routingNumber.getNullable("routing_number")) - /** The name of the bank associated in the payroll/HRIS system. */ + /** + * Returns the raw JSON value of [accountName]. + * + * Unlike [accountName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("account_name") @ExcludeMissing fun _accountName(): JsonField = accountName - /** 10-12 digit number to specify the bank account */ + /** + * Returns the raw JSON value of [accountNumber]. + * + * Unlike [accountNumber], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("account_number") @ExcludeMissing fun _accountNumber(): JsonField = accountNumber - /** The type of bank account. */ + /** + * Returns the raw JSON value of [accountType]. + * + * Unlike [accountType], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("account_type") @ExcludeMissing fun _accountType(): JsonField = accountType - /** Name of the banking institution. */ + /** + * Returns the raw JSON value of [institutionName]. + * + * Unlike [institutionName], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("institution_name") @ExcludeMissing fun _institutionName(): JsonField = institutionName /** - * A nine-digit code that's based on the U.S. Bank location where your account was opened. + * Returns the raw JSON value of [routingNumber]. + * + * Unlike [routingNumber], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("routing_number") @ExcludeMissing @@ -781,10 +1101,16 @@ private constructor( /** The name of the bank associated in the payroll/HRIS system. */ fun accountName(accountName: String?) = accountName(JsonField.ofNullable(accountName)) - /** The name of the bank associated in the payroll/HRIS system. */ + /** Alias for calling [Builder.accountName] with `accountName.orElse(null)`. */ fun accountName(accountName: Optional) = accountName(accountName.getOrNull()) - /** The name of the bank associated in the payroll/HRIS system. */ + /** + * Sets [Builder.accountName] to an arbitrary JSON value. + * + * You should usually call [Builder.accountName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun accountName(accountName: JsonField) = apply { this.accountName = accountName } @@ -793,11 +1119,17 @@ private constructor( fun accountNumber(accountNumber: String?) = accountNumber(JsonField.ofNullable(accountNumber)) - /** 10-12 digit number to specify the bank account */ + /** Alias for calling [Builder.accountNumber] with `accountNumber.orElse(null)`. */ fun accountNumber(accountNumber: Optional) = accountNumber(accountNumber.getOrNull()) - /** 10-12 digit number to specify the bank account */ + /** + * Sets [Builder.accountNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.accountNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun accountNumber(accountNumber: JsonField) = apply { this.accountNumber = accountNumber } @@ -806,11 +1138,17 @@ private constructor( fun accountType(accountType: AccountType?) = accountType(JsonField.ofNullable(accountType)) - /** The type of bank account. */ + /** Alias for calling [Builder.accountType] with `accountType.orElse(null)`. */ fun accountType(accountType: Optional) = accountType(accountType.getOrNull()) - /** The type of bank account. */ + /** + * Sets [Builder.accountType] to an arbitrary JSON value. + * + * You should usually call [Builder.accountType] with a well-typed [AccountType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun accountType(accountType: JsonField) = apply { this.accountType = accountType } @@ -819,11 +1157,17 @@ private constructor( fun institutionName(institutionName: String?) = institutionName(JsonField.ofNullable(institutionName)) - /** Name of the banking institution. */ + /** Alias for calling [Builder.institutionName] with `institutionName.orElse(null)`. */ fun institutionName(institutionName: Optional) = institutionName(institutionName.getOrNull()) - /** Name of the banking institution. */ + /** + * Sets [Builder.institutionName] to an arbitrary JSON value. + * + * You should usually call [Builder.institutionName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun institutionName(institutionName: JsonField) = apply { this.institutionName = institutionName } @@ -835,16 +1179,16 @@ private constructor( fun routingNumber(routingNumber: String?) = routingNumber(JsonField.ofNullable(routingNumber)) - /** - * A nine-digit code that's based on the U.S. Bank location where your account was - * opened. - */ + /** Alias for calling [Builder.routingNumber] with `routingNumber.orElse(null)`. */ fun routingNumber(routingNumber: Optional) = routingNumber(routingNumber.getOrNull()) /** - * A nine-digit code that's based on the U.S. Bank location where your account was - * opened. + * Sets [Builder.routingNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.routingNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun routingNumber(routingNumber: JsonField) = apply { this.routingNumber = routingNumber @@ -1017,16 +1361,34 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The department name. */ + /** + * The department name. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The parent department, if present. */ + /** + * The parent department, if present. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun parent(): Optional = Optional.ofNullable(parent.getNullable("parent")) - /** The department name. */ + /** + * 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 - /** The parent department, if present. */ + /** + * Returns the raw JSON value of [parent]. + * + * Unlike [parent], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("parent") @ExcludeMissing fun _parent(): JsonField = parent @JsonAnyGetter @@ -1070,19 +1432,31 @@ private constructor( /** The department name. */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The department name. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The department name. */ + /** + * 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 } /** The parent department, if present. */ fun parent(parent: Parent?) = parent(JsonField.ofNullable(parent)) - /** The parent department, if present. */ + /** Alias for calling [Builder.parent] with `parent.orElse(null)`. */ fun parent(parent: Optional) = parent(parent.getOrNull()) - /** The parent department, if present. */ + /** + * Sets [Builder.parent] to an arbitrary JSON value. + * + * You should usually call [Builder.parent] with a well-typed [Parent] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun parent(parent: JsonField) = apply { this.parent = parent } fun additionalProperties(additionalProperties: Map) = apply { @@ -1119,10 +1493,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The parent department's name. */ + /** + * The parent department's name. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The parent department's name. */ + /** + * 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 @JsonAnyGetter @@ -1163,10 +1546,16 @@ private constructor( /** The parent department's name. */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The parent department's name. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The parent department's name. */ + /** + * 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 { @@ -1243,16 +1632,34 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The tax payer subtype of the company. */ + /** + * The tax payer subtype of the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) - /** The tax payer type of the company. */ + /** + * The tax payer type of the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** The tax payer subtype of the company. */ + /** + * Returns the raw JSON value of [subtype]. + * + * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype - /** The tax payer type of the company. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1296,19 +1703,31 @@ private constructor( /** The tax payer subtype of the company. */ fun subtype(subtype: Subtype?) = subtype(JsonField.ofNullable(subtype)) - /** The tax payer subtype of the company. */ + /** Alias for calling [Builder.subtype] with `subtype.orElse(null)`. */ fun subtype(subtype: Optional) = subtype(subtype.getOrNull()) - /** The tax payer subtype of the company. */ + /** + * Sets [Builder.subtype] to an arbitrary JSON value. + * + * You should usually call [Builder.subtype] with a well-typed [Subtype] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun subtype(subtype: JsonField) = apply { this.subtype = subtype } /** The tax payer type of the company. */ fun type(type: Type?) = type(JsonField.ofNullable(type)) - /** The tax payer type of the company. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** The tax payer type of the company. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt index e7801891..7faad99c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt @@ -31,29 +31,61 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { + /** + * @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 companyId(): String = body.companyId() - /** The provider associated with the `access_token` */ + /** + * The provider associated with the `access_token` + * + * @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 providerId(): String = body.providerId() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun authenticationType(): Optional = body.authenticationType() /** * Optional, defaults to Organization products (`company`, `directory`, `employment`, * `individual`) + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun products(): Optional> = body.products() + /** + * Returns the raw JSON value of [companyId]. + * + * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _companyId(): JsonField = body._companyId() - /** The provider associated with the `access_token` */ + /** + * Returns the raw JSON value of [providerId]. + * + * Unlike [providerId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _providerId(): JsonField = body._providerId() + /** + * Returns the raw JSON value of [authenticationType]. + * + * Unlike [authenticationType], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _authenticationType(): JsonField = body._authenticationType() /** - * Optional, defaults to Organization products (`company`, `directory`, `employment`, - * `individual`) + * Returns the raw JSON value of [products]. + * + * Unlike [products], this method doesn't throw if the JSON field has an unexpected type. */ fun _products(): JsonField> = body._products() @@ -89,35 +121,67 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @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 companyId(): String = companyId.getRequired("company_id") - /** The provider associated with the `access_token` */ + /** + * The provider associated with the `access_token` + * + * @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 providerId(): String = providerId.getRequired("provider_id") + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun authenticationType(): Optional = Optional.ofNullable(authenticationType.getNullable("authentication_type")) /** * Optional, defaults to Organization products (`company`, `directory`, `employment`, * `individual`) + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun products(): Optional> = Optional.ofNullable(products.getNullable("products")) + /** + * Returns the raw JSON value of [companyId]. + * + * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("company_id") @ExcludeMissing fun _companyId(): JsonField = companyId - /** The provider associated with the `access_token` */ + /** + * Returns the raw JSON value of [providerId]. + * + * Unlike [providerId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("provider_id") @ExcludeMissing fun _providerId(): JsonField = providerId + /** + * Returns the raw JSON value of [authenticationType]. + * + * Unlike [authenticationType], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("authentication_type") @ExcludeMissing fun _authenticationType(): JsonField = authenticationType /** - * Optional, defaults to Organization products (`company`, `directory`, `employment`, - * `individual`) + * Returns the raw JSON value of [products]. + * + * Unlike [products], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("products") @ExcludeMissing @@ -177,17 +241,37 @@ private constructor( fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + /** + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun companyId(companyId: JsonField) = apply { this.companyId = companyId } /** The provider associated with the `access_token` */ fun providerId(providerId: String) = providerId(JsonField.of(providerId)) - /** The provider associated with the `access_token` */ + /** + * Sets [Builder.providerId] to an arbitrary JSON value. + * + * You should usually call [Builder.providerId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun providerId(providerId: JsonField) = apply { this.providerId = providerId } fun authenticationType(authenticationType: AuthenticationType) = authenticationType(JsonField.of(authenticationType)) + /** + * Sets [Builder.authenticationType] to an arbitrary JSON value. + * + * You should usually call [Builder.authenticationType] with a well-typed + * [AuthenticationType] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun authenticationType(authenticationType: JsonField) = apply { this.authenticationType = authenticationType } @@ -199,16 +283,20 @@ private constructor( fun products(products: List) = products(JsonField.of(products)) /** - * Optional, defaults to Organization products (`company`, `directory`, `employment`, - * `individual`) + * Sets [Builder.products] to an arbitrary JSON value. + * + * You should usually call [Builder.products] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun products(products: JsonField>) = apply { this.products = products.map { it.toMutableList() } } /** - * Optional, defaults to Organization products (`company`, `directory`, `employment`, - * `individual`) + * Adds a single [String] to [products]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addProduct(product: String) = apply { products = @@ -301,18 +389,38 @@ private constructor( fun companyId(companyId: String) = apply { body.companyId(companyId) } + /** + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun companyId(companyId: JsonField) = apply { body.companyId(companyId) } /** The provider associated with the `access_token` */ fun providerId(providerId: String) = apply { body.providerId(providerId) } - /** The provider associated with the `access_token` */ + /** + * Sets [Builder.providerId] to an arbitrary JSON value. + * + * You should usually call [Builder.providerId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun providerId(providerId: JsonField) = apply { body.providerId(providerId) } fun authenticationType(authenticationType: AuthenticationType) = apply { body.authenticationType(authenticationType) } + /** + * Sets [Builder.authenticationType] to an arbitrary JSON value. + * + * You should usually call [Builder.authenticationType] with a well-typed + * [AuthenticationType] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun authenticationType(authenticationType: JsonField) = apply { body.authenticationType(authenticationType) } @@ -324,14 +432,18 @@ private constructor( fun products(products: List) = apply { body.products(products) } /** - * Optional, defaults to Organization products (`company`, `directory`, `employment`, - * `individual`) + * Sets [Builder.products] to an arbitrary JSON value. + * + * You should usually call [Builder.products] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun products(products: JsonField>) = apply { body.products(products) } /** - * Optional, defaults to Organization products (`company`, `directory`, `employment`, - * `individual`) + * Adds a single [String] to [products]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addProduct(product: String) = apply { body.addProduct(product) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt index f3bbcce4..8aec6a60 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt @@ -16,6 +16,7 @@ import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional @@ -30,8 +31,18 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun connectionStatus(): Optional = body.connectionStatus() + /** + * Returns the raw JSON value of [connectionStatus]. + * + * Unlike [connectionStatus], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _connectionStatus(): JsonField = body._connectionStatus() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -57,9 +68,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun connectionStatus(): Optional = Optional.ofNullable(connectionStatus.getNullable("connection_status")) + /** + * Returns the raw JSON value of [connectionStatus]. + * + * Unlike [connectionStatus], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("connection_status") @ExcludeMissing fun _connectionStatus(): JsonField = connectionStatus @@ -102,6 +123,13 @@ private constructor( fun connectionStatus(connectionStatus: ConnectionStatusType) = connectionStatus(JsonField.of(connectionStatus)) + /** + * Sets [Builder.connectionStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionStatus] with a well-typed + * [ConnectionStatusType] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ fun connectionStatus(connectionStatus: JsonField) = apply { this.connectionStatus = connectionStatus } @@ -181,6 +209,13 @@ private constructor( body.connectionStatus(connectionStatus) } + /** + * Sets [Builder.connectionStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionStatus] with a well-typed + * [ConnectionStatusType] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun connectionStatus(connectionStatus: JsonField) = apply { body.connectionStatus(connectionStatus) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt index e6eeb7b1..b991d17b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt @@ -31,32 +31,63 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** The provider associated with the connection */ + /** + * The provider associated with the connection + * + * @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 providerId(): String = body.providerId() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun authenticationType(): Optional = body.authenticationType() /** * Optional: the size of the employer to be created with this connection. Defaults to 20. Note * that if this is higher than 100, historical payroll data will not be generated, and instead * only one pay period will be created. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun employeeSize(): Optional = body.employeeSize() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun products(): Optional> = body.products() - /** The provider associated with the connection */ + /** + * Returns the raw JSON value of [providerId]. + * + * Unlike [providerId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _providerId(): JsonField = body._providerId() + /** + * Returns the raw JSON value of [authenticationType]. + * + * Unlike [authenticationType], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _authenticationType(): JsonField = body._authenticationType() /** - * Optional: the size of the employer to be created with this connection. Defaults to 20. Note - * that if this is higher than 100, historical payroll data will not be generated, and instead - * only one pay period will be created. + * Returns the raw JSON value of [employeeSize]. + * + * Unlike [employeeSize], this method doesn't throw if the JSON field has an unexpected type. */ fun _employeeSize(): JsonField = body._employeeSize() + /** + * Returns the raw JSON value of [products]. + * + * Unlike [products], this method doesn't throw if the JSON field has an unexpected type. + */ fun _products(): JsonField> = body._products() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -91,9 +122,18 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The provider associated with the connection */ + /** + * The provider associated with the connection + * + * @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 providerId(): String = providerId.getRequired("provider_id") + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun authenticationType(): Optional = Optional.ofNullable(authenticationType.getNullable("authentication_type")) @@ -101,31 +141,54 @@ private constructor( * Optional: the size of the employer to be created with this connection. Defaults to 20. * Note that if this is higher than 100, historical payroll data will not be generated, and * instead only one pay period will be created. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun employeeSize(): Optional = Optional.ofNullable(employeeSize.getNullable("employee_size")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun products(): Optional> = Optional.ofNullable(products.getNullable("products")) - /** The provider associated with the connection */ + /** + * Returns the raw JSON value of [providerId]. + * + * Unlike [providerId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("provider_id") @ExcludeMissing fun _providerId(): JsonField = providerId + /** + * Returns the raw JSON value of [authenticationType]. + * + * Unlike [authenticationType], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("authentication_type") @ExcludeMissing fun _authenticationType(): JsonField = authenticationType /** - * Optional: the size of the employer to be created with this connection. Defaults to 20. - * Note that if this is higher than 100, historical payroll data will not be generated, and - * instead only one pay period will be created. + * Returns the raw JSON value of [employeeSize]. + * + * Unlike [employeeSize], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("employee_size") @ExcludeMissing fun _employeeSize(): JsonField = employeeSize + /** + * Returns the raw JSON value of [products]. + * + * Unlike [products], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("products") @ExcludeMissing fun _products(): JsonField> = products @@ -184,12 +247,25 @@ private constructor( /** The provider associated with the connection */ fun providerId(providerId: String) = providerId(JsonField.of(providerId)) - /** The provider associated with the connection */ + /** + * Sets [Builder.providerId] to an arbitrary JSON value. + * + * You should usually call [Builder.providerId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun providerId(providerId: JsonField) = apply { this.providerId = providerId } fun authenticationType(authenticationType: AuthenticationType) = authenticationType(JsonField.of(authenticationType)) + /** + * Sets [Builder.authenticationType] to an arbitrary JSON value. + * + * You should usually call [Builder.authenticationType] with a well-typed + * [AuthenticationType] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun authenticationType(authenticationType: JsonField) = apply { this.authenticationType = authenticationType } @@ -202,9 +278,11 @@ private constructor( fun employeeSize(employeeSize: Long) = employeeSize(JsonField.of(employeeSize)) /** - * Optional: the size of the employer to be created with this connection. Defaults - * to 20. Note that if this is higher than 100, historical payroll data will not be - * generated, and instead only one pay period will be created. + * Sets [Builder.employeeSize] to an arbitrary JSON value. + * + * You should usually call [Builder.employeeSize] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun employeeSize(employeeSize: JsonField) = apply { this.employeeSize = employeeSize @@ -212,10 +290,22 @@ private constructor( fun products(products: List) = products(JsonField.of(products)) + /** + * Sets [Builder.products] to an arbitrary JSON value. + * + * You should usually call [Builder.products] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun products(products: JsonField>) = apply { this.products = products.map { it.toMutableList() } } + /** + * Adds a single [String] to [products]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addProduct(product: String) = apply { products = (products ?: JsonField.of(mutableListOf())).also { @@ -304,13 +394,26 @@ private constructor( /** The provider associated with the connection */ fun providerId(providerId: String) = apply { body.providerId(providerId) } - /** The provider associated with the connection */ + /** + * Sets [Builder.providerId] to an arbitrary JSON value. + * + * You should usually call [Builder.providerId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun providerId(providerId: JsonField) = apply { body.providerId(providerId) } fun authenticationType(authenticationType: AuthenticationType) = apply { body.authenticationType(authenticationType) } + /** + * Sets [Builder.authenticationType] to an arbitrary JSON value. + * + * You should usually call [Builder.authenticationType] with a well-typed + * [AuthenticationType] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun authenticationType(authenticationType: JsonField) = apply { body.authenticationType(authenticationType) } @@ -323,16 +426,30 @@ private constructor( fun employeeSize(employeeSize: Long) = apply { body.employeeSize(employeeSize) } /** - * Optional: the size of the employer to be created with this connection. Defaults to 20. - * Note that if this is higher than 100, historical payroll data will not be generated, and - * instead only one pay period will be created. + * Sets [Builder.employeeSize] to an arbitrary JSON value. + * + * You should usually call [Builder.employeeSize] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun employeeSize(employeeSize: JsonField) = apply { body.employeeSize(employeeSize) } fun products(products: List) = apply { body.products(products) } + /** + * Sets [Builder.products] to an arbitrary JSON value. + * + * You should usually call [Builder.products] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun products(products: JsonField>) = apply { body.products(products) } + /** + * Adds a single [String] to [products]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addProduct(product: String) = apply { body.addProduct(product) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt index 26835152..51d5f5c0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt @@ -131,29 +131,60 @@ private constructor( private val title: JsonField = JsonMissing.of(), ) { - /** Worker's compensation classification code for this employee */ + /** + * Worker's compensation classification code for this employee + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun classCode(): Optional = Optional.ofNullable(classCode.getNullable("class_code")) /** * Custom fields for the individual. These are fields which are defined by the employer in * the system. Custom fields are not currently supported for assisted connections. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun customFields(): Optional> = Optional.ofNullable(customFields.getNullable("custom_fields")) - /** The department object. */ + /** + * The department object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun department(): Optional = Optional.ofNullable(department.getNullable("department")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun emails(): Optional> = Optional.ofNullable(emails.getNullable("emails")) - /** The employment object. */ + /** + * The employment object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun employment(): Optional = Optional.ofNullable(employment.getNullable("employment")) - /** The detailed employment status of the individual. */ + /** + * The detailed employment status of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun employmentStatus(): Optional = Optional.ofNullable(employmentStatus.getNullable("employment_status")) @@ -161,184 +192,380 @@ private constructor( * Social Security Number of the individual in **encrypted** format. This field is only * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set * in the body. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun encryptedSsn(): Optional = Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - /** The EEOC-defined ethnicity of the individual. */ + /** + * The EEOC-defined ethnicity of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun ethnicity(): Optional = Optional.ofNullable(ethnicity.getNullable("ethnicity")) - /** The legal first name of the individual. */ + /** + * The legal first name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) - /** The gender of the individual. */ + /** + * The gender of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun gender(): Optional = Optional.ofNullable(gender.getNullable("gender")) /** * The employee's income as reported by the provider. This may not always be annualized * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what * information the provider returns. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun income(): Optional = Optional.ofNullable(income.getNullable("income")) - /** The array of income history. */ + /** + * The array of income history. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun incomeHistory(): Optional> = Optional.ofNullable(incomeHistory.getNullable("income_history")) - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * `true` if the individual an an active employee or contractor at the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) - /** The legal last name of the individual. */ + /** + * The legal last name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun latestRehireDate(): Optional = Optional.ofNullable(latestRehireDate.getNullable("latest_rehire_date")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun location(): Optional = Optional.ofNullable(location.getNullable("location")) - /** The manager object representing the manager of the individual within the org. */ + /** + * The manager object representing the manager of the individual within the org. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) - /** The legal middle name of the individual. */ + /** + * The legal middle name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun phoneNumbers(): Optional> = Optional.ofNullable(phoneNumbers.getNullable("phone_numbers")) - /** The preferred name of the individual. */ + /** + * The preferred name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun preferredName(): Optional = Optional.ofNullable(preferredName.getNullable("preferred_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun residence(): Optional = Optional.ofNullable(residence.getNullable("residence")) - /** The source system's unique employment identifier for this individual */ + /** + * The source system's unique employment identifier for this individual + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun sourceId(): Optional = Optional.ofNullable(sourceId.getNullable("source_id")) /** * Social Security Number of the individual. This field is only available with the `ssn` * scope enabled and the `options: { include: ['ssn'] }` param set in the body. * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) - /** The current title of the individual. */ + /** + * The current title of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun title(): Optional = Optional.ofNullable(title.getNullable("title")) - /** Worker's compensation classification code for this employee */ + /** + * Returns the raw JSON value of [classCode]. + * + * Unlike [classCode], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("class_code") @ExcludeMissing fun _classCode(): JsonField = classCode /** - * Custom fields for the individual. These are fields which are defined by the employer in - * the system. Custom fields are not currently supported for assisted connections. + * Returns the raw JSON value of [customFields]. + * + * Unlike [customFields], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("custom_fields") @ExcludeMissing fun _customFields(): JsonField> = customFields - /** The department object. */ + /** + * Returns the raw JSON value of [department]. + * + * Unlike [department], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("department") @ExcludeMissing fun _department(): JsonField = department + /** + * Returns the raw JSON value of [dob]. + * + * Unlike [dob], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dob") @ExcludeMissing fun _dob(): JsonField = dob + /** + * Returns the raw JSON value of [emails]. + * + * Unlike [emails], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("emails") @ExcludeMissing fun _emails(): JsonField> = emails - /** The employment object. */ + /** + * Returns the raw JSON value of [employment]. + * + * Unlike [employment], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("employment") @ExcludeMissing fun _employment(): JsonField = employment - /** The detailed employment status of the individual. */ + /** + * Returns the raw JSON value of [employmentStatus]. + * + * Unlike [employmentStatus], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("employment_status") @ExcludeMissing fun _employmentStatus(): JsonField = employmentStatus /** - * Social Security Number of the individual in **encrypted** format. This field is only - * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set - * in the body. + * Returns the raw JSON value of [encryptedSsn]. + * + * Unlike [encryptedSsn], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("encrypted_ssn") @ExcludeMissing fun _encryptedSsn(): JsonField = encryptedSsn + /** + * Returns the raw JSON value of [endDate]. + * + * Unlike [endDate], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("end_date") @ExcludeMissing fun _endDate(): JsonField = endDate - /** The EEOC-defined ethnicity of the individual. */ + /** + * Returns the raw JSON value of [ethnicity]. + * + * Unlike [ethnicity], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("ethnicity") @ExcludeMissing fun _ethnicity(): JsonField = ethnicity - /** The legal first name of the individual. */ + /** + * Returns the raw JSON value of [firstName]. + * + * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName - /** The gender of the individual. */ + /** + * Returns the raw JSON value of [gender]. + * + * Unlike [gender], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gender") @ExcludeMissing fun _gender(): JsonField = gender /** - * The employee's income as reported by the provider. This may not always be annualized - * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what - * information the provider returns. + * Returns the raw JSON value of [income]. + * + * Unlike [income], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("income") @ExcludeMissing fun _income(): JsonField = income - /** The array of income history. */ + /** + * Returns the raw JSON value of [incomeHistory]. + * + * Unlike [incomeHistory], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("income_history") @ExcludeMissing fun _incomeHistory(): JsonField> = incomeHistory - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * Returns the raw JSON value of [isActive]. + * + * Unlike [isActive], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("is_active") @ExcludeMissing fun _isActive(): JsonField = isActive - /** The legal last name of the individual. */ + /** + * Returns the raw JSON value of [lastName]. + * + * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName + /** + * Returns the raw JSON value of [latestRehireDate]. + * + * Unlike [latestRehireDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("latest_rehire_date") @ExcludeMissing fun _latestRehireDate(): JsonField = latestRehireDate + /** + * Returns the raw JSON value of [location]. + * + * Unlike [location], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("location") @ExcludeMissing fun _location(): JsonField = location - /** The manager object representing the manager of the individual within the org. */ + /** + * Returns the raw JSON value of [manager]. + * + * Unlike [manager], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("manager") @ExcludeMissing fun _manager(): JsonField = manager - /** The legal middle name of the individual. */ + /** + * Returns the raw JSON value of [middleName]. + * + * Unlike [middleName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("middle_name") @ExcludeMissing fun _middleName(): JsonField = middleName + /** + * Returns the raw JSON value of [phoneNumbers]. + * + * Unlike [phoneNumbers], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("phone_numbers") @ExcludeMissing fun _phoneNumbers(): JsonField> = phoneNumbers - /** The preferred name of the individual. */ + /** + * Returns the raw JSON value of [preferredName]. + * + * Unlike [preferredName], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("preferred_name") @ExcludeMissing fun _preferredName(): JsonField = preferredName + /** + * Returns the raw JSON value of [residence]. + * + * Unlike [residence], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("residence") @ExcludeMissing fun _residence(): JsonField = residence - /** The source system's unique employment identifier for this individual */ + /** + * Returns the raw JSON value of [sourceId]. + * + * Unlike [sourceId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("source_id") @ExcludeMissing fun _sourceId(): JsonField = sourceId /** - * Social Security Number of the individual. This field is only available with the `ssn` - * scope enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + * Returns the raw JSON value of [ssn]. + * + * Unlike [ssn], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("ssn") @ExcludeMissing fun _ssn(): JsonField = ssn + /** + * Returns the raw JSON value of [startDate]. + * + * Unlike [startDate], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("start_date") @ExcludeMissing fun _startDate(): JsonField = startDate - /** The current title of the individual. */ + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title private var validated: Boolean = false @@ -453,10 +680,16 @@ private constructor( /** Worker's compensation classification code for this employee */ fun classCode(classCode: String?) = classCode(JsonField.ofNullable(classCode)) - /** Worker's compensation classification code for this employee */ + /** Alias for calling [Builder.classCode] with `classCode.orElse(null)`. */ fun classCode(classCode: Optional) = classCode(classCode.getOrNull()) - /** Worker's compensation classification code for this employee */ + /** + * Sets [Builder.classCode] to an arbitrary JSON value. + * + * You should usually call [Builder.classCode] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun classCode(classCode: JsonField) = apply { this.classCode = classCode } /** @@ -467,16 +700,20 @@ private constructor( customFields(JsonField.of(customFields)) /** - * Custom fields for the individual. These are fields which are defined by the employer - * in the system. Custom fields are not currently supported for assisted connections. + * Sets [Builder.customFields] to an arbitrary JSON value. + * + * You should usually call [Builder.customFields] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ fun customFields(customFields: JsonField>) = apply { this.customFields = customFields.map { it.toMutableList() } } /** - * Custom fields for the individual. These are fields which are defined by the employer - * in the system. Custom fields are not currently supported for assisted connections. + * Adds a single [CustomField] to [customFields]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addCustomField(customField: CustomField) = apply { customFields = @@ -488,28 +725,55 @@ private constructor( /** The department object. */ fun department(department: Department?) = department(JsonField.ofNullable(department)) - /** The department object. */ + /** Alias for calling [Builder.department] with `department.orElse(null)`. */ fun department(department: Optional) = department(department.getOrNull()) - /** The department object. */ + /** + * Sets [Builder.department] to an arbitrary JSON value. + * + * You should usually call [Builder.department] with a well-typed [Department] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun department(department: JsonField) = apply { this.department = department } fun dob(dob: String?) = dob(JsonField.ofNullable(dob)) + /** Alias for calling [Builder.dob] with `dob.orElse(null)`. */ fun dob(dob: Optional) = dob(dob.getOrNull()) + /** + * Sets [Builder.dob] to an arbitrary JSON value. + * + * You should usually call [Builder.dob] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun dob(dob: JsonField) = apply { this.dob = dob } fun emails(emails: List?) = emails(JsonField.ofNullable(emails)) + /** Alias for calling [Builder.emails] with `emails.orElse(null)`. */ fun emails(emails: Optional>) = emails(emails.getOrNull()) + /** + * Sets [Builder.emails] to an arbitrary JSON value. + * + * You should usually call [Builder.emails] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun emails(emails: JsonField>) = apply { this.emails = emails.map { it.toMutableList() } } + /** + * Adds a single [Email] to [emails]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEmail(email: Email) = apply { emails = (emails ?: JsonField.of(mutableListOf())).also { @@ -520,10 +784,16 @@ private constructor( /** The employment object. */ fun employment(employment: Employment?) = employment(JsonField.ofNullable(employment)) - /** The employment object. */ + /** Alias for calling [Builder.employment] with `employment.orElse(null)`. */ fun employment(employment: Optional) = employment(employment.getOrNull()) - /** The employment object. */ + /** + * Sets [Builder.employment] to an arbitrary JSON value. + * + * You should usually call [Builder.employment] with a well-typed [Employment] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun employment(employment: JsonField) = apply { this.employment = employment } @@ -532,11 +802,19 @@ private constructor( fun employmentStatus(employmentStatus: EmploymentStatus?) = employmentStatus(JsonField.ofNullable(employmentStatus)) - /** The detailed employment status of the individual. */ + /** + * Alias for calling [Builder.employmentStatus] with `employmentStatus.orElse(null)`. + */ fun employmentStatus(employmentStatus: Optional) = employmentStatus(employmentStatus.getOrNull()) - /** The detailed employment status of the individual. */ + /** + * Sets [Builder.employmentStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.employmentStatus] with a well-typed + * [EmploymentStatus] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun employmentStatus(employmentStatus: JsonField) = apply { this.employmentStatus = employmentStatus } @@ -549,18 +827,16 @@ private constructor( fun encryptedSsn(encryptedSsn: String?) = encryptedSsn(JsonField.ofNullable(encryptedSsn)) - /** - * Social Security Number of the individual in **encrypted** format. This field is only - * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param - * set in the body. - */ + /** Alias for calling [Builder.encryptedSsn] with `encryptedSsn.orElse(null)`. */ fun encryptedSsn(encryptedSsn: Optional) = encryptedSsn(encryptedSsn.getOrNull()) /** - * Social Security Number of the individual in **encrypted** format. This field is only - * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param - * set in the body. + * Sets [Builder.encryptedSsn] to an arbitrary JSON value. + * + * You should usually call [Builder.encryptedSsn] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun encryptedSsn(encryptedSsn: JsonField) = apply { this.encryptedSsn = encryptedSsn @@ -568,35 +844,61 @@ private constructor( fun endDate(endDate: String?) = endDate(JsonField.ofNullable(endDate)) + /** Alias for calling [Builder.endDate] with `endDate.orElse(null)`. */ fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) + /** + * Sets [Builder.endDate] to an arbitrary JSON value. + * + * You should usually call [Builder.endDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } /** The EEOC-defined ethnicity of the individual. */ fun ethnicity(ethnicity: Ethnicity?) = ethnicity(JsonField.ofNullable(ethnicity)) - /** The EEOC-defined ethnicity of the individual. */ + /** Alias for calling [Builder.ethnicity] with `ethnicity.orElse(null)`. */ fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.getOrNull()) - /** The EEOC-defined ethnicity of the individual. */ + /** + * Sets [Builder.ethnicity] to an arbitrary JSON value. + * + * You should usually call [Builder.ethnicity] with a well-typed [Ethnicity] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun ethnicity(ethnicity: JsonField) = apply { this.ethnicity = ethnicity } /** The legal first name of the individual. */ fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) - /** The legal first name of the individual. */ + /** Alias for calling [Builder.firstName] with `firstName.orElse(null)`. */ fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) - /** The legal first name of the individual. */ + /** + * Sets [Builder.firstName] to an arbitrary JSON value. + * + * You should usually call [Builder.firstName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } /** The gender of the individual. */ fun gender(gender: Gender?) = gender(JsonField.ofNullable(gender)) - /** The gender of the individual. */ + /** Alias for calling [Builder.gender] with `gender.orElse(null)`. */ fun gender(gender: Optional) = gender(gender.getOrNull()) - /** The gender of the individual. */ + /** + * Sets [Builder.gender] to an arbitrary JSON value. + * + * You should usually call [Builder.gender] with a well-typed [Gender] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gender(gender: JsonField) = apply { this.gender = gender } /** @@ -606,17 +908,15 @@ private constructor( */ fun income(income: Income?) = income(JsonField.ofNullable(income)) - /** - * The employee's income as reported by the provider. This may not always be annualized - * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what - * information the provider returns. - */ + /** Alias for calling [Builder.income] with `income.orElse(null)`. */ fun income(income: Optional) = income(income.getOrNull()) /** - * The employee's income as reported by the provider. This may not always be annualized - * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what - * information the provider returns. + * Sets [Builder.income] to an arbitrary JSON value. + * + * You should usually call [Builder.income] with a well-typed [Income] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun income(income: JsonField) = apply { this.income = income } @@ -624,16 +924,26 @@ private constructor( fun incomeHistory(incomeHistory: List?) = incomeHistory(JsonField.ofNullable(incomeHistory)) - /** The array of income history. */ + /** Alias for calling [Builder.incomeHistory] with `incomeHistory.orElse(null)`. */ fun incomeHistory(incomeHistory: Optional>) = incomeHistory(incomeHistory.getOrNull()) - /** The array of income history. */ + /** + * Sets [Builder.incomeHistory] to an arbitrary JSON value. + * + * You should usually call [Builder.incomeHistory] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun incomeHistory(incomeHistory: JsonField>) = apply { this.incomeHistory = incomeHistory.map { it.toMutableList() } } - /** The array of income history. */ + /** + * Adds a single [Income] to [Builder.incomeHistory]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addIncomeHistory(incomeHistory: Income) = apply { this.incomeHistory = (this.incomeHistory ?: JsonField.of(mutableListOf())).also { @@ -644,68 +954,127 @@ private constructor( /** `true` if the individual an an active employee or contractor at the company. */ fun isActive(isActive: Boolean?) = isActive(JsonField.ofNullable(isActive)) - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * Alias for [Builder.isActive]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun isActive(isActive: Boolean) = isActive(isActive as Boolean?) - /** `true` if the individual an an active employee or contractor at the company. */ + /** Alias for calling [Builder.isActive] with `isActive.orElse(null)`. */ fun isActive(isActive: Optional) = isActive(isActive.getOrNull()) - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * Sets [Builder.isActive] to an arbitrary JSON value. + * + * You should usually call [Builder.isActive] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun isActive(isActive: JsonField) = apply { this.isActive = isActive } /** The legal last name of the individual. */ fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) - /** The legal last name of the individual. */ + /** Alias for calling [Builder.lastName] with `lastName.orElse(null)`. */ fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) - /** The legal last name of the individual. */ + /** + * Sets [Builder.lastName] to an arbitrary JSON value. + * + * You should usually call [Builder.lastName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } fun latestRehireDate(latestRehireDate: String?) = latestRehireDate(JsonField.ofNullable(latestRehireDate)) + /** + * Alias for calling [Builder.latestRehireDate] with `latestRehireDate.orElse(null)`. + */ fun latestRehireDate(latestRehireDate: Optional) = latestRehireDate(latestRehireDate.getOrNull()) + /** + * Sets [Builder.latestRehireDate] to an arbitrary JSON value. + * + * You should usually call [Builder.latestRehireDate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun latestRehireDate(latestRehireDate: JsonField) = apply { this.latestRehireDate = latestRehireDate } fun location(location: Location?) = location(JsonField.ofNullable(location)) + /** Alias for calling [Builder.location] with `location.orElse(null)`. */ fun location(location: Optional) = location(location.getOrNull()) + /** + * Sets [Builder.location] to an arbitrary JSON value. + * + * You should usually call [Builder.location] with a well-typed [Location] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun location(location: JsonField) = apply { this.location = location } /** The manager object representing the manager of the individual within the org. */ fun manager(manager: Manager?) = manager(JsonField.ofNullable(manager)) - /** The manager object representing the manager of the individual within the org. */ + /** Alias for calling [Builder.manager] with `manager.orElse(null)`. */ fun manager(manager: Optional) = manager(manager.getOrNull()) - /** The manager object representing the manager of the individual within the org. */ + /** + * Sets [Builder.manager] to an arbitrary JSON value. + * + * You should usually call [Builder.manager] with a well-typed [Manager] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun manager(manager: JsonField) = apply { this.manager = manager } /** The legal middle name of the individual. */ fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) - /** The legal middle name of the individual. */ + /** Alias for calling [Builder.middleName] with `middleName.orElse(null)`. */ fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) - /** The legal middle name of the individual. */ + /** + * Sets [Builder.middleName] to an arbitrary JSON value. + * + * You should usually call [Builder.middleName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } fun phoneNumbers(phoneNumbers: List?) = phoneNumbers(JsonField.ofNullable(phoneNumbers)) + /** Alias for calling [Builder.phoneNumbers] with `phoneNumbers.orElse(null)`. */ fun phoneNumbers(phoneNumbers: Optional>) = phoneNumbers(phoneNumbers.getOrNull()) + /** + * Sets [Builder.phoneNumbers] to an arbitrary JSON value. + * + * You should usually call [Builder.phoneNumbers] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun phoneNumbers(phoneNumbers: JsonField>) = apply { this.phoneNumbers = phoneNumbers.map { it.toMutableList() } } + /** + * Adds a single [PhoneNumber] to [phoneNumbers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addPhoneNumber(phoneNumber: PhoneNumber) = apply { phoneNumbers = (phoneNumbers ?: JsonField.of(mutableListOf())).also { @@ -717,25 +1086,45 @@ private constructor( fun preferredName(preferredName: String?) = preferredName(JsonField.ofNullable(preferredName)) - /** The preferred name of the individual. */ + /** Alias for calling [Builder.preferredName] with `preferredName.orElse(null)`. */ fun preferredName(preferredName: Optional) = preferredName(preferredName.getOrNull()) - /** The preferred name of the individual. */ + /** + * Sets [Builder.preferredName] to an arbitrary JSON value. + * + * You should usually call [Builder.preferredName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun preferredName(preferredName: JsonField) = apply { this.preferredName = preferredName } fun residence(residence: Location?) = residence(JsonField.ofNullable(residence)) + /** Alias for calling [Builder.residence] with `residence.orElse(null)`. */ fun residence(residence: Optional) = residence(residence.getOrNull()) + /** + * Sets [Builder.residence] to an arbitrary JSON value. + * + * You should usually call [Builder.residence] with a well-typed [Location] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun residence(residence: JsonField) = apply { this.residence = residence } /** The source system's unique employment identifier for this individual */ fun sourceId(sourceId: String) = sourceId(JsonField.of(sourceId)) - /** The source system's unique employment identifier for this individual */ + /** + * Sets [Builder.sourceId] to an arbitrary JSON value. + * + * You should usually call [Builder.sourceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun sourceId(sourceId: JsonField) = apply { this.sourceId = sourceId } /** @@ -745,33 +1134,45 @@ private constructor( */ fun ssn(ssn: String?) = ssn(JsonField.ofNullable(ssn)) - /** - * Social Security Number of the individual. This field is only available with the `ssn` - * scope enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). - */ + /** Alias for calling [Builder.ssn] with `ssn.orElse(null)`. */ fun ssn(ssn: Optional) = ssn(ssn.getOrNull()) /** - * Social Security Number of the individual. This field is only available with the `ssn` - * scope enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + * Sets [Builder.ssn] to an arbitrary JSON value. + * + * You should usually call [Builder.ssn] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun ssn(ssn: JsonField) = apply { this.ssn = ssn } fun startDate(startDate: String?) = startDate(JsonField.ofNullable(startDate)) + /** Alias for calling [Builder.startDate] with `startDate.orElse(null)`. */ fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) + /** + * Sets [Builder.startDate] to an arbitrary JSON value. + * + * You should usually call [Builder.startDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun startDate(startDate: JsonField) = apply { this.startDate = startDate } /** The current title of the individual. */ fun title(title: String?) = title(JsonField.ofNullable(title)) - /** The current title of the individual. */ + /** Alias for calling [Builder.title] with `title.orElse(null)`. */ fun title(title: Optional) = title(title.getOrNull()) - /** The current title of the individual. */ + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun title(title: JsonField) = apply { this.title = title } fun build(): IndividualOrEmployment = @@ -818,10 +1219,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value + /** + * 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 @JsonAnyGetter @@ -863,8 +1273,16 @@ private constructor( 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 value(value: JsonValue) = apply { this.value = value } @@ -925,10 +1343,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The name of the department associated with the individual. */ + /** + * The name of the department associated with the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The name of the department associated with the individual. */ + /** + * 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 @JsonAnyGetter @@ -969,10 +1396,16 @@ private constructor( /** The name of the department associated with the individual. */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The name of the department associated with the individual. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The name of the department associated with the individual. */ + /** + * 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 { @@ -1032,12 +1465,30 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1080,12 +1531,27 @@ private constructor( fun data(data: String) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun data(data: JsonField) = apply { this.data = data } fun type(type: Type?) = type(JsonField.ofNullable(type)) + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -1252,19 +1718,32 @@ private constructor( /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, * `intern`, `temp`, `seasonal` and `individual_contractor`. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) - /** The main employment type of the individual. */ + /** + * The main employment type of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) /** - * The secondary employment type of the individual. Options: `full_time`, `part_time`, - * `intern`, `temp`, `seasonal` and `individual_contractor`. + * Returns the raw JSON value of [subtype]. + * + * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype - /** The main employment type of the individual. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1311,25 +1790,31 @@ private constructor( */ fun subtype(subtype: Subtype?) = subtype(JsonField.ofNullable(subtype)) - /** - * The secondary employment type of the individual. Options: `full_time`, - * `part_time`, `intern`, `temp`, `seasonal` and `individual_contractor`. - */ + /** Alias for calling [Builder.subtype] with `subtype.orElse(null)`. */ fun subtype(subtype: Optional) = subtype(subtype.getOrNull()) /** - * The secondary employment type of the individual. Options: `full_time`, - * `part_time`, `intern`, `temp`, `seasonal` and `individual_contractor`. + * Sets [Builder.subtype] to an arbitrary JSON value. + * + * You should usually call [Builder.subtype] with a well-typed [Subtype] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ fun subtype(subtype: JsonField) = apply { this.subtype = subtype } /** The main employment type of the individual. */ fun type(type: Type?) = type(JsonField.ofNullable(type)) - /** The main employment type of the individual. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** The main employment type of the individual. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -2019,10 +2504,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * A stable Finch `id` (UUID v4) for an individual in the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id @JsonAnyGetter @@ -2063,7 +2557,13 @@ private constructor( /** A stable Finch `id` (UUID v4) for an individual in the company. */ fun id(id: String) = id(JsonField.of(id)) - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun id(id: JsonField) = apply { this.id = id } fun additionalProperties(additionalProperties: Map) = apply { @@ -2122,12 +2622,30 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -2170,12 +2688,27 @@ private constructor( fun data(data: String) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun data(data: JsonField) = apply { this.data = data } fun type(type: Type?) = type(JsonField.ofNullable(type)) + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -2376,15 +2909,13 @@ private constructor( */ fun body(body: List?) = apply { this.body = body?.toMutableList() } - /** - * Array of individuals to create. Takes all combined fields from `/individual` and - * `/employment` endpoints. All fields are optional. - */ + /** Alias for calling [Builder.body] with `body.orElse(null)`. */ fun body(body: Optional>) = body(body.getOrNull()) /** - * Array of individuals to create. Takes all combined fields from `/individual` and - * `/employment` endpoints. All fields are optional. + * Adds a single [IndividualOrEmployment] to [Builder.body]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addBody(body: IndividualOrEmployment) = apply { this.body = (this.body ?: mutableListOf()).apply { add(body) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt index fb614e3f..6dd0af93 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt @@ -35,118 +35,271 @@ private constructor( fun individualId(): String = individualId - /** Worker's compensation classification code for this employee */ + /** + * Worker's compensation classification code for this employee + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun classCode(): Optional = body.classCode() /** * Custom fields for the individual. These are fields which are defined by the employer in the * system. Custom fields are not currently supported for assisted connections. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun customFields(): Optional> = body.customFields() - /** The department object. */ + /** + * The department object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun department(): Optional = body.department() - /** The employment object. */ + /** + * The employment object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun employment(): Optional = body.employment() - /** The detailed employment status of the individual. */ + /** + * The detailed employment status of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun employmentStatus(): Optional = body.employmentStatus() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun endDate(): Optional = body.endDate() - /** The legal first name of the individual. */ + /** + * The legal first name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun firstName(): Optional = body.firstName() /** * The employee's income as reported by the provider. This may not always be annualized income, * but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what information the * provider returns. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun income(): Optional = body.income() - /** The array of income history. */ + /** + * The array of income history. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun incomeHistory(): Optional> = body.incomeHistory() - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * `true` if the individual an an active employee or contractor at the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun isActive(): Optional = body.isActive() - /** The legal last name of the individual. */ + /** + * The legal last name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun lastName(): Optional = body.lastName() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun latestRehireDate(): Optional = body.latestRehireDate() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun location(): Optional = body.location() - /** The manager object representing the manager of the individual within the org. */ + /** + * The manager object representing the manager of the individual within the org. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun manager(): Optional = body.manager() - /** The legal middle name of the individual. */ + /** + * The legal middle name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun middleName(): Optional = body.middleName() - /** The source system's unique employment identifier for this individual */ + /** + * The source system's unique employment identifier for this individual + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun sourceId(): Optional = body.sourceId() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun startDate(): Optional = body.startDate() - /** The current title of the individual. */ + /** + * The current title of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun title(): Optional = body.title() - /** Worker's compensation classification code for this employee */ + /** + * Returns the raw JSON value of [classCode]. + * + * Unlike [classCode], this method doesn't throw if the JSON field has an unexpected type. + */ fun _classCode(): JsonField = body._classCode() /** - * Custom fields for the individual. These are fields which are defined by the employer in the - * system. Custom fields are not currently supported for assisted connections. + * Returns the raw JSON value of [customFields]. + * + * Unlike [customFields], this method doesn't throw if the JSON field has an unexpected type. */ fun _customFields(): JsonField> = body._customFields() - /** The department object. */ + /** + * Returns the raw JSON value of [department]. + * + * Unlike [department], this method doesn't throw if the JSON field has an unexpected type. + */ fun _department(): JsonField = body._department() - /** The employment object. */ + /** + * Returns the raw JSON value of [employment]. + * + * Unlike [employment], this method doesn't throw if the JSON field has an unexpected type. + */ fun _employment(): JsonField = body._employment() - /** The detailed employment status of the individual. */ + /** + * Returns the raw JSON value of [employmentStatus]. + * + * Unlike [employmentStatus], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _employmentStatus(): JsonField = body._employmentStatus() + /** + * Returns the raw JSON value of [endDate]. + * + * Unlike [endDate], this method doesn't throw if the JSON field has an unexpected type. + */ fun _endDate(): JsonField = body._endDate() - /** The legal first name of the individual. */ + /** + * Returns the raw JSON value of [firstName]. + * + * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected type. + */ fun _firstName(): JsonField = body._firstName() /** - * The employee's income as reported by the provider. This may not always be annualized income, - * but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what information the - * provider returns. + * Returns the raw JSON value of [income]. + * + * Unlike [income], this method doesn't throw if the JSON field has an unexpected type. */ fun _income(): JsonField = body._income() - /** The array of income history. */ + /** + * Returns the raw JSON value of [incomeHistory]. + * + * Unlike [incomeHistory], this method doesn't throw if the JSON field has an unexpected type. + */ fun _incomeHistory(): JsonField> = body._incomeHistory() - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * Returns the raw JSON value of [isActive]. + * + * Unlike [isActive], this method doesn't throw if the JSON field has an unexpected type. + */ fun _isActive(): JsonField = body._isActive() - /** The legal last name of the individual. */ + /** + * Returns the raw JSON value of [lastName]. + * + * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected type. + */ fun _lastName(): JsonField = body._lastName() + /** + * Returns the raw JSON value of [latestRehireDate]. + * + * Unlike [latestRehireDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ fun _latestRehireDate(): JsonField = body._latestRehireDate() + /** + * Returns the raw JSON value of [location]. + * + * Unlike [location], this method doesn't throw if the JSON field has an unexpected type. + */ fun _location(): JsonField = body._location() - /** The manager object representing the manager of the individual within the org. */ + /** + * Returns the raw JSON value of [manager]. + * + * Unlike [manager], this method doesn't throw if the JSON field has an unexpected type. + */ fun _manager(): JsonField = body._manager() - /** The legal middle name of the individual. */ + /** + * Returns the raw JSON value of [middleName]. + * + * Unlike [middleName], this method doesn't throw if the JSON field has an unexpected type. + */ fun _middleName(): JsonField = body._middleName() - /** The source system's unique employment identifier for this individual */ + /** + * Returns the raw JSON value of [sourceId]. + * + * Unlike [sourceId], this method doesn't throw if the JSON field has an unexpected type. + */ fun _sourceId(): JsonField = body._sourceId() + /** + * Returns the raw JSON value of [startDate]. + * + * Unlike [startDate], this method doesn't throw if the JSON field has an unexpected type. + */ fun _startDate(): JsonField = body._startDate() - /** The current title of the individual. */ + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. + */ fun _title(): JsonField = body._title() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -230,139 +383,294 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Worker's compensation classification code for this employee */ + /** + * Worker's compensation classification code for this employee + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun classCode(): Optional = Optional.ofNullable(classCode.getNullable("class_code")) /** * Custom fields for the individual. These are fields which are defined by the employer in * the system. Custom fields are not currently supported for assisted connections. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun customFields(): Optional> = Optional.ofNullable(customFields.getNullable("custom_fields")) - /** The department object. */ + /** + * The department object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun department(): Optional = Optional.ofNullable(department.getNullable("department")) - /** The employment object. */ + /** + * The employment object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun employment(): Optional = Optional.ofNullable(employment.getNullable("employment")) - /** The detailed employment status of the individual. */ + /** + * The detailed employment status of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun employmentStatus(): Optional = Optional.ofNullable(employmentStatus.getNullable("employment_status")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - /** The legal first name of the individual. */ + /** + * The legal first name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) /** * The employee's income as reported by the provider. This may not always be annualized * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what * information the provider returns. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun income(): Optional = Optional.ofNullable(income.getNullable("income")) - /** The array of income history. */ + /** + * The array of income history. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun incomeHistory(): Optional> = Optional.ofNullable(incomeHistory.getNullable("income_history")) - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * `true` if the individual an an active employee or contractor at the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) - /** The legal last name of the individual. */ + /** + * The legal last name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun latestRehireDate(): Optional = Optional.ofNullable(latestRehireDate.getNullable("latest_rehire_date")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun location(): Optional = Optional.ofNullable(location.getNullable("location")) - /** The manager object representing the manager of the individual within the org. */ + /** + * The manager object representing the manager of the individual within the org. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) - /** The legal middle name of the individual. */ + /** + * The legal middle name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) - /** The source system's unique employment identifier for this individual */ + /** + * The source system's unique employment identifier for this individual + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun sourceId(): Optional = Optional.ofNullable(sourceId.getNullable("source_id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) - /** The current title of the individual. */ + /** + * The current title of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun title(): Optional = Optional.ofNullable(title.getNullable("title")) - /** Worker's compensation classification code for this employee */ + /** + * Returns the raw JSON value of [classCode]. + * + * Unlike [classCode], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("class_code") @ExcludeMissing fun _classCode(): JsonField = classCode /** - * Custom fields for the individual. These are fields which are defined by the employer in - * the system. Custom fields are not currently supported for assisted connections. + * Returns the raw JSON value of [customFields]. + * + * Unlike [customFields], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("custom_fields") @ExcludeMissing fun _customFields(): JsonField> = customFields - /** The department object. */ + /** + * Returns the raw JSON value of [department]. + * + * Unlike [department], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("department") @ExcludeMissing fun _department(): JsonField = department - /** The employment object. */ + /** + * Returns the raw JSON value of [employment]. + * + * Unlike [employment], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("employment") @ExcludeMissing fun _employment(): JsonField = employment - /** The detailed employment status of the individual. */ + /** + * Returns the raw JSON value of [employmentStatus]. + * + * Unlike [employmentStatus], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("employment_status") @ExcludeMissing fun _employmentStatus(): JsonField = employmentStatus + /** + * Returns the raw JSON value of [endDate]. + * + * Unlike [endDate], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("end_date") @ExcludeMissing fun _endDate(): JsonField = endDate - /** The legal first name of the individual. */ + /** + * Returns the raw JSON value of [firstName]. + * + * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName /** - * The employee's income as reported by the provider. This may not always be annualized - * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what - * information the provider returns. + * Returns the raw JSON value of [income]. + * + * Unlike [income], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("income") @ExcludeMissing fun _income(): JsonField = income - /** The array of income history. */ + /** + * Returns the raw JSON value of [incomeHistory]. + * + * Unlike [incomeHistory], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("income_history") @ExcludeMissing fun _incomeHistory(): JsonField> = incomeHistory - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * Returns the raw JSON value of [isActive]. + * + * Unlike [isActive], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("is_active") @ExcludeMissing fun _isActive(): JsonField = isActive - /** The legal last name of the individual. */ + /** + * Returns the raw JSON value of [lastName]. + * + * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName + /** + * Returns the raw JSON value of [latestRehireDate]. + * + * Unlike [latestRehireDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("latest_rehire_date") @ExcludeMissing fun _latestRehireDate(): JsonField = latestRehireDate + /** + * Returns the raw JSON value of [location]. + * + * Unlike [location], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("location") @ExcludeMissing fun _location(): JsonField = location - /** The manager object representing the manager of the individual within the org. */ + /** + * Returns the raw JSON value of [manager]. + * + * Unlike [manager], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("manager") @ExcludeMissing fun _manager(): JsonField = manager - /** The legal middle name of the individual. */ + /** + * Returns the raw JSON value of [middleName]. + * + * Unlike [middleName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("middle_name") @ExcludeMissing fun _middleName(): JsonField = middleName - /** The source system's unique employment identifier for this individual */ + /** + * Returns the raw JSON value of [sourceId]. + * + * Unlike [sourceId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("source_id") @ExcludeMissing fun _sourceId(): JsonField = sourceId + /** + * Returns the raw JSON value of [startDate]. + * + * Unlike [startDate], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("start_date") @ExcludeMissing fun _startDate(): JsonField = startDate - /** The current title of the individual. */ + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title @JsonAnyGetter @@ -454,10 +762,16 @@ private constructor( /** Worker's compensation classification code for this employee */ fun classCode(classCode: String?) = classCode(JsonField.ofNullable(classCode)) - /** Worker's compensation classification code for this employee */ + /** Alias for calling [Builder.classCode] with `classCode.orElse(null)`. */ fun classCode(classCode: Optional) = classCode(classCode.getOrNull()) - /** Worker's compensation classification code for this employee */ + /** + * Sets [Builder.classCode] to an arbitrary JSON value. + * + * You should usually call [Builder.classCode] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun classCode(classCode: JsonField) = apply { this.classCode = classCode } /** @@ -468,16 +782,20 @@ private constructor( customFields(JsonField.of(customFields)) /** - * Custom fields for the individual. These are fields which are defined by the employer - * in the system. Custom fields are not currently supported for assisted connections. + * Sets [Builder.customFields] to an arbitrary JSON value. + * + * You should usually call [Builder.customFields] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ fun customFields(customFields: JsonField>) = apply { this.customFields = customFields.map { it.toMutableList() } } /** - * Custom fields for the individual. These are fields which are defined by the employer - * in the system. Custom fields are not currently supported for assisted connections. + * Adds a single [CustomField] to [customFields]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addCustomField(customField: CustomField) = apply { customFields = @@ -489,10 +807,16 @@ private constructor( /** The department object. */ fun department(department: Department?) = department(JsonField.ofNullable(department)) - /** The department object. */ + /** Alias for calling [Builder.department] with `department.orElse(null)`. */ fun department(department: Optional) = department(department.getOrNull()) - /** The department object. */ + /** + * Sets [Builder.department] to an arbitrary JSON value. + * + * You should usually call [Builder.department] with a well-typed [Department] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun department(department: JsonField) = apply { this.department = department } @@ -500,10 +824,16 @@ private constructor( /** The employment object. */ fun employment(employment: Employment?) = employment(JsonField.ofNullable(employment)) - /** The employment object. */ + /** Alias for calling [Builder.employment] with `employment.orElse(null)`. */ fun employment(employment: Optional) = employment(employment.getOrNull()) - /** The employment object. */ + /** + * Sets [Builder.employment] to an arbitrary JSON value. + * + * You should usually call [Builder.employment] with a well-typed [Employment] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun employment(employment: JsonField) = apply { this.employment = employment } @@ -512,28 +842,50 @@ private constructor( fun employmentStatus(employmentStatus: EmploymentStatus?) = employmentStatus(JsonField.ofNullable(employmentStatus)) - /** The detailed employment status of the individual. */ + /** + * Alias for calling [Builder.employmentStatus] with `employmentStatus.orElse(null)`. + */ fun employmentStatus(employmentStatus: Optional) = employmentStatus(employmentStatus.getOrNull()) - /** The detailed employment status of the individual. */ + /** + * Sets [Builder.employmentStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.employmentStatus] with a well-typed + * [EmploymentStatus] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun employmentStatus(employmentStatus: JsonField) = apply { this.employmentStatus = employmentStatus } fun endDate(endDate: String?) = endDate(JsonField.ofNullable(endDate)) + /** Alias for calling [Builder.endDate] with `endDate.orElse(null)`. */ fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) + /** + * Sets [Builder.endDate] to an arbitrary JSON value. + * + * You should usually call [Builder.endDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } /** The legal first name of the individual. */ fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) - /** The legal first name of the individual. */ + /** Alias for calling [Builder.firstName] with `firstName.orElse(null)`. */ fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) - /** The legal first name of the individual. */ + /** + * Sets [Builder.firstName] to an arbitrary JSON value. + * + * You should usually call [Builder.firstName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } /** @@ -543,17 +895,15 @@ private constructor( */ fun income(income: Income?) = income(JsonField.ofNullable(income)) - /** - * The employee's income as reported by the provider. This may not always be annualized - * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what - * information the provider returns. - */ + /** Alias for calling [Builder.income] with `income.orElse(null)`. */ fun income(income: Optional) = income(income.getOrNull()) /** - * The employee's income as reported by the provider. This may not always be annualized - * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what - * information the provider returns. + * Sets [Builder.income] to an arbitrary JSON value. + * + * You should usually call [Builder.income] with a well-typed [Income] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun income(income: JsonField) = apply { this.income = income } @@ -561,16 +911,26 @@ private constructor( fun incomeHistory(incomeHistory: List?) = incomeHistory(JsonField.ofNullable(incomeHistory)) - /** The array of income history. */ + /** Alias for calling [Builder.incomeHistory] with `incomeHistory.orElse(null)`. */ fun incomeHistory(incomeHistory: Optional>) = incomeHistory(incomeHistory.getOrNull()) - /** The array of income history. */ + /** + * Sets [Builder.incomeHistory] to an arbitrary JSON value. + * + * You should usually call [Builder.incomeHistory] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun incomeHistory(incomeHistory: JsonField>) = apply { this.incomeHistory = incomeHistory.map { it.toMutableList() } } - /** The array of income history. */ + /** + * Adds a single [Income] to [Builder.incomeHistory]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addIncomeHistory(incomeHistory: Income) = apply { this.incomeHistory = (this.incomeHistory ?: JsonField.of(mutableListOf())).also { @@ -581,77 +941,143 @@ private constructor( /** `true` if the individual an an active employee or contractor at the company. */ fun isActive(isActive: Boolean?) = isActive(JsonField.ofNullable(isActive)) - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * Alias for [Builder.isActive]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun isActive(isActive: Boolean) = isActive(isActive as Boolean?) - /** `true` if the individual an an active employee or contractor at the company. */ + /** Alias for calling [Builder.isActive] with `isActive.orElse(null)`. */ fun isActive(isActive: Optional) = isActive(isActive.getOrNull()) - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * Sets [Builder.isActive] to an arbitrary JSON value. + * + * You should usually call [Builder.isActive] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun isActive(isActive: JsonField) = apply { this.isActive = isActive } /** The legal last name of the individual. */ fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) - /** The legal last name of the individual. */ + /** Alias for calling [Builder.lastName] with `lastName.orElse(null)`. */ fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) - /** The legal last name of the individual. */ + /** + * Sets [Builder.lastName] to an arbitrary JSON value. + * + * You should usually call [Builder.lastName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } fun latestRehireDate(latestRehireDate: String?) = latestRehireDate(JsonField.ofNullable(latestRehireDate)) + /** + * Alias for calling [Builder.latestRehireDate] with `latestRehireDate.orElse(null)`. + */ fun latestRehireDate(latestRehireDate: Optional) = latestRehireDate(latestRehireDate.getOrNull()) + /** + * Sets [Builder.latestRehireDate] to an arbitrary JSON value. + * + * You should usually call [Builder.latestRehireDate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun latestRehireDate(latestRehireDate: JsonField) = apply { this.latestRehireDate = latestRehireDate } fun location(location: Location?) = location(JsonField.ofNullable(location)) + /** Alias for calling [Builder.location] with `location.orElse(null)`. */ fun location(location: Optional) = location(location.getOrNull()) + /** + * Sets [Builder.location] to an arbitrary JSON value. + * + * You should usually call [Builder.location] with a well-typed [Location] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun location(location: JsonField) = apply { this.location = location } /** The manager object representing the manager of the individual within the org. */ fun manager(manager: Manager?) = manager(JsonField.ofNullable(manager)) - /** The manager object representing the manager of the individual within the org. */ + /** Alias for calling [Builder.manager] with `manager.orElse(null)`. */ fun manager(manager: Optional) = manager(manager.getOrNull()) - /** The manager object representing the manager of the individual within the org. */ + /** + * Sets [Builder.manager] to an arbitrary JSON value. + * + * You should usually call [Builder.manager] with a well-typed [Manager] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun manager(manager: JsonField) = apply { this.manager = manager } /** The legal middle name of the individual. */ fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) - /** The legal middle name of the individual. */ + /** Alias for calling [Builder.middleName] with `middleName.orElse(null)`. */ fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) - /** The legal middle name of the individual. */ + /** + * Sets [Builder.middleName] to an arbitrary JSON value. + * + * You should usually call [Builder.middleName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } /** The source system's unique employment identifier for this individual */ fun sourceId(sourceId: String) = sourceId(JsonField.of(sourceId)) - /** The source system's unique employment identifier for this individual */ + /** + * Sets [Builder.sourceId] to an arbitrary JSON value. + * + * You should usually call [Builder.sourceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun sourceId(sourceId: JsonField) = apply { this.sourceId = sourceId } fun startDate(startDate: String?) = startDate(JsonField.ofNullable(startDate)) + /** Alias for calling [Builder.startDate] with `startDate.orElse(null)`. */ fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) + /** + * Sets [Builder.startDate] to an arbitrary JSON value. + * + * You should usually call [Builder.startDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun startDate(startDate: JsonField) = apply { this.startDate = startDate } /** The current title of the individual. */ fun title(title: String?) = title(JsonField.ofNullable(title)) - /** The current title of the individual. */ + /** Alias for calling [Builder.title] with `title.orElse(null)`. */ fun title(title: Optional) = title(title.getOrNull()) - /** The current title of the individual. */ + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun title(title: JsonField) = apply { this.title = title } fun additionalProperties(additionalProperties: Map) = apply { @@ -753,10 +1179,16 @@ private constructor( /** Worker's compensation classification code for this employee */ fun classCode(classCode: String?) = apply { body.classCode(classCode) } - /** Worker's compensation classification code for this employee */ + /** Alias for calling [Builder.classCode] with `classCode.orElse(null)`. */ fun classCode(classCode: Optional) = classCode(classCode.getOrNull()) - /** Worker's compensation classification code for this employee */ + /** + * Sets [Builder.classCode] to an arbitrary JSON value. + * + * You should usually call [Builder.classCode] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun classCode(classCode: JsonField) = apply { body.classCode(classCode) } /** @@ -768,35 +1200,51 @@ private constructor( } /** - * Custom fields for the individual. These are fields which are defined by the employer in - * the system. Custom fields are not currently supported for assisted connections. + * Sets [Builder.customFields] to an arbitrary JSON value. + * + * You should usually call [Builder.customFields] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ fun customFields(customFields: JsonField>) = apply { body.customFields(customFields) } /** - * Custom fields for the individual. These are fields which are defined by the employer in - * the system. Custom fields are not currently supported for assisted connections. + * Adds a single [CustomField] to [customFields]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ fun addCustomField(customField: CustomField) = apply { body.addCustomField(customField) } /** The department object. */ fun department(department: Department?) = apply { body.department(department) } - /** The department object. */ + /** Alias for calling [Builder.department] with `department.orElse(null)`. */ fun department(department: Optional) = department(department.getOrNull()) - /** The department object. */ + /** + * Sets [Builder.department] to an arbitrary JSON value. + * + * You should usually call [Builder.department] with a well-typed [Department] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun department(department: JsonField) = apply { body.department(department) } /** The employment object. */ fun employment(employment: Employment?) = apply { body.employment(employment) } - /** The employment object. */ + /** Alias for calling [Builder.employment] with `employment.orElse(null)`. */ fun employment(employment: Optional) = employment(employment.getOrNull()) - /** The employment object. */ + /** + * Sets [Builder.employment] to an arbitrary JSON value. + * + * You should usually call [Builder.employment] with a well-typed [Employment] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun employment(employment: JsonField) = apply { body.employment(employment) } /** The detailed employment status of the individual. */ @@ -804,28 +1252,47 @@ private constructor( body.employmentStatus(employmentStatus) } - /** The detailed employment status of the individual. */ + /** Alias for calling [Builder.employmentStatus] with `employmentStatus.orElse(null)`. */ fun employmentStatus(employmentStatus: Optional) = employmentStatus(employmentStatus.getOrNull()) - /** The detailed employment status of the individual. */ + /** + * Sets [Builder.employmentStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.employmentStatus] with a well-typed [EmploymentStatus] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun employmentStatus(employmentStatus: JsonField) = apply { body.employmentStatus(employmentStatus) } fun endDate(endDate: String?) = apply { body.endDate(endDate) } + /** Alias for calling [Builder.endDate] with `endDate.orElse(null)`. */ fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) + /** + * Sets [Builder.endDate] to an arbitrary JSON value. + * + * You should usually call [Builder.endDate] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun endDate(endDate: JsonField) = apply { body.endDate(endDate) } /** The legal first name of the individual. */ fun firstName(firstName: String?) = apply { body.firstName(firstName) } - /** The legal first name of the individual. */ + /** Alias for calling [Builder.firstName] with `firstName.orElse(null)`. */ fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) - /** The legal first name of the individual. */ + /** + * Sets [Builder.firstName] to an arbitrary JSON value. + * + * You should usually call [Builder.firstName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun firstName(firstName: JsonField) = apply { body.firstName(firstName) } /** @@ -835,17 +1302,14 @@ private constructor( */ fun income(income: Income?) = apply { body.income(income) } - /** - * The employee's income as reported by the provider. This may not always be annualized - * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what - * information the provider returns. - */ + /** Alias for calling [Builder.income] with `income.orElse(null)`. */ fun income(income: Optional) = income(income.getOrNull()) /** - * The employee's income as reported by the provider. This may not always be annualized - * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what - * information the provider returns. + * Sets [Builder.income] to an arbitrary JSON value. + * + * You should usually call [Builder.income] with a well-typed [Income] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun income(income: JsonField) = apply { body.income(income) } @@ -854,93 +1318,163 @@ private constructor( body.incomeHistory(incomeHistory) } - /** The array of income history. */ + /** Alias for calling [Builder.incomeHistory] with `incomeHistory.orElse(null)`. */ fun incomeHistory(incomeHistory: Optional>) = incomeHistory(incomeHistory.getOrNull()) - /** The array of income history. */ + /** + * Sets [Builder.incomeHistory] to an arbitrary JSON value. + * + * You should usually call [Builder.incomeHistory] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun incomeHistory(incomeHistory: JsonField>) = apply { body.incomeHistory(incomeHistory) } - /** The array of income history. */ + /** + * Adds a single [Income] to [Builder.incomeHistory]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addIncomeHistory(incomeHistory: Income) = apply { body.addIncomeHistory(incomeHistory) } /** `true` if the individual an an active employee or contractor at the company. */ fun isActive(isActive: Boolean?) = apply { body.isActive(isActive) } - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * Alias for [Builder.isActive]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun isActive(isActive: Boolean) = isActive(isActive as Boolean?) - /** `true` if the individual an an active employee or contractor at the company. */ + /** Alias for calling [Builder.isActive] with `isActive.orElse(null)`. */ fun isActive(isActive: Optional) = isActive(isActive.getOrNull()) - /** `true` if the individual an an active employee or contractor at the company. */ + /** + * Sets [Builder.isActive] to an arbitrary JSON value. + * + * You should usually call [Builder.isActive] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun isActive(isActive: JsonField) = apply { body.isActive(isActive) } /** The legal last name of the individual. */ fun lastName(lastName: String?) = apply { body.lastName(lastName) } - /** The legal last name of the individual. */ + /** Alias for calling [Builder.lastName] with `lastName.orElse(null)`. */ fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) - /** The legal last name of the individual. */ + /** + * Sets [Builder.lastName] to an arbitrary JSON value. + * + * You should usually call [Builder.lastName] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun lastName(lastName: JsonField) = apply { body.lastName(lastName) } fun latestRehireDate(latestRehireDate: String?) = apply { body.latestRehireDate(latestRehireDate) } + /** Alias for calling [Builder.latestRehireDate] with `latestRehireDate.orElse(null)`. */ fun latestRehireDate(latestRehireDate: Optional) = latestRehireDate(latestRehireDate.getOrNull()) + /** + * Sets [Builder.latestRehireDate] to an arbitrary JSON value. + * + * You should usually call [Builder.latestRehireDate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun latestRehireDate(latestRehireDate: JsonField) = apply { body.latestRehireDate(latestRehireDate) } fun location(location: Location?) = apply { body.location(location) } + /** Alias for calling [Builder.location] with `location.orElse(null)`. */ fun location(location: Optional) = location(location.getOrNull()) + /** + * Sets [Builder.location] to an arbitrary JSON value. + * + * You should usually call [Builder.location] with a well-typed [Location] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun location(location: JsonField) = apply { body.location(location) } /** The manager object representing the manager of the individual within the org. */ fun manager(manager: Manager?) = apply { body.manager(manager) } - /** The manager object representing the manager of the individual within the org. */ + /** Alias for calling [Builder.manager] with `manager.orElse(null)`. */ fun manager(manager: Optional) = manager(manager.getOrNull()) - /** The manager object representing the manager of the individual within the org. */ + /** + * Sets [Builder.manager] to an arbitrary JSON value. + * + * You should usually call [Builder.manager] with a well-typed [Manager] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun manager(manager: JsonField) = apply { body.manager(manager) } /** The legal middle name of the individual. */ fun middleName(middleName: String?) = apply { body.middleName(middleName) } - /** The legal middle name of the individual. */ + /** Alias for calling [Builder.middleName] with `middleName.orElse(null)`. */ fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) - /** The legal middle name of the individual. */ + /** + * Sets [Builder.middleName] to an arbitrary JSON value. + * + * You should usually call [Builder.middleName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun middleName(middleName: JsonField) = apply { body.middleName(middleName) } /** The source system's unique employment identifier for this individual */ fun sourceId(sourceId: String) = apply { body.sourceId(sourceId) } - /** The source system's unique employment identifier for this individual */ + /** + * Sets [Builder.sourceId] to an arbitrary JSON value. + * + * You should usually call [Builder.sourceId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun sourceId(sourceId: JsonField) = apply { body.sourceId(sourceId) } fun startDate(startDate: String?) = apply { body.startDate(startDate) } + /** Alias for calling [Builder.startDate] with `startDate.orElse(null)`. */ fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) + /** + * Sets [Builder.startDate] to an arbitrary JSON value. + * + * You should usually call [Builder.startDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun startDate(startDate: JsonField) = apply { body.startDate(startDate) } /** The current title of the individual. */ fun title(title: String?) = apply { body.title(title) } - /** The current title of the individual. */ + /** Alias for calling [Builder.title] with `title.orElse(null)`. */ fun title(title: Optional) = title(title.getOrNull()) - /** The current title of the individual. */ + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun title(title: JsonField) = apply { body.title(title) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { @@ -1081,10 +1615,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value + /** + * 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 @JsonAnyGetter @@ -1126,8 +1669,16 @@ private constructor( 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 value(value: JsonValue) = apply { this.value = value } @@ -1184,10 +1735,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The name of the department associated with the individual. */ + /** + * The name of the department associated with the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The name of the department associated with the individual. */ + /** + * 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 @JsonAnyGetter @@ -1228,10 +1788,16 @@ private constructor( /** The name of the department associated with the individual. */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The name of the department associated with the individual. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The name of the department associated with the individual. */ + /** + * 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 { @@ -1290,19 +1856,32 @@ private constructor( /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, * `intern`, `temp`, `seasonal` and `individual_contractor`. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) - /** The main employment type of the individual. */ + /** + * The main employment type of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) /** - * The secondary employment type of the individual. Options: `full_time`, `part_time`, - * `intern`, `temp`, `seasonal` and `individual_contractor`. + * Returns the raw JSON value of [subtype]. + * + * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype - /** The main employment type of the individual. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1349,25 +1928,31 @@ private constructor( */ fun subtype(subtype: Subtype?) = subtype(JsonField.ofNullable(subtype)) - /** - * The secondary employment type of the individual. Options: `full_time`, `part_time`, - * `intern`, `temp`, `seasonal` and `individual_contractor`. - */ + /** Alias for calling [Builder.subtype] with `subtype.orElse(null)`. */ fun subtype(subtype: Optional) = subtype(subtype.getOrNull()) /** - * The secondary employment type of the individual. Options: `full_time`, `part_time`, - * `intern`, `temp`, `seasonal` and `individual_contractor`. + * Sets [Builder.subtype] to an arbitrary JSON value. + * + * You should usually call [Builder.subtype] with a well-typed [Subtype] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun subtype(subtype: JsonField) = apply { this.subtype = subtype } /** The main employment type of the individual. */ fun type(type: Type?) = type(JsonField.ofNullable(type)) - /** The main employment type of the individual. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** The main employment type of the individual. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -1784,10 +2369,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * A stable Finch `id` (UUID v4) for an individual in the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id @JsonAnyGetter @@ -1828,7 +2422,13 @@ private constructor( /** A stable Finch `id` (UUID v4) for an individual in the company. */ fun id(id: String) = id(JsonField.of(id)) - /** A stable Finch `id` (UUID v4) for an individual in the company. */ + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun id(id: JsonField) = apply { this.id = id } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt index b113b362..7a4a5282 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt @@ -35,83 +35,179 @@ private constructor( fun individualId(): String = individualId + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dob(): Optional = body.dob() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun emails(): Optional> = body.emails() /** * Social Security Number of the individual in **encrypted** format. This field is only * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set in * the body. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun encryptedSsn(): Optional = body.encryptedSsn() - /** The EEOC-defined ethnicity of the individual. */ + /** + * The EEOC-defined ethnicity of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun ethnicity(): Optional = body.ethnicity() - /** The legal first name of the individual. */ + /** + * The legal first name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun firstName(): Optional = body.firstName() - /** The gender of the individual. */ + /** + * The gender of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun gender(): Optional = body.gender() - /** The legal last name of the individual. */ + /** + * The legal last name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun lastName(): Optional = body.lastName() - /** The legal middle name of the individual. */ + /** + * The legal middle name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun middleName(): Optional = body.middleName() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun phoneNumbers(): Optional> = body.phoneNumbers() - /** The preferred name of the individual. */ + /** + * The preferred name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun preferredName(): Optional = body.preferredName() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun residence(): Optional = body.residence() /** * Social Security Number of the individual. This field is only available with the `ssn` scope * enabled and the `options: { include: ['ssn'] }` param set in the body. * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun ssn(): Optional = body.ssn() + /** + * Returns the raw JSON value of [dob]. + * + * Unlike [dob], this method doesn't throw if the JSON field has an unexpected type. + */ fun _dob(): JsonField = body._dob() + /** + * Returns the raw JSON value of [emails]. + * + * Unlike [emails], this method doesn't throw if the JSON field has an unexpected type. + */ fun _emails(): JsonField> = body._emails() /** - * Social Security Number of the individual in **encrypted** format. This field is only - * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set in - * the body. + * Returns the raw JSON value of [encryptedSsn]. + * + * Unlike [encryptedSsn], this method doesn't throw if the JSON field has an unexpected type. */ fun _encryptedSsn(): JsonField = body._encryptedSsn() - /** The EEOC-defined ethnicity of the individual. */ + /** + * Returns the raw JSON value of [ethnicity]. + * + * Unlike [ethnicity], this method doesn't throw if the JSON field has an unexpected type. + */ fun _ethnicity(): JsonField = body._ethnicity() - /** The legal first name of the individual. */ + /** + * Returns the raw JSON value of [firstName]. + * + * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected type. + */ fun _firstName(): JsonField = body._firstName() - /** The gender of the individual. */ + /** + * Returns the raw JSON value of [gender]. + * + * Unlike [gender], this method doesn't throw if the JSON field has an unexpected type. + */ fun _gender(): JsonField = body._gender() - /** The legal last name of the individual. */ + /** + * Returns the raw JSON value of [lastName]. + * + * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected type. + */ fun _lastName(): JsonField = body._lastName() - /** The legal middle name of the individual. */ + /** + * Returns the raw JSON value of [middleName]. + * + * Unlike [middleName], this method doesn't throw if the JSON field has an unexpected type. + */ fun _middleName(): JsonField = body._middleName() + /** + * Returns the raw JSON value of [phoneNumbers]. + * + * Unlike [phoneNumbers], this method doesn't throw if the JSON field has an unexpected type. + */ fun _phoneNumbers(): JsonField> = body._phoneNumbers() - /** The preferred name of the individual. */ + /** + * Returns the raw JSON value of [preferredName]. + * + * Unlike [preferredName], this method doesn't throw if the JSON field has an unexpected type. + */ fun _preferredName(): JsonField = body._preferredName() + /** + * Returns the raw JSON value of [residence]. + * + * Unlike [residence], this method doesn't throw if the JSON field has an unexpected type. + */ fun _residence(): JsonField = body._residence() /** - * Social Security Number of the individual. This field is only available with the `ssn` scope - * enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + * Returns the raw JSON value of [ssn]. + * + * Unlike [ssn], this method doesn't throw if the JSON field has an unexpected type. */ fun _ssn(): JsonField = body._ssn() @@ -174,42 +270,91 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun emails(): Optional> = Optional.ofNullable(emails.getNullable("emails")) /** * Social Security Number of the individual in **encrypted** format. This field is only * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set * in the body. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun encryptedSsn(): Optional = Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) - /** The EEOC-defined ethnicity of the individual. */ + /** + * The EEOC-defined ethnicity of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun ethnicity(): Optional = Optional.ofNullable(ethnicity.getNullable("ethnicity")) - /** The legal first name of the individual. */ + /** + * The legal first name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) - /** The gender of the individual. */ + /** + * The gender of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun gender(): Optional = Optional.ofNullable(gender.getNullable("gender")) - /** The legal last name of the individual. */ + /** + * The legal last name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) - /** The legal middle name of the individual. */ + /** + * The legal middle name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun phoneNumbers(): Optional> = Optional.ofNullable(phoneNumbers.getNullable("phone_numbers")) - /** The preferred name of the individual. */ + /** + * The preferred name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun preferredName(): Optional = Optional.ofNullable(preferredName.getNullable("preferred_name")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun residence(): Optional = Optional.ofNullable(residence.getNullable("residence")) @@ -217,56 +362,106 @@ private constructor( * Social Security Number of the individual. This field is only available with the `ssn` * scope enabled and the `options: { include: ['ssn'] }` param set in the body. * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) + /** + * Returns the raw JSON value of [dob]. + * + * Unlike [dob], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("dob") @ExcludeMissing fun _dob(): JsonField = dob + /** + * Returns the raw JSON value of [emails]. + * + * Unlike [emails], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("emails") @ExcludeMissing fun _emails(): JsonField> = emails /** - * Social Security Number of the individual in **encrypted** format. This field is only - * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set - * in the body. + * Returns the raw JSON value of [encryptedSsn]. + * + * Unlike [encryptedSsn], this method doesn't throw if the JSON field has an unexpected + * type. */ @JsonProperty("encrypted_ssn") @ExcludeMissing fun _encryptedSsn(): JsonField = encryptedSsn - /** The EEOC-defined ethnicity of the individual. */ + /** + * Returns the raw JSON value of [ethnicity]. + * + * Unlike [ethnicity], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("ethnicity") @ExcludeMissing fun _ethnicity(): JsonField = ethnicity - /** The legal first name of the individual. */ + /** + * Returns the raw JSON value of [firstName]. + * + * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName - /** The gender of the individual. */ + /** + * Returns the raw JSON value of [gender]. + * + * Unlike [gender], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gender") @ExcludeMissing fun _gender(): JsonField = gender - /** The legal last name of the individual. */ + /** + * Returns the raw JSON value of [lastName]. + * + * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName - /** The legal middle name of the individual. */ + /** + * Returns the raw JSON value of [middleName]. + * + * Unlike [middleName], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("middle_name") @ExcludeMissing fun _middleName(): JsonField = middleName + /** + * Returns the raw JSON value of [phoneNumbers]. + * + * Unlike [phoneNumbers], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("phone_numbers") @ExcludeMissing fun _phoneNumbers(): JsonField> = phoneNumbers - /** The preferred name of the individual. */ + /** + * Returns the raw JSON value of [preferredName]. + * + * Unlike [preferredName], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("preferred_name") @ExcludeMissing fun _preferredName(): JsonField = preferredName + /** + * Returns the raw JSON value of [residence]. + * + * Unlike [residence], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("residence") @ExcludeMissing fun _residence(): JsonField = residence /** - * Social Security Number of the individual. This field is only available with the `ssn` - * scope enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + * Returns the raw JSON value of [ssn]. + * + * Unlike [ssn], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("ssn") @ExcludeMissing fun _ssn(): JsonField = ssn @@ -340,18 +535,39 @@ private constructor( fun dob(dob: String?) = dob(JsonField.ofNullable(dob)) + /** Alias for calling [Builder.dob] with `dob.orElse(null)`. */ fun dob(dob: Optional) = dob(dob.getOrNull()) + /** + * Sets [Builder.dob] to an arbitrary JSON value. + * + * You should usually call [Builder.dob] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun dob(dob: JsonField) = apply { this.dob = dob } fun emails(emails: List?) = emails(JsonField.ofNullable(emails)) + /** Alias for calling [Builder.emails] with `emails.orElse(null)`. */ fun emails(emails: Optional>) = emails(emails.getOrNull()) + /** + * Sets [Builder.emails] to an arbitrary JSON value. + * + * You should usually call [Builder.emails] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun emails(emails: JsonField>) = apply { this.emails = emails.map { it.toMutableList() } } + /** + * Adds a single [Email] to [emails]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEmail(email: Email) = apply { emails = (emails ?: JsonField.of(mutableListOf())).also { @@ -367,18 +583,16 @@ private constructor( fun encryptedSsn(encryptedSsn: String?) = encryptedSsn(JsonField.ofNullable(encryptedSsn)) - /** - * Social Security Number of the individual in **encrypted** format. This field is only - * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param - * set in the body. - */ + /** Alias for calling [Builder.encryptedSsn] with `encryptedSsn.orElse(null)`. */ fun encryptedSsn(encryptedSsn: Optional) = encryptedSsn(encryptedSsn.getOrNull()) /** - * Social Security Number of the individual in **encrypted** format. This field is only - * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param - * set in the body. + * Sets [Builder.encryptedSsn] to an arbitrary JSON value. + * + * You should usually call [Builder.encryptedSsn] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun encryptedSsn(encryptedSsn: JsonField) = apply { this.encryptedSsn = encryptedSsn @@ -387,58 +601,101 @@ private constructor( /** The EEOC-defined ethnicity of the individual. */ fun ethnicity(ethnicity: Ethnicity?) = ethnicity(JsonField.ofNullable(ethnicity)) - /** The EEOC-defined ethnicity of the individual. */ + /** Alias for calling [Builder.ethnicity] with `ethnicity.orElse(null)`. */ fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.getOrNull()) - /** The EEOC-defined ethnicity of the individual. */ + /** + * Sets [Builder.ethnicity] to an arbitrary JSON value. + * + * You should usually call [Builder.ethnicity] with a well-typed [Ethnicity] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun ethnicity(ethnicity: JsonField) = apply { this.ethnicity = ethnicity } /** The legal first name of the individual. */ fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) - /** The legal first name of the individual. */ + /** Alias for calling [Builder.firstName] with `firstName.orElse(null)`. */ fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) - /** The legal first name of the individual. */ + /** + * Sets [Builder.firstName] to an arbitrary JSON value. + * + * You should usually call [Builder.firstName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun firstName(firstName: JsonField) = apply { this.firstName = firstName } /** The gender of the individual. */ fun gender(gender: Gender?) = gender(JsonField.ofNullable(gender)) - /** The gender of the individual. */ + /** Alias for calling [Builder.gender] with `gender.orElse(null)`. */ fun gender(gender: Optional) = gender(gender.getOrNull()) - /** The gender of the individual. */ + /** + * Sets [Builder.gender] to an arbitrary JSON value. + * + * You should usually call [Builder.gender] with a well-typed [Gender] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun gender(gender: JsonField) = apply { this.gender = gender } /** The legal last name of the individual. */ fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) - /** The legal last name of the individual. */ + /** Alias for calling [Builder.lastName] with `lastName.orElse(null)`. */ fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) - /** The legal last name of the individual. */ + /** + * Sets [Builder.lastName] to an arbitrary JSON value. + * + * You should usually call [Builder.lastName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun lastName(lastName: JsonField) = apply { this.lastName = lastName } /** The legal middle name of the individual. */ fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) - /** The legal middle name of the individual. */ + /** Alias for calling [Builder.middleName] with `middleName.orElse(null)`. */ fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) - /** The legal middle name of the individual. */ + /** + * Sets [Builder.middleName] to an arbitrary JSON value. + * + * You should usually call [Builder.middleName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun middleName(middleName: JsonField) = apply { this.middleName = middleName } fun phoneNumbers(phoneNumbers: List?) = phoneNumbers(JsonField.ofNullable(phoneNumbers)) + /** Alias for calling [Builder.phoneNumbers] with `phoneNumbers.orElse(null)`. */ fun phoneNumbers(phoneNumbers: Optional>) = phoneNumbers(phoneNumbers.getOrNull()) + /** + * Sets [Builder.phoneNumbers] to an arbitrary JSON value. + * + * You should usually call [Builder.phoneNumbers] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun phoneNumbers(phoneNumbers: JsonField>) = apply { this.phoneNumbers = phoneNumbers.map { it.toMutableList() } } + /** + * Adds a single [PhoneNumber] to [phoneNumbers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addPhoneNumber(phoneNumber: PhoneNumber) = apply { phoneNumbers = (phoneNumbers ?: JsonField.of(mutableListOf())).also { @@ -450,19 +707,33 @@ private constructor( fun preferredName(preferredName: String?) = preferredName(JsonField.ofNullable(preferredName)) - /** The preferred name of the individual. */ + /** Alias for calling [Builder.preferredName] with `preferredName.orElse(null)`. */ fun preferredName(preferredName: Optional) = preferredName(preferredName.getOrNull()) - /** The preferred name of the individual. */ + /** + * Sets [Builder.preferredName] to an arbitrary JSON value. + * + * You should usually call [Builder.preferredName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun preferredName(preferredName: JsonField) = apply { this.preferredName = preferredName } fun residence(residence: Location?) = residence(JsonField.ofNullable(residence)) + /** Alias for calling [Builder.residence] with `residence.orElse(null)`. */ fun residence(residence: Optional) = residence(residence.getOrNull()) + /** + * Sets [Builder.residence] to an arbitrary JSON value. + * + * You should usually call [Builder.residence] with a well-typed [Location] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun residence(residence: JsonField) = apply { this.residence = residence } /** @@ -472,17 +743,15 @@ private constructor( */ fun ssn(ssn: String?) = ssn(JsonField.ofNullable(ssn)) - /** - * Social Security Number of the individual. This field is only available with the `ssn` - * scope enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). - */ + /** Alias for calling [Builder.ssn] with `ssn.orElse(null)`. */ fun ssn(ssn: Optional) = ssn(ssn.getOrNull()) /** - * Social Security Number of the individual. This field is only available with the `ssn` - * scope enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + * Sets [Builder.ssn] to an arbitrary JSON value. + * + * You should usually call [Builder.ssn] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun ssn(ssn: JsonField) = apply { this.ssn = ssn } @@ -578,16 +847,36 @@ private constructor( fun dob(dob: String?) = apply { body.dob(dob) } + /** Alias for calling [Builder.dob] with `dob.orElse(null)`. */ fun dob(dob: Optional) = dob(dob.getOrNull()) + /** + * Sets [Builder.dob] to an arbitrary JSON value. + * + * You should usually call [Builder.dob] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun dob(dob: JsonField) = apply { body.dob(dob) } fun emails(emails: List?) = apply { body.emails(emails) } + /** Alias for calling [Builder.emails] with `emails.orElse(null)`. */ fun emails(emails: Optional>) = emails(emails.getOrNull()) + /** + * Sets [Builder.emails] to an arbitrary JSON value. + * + * You should usually call [Builder.emails] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun emails(emails: JsonField>) = apply { body.emails(emails) } + /** + * Adds a single [Email] to [emails]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEmail(email: Email) = apply { body.addEmail(email) } /** @@ -597,17 +886,15 @@ private constructor( */ fun encryptedSsn(encryptedSsn: String?) = apply { body.encryptedSsn(encryptedSsn) } - /** - * Social Security Number of the individual in **encrypted** format. This field is only - * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set - * in the body. - */ + /** Alias for calling [Builder.encryptedSsn] with `encryptedSsn.orElse(null)`. */ fun encryptedSsn(encryptedSsn: Optional) = encryptedSsn(encryptedSsn.getOrNull()) /** - * Social Security Number of the individual in **encrypted** format. This field is only - * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set - * in the body. + * Sets [Builder.encryptedSsn] to an arbitrary JSON value. + * + * You should usually call [Builder.encryptedSsn] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ fun encryptedSsn(encryptedSsn: JsonField) = apply { body.encryptedSsn(encryptedSsn) @@ -616,77 +903,132 @@ private constructor( /** The EEOC-defined ethnicity of the individual. */ fun ethnicity(ethnicity: Ethnicity?) = apply { body.ethnicity(ethnicity) } - /** The EEOC-defined ethnicity of the individual. */ + /** Alias for calling [Builder.ethnicity] with `ethnicity.orElse(null)`. */ fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.getOrNull()) - /** The EEOC-defined ethnicity of the individual. */ + /** + * Sets [Builder.ethnicity] to an arbitrary JSON value. + * + * You should usually call [Builder.ethnicity] with a well-typed [Ethnicity] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun ethnicity(ethnicity: JsonField) = apply { body.ethnicity(ethnicity) } /** The legal first name of the individual. */ fun firstName(firstName: String?) = apply { body.firstName(firstName) } - /** The legal first name of the individual. */ + /** Alias for calling [Builder.firstName] with `firstName.orElse(null)`. */ fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) - /** The legal first name of the individual. */ + /** + * Sets [Builder.firstName] to an arbitrary JSON value. + * + * You should usually call [Builder.firstName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun firstName(firstName: JsonField) = apply { body.firstName(firstName) } /** The gender of the individual. */ fun gender(gender: Gender?) = apply { body.gender(gender) } - /** The gender of the individual. */ + /** Alias for calling [Builder.gender] with `gender.orElse(null)`. */ fun gender(gender: Optional) = gender(gender.getOrNull()) - /** The gender of the individual. */ + /** + * Sets [Builder.gender] to an arbitrary JSON value. + * + * You should usually call [Builder.gender] with a well-typed [Gender] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun gender(gender: JsonField) = apply { body.gender(gender) } /** The legal last name of the individual. */ fun lastName(lastName: String?) = apply { body.lastName(lastName) } - /** The legal last name of the individual. */ + /** Alias for calling [Builder.lastName] with `lastName.orElse(null)`. */ fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) - /** The legal last name of the individual. */ + /** + * Sets [Builder.lastName] to an arbitrary JSON value. + * + * You should usually call [Builder.lastName] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun lastName(lastName: JsonField) = apply { body.lastName(lastName) } /** The legal middle name of the individual. */ fun middleName(middleName: String?) = apply { body.middleName(middleName) } - /** The legal middle name of the individual. */ + /** Alias for calling [Builder.middleName] with `middleName.orElse(null)`. */ fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) - /** The legal middle name of the individual. */ + /** + * Sets [Builder.middleName] to an arbitrary JSON value. + * + * You should usually call [Builder.middleName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun middleName(middleName: JsonField) = apply { body.middleName(middleName) } fun phoneNumbers(phoneNumbers: List?) = apply { body.phoneNumbers(phoneNumbers) } + /** Alias for calling [Builder.phoneNumbers] with `phoneNumbers.orElse(null)`. */ fun phoneNumbers(phoneNumbers: Optional>) = phoneNumbers(phoneNumbers.getOrNull()) + /** + * Sets [Builder.phoneNumbers] to an arbitrary JSON value. + * + * You should usually call [Builder.phoneNumbers] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun phoneNumbers(phoneNumbers: JsonField>) = apply { body.phoneNumbers(phoneNumbers) } + /** + * Adds a single [PhoneNumber] to [phoneNumbers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addPhoneNumber(phoneNumber: PhoneNumber) = apply { body.addPhoneNumber(phoneNumber) } /** The preferred name of the individual. */ fun preferredName(preferredName: String?) = apply { body.preferredName(preferredName) } - /** The preferred name of the individual. */ + /** Alias for calling [Builder.preferredName] with `preferredName.orElse(null)`. */ fun preferredName(preferredName: Optional) = preferredName(preferredName.getOrNull()) - /** The preferred name of the individual. */ + /** + * Sets [Builder.preferredName] to an arbitrary JSON value. + * + * You should usually call [Builder.preferredName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun preferredName(preferredName: JsonField) = apply { body.preferredName(preferredName) } fun residence(residence: Location?) = apply { body.residence(residence) } + /** Alias for calling [Builder.residence] with `residence.orElse(null)`. */ fun residence(residence: Optional) = residence(residence.getOrNull()) + /** + * Sets [Builder.residence] to an arbitrary JSON value. + * + * You should usually call [Builder.residence] with a well-typed [Location] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun residence(residence: JsonField) = apply { body.residence(residence) } /** @@ -696,17 +1038,14 @@ private constructor( */ fun ssn(ssn: String?) = apply { body.ssn(ssn) } - /** - * Social Security Number of the individual. This field is only available with the `ssn` - * scope enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). - */ + /** Alias for calling [Builder.ssn] with `ssn.orElse(null)`. */ fun ssn(ssn: Optional) = ssn(ssn.getOrNull()) /** - * Social Security Number of the individual. This field is only available with the `ssn` - * scope enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + * Sets [Builder.ssn] to an arbitrary JSON value. + * + * You should usually call [Builder.ssn] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ fun ssn(ssn: JsonField) = apply { body.ssn(ssn) } @@ -848,12 +1187,30 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -896,12 +1253,27 @@ private constructor( fun data(data: String) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun data(data: JsonField) = apply { this.data = data } fun type(type: Type?) = type(JsonField.ofNullable(type)) + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -1303,12 +1675,30 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1351,12 +1741,27 @@ private constructor( fun data(data: String) = data(JsonField.of(data)) + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun data(data: JsonField) = apply { this.data = data } fun type(type: Type?) = type(JsonField.ofNullable(type)) + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt index 1201b900..bd9a488f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt @@ -29,14 +29,33 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @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 completionStatus(): CompletionStatus = completionStatus.getRequired("completion_status") + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly + * missing or null (e.g. if the server responded with an unexpected value). + */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [completionStatus]. + * + * Unlike [completionStatus], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("completion_status") @ExcludeMissing fun _completionStatus(): JsonField = completionStatus + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -88,12 +107,25 @@ private constructor( fun completionStatus(completionStatus: CompletionStatus) = completionStatus(JsonField.of(completionStatus)) + /** + * Sets [Builder.completionStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.completionStatus] with a well-typed [CompletionStatus] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun completionStatus(completionStatus: JsonField) = apply { this.completionStatus = completionStatus } fun type(type: Type) = type(JsonField.of(type)) + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt index b19cd615..f3dd5452 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt @@ -29,10 +29,19 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** The type of job to start. Currently the only supported type is `data_sync_all` */ + /** + * The type of job to start. Currently the only supported type is `data_sync_all` + * + * @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 type(): Type = body.type() - /** The type of job to start. Currently the only supported type is `data_sync_all` */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ fun _type(): JsonField = body._type() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -56,10 +65,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The type of job to start. Currently the only supported type is `data_sync_all` */ + /** + * The type of job to start. Currently the only supported type is `data_sync_all` + * + * @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 type(): Type = type.getRequired("type") - /** The type of job to start. Currently the only supported type is `data_sync_all` */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -107,7 +125,13 @@ private constructor( /** The type of job to start. Currently the only supported type is `data_sync_all` */ fun type(type: Type) = type(JsonField.of(type)) - /** The type of job to start. Currently the only supported type is `data_sync_all` */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -183,7 +207,12 @@ private constructor( /** The type of job to start. Currently the only supported type is `data_sync_all` */ fun type(type: Type) = apply { body.type(type) } - /** The type of job to start. Currently the only supported type is `data_sync_all` */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { body.type(type) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt index c7f61bfb..eb63bcab 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt @@ -31,16 +31,43 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun endDate(): Optional = body.endDate() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun payStatements(): Optional> = body.payStatements() + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun startDate(): Optional = body.startDate() + /** + * Returns the raw JSON value of [endDate]. + * + * Unlike [endDate], this method doesn't throw if the JSON field has an unexpected type. + */ fun _endDate(): JsonField = body._endDate() + /** + * Returns the raw JSON value of [payStatements]. + * + * Unlike [payStatements], this method doesn't throw if the JSON field has an unexpected type. + */ fun _payStatements(): JsonField> = body._payStatements() + /** + * Returns the raw JSON value of [startDate]. + * + * Unlike [startDate], this method doesn't throw if the JSON field has an unexpected type. + */ fun _startDate(): JsonField = body._startDate() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -76,19 +103,47 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun payStatements(): Optional> = Optional.ofNullable(payStatements.getNullable("pay_statements")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) + /** + * Returns the raw JSON value of [endDate]. + * + * Unlike [endDate], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("end_date") @ExcludeMissing fun _endDate(): JsonField = endDate + /** + * Returns the raw JSON value of [payStatements]. + * + * Unlike [payStatements], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("pay_statements") @ExcludeMissing fun _payStatements(): JsonField> = payStatements + /** + * Returns the raw JSON value of [startDate]. + * + * Unlike [startDate], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("start_date") @ExcludeMissing fun _startDate(): JsonField = startDate @JsonAnyGetter @@ -134,15 +189,34 @@ private constructor( fun endDate(endDate: String) = endDate(JsonField.of(endDate)) + /** + * Sets [Builder.endDate] to an arbitrary JSON value. + * + * You should usually call [Builder.endDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } fun payStatements(payStatements: List) = payStatements(JsonField.of(payStatements)) + /** + * Sets [Builder.payStatements] to an arbitrary JSON value. + * + * You should usually call [Builder.payStatements] with a well-typed + * `List` value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun payStatements(payStatements: JsonField>) = apply { this.payStatements = payStatements.map { it.toMutableList() } } + /** + * Adds a single [PayStatement] to [payStatements]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addPayStatement(payStatement: PayStatement) = apply { payStatements = (payStatements ?: JsonField.of(mutableListOf())).also { @@ -152,6 +226,13 @@ private constructor( fun startDate(startDate: String) = startDate(JsonField.of(startDate)) + /** + * Sets [Builder.startDate] to an arbitrary JSON value. + * + * You should usually call [Builder.startDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun startDate(startDate: JsonField) = apply { this.startDate = startDate } fun additionalProperties(additionalProperties: Map) = apply { @@ -229,22 +310,47 @@ private constructor( fun endDate(endDate: String) = apply { body.endDate(endDate) } + /** + * Sets [Builder.endDate] to an arbitrary JSON value. + * + * You should usually call [Builder.endDate] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun endDate(endDate: JsonField) = apply { body.endDate(endDate) } fun payStatements(payStatements: List) = apply { body.payStatements(payStatements) } + /** + * Sets [Builder.payStatements] to an arbitrary JSON value. + * + * You should usually call [Builder.payStatements] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun payStatements(payStatements: JsonField>) = apply { body.payStatements(payStatements) } + /** + * Adds a single [PayStatement] to [payStatements]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addPayStatement(payStatement: PayStatement) = apply { body.addPayStatement(payStatement) } fun startDate(startDate: String) = apply { body.startDate(startDate) } + /** + * Sets [Builder.startDate] to an arbitrary JSON value. + * + * You should usually call [Builder.startDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun startDate(startDate: JsonField) = apply { body.startDate(startDate) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { @@ -409,76 +515,170 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The array of earnings objects associated with this pay statement */ + /** + * The array of earnings objects associated with this pay statement + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun earnings(): Optional> = Optional.ofNullable(earnings.getNullable("earnings")) - /** The array of deductions objects associated with this pay statement. */ + /** + * The array of deductions objects associated with this pay statement. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun employeeDeductions(): Optional> = Optional.ofNullable(employeeDeductions.getNullable("employee_deductions")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun employerContributions(): Optional> = Optional.ofNullable(employerContributions.getNullable("employer_contributions")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun grossPay(): Optional = Optional.ofNullable(grossPay.getNullable("gross_pay")) - /** A stable Finch `id` (UUID v4) for an individual in the company */ + /** + * A stable Finch `id` (UUID v4) for an individual in the company + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("individual_id")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun netPay(): Optional = Optional.ofNullable(netPay.getNullable("net_pay")) - /** The payment method. */ + /** + * The payment method. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun paymentMethod(): Optional = Optional.ofNullable(paymentMethod.getNullable("payment_method")) - /** The array of taxes objects associated with this pay statement. */ + /** + * The array of taxes objects associated with this pay statement. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun taxes(): Optional> = Optional.ofNullable(taxes.getNullable("taxes")) - /** The number of hours worked for this pay period */ + /** + * The number of hours worked for this pay period + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun totalHours(): Optional = Optional.ofNullable(totalHours.getNullable("total_hours")) - /** The type of the payment associated with the pay statement. */ + /** + * The type of the payment associated with the pay statement. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** The array of earnings objects associated with this pay statement */ + /** + * Returns the raw JSON value of [earnings]. + * + * Unlike [earnings], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("earnings") @ExcludeMissing fun _earnings(): JsonField> = earnings - /** The array of deductions objects associated with this pay statement. */ + /** + * Returns the raw JSON value of [employeeDeductions]. + * + * Unlike [employeeDeductions], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("employee_deductions") @ExcludeMissing fun _employeeDeductions(): JsonField> = employeeDeductions + /** + * Returns the raw JSON value of [employerContributions]. + * + * Unlike [employerContributions], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("employer_contributions") @ExcludeMissing fun _employerContributions(): JsonField> = employerContributions + /** + * Returns the raw JSON value of [grossPay]. + * + * Unlike [grossPay], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("gross_pay") @ExcludeMissing fun _grossPay(): JsonField = grossPay - /** A stable Finch `id` (UUID v4) for an individual in the company */ + /** + * 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 + /** + * Returns the raw JSON value of [netPay]. + * + * Unlike [netPay], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("net_pay") @ExcludeMissing fun _netPay(): JsonField = netPay - /** The payment method. */ + /** + * Returns the raw JSON value of [paymentMethod]. + * + * Unlike [paymentMethod], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("payment_method") @ExcludeMissing fun _paymentMethod(): JsonField = paymentMethod - /** The array of taxes objects associated with this pay statement. */ + /** + * Returns the raw JSON value of [taxes]. + * + * Unlike [taxes], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("taxes") @ExcludeMissing fun _taxes(): JsonField> = taxes - /** The number of hours worked for this pay period */ + /** + * Returns the raw JSON value of [totalHours]. + * + * Unlike [totalHours], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("total_hours") @ExcludeMissing fun _totalHours(): JsonField = totalHours - /** The type of the payment associated with the pay statement. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -547,15 +747,25 @@ private constructor( /** The array of earnings objects associated with this pay statement */ fun earnings(earnings: List?) = earnings(JsonField.ofNullable(earnings)) - /** The array of earnings objects associated with this pay statement */ + /** Alias for calling [Builder.earnings] with `earnings.orElse(null)`. */ fun earnings(earnings: Optional>) = earnings(earnings.getOrNull()) - /** The array of earnings objects associated with this pay statement */ + /** + * Sets [Builder.earnings] to an arbitrary JSON value. + * + * You should usually call [Builder.earnings] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun earnings(earnings: JsonField>) = apply { this.earnings = earnings.map { it.toMutableList() } } - /** The array of earnings objects associated with this pay statement */ + /** + * Adds a single [Earning] to [earnings]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEarning(earning: Earning) = apply { earnings = (earnings ?: JsonField.of(mutableListOf())).also { @@ -567,17 +777,30 @@ private constructor( fun employeeDeductions(employeeDeductions: List?) = employeeDeductions(JsonField.ofNullable(employeeDeductions)) - /** The array of deductions objects associated with this pay statement. */ + /** + * Alias for calling [Builder.employeeDeductions] with + * `employeeDeductions.orElse(null)`. + */ fun employeeDeductions(employeeDeductions: Optional>) = employeeDeductions(employeeDeductions.getOrNull()) - /** The array of deductions objects associated with this pay statement. */ + /** + * Sets [Builder.employeeDeductions] to an arbitrary JSON value. + * + * You should usually call [Builder.employeeDeductions] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun employeeDeductions(employeeDeductions: JsonField>) = apply { this.employeeDeductions = employeeDeductions.map { it.toMutableList() } } - /** The array of deductions objects associated with this pay statement. */ + /** + * Adds a single [EmployeeDeduction] to [employeeDeductions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEmployeeDeduction(employeeDeduction: EmployeeDeduction) = apply { employeeDeductions = (employeeDeductions ?: JsonField.of(mutableListOf())).also { @@ -588,16 +811,32 @@ private constructor( fun employerContributions(employerContributions: List?) = employerContributions(JsonField.ofNullable(employerContributions)) + /** + * Alias for calling [Builder.employerContributions] with + * `employerContributions.orElse(null)`. + */ fun employerContributions( employerContributions: Optional> ) = employerContributions(employerContributions.getOrNull()) + /** + * Sets [Builder.employerContributions] to an arbitrary JSON value. + * + * You should usually call [Builder.employerContributions] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ fun employerContributions( employerContributions: JsonField> ) = apply { this.employerContributions = employerContributions.map { it.toMutableList() } } + /** + * Adds a single [EmployerContribution] to [employerContributions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addEmployerContribution(employerContribution: EmployerContribution) = apply { employerContributions = (employerContributions ?: JsonField.of(mutableListOf())).also { @@ -607,33 +846,61 @@ private constructor( fun grossPay(grossPay: Money?) = grossPay(JsonField.ofNullable(grossPay)) + /** Alias for calling [Builder.grossPay] with `grossPay.orElse(null)`. */ fun grossPay(grossPay: Optional) = grossPay(grossPay.getOrNull()) + /** + * Sets [Builder.grossPay] to an arbitrary JSON value. + * + * You should usually call [Builder.grossPay] with a well-typed [Money] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun grossPay(grossPay: JsonField) = apply { this.grossPay = grossPay } /** A stable Finch `id` (UUID v4) for an individual in the company */ fun individualId(individualId: String) = individualId(JsonField.of(individualId)) - /** A stable Finch `id` (UUID v4) for an individual in the company */ + /** + * 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 netPay(netPay: Money?) = netPay(JsonField.ofNullable(netPay)) + /** Alias for calling [Builder.netPay] with `netPay.orElse(null)`. */ fun netPay(netPay: Optional) = netPay(netPay.getOrNull()) + /** + * Sets [Builder.netPay] to an arbitrary JSON value. + * + * You should usually call [Builder.netPay] with a well-typed [Money] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun netPay(netPay: JsonField) = apply { this.netPay = netPay } /** The payment method. */ fun paymentMethod(paymentMethod: PaymentMethod?) = paymentMethod(JsonField.ofNullable(paymentMethod)) - /** The payment method. */ + /** Alias for calling [Builder.paymentMethod] with `paymentMethod.orElse(null)`. */ fun paymentMethod(paymentMethod: Optional) = paymentMethod(paymentMethod.getOrNull()) - /** The payment method. */ + /** + * Sets [Builder.paymentMethod] to an arbitrary JSON value. + * + * You should usually call [Builder.paymentMethod] with a well-typed [PaymentMethod] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun paymentMethod(paymentMethod: JsonField) = apply { this.paymentMethod = paymentMethod } @@ -641,15 +908,25 @@ private constructor( /** The array of taxes objects associated with this pay statement. */ fun taxes(taxes: List?) = taxes(JsonField.ofNullable(taxes)) - /** The array of taxes objects associated with this pay statement. */ + /** Alias for calling [Builder.taxes] with `taxes.orElse(null)`. */ fun taxes(taxes: Optional>) = taxes(taxes.getOrNull()) - /** The array of taxes objects associated with this pay statement. */ + /** + * Sets [Builder.taxes] to an arbitrary JSON value. + * + * You should usually call [Builder.taxes] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun taxes(taxes: JsonField>) = apply { this.taxes = taxes.map { it.toMutableList() } } - /** The array of taxes objects associated with this pay statement. */ + /** + * Adds a single [Tax] to [taxes]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ fun addTax(tax: Tax) = apply { taxes = (taxes ?: JsonField.of(mutableListOf())).also { @@ -660,22 +937,38 @@ private constructor( /** The number of hours worked for this pay period */ fun totalHours(totalHours: Double?) = totalHours(JsonField.ofNullable(totalHours)) - /** The number of hours worked for this pay period */ + /** + * Alias for [Builder.totalHours]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun totalHours(totalHours: Double) = totalHours(totalHours as Double?) - /** The number of hours worked for this pay period */ + /** Alias for calling [Builder.totalHours] with `totalHours.orElse(null)`. */ fun totalHours(totalHours: Optional) = totalHours(totalHours.getOrNull()) - /** The number of hours worked for this pay period */ + /** + * Sets [Builder.totalHours] to an arbitrary JSON value. + * + * You should usually call [Builder.totalHours] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun totalHours(totalHours: JsonField) = apply { this.totalHours = totalHours } /** The type of the payment associated with the pay statement. */ fun type(type: Type?) = type(JsonField.ofNullable(type)) - /** The type of the payment associated with the pay statement. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** The type of the payment associated with the pay statement. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -739,47 +1032,98 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The earnings amount in cents. */ + /** + * The earnings amount in cents. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun attributes(): Optional = Optional.ofNullable(attributes.getNullable("attributes")) - /** The earnings currency code. */ + /** + * The earnings currency code. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) /** * The number of hours associated with this earning. (For salaried employees, this could * be hours per pay period, `0` or `null`, depending on the provider). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ fun hours(): Optional = Optional.ofNullable(hours.getNullable("hours")) - /** The exact name of the deduction from the pay statement. */ + /** + * The exact name of the deduction from the pay statement. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The type of earning. */ + /** + * The type of earning. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** The earnings amount in cents. */ + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [attributes]. + * + * Unlike [attributes], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("attributes") @ExcludeMissing fun _attributes(): JsonField = attributes - /** The earnings currency code. */ + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency /** - * The number of hours associated with this earning. (For salaried employees, this could - * be hours per pay period, `0` or `null`, depending on the provider). + * Returns the raw JSON value of [hours]. + * + * Unlike [hours], this method doesn't throw if the JSON field has an unexpected type. */ @JsonProperty("hours") @ExcludeMissing fun _hours(): JsonField = hours - /** The exact name of the deduction from the pay statement. */ + /** + * 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 - /** The type of earning. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -835,21 +1179,39 @@ private constructor( /** The earnings amount in cents. */ fun amount(amount: Long?) = amount(JsonField.ofNullable(amount)) - /** The earnings amount in cents. */ + /** + * Alias for [Builder.amount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun amount(amount: Long) = amount(amount as Long?) - /** The earnings amount in cents. */ + /** Alias for calling [Builder.amount] with `amount.orElse(null)`. */ fun amount(amount: Optional) = amount(amount.getOrNull()) - /** The earnings amount in cents. */ + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } fun attributes(attributes: Attributes?) = attributes(JsonField.ofNullable(attributes)) + /** Alias for calling [Builder.attributes] with `attributes.orElse(null)`. */ fun attributes(attributes: Optional) = attributes(attributes.getOrNull()) + /** + * Sets [Builder.attributes] to an arbitrary JSON value. + * + * You should usually call [Builder.attributes] with a well-typed [Attributes] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun attributes(attributes: JsonField) = apply { this.attributes = attributes } @@ -857,10 +1219,16 @@ private constructor( /** The earnings currency code. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) - /** The earnings currency code. */ + /** Alias for calling [Builder.currency] with `currency.orElse(null)`. */ fun currency(currency: Optional) = currency(currency.getOrNull()) - /** The earnings currency code. */ + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } /** @@ -870,39 +1238,52 @@ private constructor( fun hours(hours: Double?) = hours(JsonField.ofNullable(hours)) /** - * The number of hours associated with this earning. (For salaried employees, this - * could be hours per pay period, `0` or `null`, depending on the provider). + * Alias for [Builder.hours]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun hours(hours: Double) = hours(hours as Double?) - /** - * The number of hours associated with this earning. (For salaried employees, this - * could be hours per pay period, `0` or `null`, depending on the provider). - */ + /** Alias for calling [Builder.hours] with `hours.orElse(null)`. */ fun hours(hours: Optional) = hours(hours.getOrNull()) /** - * The number of hours associated with this earning. (For salaried employees, this - * could be hours per pay period, `0` or `null`, depending on the provider). + * Sets [Builder.hours] to an arbitrary JSON value. + * + * You should usually call [Builder.hours] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ fun hours(hours: JsonField) = apply { this.hours = hours } /** The exact name of the deduction from the pay statement. */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The exact name of the deduction from the pay statement. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The exact name of the deduction from the pay statement. */ + /** + * 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 } /** The type of earning. */ fun type(type: Type?) = type(JsonField.ofNullable(type)) - /** The type of earning. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** The type of earning. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -950,9 +1331,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata @@ -994,6 +1385,13 @@ private constructor( fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { @@ -1037,14 +1435,18 @@ private constructor( * The metadata to be attached to the entity by existing rules. It is a * key-value pairs where the values can be of any type (string, number, boolean, * object, array, etc.). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, boolean, - * object, array, etc.). + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("metadata") @ExcludeMissing @@ -1094,9 +1496,11 @@ private constructor( fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, - * boolean, object, array, etc.). + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed + * [InnerMetadata] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata @@ -1473,41 +1877,97 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The deduction amount in cents. */ + /** + * The deduction amount in cents. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun attributes(): Optional = Optional.ofNullable(attributes.getNullable("attributes")) - /** The deduction currency. */ + /** + * The deduction currency. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - /** The deduction name from the pay statement. */ + /** + * The deduction name from the pay statement. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** Boolean indicating if the deduction is pre-tax. */ + /** + * Boolean indicating if the deduction is pre-tax. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun preTax(): Optional = Optional.ofNullable(preTax.getNullable("pre_tax")) - /** Type of benefit. */ + /** + * Type of benefit. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** The deduction amount in cents. */ + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [attributes]. + * + * Unlike [attributes], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("attributes") @ExcludeMissing fun _attributes(): JsonField = attributes - /** The deduction currency. */ + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** The deduction name from the pay statement. */ + /** + * 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 - /** Boolean indicating if the deduction is pre-tax. */ + /** + * Returns the raw JSON value of [preTax]. + * + * Unlike [preTax], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("pre_tax") @ExcludeMissing fun _preTax(): JsonField = preTax - /** Type of benefit. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -1565,21 +2025,39 @@ private constructor( /** The deduction amount in cents. */ fun amount(amount: Long?) = amount(JsonField.ofNullable(amount)) - /** The deduction amount in cents. */ + /** + * Alias for [Builder.amount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun amount(amount: Long) = amount(amount as Long?) - /** The deduction amount in cents. */ + /** Alias for calling [Builder.amount] with `amount.orElse(null)`. */ fun amount(amount: Optional) = amount(amount.getOrNull()) - /** The deduction amount in cents. */ + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } fun attributes(attributes: Attributes?) = attributes(JsonField.ofNullable(attributes)) + /** Alias for calling [Builder.attributes] with `attributes.orElse(null)`. */ fun attributes(attributes: Optional) = attributes(attributes.getOrNull()) + /** + * Sets [Builder.attributes] to an arbitrary JSON value. + * + * You should usually call [Builder.attributes] with a well-typed [Attributes] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun attributes(attributes: JsonField) = apply { this.attributes = attributes } @@ -1587,40 +2065,68 @@ private constructor( /** The deduction currency. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) - /** The deduction currency. */ + /** Alias for calling [Builder.currency] with `currency.orElse(null)`. */ fun currency(currency: Optional) = currency(currency.getOrNull()) - /** The deduction currency. */ + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } /** The deduction name from the pay statement. */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The deduction name from the pay statement. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The deduction name from the pay statement. */ + /** + * 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 } /** Boolean indicating if the deduction is pre-tax. */ fun preTax(preTax: Boolean?) = preTax(JsonField.ofNullable(preTax)) - /** Boolean indicating if the deduction is pre-tax. */ + /** + * Alias for [Builder.preTax]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun preTax(preTax: Boolean) = preTax(preTax as Boolean?) - /** Boolean indicating if the deduction is pre-tax. */ + /** Alias for calling [Builder.preTax] with `preTax.orElse(null)`. */ fun preTax(preTax: Optional) = preTax(preTax.getOrNull()) - /** Boolean indicating if the deduction is pre-tax. */ + /** + * Sets [Builder.preTax] to an arbitrary JSON value. + * + * You should usually call [Builder.preTax] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun preTax(preTax: JsonField) = apply { this.preTax = preTax } /** Type of benefit. */ fun type(type: BenefitType?) = type(JsonField.ofNullable(type)) - /** Type of benefit. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** Type of benefit. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [BenefitType] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -1668,9 +2174,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata @@ -1712,6 +2228,13 @@ private constructor( fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { @@ -1755,14 +2278,18 @@ private constructor( * The metadata to be attached to the entity by existing rules. It is a * key-value pairs where the values can be of any type (string, number, boolean, * object, array, etc.). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, boolean, - * object, array, etc.). + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("metadata") @ExcludeMissing @@ -1812,9 +2339,11 @@ private constructor( fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, - * boolean, object, array, etc.). + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed + * [InnerMetadata] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata @@ -2018,35 +2547,82 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The contribution amount in cents. */ + /** + * The contribution amount in cents. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun attributes(): Optional = Optional.ofNullable(attributes.getNullable("attributes")) - /** The contribution currency. */ + /** + * The contribution currency. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - /** The contribution name from the pay statement. */ + /** + * The contribution name from the pay statement. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** Type of benefit. */ + /** + * Type of benefit. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** The contribution amount in cents. */ + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [attributes]. + * + * Unlike [attributes], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("attributes") @ExcludeMissing fun _attributes(): JsonField = attributes - /** The contribution currency. */ + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** The contribution name from the pay statement. */ + /** + * 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 - /** Type of benefit. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -2101,21 +2677,39 @@ private constructor( /** The contribution amount in cents. */ fun amount(amount: Long?) = amount(JsonField.ofNullable(amount)) - /** The contribution amount in cents. */ + /** + * Alias for [Builder.amount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun amount(amount: Long) = amount(amount as Long?) - /** The contribution amount in cents. */ + /** Alias for calling [Builder.amount] with `amount.orElse(null)`. */ fun amount(amount: Optional) = amount(amount.getOrNull()) - /** The contribution amount in cents. */ + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } fun attributes(attributes: Attributes?) = attributes(JsonField.ofNullable(attributes)) + /** Alias for calling [Builder.attributes] with `attributes.orElse(null)`. */ fun attributes(attributes: Optional) = attributes(attributes.getOrNull()) + /** + * Sets [Builder.attributes] to an arbitrary JSON value. + * + * You should usually call [Builder.attributes] with a well-typed [Attributes] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun attributes(attributes: JsonField) = apply { this.attributes = attributes } @@ -2123,28 +2717,46 @@ private constructor( /** The contribution currency. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) - /** The contribution currency. */ + /** Alias for calling [Builder.currency] with `currency.orElse(null)`. */ fun currency(currency: Optional) = currency(currency.getOrNull()) - /** The contribution currency. */ + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } /** The contribution name from the pay statement. */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The contribution name from the pay statement. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The contribution name from the pay statement. */ + /** + * 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 } /** Type of benefit. */ fun type(type: BenefitType?) = type(JsonField.ofNullable(type)) - /** Type of benefit. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** Type of benefit. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [BenefitType] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -2191,9 +2803,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata @@ -2235,6 +2857,13 @@ private constructor( fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { @@ -2278,14 +2907,18 @@ private constructor( * The metadata to be attached to the entity by existing rules. It is a * key-value pairs where the values can be of any type (string, number, boolean, * object, array, etc.). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, boolean, - * object, array, etc.). + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("metadata") @ExcludeMissing @@ -2335,9 +2968,11 @@ private constructor( fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, - * boolean, object, array, etc.). + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed + * [InnerMetadata] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata @@ -2649,42 +3284,99 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The tax amount in cents. */ + /** + * The tax amount in cents. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun attributes(): Optional = Optional.ofNullable(attributes.getNullable("attributes")) - /** The currency code. */ + /** + * The currency code. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - /** `true` if the amount is paid by the employers. */ + /** + * `true` if the amount is paid by the employers. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun employer(): Optional = Optional.ofNullable(employer.getNullable("employer")) - /** The exact name of tax from the pay statement. */ + /** + * The exact name of tax from the pay statement. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The type of taxes. */ + /** + * The type of taxes. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** The tax amount in cents. */ + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [attributes]. + * + * Unlike [attributes], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("attributes") @ExcludeMissing fun _attributes(): JsonField = attributes - /** The currency code. */ + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** `true` if the amount is paid by the employers. */ + /** + * Returns the raw JSON value of [employer]. + * + * Unlike [employer], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("employer") @ExcludeMissing fun _employer(): JsonField = employer - /** The exact name of tax from the pay statement. */ + /** + * 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 - /** The type of taxes. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -2740,21 +3432,39 @@ private constructor( /** The tax amount in cents. */ fun amount(amount: Long?) = amount(JsonField.ofNullable(amount)) - /** The tax amount in cents. */ + /** + * Alias for [Builder.amount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun amount(amount: Long) = amount(amount as Long?) - /** The tax amount in cents. */ + /** Alias for calling [Builder.amount] with `amount.orElse(null)`. */ fun amount(amount: Optional) = amount(amount.getOrNull()) - /** The tax amount in cents. */ + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun amount(amount: JsonField) = apply { this.amount = amount } fun attributes(attributes: Attributes?) = attributes(JsonField.ofNullable(attributes)) + /** Alias for calling [Builder.attributes] with `attributes.orElse(null)`. */ fun attributes(attributes: Optional) = attributes(attributes.getOrNull()) + /** + * Sets [Builder.attributes] to an arbitrary JSON value. + * + * You should usually call [Builder.attributes] with a well-typed [Attributes] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun attributes(attributes: JsonField) = apply { this.attributes = attributes } @@ -2762,40 +3472,68 @@ private constructor( /** The currency code. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) - /** The currency code. */ + /** Alias for calling [Builder.currency] with `currency.orElse(null)`. */ fun currency(currency: Optional) = currency(currency.getOrNull()) - /** The currency code. */ + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun currency(currency: JsonField) = apply { this.currency = currency } /** `true` if the amount is paid by the employers. */ fun employer(employer: Boolean?) = employer(JsonField.ofNullable(employer)) - /** `true` if the amount is paid by the employers. */ + /** + * Alias for [Builder.employer]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun employer(employer: Boolean) = employer(employer as Boolean?) - /** `true` if the amount is paid by the employers. */ + /** Alias for calling [Builder.employer] with `employer.orElse(null)`. */ fun employer(employer: Optional) = employer(employer.getOrNull()) - /** `true` if the amount is paid by the employers. */ + /** + * Sets [Builder.employer] to an arbitrary JSON value. + * + * You should usually call [Builder.employer] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ fun employer(employer: JsonField) = apply { this.employer = employer } /** The exact name of tax from the pay statement. */ fun name(name: String?) = name(JsonField.ofNullable(name)) - /** The exact name of tax from the pay statement. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** The exact name of tax from the pay statement. */ + /** + * 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 } /** The type of taxes. */ fun type(type: Type?) = type(JsonField.ofNullable(type)) - /** The type of taxes. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** The type of taxes. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { @@ -2843,9 +3581,19 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata @@ -2887,6 +3635,13 @@ private constructor( fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { @@ -2930,14 +3685,18 @@ private constructor( * The metadata to be attached to the entity by existing rules. It is a * key-value pairs where the values can be of any type (string, number, boolean, * object, array, etc.). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, boolean, - * object, array, etc.). + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("metadata") @ExcludeMissing @@ -2987,9 +3746,11 @@ private constructor( fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, - * boolean, object, array, etc.). + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed + * [InnerMetadata] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt index 34b65939..d1bb90f9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt @@ -14,6 +14,7 @@ import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @NoAutoDetect @@ -29,16 +30,34 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The Connect URL to redirect the user to for authentication */ + /** + * The Connect URL to redirect the user to for authentication + * + * @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 connectUrl(): String = connectUrl.getRequired("connect_url") - /** The unique identifier for the created connect session */ + /** + * The unique identifier for the created connect session + * + * @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 sessionId(): String = sessionId.getRequired("session_id") - /** The Connect URL to redirect the user to for authentication */ + /** + * Returns the raw JSON value of [connectUrl]. + * + * Unlike [connectUrl], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("connect_url") @ExcludeMissing fun _connectUrl(): JsonField = connectUrl - /** The unique identifier for the created connect session */ + /** + * Returns the raw JSON value of [sessionId]. + * + * Unlike [sessionId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("session_id") @ExcludeMissing fun _sessionId(): JsonField = sessionId @JsonAnyGetter @@ -90,13 +109,25 @@ private constructor( /** The Connect URL to redirect the user to for authentication */ fun connectUrl(connectUrl: String) = connectUrl(JsonField.of(connectUrl)) - /** The Connect URL to redirect the user to for authentication */ + /** + * Sets [Builder.connectUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.connectUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun connectUrl(connectUrl: JsonField) = apply { this.connectUrl = connectUrl } /** The unique identifier for the created connect session */ fun sessionId(sessionId: String) = sessionId(JsonField.of(sessionId)) - /** The unique identifier for the created connect session */ + /** + * Sets [Builder.sessionId] to an arbitrary JSON value. + * + * You should usually call [Builder.sessionId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun sessionId(sessionId: JsonField) = apply { this.sessionId = sessionId } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt index ecb91c0e..257d2ec3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt @@ -14,6 +14,7 @@ import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @NoAutoDetect @@ -29,16 +30,34 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The Connect URL to redirect the user to for reauthentication */ + /** + * The Connect URL to redirect the user to for reauthentication + * + * @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 connectUrl(): String = connectUrl.getRequired("connect_url") - /** The unique identifier for the created connect session */ + /** + * The unique identifier for the created connect session + * + * @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 sessionId(): String = sessionId.getRequired("session_id") - /** The Connect URL to redirect the user to for reauthentication */ + /** + * Returns the raw JSON value of [connectUrl]. + * + * Unlike [connectUrl], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("connect_url") @ExcludeMissing fun _connectUrl(): JsonField = connectUrl - /** The unique identifier for the created connect session */ + /** + * Returns the raw JSON value of [sessionId]. + * + * Unlike [sessionId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("session_id") @ExcludeMissing fun _sessionId(): JsonField = sessionId @JsonAnyGetter @@ -91,13 +110,25 @@ private constructor( /** The Connect URL to redirect the user to for reauthentication */ fun connectUrl(connectUrl: String) = connectUrl(JsonField.of(connectUrl)) - /** The Connect URL to redirect the user to for reauthentication */ + /** + * Sets [Builder.connectUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.connectUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun connectUrl(connectUrl: JsonField) = apply { this.connectUrl = connectUrl } /** The unique identifier for the created connect session */ fun sessionId(sessionId: String) = sessionId(JsonField.of(sessionId)) - /** The unique identifier for the created connect session */ + /** + * Sets [Builder.sessionId] to an arbitrary JSON value. + * + * You should usually call [Builder.sessionId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun sessionId(sessionId: JsonField) = apply { this.sessionId = sessionId } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt index f4a245c5..83e36a02 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional @@ -29,16 +30,35 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun companyBenefits(): Optional = Optional.ofNullable(companyBenefits.getNullable("company_benefits")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun individualBenefits(): Optional = Optional.ofNullable(individualBenefits.getNullable("individual_benefits")) + /** + * Returns the raw JSON value of [companyBenefits]. + * + * Unlike [companyBenefits], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("company_benefits") @ExcludeMissing fun _companyBenefits(): JsonField = companyBenefits + /** + * Returns the raw JSON value of [individualBenefits]. + * + * Unlike [individualBenefits], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("individual_benefits") @ExcludeMissing fun _individualBenefits(): JsonField = individualBenefits @@ -84,6 +104,13 @@ private constructor( fun companyBenefits(companyBenefits: OperationSupportMatrix) = companyBenefits(JsonField.of(companyBenefits)) + /** + * Sets [Builder.companyBenefits] to an arbitrary JSON value. + * + * You should usually call [Builder.companyBenefits] with a well-typed + * [OperationSupportMatrix] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun companyBenefits(companyBenefits: JsonField) = apply { this.companyBenefits = companyBenefits } @@ -91,6 +118,13 @@ private constructor( fun individualBenefits(individualBenefits: OperationSupportMatrix) = individualBenefits(JsonField.of(individualBenefits)) + /** + * Sets [Builder.individualBenefits] to an arbitrary JSON value. + * + * You should usually call [Builder.individualBenefits] with a well-typed + * [OperationSupportMatrix] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ fun individualBenefits(individualBenefits: JsonField) = apply { this.individualBenefits = individualBenefits } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt index 9798d88b..3ad658a1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt @@ -51,78 +51,143 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Whether the provider supports an annual maximum for this benefit. */ + /** + * 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 = Optional.ofNullable(annualMaximum.getNullable("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 = Optional.ofNullable(catchUp.getNullable("catch_up")) - /** Supported contribution types. An empty array indicates contributions are not supported. */ + /** + * 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> = Optional.ofNullable(companyContribution.getNullable("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 = Optional.ofNullable(description.getNullable("description")) - /** Supported deduction types. An empty array indicates deductions are not supported. */ + /** + * 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> = Optional.ofNullable(employeeDeduction.getNullable("employee_deduction")) - /** The list of frequencies supported by the provider for this benefit */ + /** + * 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> = Optional.ofNullable(frequencies.getNullable("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> = Optional.ofNullable(hsaContributionLimit.getNullable("hsa_contribution_limit")) - /** Type of benefit. */ + /** + * Type of benefit. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** Whether the provider supports an annual maximum for this benefit. */ + /** + * 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 /** - * Whether the provider supports catch up for this benefit. This field will only be true for - * retirement benefits. + * 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 - /** Supported contribution types. An empty array indicates contributions are not supported. */ + /** + * 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 - /** Supported deduction types. An empty array indicates deductions are not supported. */ + /** + * 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 - /** The list of frequencies supported by the provider for this benefit */ + /** + * 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 /** - * 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. + * 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 - /** Type of benefit. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type @JsonAnyGetter @@ -185,14 +250,24 @@ private constructor( fun annualMaximum(annualMaximum: Boolean?) = annualMaximum(JsonField.ofNullable(annualMaximum)) - /** Whether the provider supports an annual maximum for this benefit. */ + /** + * Alias for [Builder.annualMaximum]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun annualMaximum(annualMaximum: Boolean) = annualMaximum(annualMaximum as Boolean?) - /** Whether the provider supports an annual maximum for this benefit. */ + /** Alias for calling [Builder.annualMaximum] with `annualMaximum.orElse(null)`. */ fun annualMaximum(annualMaximum: Optional) = annualMaximum(annualMaximum.getOrNull()) - /** Whether the provider supports an annual maximum for this benefit. */ + /** + * 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 } @@ -204,20 +279,20 @@ private constructor( fun catchUp(catchUp: Boolean?) = catchUp(JsonField.ofNullable(catchUp)) /** - * Whether the provider supports catch up for this benefit. This field will only be true for - * retirement benefits. + * Alias for [Builder.catchUp]. + * + * This unboxed primitive overload exists for backwards compatibility. */ fun catchUp(catchUp: Boolean) = catchUp(catchUp as Boolean?) - /** - * Whether the provider supports catch up for this benefit. This field will only be true for - * retirement benefits. - */ + /** Alias for calling [Builder.catchUp] with `catchUp.orElse(null)`. */ fun catchUp(catchUp: Optional) = catchUp(catchUp.getOrNull()) /** - * Whether the provider supports catch up for this benefit. This field will only be true for - * retirement benefits. + * 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 } @@ -228,13 +303,17 @@ private constructor( companyContribution(JsonField.ofNullable(companyContribution)) /** - * Supported contribution types. An empty array indicates contributions are not supported. + * Alias for calling [Builder.companyContribution] with `companyContribution.orElse(null)`. */ fun companyContribution(companyContribution: Optional>) = companyContribution(companyContribution.getOrNull()) /** - * Supported contribution types. An empty array indicates contributions are not supported. + * 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 { @@ -242,7 +321,9 @@ private constructor( } /** - * Supported contribution types. An empty array indicates contributions are not supported. + * 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 = @@ -253,24 +334,42 @@ private constructor( 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)) - /** Supported deduction types. An empty array indicates deductions are not supported. */ + /** Alias for calling [Builder.employeeDeduction] with `employeeDeduction.orElse(null)`. */ fun employeeDeduction(employeeDeduction: Optional>) = employeeDeduction(employeeDeduction.getOrNull()) - /** Supported deduction types. An empty array indicates deductions are not supported. */ + /** + * 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() } } - /** Supported deduction types. An empty array indicates deductions are not supported. */ + /** + * 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 { @@ -282,12 +381,22 @@ private constructor( fun frequencies(frequencies: List) = frequencies(JsonField.of(frequencies)) - /** The list of frequencies supported by the provider for this benefit */ + /** + * 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() } } - /** The list of frequencies supported by the provider for this benefit */ + /** + * 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 { @@ -303,15 +412,18 @@ private constructor( hsaContributionLimit(JsonField.ofNullable(hsaContributionLimit)) /** - * 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. + * Alias for calling [Builder.hsaContributionLimit] with + * `hsaContributionLimit.orElse(null)`. */ fun hsaContributionLimit(hsaContributionLimit: Optional>) = hsaContributionLimit(hsaContributionLimit.getOrNull()) /** - * 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. + * 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 { @@ -319,8 +431,9 @@ private constructor( } /** - * 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. + * 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 = @@ -332,10 +445,16 @@ private constructor( /** Type of benefit. */ fun type(type: BenefitType?) = type(JsonField.ofNullable(type)) - /** Type of benefit. */ + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ fun type(type: Optional) = type(type.getOrNull()) - /** Type of benefit. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [BenefitType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt index 4429a738..4e015a2e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt @@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -29,19 +30,46 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun body(): Optional = Optional.ofNullable(body.getNullable("body")) - /** HTTP status code */ + /** + * HTTP status code + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun code(): Optional = Optional.ofNullable(code.getNullable("code")) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("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 - /** HTTP status code */ + /** + * 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 @@ -89,16 +117,34 @@ private constructor( 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 */ fun code(code: Long) = code(JsonField.of(code)) - /** HTTP status code */ + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [Long] 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 } @@ -143,22 +189,49 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A descriptive identifier for the response. */ + /** + * 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 = Optional.ofNullable(finchCode.getNullable("finch_code")) - /** Short description in English that provides more information about the response. */ + /** + * 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 = Optional.ofNullable(message.getNullable("message")) - /** Identifier indicating whether the benefit was newly enrolled or updated. */ + /** + * 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 = Optional.ofNullable(name.getNullable("name")) - /** A descriptive identifier for the response. */ + /** + * 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 - /** Short description in English that provides more information about the response. */ + /** + * 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 - /** Identifier indicating whether the benefit was newly enrolled or updated. */ + /** + * 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 @JsonAnyGetter @@ -205,28 +278,46 @@ private constructor( /** A descriptive identifier for the response. */ fun finchCode(finchCode: String?) = finchCode(JsonField.ofNullable(finchCode)) - /** A descriptive identifier for the response. */ + /** Alias for calling [Builder.finchCode] with `finchCode.orElse(null)`. */ fun finchCode(finchCode: Optional) = finchCode(finchCode.getOrNull()) - /** A descriptive identifier for the response. */ + /** + * 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)) - /** Short description in English that provides more information about the response. */ + /** Alias for calling [Builder.message] with `message.orElse(null)`. */ fun message(message: Optional) = message(message.getOrNull()) - /** Short description in English that provides more information about the response. */ + /** + * 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)) - /** Identifier indicating whether the benefit was newly enrolled or updated. */ + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ fun name(name: Optional) = name(name.getOrNull()) - /** Identifier indicating whether the benefit was newly enrolled or updated. */ + /** + * 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 { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt index 26e1ac2e..6f63f391 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt @@ -14,6 +14,7 @@ import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @NoAutoDetect @@ -26,8 +27,17 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * @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 benefitId(): String = benefitId.getRequired("benefit_id") + /** + * Returns the raw JSON value of [benefitId]. + * + * Unlike [benefitId], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("benefit_id") @ExcludeMissing fun _benefitId(): JsonField = benefitId @JsonAnyGetter @@ -74,6 +84,13 @@ private constructor( fun benefitId(benefitId: String) = benefitId(JsonField.of(benefitId)) + /** + * Sets [Builder.benefitId] to an arbitrary JSON value. + * + * You should usually call [Builder.benefitId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ fun benefitId(benefitId: JsonField) = apply { this.benefitId = benefitId } fun additionalProperties(additionalProperties: Map) = apply { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt index 9b7be7d7..b8f8031e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt @@ -33,22 +33,49 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Detailed information specific to the 2005 W4 form. */ + /** + * Detailed information specific to the 2005 W4 form. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) - /** Specifies the form type, indicating that this document is a 2005 W4 form. */ + /** + * Specifies the form type, indicating that this document is a 2005 W4 form. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** The tax year this W4 document applies to. */ + /** + * The tax year this W4 document applies to. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun year(): Optional = Optional.ofNullable(year.getNullable("year")) - /** Detailed information specific to the 2005 W4 form. */ + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data - /** Specifies the form type, indicating that this document is a 2005 W4 form. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - /** The tax year this W4 document applies to. */ + /** + * Returns the raw JSON value of [year]. + * + * Unlike [year], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("year") @ExcludeMissing fun _year(): JsonField = year @JsonAnyGetter @@ -95,25 +122,44 @@ private constructor( /** Detailed information specific to the 2005 W4 form. */ fun data(data: Data) = data(JsonField.of(data)) - /** Detailed information specific to the 2005 W4 form. */ + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Data] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun data(data: JsonField) = apply { this.data = data } /** Specifies the form type, indicating that this document is a 2005 W4 form. */ fun type(type: Type) = type(JsonField.of(type)) - /** Specifies the form type, indicating that this document is a 2005 W4 form. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } /** The tax year this W4 document applies to. */ fun year(year: Double?) = year(JsonField.ofNullable(year)) - /** The tax year this W4 document applies to. */ + /** + * Alias for [Builder.year]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun year(year: Double) = year(year as Double?) - /** The tax year this W4 document applies to. */ + /** Alias for calling [Builder.year] with `year.orElse(null)`. */ fun year(year: Optional) = year(year.getOrNull()) - /** The tax year this W4 document applies to. */ + /** + * Sets [Builder.year] to an arbitrary JSON value. + * + * You should usually call [Builder.year] with a well-typed [Double] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun year(year: JsonField) = apply { this.year = year } fun additionalProperties(additionalProperties: Map) = apply { @@ -162,47 +208,96 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Additional withholding amount (in cents). */ + /** + * Additional withholding amount (in cents). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun additionalWithholding(): Optional = Optional.ofNullable(additionalWithholding.getNullable("additional_withholding")) - /** Indicates exemption status from federal tax withholding. */ + /** + * Indicates exemption status from federal tax withholding. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun exemption(): Optional = Optional.ofNullable(exemption.getNullable("exemption")) - /** The individual's filing status for tax purposes. */ + /** + * The individual's filing status for tax purposes. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun filingStatus(): Optional = Optional.ofNullable(filingStatus.getNullable("filing_status")) - /** The unique identifier for the individual associated with this 2005 W4 form. */ + /** + * The unique identifier for the individual associated with this 2005 W4 form. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("individual_id")) - /** Total number of allowances claimed (in cents). */ + /** + * Total number of allowances claimed (in cents). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun totalNumberOfAllowances(): Optional = Optional.ofNullable(totalNumberOfAllowances.getNullable("total_number_of_allowances")) - /** Additional withholding amount (in cents). */ + /** + * Returns the raw JSON value of [additionalWithholding]. + * + * Unlike [additionalWithholding], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("additional_withholding") @ExcludeMissing fun _additionalWithholding(): JsonField = additionalWithholding - /** Indicates exemption status from federal tax withholding. */ + /** + * Returns the raw JSON value of [exemption]. + * + * Unlike [exemption], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("exemption") @ExcludeMissing fun _exemption(): JsonField = exemption - /** The individual's filing status for tax purposes. */ + /** + * Returns the raw JSON value of [filingStatus]. + * + * Unlike [filingStatus], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("filing_status") @ExcludeMissing fun _filingStatus(): JsonField = filingStatus - /** The unique identifier for the individual associated with this 2005 W4 form. */ + /** + * 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 - /** Total number of allowances claimed (in cents). */ + /** + * Returns the raw JSON value of [totalNumberOfAllowances]. + * + * Unlike [totalNumberOfAllowances], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("total_number_of_allowances") @ExcludeMissing fun _totalNumberOfAllowances(): JsonField = totalNumberOfAllowances @@ -258,15 +353,28 @@ private constructor( fun additionalWithholding(additionalWithholding: Long?) = additionalWithholding(JsonField.ofNullable(additionalWithholding)) - /** Additional withholding amount (in cents). */ + /** + * Alias for [Builder.additionalWithholding]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun additionalWithholding(additionalWithholding: Long) = additionalWithholding(additionalWithholding as Long?) - /** Additional withholding amount (in cents). */ + /** + * Alias for calling [Builder.additionalWithholding] with + * `additionalWithholding.orElse(null)`. + */ fun additionalWithholding(additionalWithholding: Optional) = additionalWithholding(additionalWithholding.getOrNull()) - /** Additional withholding amount (in cents). */ + /** + * Sets [Builder.additionalWithholding] to an arbitrary JSON value. + * + * You should usually call [Builder.additionalWithholding] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun additionalWithholding(additionalWithholding: JsonField) = apply { this.additionalWithholding = additionalWithholding } @@ -274,13 +382,25 @@ private constructor( /** Indicates exemption status from federal tax withholding. */ fun exemption(exemption: Exemption) = exemption(JsonField.of(exemption)) - /** Indicates exemption status from federal tax withholding. */ + /** + * Sets [Builder.exemption] to an arbitrary JSON value. + * + * You should usually call [Builder.exemption] with a well-typed [Exemption] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun exemption(exemption: JsonField) = apply { this.exemption = exemption } /** The individual's filing status for tax purposes. */ fun filingStatus(filingStatus: FilingStatus) = filingStatus(JsonField.of(filingStatus)) - /** The individual's filing status for tax purposes. */ + /** + * Sets [Builder.filingStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.filingStatus] with a well-typed [FilingStatus] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun filingStatus(filingStatus: JsonField) = apply { this.filingStatus = filingStatus } @@ -288,7 +408,13 @@ private constructor( /** The unique identifier for the individual associated with this 2005 W4 form. */ fun individualId(individualId: String) = individualId(JsonField.of(individualId)) - /** The unique identifier for the individual associated with this 2005 W4 form. */ + /** + * 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 } @@ -297,15 +423,28 @@ private constructor( fun totalNumberOfAllowances(totalNumberOfAllowances: Long?) = totalNumberOfAllowances(JsonField.ofNullable(totalNumberOfAllowances)) - /** Total number of allowances claimed (in cents). */ + /** + * Alias for [Builder.totalNumberOfAllowances]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun totalNumberOfAllowances(totalNumberOfAllowances: Long) = totalNumberOfAllowances(totalNumberOfAllowances as Long?) - /** Total number of allowances claimed (in cents). */ + /** + * Alias for calling [Builder.totalNumberOfAllowances] with + * `totalNumberOfAllowances.orElse(null)`. + */ fun totalNumberOfAllowances(totalNumberOfAllowances: Optional) = totalNumberOfAllowances(totalNumberOfAllowances.getOrNull()) - /** Total number of allowances claimed (in cents). */ + /** + * Sets [Builder.totalNumberOfAllowances] to an arbitrary JSON value. + * + * You should usually call [Builder.totalNumberOfAllowances] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun totalNumberOfAllowances(totalNumberOfAllowances: JsonField) = apply { this.totalNumberOfAllowances = totalNumberOfAllowances } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt index 53555e9e..8cdeede2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt @@ -33,22 +33,49 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Detailed information specific to the 2020 W4 form. */ + /** + * Detailed information specific to the 2020 W4 form. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun data(): Optional = Optional.ofNullable(data.getNullable("data")) - /** Specifies the form type, indicating that this document is a 2020 W4 form. */ + /** + * Specifies the form type, indicating that this document is a 2020 W4 form. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** The tax year this W4 document applies to. */ + /** + * The tax year this W4 document applies to. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun year(): Optional = Optional.ofNullable(year.getNullable("year")) - /** Detailed information specific to the 2020 W4 form. */ + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data - /** Specifies the form type, indicating that this document is a 2020 W4 form. */ + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - /** The tax year this W4 document applies to. */ + /** + * Returns the raw JSON value of [year]. + * + * Unlike [year], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("year") @ExcludeMissing fun _year(): JsonField = year @JsonAnyGetter @@ -95,25 +122,44 @@ private constructor( /** Detailed information specific to the 2020 W4 form. */ fun data(data: Data) = data(JsonField.of(data)) - /** Detailed information specific to the 2020 W4 form. */ + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Data] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun data(data: JsonField) = apply { this.data = data } /** Specifies the form type, indicating that this document is a 2020 W4 form. */ fun type(type: Type) = type(JsonField.of(type)) - /** Specifies the form type, indicating that this document is a 2020 W4 form. */ + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun type(type: JsonField) = apply { this.type = type } /** The tax year this W4 document applies to. */ fun year(year: Double?) = year(JsonField.ofNullable(year)) - /** The tax year this W4 document applies to. */ + /** + * Alias for [Builder.year]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun year(year: Double) = year(year as Double?) - /** The tax year this W4 document applies to. */ + /** Alias for calling [Builder.year] with `year.orElse(null)`. */ fun year(year: Optional) = year(year.getOrNull()) - /** The tax year this W4 document applies to. */ + /** + * Sets [Builder.year] to an arbitrary JSON value. + * + * You should usually call [Builder.year] with a well-typed [Double] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ fun year(year: JsonField) = apply { this.year = year } fun additionalProperties(additionalProperties: Map) = apply { @@ -171,11 +217,21 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Amount claimed for dependents other than qualifying children under 17 (in cents). */ + /** + * Amount claimed for dependents other than qualifying children under 17 (in cents). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun amountForOtherDependents(): Optional = Optional.ofNullable(amountForOtherDependents.getNullable("amount_for_other_dependents")) - /** Amount claimed for dependents under 17 years old (in cents). */ + /** + * Amount claimed for dependents under 17 years old (in cents). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun amountForQualifyingChildrenUnder17(): Optional = Optional.ofNullable( amountForQualifyingChildrenUnder17.getNullable( @@ -183,26 +239,56 @@ private constructor( ) ) - /** Deductible expenses (in cents). */ + /** + * Deductible expenses (in cents). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun deductions(): Optional = Optional.ofNullable(deductions.getNullable("deductions")) - /** Additional withholding amount (in cents). */ + /** + * Additional withholding amount (in cents). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun extraWithholding(): Optional = Optional.ofNullable(extraWithholding.getNullable("extra_withholding")) - /** The individual's filing status for tax purposes. */ + /** + * The individual's filing status for tax purposes. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun filingStatus(): Optional = Optional.ofNullable(filingStatus.getNullable("filing_status")) - /** The unique identifier for the individual associated with this document. */ + /** + * The unique identifier for the individual associated with this document. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("individual_id")) - /** Additional income from sources outside of primary employment (in cents). */ + /** + * Additional income from sources outside of primary employment (in cents). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun otherIncome(): Optional = Optional.ofNullable(otherIncome.getNullable("other_income")) - /** Total amount claimed for dependents and other credits (in cents). */ + /** + * Total amount claimed for dependents and other credits (in cents). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun totalClaimDependentAndOtherCredits(): Optional = Optional.ofNullable( totalClaimDependentAndOtherCredits.getNullable( @@ -210,41 +296,79 @@ private constructor( ) ) - /** Amount claimed for dependents other than qualifying children under 17 (in cents). */ + /** + * Returns the raw JSON value of [amountForOtherDependents]. + * + * Unlike [amountForOtherDependents], this method doesn't throw if the JSON field has an + * unexpected type. + */ @JsonProperty("amount_for_other_dependents") @ExcludeMissing fun _amountForOtherDependents(): JsonField = amountForOtherDependents - /** Amount claimed for dependents under 17 years old (in cents). */ + /** + * Returns the raw JSON value of [amountForQualifyingChildrenUnder17]. + * + * Unlike [amountForQualifyingChildrenUnder17], this method doesn't throw if the JSON field + * has an unexpected type. + */ @JsonProperty("amount_for_qualifying_children_under_17") @ExcludeMissing fun _amountForQualifyingChildrenUnder17(): JsonField = amountForQualifyingChildrenUnder17 - /** Deductible expenses (in cents). */ + /** + * Returns the raw JSON value of [deductions]. + * + * Unlike [deductions], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("deductions") @ExcludeMissing fun _deductions(): JsonField = deductions - /** Additional withholding amount (in cents). */ + /** + * Returns the raw JSON value of [extraWithholding]. + * + * Unlike [extraWithholding], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("extra_withholding") @ExcludeMissing fun _extraWithholding(): JsonField = extraWithholding - /** The individual's filing status for tax purposes. */ + /** + * Returns the raw JSON value of [filingStatus]. + * + * Unlike [filingStatus], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("filing_status") @ExcludeMissing fun _filingStatus(): JsonField = filingStatus - /** The unique identifier for the individual associated with this document. */ + /** + * 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 - /** Additional income from sources outside of primary employment (in cents). */ + /** + * Returns the raw JSON value of [otherIncome]. + * + * Unlike [otherIncome], this method doesn't throw if the JSON field has an unexpected type. + */ @JsonProperty("other_income") @ExcludeMissing fun _otherIncome(): JsonField = otherIncome - /** Total amount claimed for dependents and other credits (in cents). */ + /** + * Returns the raw JSON value of [totalClaimDependentAndOtherCredits]. + * + * Unlike [totalClaimDependentAndOtherCredits], this method doesn't throw if the JSON field + * has an unexpected type. + */ @JsonProperty("total_claim_dependent_and_other_credits") @ExcludeMissing fun _totalClaimDependentAndOtherCredits(): JsonField = @@ -310,15 +434,28 @@ private constructor( fun amountForOtherDependents(amountForOtherDependents: Long?) = amountForOtherDependents(JsonField.ofNullable(amountForOtherDependents)) - /** Amount claimed for dependents other than qualifying children under 17 (in cents). */ + /** + * Alias for [Builder.amountForOtherDependents]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun amountForOtherDependents(amountForOtherDependents: Long) = amountForOtherDependents(amountForOtherDependents as Long?) - /** Amount claimed for dependents other than qualifying children under 17 (in cents). */ + /** + * Alias for calling [Builder.amountForOtherDependents] with + * `amountForOtherDependents.orElse(null)`. + */ fun amountForOtherDependents(amountForOtherDependents: Optional) = amountForOtherDependents(amountForOtherDependents.getOrNull()) - /** Amount claimed for dependents other than qualifying children under 17 (in cents). */ + /** + * Sets [Builder.amountForOtherDependents] to an arbitrary JSON value. + * + * You should usually call [Builder.amountForOtherDependents] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ fun amountForOtherDependents(amountForOtherDependents: JsonField) = apply { this.amountForOtherDependents = amountForOtherDependents } @@ -329,16 +466,29 @@ private constructor( JsonField.ofNullable(amountForQualifyingChildrenUnder17) ) - /** Amount claimed for dependents under 17 years old (in cents). */ + /** + * Alias for [Builder.amountForQualifyingChildrenUnder17]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun amountForQualifyingChildrenUnder17(amountForQualifyingChildrenUnder17: Long) = amountForQualifyingChildrenUnder17(amountForQualifyingChildrenUnder17 as Long?) - /** Amount claimed for dependents under 17 years old (in cents). */ + /** + * Alias for calling [Builder.amountForQualifyingChildrenUnder17] with + * `amountForQualifyingChildrenUnder17.orElse(null)`. + */ fun amountForQualifyingChildrenUnder17( amountForQualifyingChildrenUnder17: Optional ) = amountForQualifyingChildrenUnder17(amountForQualifyingChildrenUnder17.getOrNull()) - /** Amount claimed for dependents under 17 years old (in cents). */ + /** + * Sets [Builder.amountForQualifyingChildrenUnder17] to an arbitrary JSON value. + * + * You should usually call [Builder.amountForQualifyingChildrenUnder17] with a + * well-typed [Long] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun amountForQualifyingChildrenUnder17( amountForQualifyingChildrenUnder17: JsonField ) = apply { @@ -348,28 +498,50 @@ private constructor( /** Deductible expenses (in cents). */ fun deductions(deductions: Long?) = deductions(JsonField.ofNullable(deductions)) - /** Deductible expenses (in cents). */ + /** + * Alias for [Builder.deductions]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun deductions(deductions: Long) = deductions(deductions as Long?) - /** Deductible expenses (in cents). */ + /** Alias for calling [Builder.deductions] with `deductions.orElse(null)`. */ fun deductions(deductions: Optional) = deductions(deductions.getOrNull()) - /** Deductible expenses (in cents). */ + /** + * Sets [Builder.deductions] to an arbitrary JSON value. + * + * You should usually call [Builder.deductions] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun deductions(deductions: JsonField) = apply { this.deductions = deductions } /** Additional withholding amount (in cents). */ fun extraWithholding(extraWithholding: Long?) = extraWithholding(JsonField.ofNullable(extraWithholding)) - /** Additional withholding amount (in cents). */ + /** + * Alias for [Builder.extraWithholding]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun extraWithholding(extraWithholding: Long) = extraWithholding(extraWithholding as Long?) - /** Additional withholding amount (in cents). */ + /** + * Alias for calling [Builder.extraWithholding] with `extraWithholding.orElse(null)`. + */ fun extraWithholding(extraWithholding: Optional) = extraWithholding(extraWithholding.getOrNull()) - /** Additional withholding amount (in cents). */ + /** + * Sets [Builder.extraWithholding] to an arbitrary JSON value. + * + * You should usually call [Builder.extraWithholding] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun extraWithholding(extraWithholding: JsonField) = apply { this.extraWithholding = extraWithholding } @@ -378,11 +550,17 @@ private constructor( fun filingStatus(filingStatus: FilingStatus?) = filingStatus(JsonField.ofNullable(filingStatus)) - /** The individual's filing status for tax purposes. */ + /** Alias for calling [Builder.filingStatus] with `filingStatus.orElse(null)`. */ fun filingStatus(filingStatus: Optional) = filingStatus(filingStatus.getOrNull()) - /** The individual's filing status for tax purposes. */ + /** + * Sets [Builder.filingStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.filingStatus] with a well-typed [FilingStatus] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun filingStatus(filingStatus: JsonField) = apply { this.filingStatus = filingStatus } @@ -390,7 +568,13 @@ private constructor( /** The unique identifier for the individual associated with this document. */ fun individualId(individualId: String) = individualId(JsonField.of(individualId)) - /** The unique identifier for the individual associated with this document. */ + /** + * 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 } @@ -398,13 +582,23 @@ private constructor( /** Additional income from sources outside of primary employment (in cents). */ fun otherIncome(otherIncome: Long?) = otherIncome(JsonField.ofNullable(otherIncome)) - /** Additional income from sources outside of primary employment (in cents). */ + /** + * Alias for [Builder.otherIncome]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun otherIncome(otherIncome: Long) = otherIncome(otherIncome as Long?) - /** Additional income from sources outside of primary employment (in cents). */ + /** Alias for calling [Builder.otherIncome] with `otherIncome.orElse(null)`. */ fun otherIncome(otherIncome: Optional) = otherIncome(otherIncome.getOrNull()) - /** Additional income from sources outside of primary employment (in cents). */ + /** + * Sets [Builder.otherIncome] to an arbitrary JSON value. + * + * You should usually call [Builder.otherIncome] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ fun otherIncome(otherIncome: JsonField) = apply { this.otherIncome = otherIncome } /** Total amount claimed for dependents and other credits (in cents). */ @@ -413,16 +607,29 @@ private constructor( JsonField.ofNullable(totalClaimDependentAndOtherCredits) ) - /** Total amount claimed for dependents and other credits (in cents). */ + /** + * Alias for [Builder.totalClaimDependentAndOtherCredits]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ fun totalClaimDependentAndOtherCredits(totalClaimDependentAndOtherCredits: Long) = totalClaimDependentAndOtherCredits(totalClaimDependentAndOtherCredits as Long?) - /** Total amount claimed for dependents and other credits (in cents). */ + /** + * Alias for calling [Builder.totalClaimDependentAndOtherCredits] with + * `totalClaimDependentAndOtherCredits.orElse(null)`. + */ fun totalClaimDependentAndOtherCredits( totalClaimDependentAndOtherCredits: Optional ) = totalClaimDependentAndOtherCredits(totalClaimDependentAndOtherCredits.getOrNull()) - /** Total amount claimed for dependents and other credits (in cents). */ + /** + * Sets [Builder.totalClaimDependentAndOtherCredits] to an arbitrary JSON value. + * + * You should usually call [Builder.totalClaimDependentAndOtherCredits] with a + * well-typed [Long] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ fun totalClaimDependentAndOtherCredits( totalClaimDependentAndOtherCredits: JsonField ) = apply { From 2048a6a29711b2436894c0498bcd97c89ce7ac4c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Mar 2025 15:16:01 +0000 Subject: [PATCH 24/65] chore(internal): make test classes internal (#495) --- .../com/tryfinch/api/models/AccessTokenCreateParamsTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/AccountCreateResponseTest.kt | 2 +- .../com/tryfinch/api/models/AccountDisconnectParamsTest.kt | 2 +- .../com/tryfinch/api/models/AccountIntrospectParamsTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/AccountUpdateResponseTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/AutomatedAsyncJobTest.kt | 2 +- .../com/tryfinch/api/models/AutomatedCreateResponseTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/AutomatedListResponseTest.kt | 2 +- .../test/kotlin/com/tryfinch/api/models/BaseWebhookEventTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/BenefitContributionTest.kt | 2 +- .../com/tryfinch/api/models/BenefitFeaturesAndOperationsTest.kt | 2 +- .../test/kotlin/com/tryfinch/api/models/BenefitsSupportTest.kt | 2 +- .../test/kotlin/com/tryfinch/api/models/CompanyBenefitTest.kt | 2 +- .../src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt | 2 +- .../com/tryfinch/api/models/ConnectSessionNewParamsTest.kt | 2 +- .../api/models/ConnectSessionReauthenticateParamsTest.kt | 2 +- .../com/tryfinch/api/models/ConnectionCreateResponseTest.kt | 2 +- .../com/tryfinch/api/models/CreateAccessTokenResponseTest.kt | 2 +- .../tryfinch/api/models/CreateCompanyBenefitsResponseTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/DisconnectResponseTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/DocumentListResponseTest.kt | 2 +- .../test/kotlin/com/tryfinch/api/models/DocumentResponseTest.kt | 2 +- .../com/tryfinch/api/models/EmploymentDataResponseTest.kt | 2 +- .../test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt | 2 +- .../com/tryfinch/api/models/EmploymentUpdateResponseTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/EnrolledIndividualTest.kt | 2 +- .../com/tryfinch/api/models/HrisBenefitCreateParamsTest.kt | 2 +- .../api/models/HrisBenefitIndividualEnrolledIdsParamsTest.kt | 2 +- .../HrisBenefitIndividualRetrieveManyBenefitsParamsTest.kt | 2 +- .../api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/HrisBenefitListParamsTest.kt | 2 +- .../api/models/HrisBenefitListSupportedBenefitsParamsTest.kt | 2 +- .../com/tryfinch/api/models/HrisBenefitRetrieveParamsTest.kt | 2 +- .../com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt | 2 +- .../com/tryfinch/api/models/HrisCompanyRetrieveParamsTest.kt | 2 +- .../api/models/HrisDirectoryListIndividualsParamsTest.kt | 2 +- .../com/tryfinch/api/models/HrisDirectoryListParamsTest.kt | 2 +- .../com/tryfinch/api/models/HrisDocumentListParamsTest.kt | 2 +- .../com/tryfinch/api/models/HrisDocumentRetreiveParamsTest.kt | 2 +- .../tryfinch/api/models/HrisEmploymentRetrieveManyParamsTest.kt | 2 +- .../tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt | 2 +- .../api/models/HrisPayStatementRetrieveManyParamsTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/HrisPaymentListParamsTest.kt | 2 +- .../src/test/kotlin/com/tryfinch/api/models/IncomeTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/IndividualBenefitTest.kt | 2 +- .../tryfinch/api/models/IndividualEnrolledIdsResponseTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/IndividualInDirectoryTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/IndividualResponseTest.kt | 2 +- .../src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt | 2 +- .../com/tryfinch/api/models/IndividualUpdateResponseTest.kt | 2 +- .../test/kotlin/com/tryfinch/api/models/IntrospectionTest.kt | 2 +- .../com/tryfinch/api/models/JobAutomatedCreateParamsTest.kt | 2 +- .../com/tryfinch/api/models/JobAutomatedListParamsTest.kt | 2 +- .../com/tryfinch/api/models/JobAutomatedRetrieveParamsTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/JobCreateResponseTest.kt | 2 +- .../com/tryfinch/api/models/JobManualRetrieveParamsTest.kt | 2 +- .../src/test/kotlin/com/tryfinch/api/models/LocationTest.kt | 2 +- .../test/kotlin/com/tryfinch/api/models/ManualAsyncJobTest.kt | 2 +- .../src/test/kotlin/com/tryfinch/api/models/MoneyTest.kt | 2 +- .../com/tryfinch/api/models/OperationSupportMatrixTest.kt | 2 +- .../src/test/kotlin/com/tryfinch/api/models/PagingTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt | 2 +- .../com/tryfinch/api/models/PayGroupRetrieveResponseTest.kt | 2 +- .../com/tryfinch/api/models/PayStatementResponseBodyTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt | 2 +- .../src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/PaymentCreateResponseTest.kt | 2 +- .../src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt | 2 +- .../com/tryfinch/api/models/PayrollPayGroupListParamsTest.kt | 2 +- .../tryfinch/api/models/PayrollPayGroupRetrieveParamsTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/ProviderListParamsTest.kt | 2 +- .../src/test/kotlin/com/tryfinch/api/models/ProviderTest.kt | 2 +- .../tryfinch/api/models/RequestForwardingForwardParamsTest.kt | 2 +- .../tryfinch/api/models/RequestForwardingForwardResponseTest.kt | 2 +- .../com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt | 2 +- .../api/models/SandboxConnectionAccountCreateParamsTest.kt | 2 +- .../api/models/SandboxConnectionAccountUpdateParamsTest.kt | 2 +- .../tryfinch/api/models/SandboxConnectionCreateParamsTest.kt | 2 +- .../com/tryfinch/api/models/SandboxDirectoryCreateParamsTest.kt | 2 +- .../tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt | 2 +- .../tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt | 2 +- .../api/models/SandboxJobConfigurationRetrieveParamsTest.kt | 2 +- .../com/tryfinch/api/models/SandboxJobConfigurationTest.kt | 2 +- .../api/models/SandboxJobConfigurationUpdateParamsTest.kt | 2 +- .../com/tryfinch/api/models/SandboxJobCreateParamsTest.kt | 2 +- .../com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/SessionNewResponseTest.kt | 2 +- .../tryfinch/api/models/SessionReauthenticateResponseTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/SupportPerBenefitTypeTest.kt | 2 +- .../test/kotlin/com/tryfinch/api/models/SupportedBenefitTest.kt | 2 +- .../kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt | 2 +- .../com/tryfinch/api/models/UpdateCompanyBenefitResponseTest.kt | 2 +- .../src/test/kotlin/com/tryfinch/api/models/W42005Test.kt | 2 +- .../src/test/kotlin/com/tryfinch/api/models/W42020Test.kt | 2 +- .../test/kotlin/com/tryfinch/api/services/ErrorHandlingTest.kt | 2 +- .../tryfinch/api/services/async/AccessTokenServiceAsyncTest.kt | 2 +- .../com/tryfinch/api/services/async/AccountServiceAsyncTest.kt | 2 +- .../com/tryfinch/api/services/async/ProviderServiceAsyncTest.kt | 2 +- .../api/services/async/RequestForwardingServiceAsyncTest.kt | 2 +- .../api/services/async/connect/SessionServiceAsyncTest.kt | 2 +- .../tryfinch/api/services/async/hris/BenefitServiceAsyncTest.kt | 2 +- .../tryfinch/api/services/async/hris/CompanyServiceAsyncTest.kt | 2 +- .../api/services/async/hris/DirectoryServiceAsyncTest.kt | 2 +- .../api/services/async/hris/DocumentServiceAsyncTest.kt | 2 +- .../api/services/async/hris/EmploymentServiceAsyncTest.kt | 2 +- .../api/services/async/hris/IndividualServiceAsyncTest.kt | 2 +- .../api/services/async/hris/PayStatementServiceAsyncTest.kt | 2 +- .../tryfinch/api/services/async/hris/PaymentServiceAsyncTest.kt | 2 +- .../services/async/hris/benefits/IndividualServiceAsyncTest.kt | 2 +- .../api/services/async/jobs/AutomatedServiceAsyncTest.kt | 2 +- .../tryfinch/api/services/async/jobs/ManualServiceAsyncTest.kt | 2 +- .../api/services/async/payroll/PayGroupServiceAsyncTest.kt | 2 +- .../api/services/async/sandbox/CompanyServiceAsyncTest.kt | 2 +- .../api/services/async/sandbox/ConnectionServiceAsyncTest.kt | 2 +- .../api/services/async/sandbox/DirectoryServiceAsyncTest.kt | 2 +- .../api/services/async/sandbox/EmploymentServiceAsyncTest.kt | 2 +- .../api/services/async/sandbox/IndividualServiceAsyncTest.kt | 2 +- .../tryfinch/api/services/async/sandbox/JobServiceAsyncTest.kt | 2 +- .../api/services/async/sandbox/PaymentServiceAsyncTest.kt | 2 +- .../async/sandbox/connections/AccountServiceAsyncTest.kt | 2 +- .../async/sandbox/jobs/ConfigurationServiceAsyncTest.kt | 2 +- .../tryfinch/api/services/blocking/AccessTokenServiceTest.kt | 2 +- .../com/tryfinch/api/services/blocking/AccountServiceTest.kt | 2 +- .../com/tryfinch/api/services/blocking/ProviderServiceTest.kt | 2 +- .../api/services/blocking/RequestForwardingServiceTest.kt | 2 +- .../api/services/blocking/connect/SessionServiceTest.kt | 2 +- .../tryfinch/api/services/blocking/hris/BenefitServiceTest.kt | 2 +- .../tryfinch/api/services/blocking/hris/CompanyServiceTest.kt | 2 +- .../tryfinch/api/services/blocking/hris/DirectoryServiceTest.kt | 2 +- .../tryfinch/api/services/blocking/hris/DocumentServiceTest.kt | 2 +- .../api/services/blocking/hris/EmploymentServiceTest.kt | 2 +- .../api/services/blocking/hris/IndividualServiceTest.kt | 2 +- .../api/services/blocking/hris/PayStatementServiceTest.kt | 2 +- .../tryfinch/api/services/blocking/hris/PaymentServiceTest.kt | 2 +- .../services/blocking/hris/benefits/IndividualServiceTest.kt | 2 +- .../tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt | 2 +- .../tryfinch/api/services/blocking/jobs/ManualServiceTest.kt | 2 +- .../api/services/blocking/payroll/PayGroupServiceTest.kt | 2 +- .../api/services/blocking/sandbox/CompanyServiceTest.kt | 2 +- .../api/services/blocking/sandbox/ConnectionServiceTest.kt | 2 +- .../api/services/blocking/sandbox/DirectoryServiceTest.kt | 2 +- .../api/services/blocking/sandbox/EmploymentServiceTest.kt | 2 +- .../api/services/blocking/sandbox/IndividualServiceTest.kt | 2 +- .../tryfinch/api/services/blocking/sandbox/JobServiceTest.kt | 2 +- .../api/services/blocking/sandbox/PaymentServiceTest.kt | 2 +- .../services/blocking/sandbox/connections/AccountServiceTest.kt | 2 +- .../services/blocking/sandbox/jobs/ConfigurationServiceTest.kt | 2 +- 148 files changed, 148 insertions(+), 148 deletions(-) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccessTokenCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccessTokenCreateParamsTest.kt index 3878dc6a..c1305e02 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccessTokenCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccessTokenCreateParamsTest.kt @@ -6,7 +6,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class AccessTokenCreateParamsTest { +internal class AccessTokenCreateParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountCreateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountCreateResponseTest.kt index 77ad0cd6..2fc74cd9 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountCreateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountCreateResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class AccountCreateResponseTest { +internal class AccountCreateResponseTest { @Test fun createAccountCreateResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountDisconnectParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountDisconnectParamsTest.kt index 939d87df..346c850b 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountDisconnectParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountDisconnectParamsTest.kt @@ -4,7 +4,7 @@ package com.tryfinch.api.models import org.junit.jupiter.api.Test -class AccountDisconnectParamsTest { +internal class AccountDisconnectParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountIntrospectParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountIntrospectParamsTest.kt index df68f2aa..51ed781b 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountIntrospectParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountIntrospectParamsTest.kt @@ -4,7 +4,7 @@ package com.tryfinch.api.models import org.junit.jupiter.api.Test -class AccountIntrospectParamsTest { +internal class AccountIntrospectParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateResponseTest.kt index 822eb797..a8beec51 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class AccountUpdateResponseTest { +internal class AccountUpdateResponseTest { @Test fun createAccountUpdateResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedAsyncJobTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedAsyncJobTest.kt index 4b581077..368b350b 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedAsyncJobTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedAsyncJobTest.kt @@ -6,7 +6,7 @@ import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class AutomatedAsyncJobTest { +internal class AutomatedAsyncJobTest { @Test fun createAutomatedAsyncJob() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedCreateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedCreateResponseTest.kt index 9fad95d7..faa62bb2 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedCreateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedCreateResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class AutomatedCreateResponseTest { +internal class AutomatedCreateResponseTest { @Test fun createAutomatedCreateResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedListResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedListResponseTest.kt index 4eafc3a8..c2a2a63a 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedListResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedListResponseTest.kt @@ -6,7 +6,7 @@ import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class AutomatedListResponseTest { +internal class AutomatedListResponseTest { @Test fun createAutomatedListResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BaseWebhookEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BaseWebhookEventTest.kt index 85809beb..1696ad05 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BaseWebhookEventTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BaseWebhookEventTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class BaseWebhookEventTest { +internal class BaseWebhookEventTest { @Test fun createBaseWebhookEvent() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitContributionTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitContributionTest.kt index 08448c53..10a46665 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitContributionTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitContributionTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class BenefitContributionTest { +internal class BenefitContributionTest { @Test fun createBenefitContribution() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperationsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperationsTest.kt index c9ceed88..5b1a21ee 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperationsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperationsTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class BenefitFeaturesAndOperationsTest { +internal class BenefitFeaturesAndOperationsTest { @Test fun createBenefitFeaturesAndOperations() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitsSupportTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitsSupportTest.kt index 1d3cc3cb..ba9f3c4e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitsSupportTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitsSupportTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class BenefitsSupportTest { +internal class BenefitsSupportTest { @Test fun createBenefitsSupport() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyBenefitTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyBenefitTest.kt index e3f8d682..60c2bb07 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyBenefitTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyBenefitTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class CompanyBenefitTest { +internal class CompanyBenefitTest { @Test fun createCompanyBenefit() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt index 4ca6ddb3..c040a8a7 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class CompanyTest { +internal class CompanyTest { @Test fun createCompany() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt index c08e1171..d5578b15 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class CompanyUpdateResponseTest { +internal class CompanyUpdateResponseTest { @Test fun createCompanyUpdateResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt index 8ea1ce5d..e75e85ce 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt @@ -6,7 +6,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class ConnectSessionNewParamsTest { +internal class ConnectSessionNewParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt index bd7bdfdc..e685f3bd 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt @@ -6,7 +6,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class ConnectSessionReauthenticateParamsTest { +internal class ConnectSessionReauthenticateParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectionCreateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectionCreateResponseTest.kt index 742816d8..9fe69a6a 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectionCreateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectionCreateResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class ConnectionCreateResponseTest { +internal class ConnectionCreateResponseTest { @Test fun createConnectionCreateResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateAccessTokenResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateAccessTokenResponseTest.kt index 86c7535f..68f5c769 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateAccessTokenResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateAccessTokenResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class CreateAccessTokenResponseTest { +internal class CreateAccessTokenResponseTest { @Test fun createCreateAccessTokenResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponseTest.kt index 1edef034..6bb14863 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class CreateCompanyBenefitsResponseTest { +internal class CreateCompanyBenefitsResponseTest { @Test fun createCreateCompanyBenefitsResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DisconnectResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DisconnectResponseTest.kt index 9ff5e861..b735757c 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DisconnectResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DisconnectResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class DisconnectResponseTest { +internal class DisconnectResponseTest { @Test fun createDisconnectResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentListResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentListResponseTest.kt index ace92517..9cb20901 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentListResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentListResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class DocumentListResponseTest { +internal class DocumentListResponseTest { @Test fun createDocumentListResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentResponseTest.kt index d138c11d..41a63977 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class DocumentResponseTest { +internal class DocumentResponseTest { @Test fun createDocumentResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataResponseTest.kt index e35bbacf..09e2d08f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataResponseTest.kt @@ -6,7 +6,7 @@ import com.tryfinch.api.core.JsonValue import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class EmploymentDataResponseTest { +internal class EmploymentDataResponseTest { @Test fun createEmploymentDataResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt index 2eea0b0b..16cc726b 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt @@ -6,7 +6,7 @@ import com.tryfinch.api.core.JsonValue import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class EmploymentDataTest { +internal class EmploymentDataTest { @Test fun createEmploymentData() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt index 282c47ae..f4def2ce 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt @@ -6,7 +6,7 @@ import com.tryfinch.api.core.JsonValue import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class EmploymentUpdateResponseTest { +internal class EmploymentUpdateResponseTest { @Test fun createEmploymentUpdateResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EnrolledIndividualTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EnrolledIndividualTest.kt index 0613d04c..164ad62c 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EnrolledIndividualTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EnrolledIndividualTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class EnrolledIndividualTest { +internal class EnrolledIndividualTest { @Test fun createEnrolledIndividual() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitCreateParamsTest.kt index 8255a9c7..2ab7eacd 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitCreateParamsTest.kt @@ -6,7 +6,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class HrisBenefitCreateParamsTest { +internal class HrisBenefitCreateParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParamsTest.kt index de75d8dc..88ab3580 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParamsTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class HrisBenefitIndividualEnrolledIdsParamsTest { +internal class HrisBenefitIndividualEnrolledIdsParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParamsTest.kt index 5768f00c..c906c158 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParamsTest.kt @@ -6,7 +6,7 @@ import com.tryfinch.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class HrisBenefitIndividualRetrieveManyBenefitsParamsTest { +internal class HrisBenefitIndividualRetrieveManyBenefitsParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt index 9e007c2a..8dc66fd7 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt @@ -6,7 +6,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class HrisBenefitIndividualUnenrollManyParamsTest { +internal class HrisBenefitIndividualUnenrollManyParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitListParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitListParamsTest.kt index 587d8917..09d50f7e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitListParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitListParamsTest.kt @@ -4,7 +4,7 @@ package com.tryfinch.api.models import org.junit.jupiter.api.Test -class HrisBenefitListParamsTest { +internal class HrisBenefitListParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParamsTest.kt index 5aaf456f..c9e4aa6c 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParamsTest.kt @@ -4,7 +4,7 @@ package com.tryfinch.api.models import org.junit.jupiter.api.Test -class HrisBenefitListSupportedBenefitsParamsTest { +internal class HrisBenefitListSupportedBenefitsParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParamsTest.kt index ca7ecf00..7cf83452 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParamsTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class HrisBenefitRetrieveParamsTest { +internal class HrisBenefitRetrieveParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt index b9074f26..0cc495df 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt @@ -6,7 +6,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class HrisBenefitUpdateParamsTest { +internal class HrisBenefitUpdateParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParamsTest.kt index ba444bb0..d96e46dd 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParamsTest.kt @@ -4,7 +4,7 @@ package com.tryfinch.api.models import org.junit.jupiter.api.Test -class HrisCompanyRetrieveParamsTest { +internal class HrisCompanyRetrieveParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParamsTest.kt index 42efb8a4..d1418f46 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParamsTest.kt @@ -6,7 +6,7 @@ import com.tryfinch.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class HrisDirectoryListIndividualsParamsTest { +internal class HrisDirectoryListIndividualsParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListParamsTest.kt index fdfd708a..2414c44e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListParamsTest.kt @@ -6,7 +6,7 @@ import com.tryfinch.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class HrisDirectoryListParamsTest { +internal class HrisDirectoryListParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentListParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentListParamsTest.kt index 4b3093ef..5a9ab2e2 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentListParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentListParamsTest.kt @@ -6,7 +6,7 @@ import com.tryfinch.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class HrisDocumentListParamsTest { +internal class HrisDocumentListParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParamsTest.kt index 89a0e4c9..04925a10 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParamsTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class HrisDocumentRetreiveParamsTest { +internal class HrisDocumentRetreiveParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParamsTest.kt index c1b825d6..f339dccf 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParamsTest.kt @@ -6,7 +6,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class HrisEmploymentRetrieveManyParamsTest { +internal class HrisEmploymentRetrieveManyParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt index 34340368..1977540e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt @@ -6,7 +6,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class HrisIndividualRetrieveManyParamsTest { +internal class HrisIndividualRetrieveManyParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt index da6b1ccd..cc41f983 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt @@ -6,7 +6,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class HrisPayStatementRetrieveManyParamsTest { +internal class HrisPayStatementRetrieveManyParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPaymentListParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPaymentListParamsTest.kt index 573bdb2c..27d5deb2 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPaymentListParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPaymentListParamsTest.kt @@ -7,7 +7,7 @@ import java.time.LocalDate import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class HrisPaymentListParamsTest { +internal class HrisPaymentListParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IncomeTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IncomeTest.kt index 48189257..234b5bdc 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IncomeTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IncomeTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class IncomeTest { +internal class IncomeTest { @Test fun createIncome() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualBenefitTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualBenefitTest.kt index 64fda15d..65e14994 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualBenefitTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualBenefitTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class IndividualBenefitTest { +internal class IndividualBenefitTest { @Test fun createIndividualBenefit() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponseTest.kt index 02aedfcf..a1bb5e48 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class IndividualEnrolledIdsResponseTest { +internal class IndividualEnrolledIdsResponseTest { @Test fun createIndividualEnrolledIdsResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualInDirectoryTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualInDirectoryTest.kt index e812e2d1..7c7a2c0b 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualInDirectoryTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualInDirectoryTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class IndividualInDirectoryTest { +internal class IndividualInDirectoryTest { @Test fun createIndividualInDirectory() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualResponseTest.kt index a2663ff8..47c09bce 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class IndividualResponseTest { +internal class IndividualResponseTest { @Test fun createIndividualResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt index 80107aeb..f7b3c2a3 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class IndividualTest { +internal class IndividualTest { @Test fun createIndividual() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt index 20525b44..4aec13f7 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class IndividualUpdateResponseTest { +internal class IndividualUpdateResponseTest { @Test fun createIndividualUpdateResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IntrospectionTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IntrospectionTest.kt index 573f19a4..d963baf9 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IntrospectionTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IntrospectionTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class IntrospectionTest { +internal class IntrospectionTest { @Test fun createIntrospection() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedCreateParamsTest.kt index 3e50cc29..8221c7e1 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedCreateParamsTest.kt @@ -6,7 +6,7 @@ import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class JobAutomatedCreateParamsTest { +internal class JobAutomatedCreateParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedListParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedListParamsTest.kt index 7d8eb4e6..0a87d4b8 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedListParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedListParamsTest.kt @@ -6,7 +6,7 @@ import com.tryfinch.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class JobAutomatedListParamsTest { +internal class JobAutomatedListParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParamsTest.kt index 3aaceca0..3b9dea19 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParamsTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class JobAutomatedRetrieveParamsTest { +internal class JobAutomatedRetrieveParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCreateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCreateResponseTest.kt index 330d1b6a..5160cdf2 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCreateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCreateResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class JobCreateResponseTest { +internal class JobCreateResponseTest { @Test fun createJobCreateResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobManualRetrieveParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobManualRetrieveParamsTest.kt index 9ae5ed32..f75a7aec 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobManualRetrieveParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobManualRetrieveParamsTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class JobManualRetrieveParamsTest { +internal class JobManualRetrieveParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/LocationTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/LocationTest.kt index 82a65fd0..ae70caf7 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/LocationTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/LocationTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class LocationTest { +internal class LocationTest { @Test fun createLocation() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ManualAsyncJobTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ManualAsyncJobTest.kt index 198d409a..93f12c76 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ManualAsyncJobTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ManualAsyncJobTest.kt @@ -6,7 +6,7 @@ import com.tryfinch.api.core.JsonValue import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class ManualAsyncJobTest { +internal class ManualAsyncJobTest { @Test fun createManualAsyncJob() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/MoneyTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/MoneyTest.kt index 3d0dd64a..6b2bfbd1 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/MoneyTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/MoneyTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class MoneyTest { +internal class MoneyTest { @Test fun createMoney() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/OperationSupportMatrixTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/OperationSupportMatrixTest.kt index c907621d..19c90b35 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/OperationSupportMatrixTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/OperationSupportMatrixTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class OperationSupportMatrixTest { +internal class OperationSupportMatrixTest { @Test fun createOperationSupportMatrix() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PagingTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PagingTest.kt index 896698f3..1a5c2b60 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PagingTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PagingTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class PagingTest { +internal class PagingTest { @Test fun createPaging() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt index f3c2561b..3346f8d4 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class PayGroupListResponseTest { +internal class PayGroupListResponseTest { @Test fun createPayGroupListResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponseTest.kt index 21f2f7c9..421db3e7 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class PayGroupRetrieveResponseTest { +internal class PayGroupRetrieveResponseTest { @Test fun createPayGroupRetrieveResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt index 8c004da4..c1ea4fb8 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt @@ -6,7 +6,7 @@ import com.tryfinch.api.core.JsonValue import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class PayStatementResponseBodyTest { +internal class PayStatementResponseBodyTest { @Test fun createPayStatementResponseBody() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt index 2400e2ca..c4d15a04 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt @@ -6,7 +6,7 @@ import com.tryfinch.api.core.JsonValue import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class PayStatementResponseTest { +internal class PayStatementResponseTest { @Test fun createPayStatementResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt index 62d33044..deb7e2de 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt @@ -6,7 +6,7 @@ import com.tryfinch.api.core.JsonValue import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class PayStatementTest { +internal class PayStatementTest { @Test fun createPayStatement() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentCreateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentCreateResponseTest.kt index 16d8a746..cff66940 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentCreateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentCreateResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class PaymentCreateResponseTest { +internal class PaymentCreateResponseTest { @Test fun createPaymentCreateResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt index 42235e2a..d9b612b1 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class PaymentTest { +internal class PaymentTest { @Test fun createPayment() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayrollPayGroupListParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayrollPayGroupListParamsTest.kt index 45029bf7..d96aa5ee 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayrollPayGroupListParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayrollPayGroupListParamsTest.kt @@ -6,7 +6,7 @@ import com.tryfinch.api.core.http.QueryParams import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class PayrollPayGroupListParamsTest { +internal class PayrollPayGroupListParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParamsTest.kt index 657b7fd2..db9a28b8 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParamsTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class PayrollPayGroupRetrieveParamsTest { +internal class PayrollPayGroupRetrieveParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderListParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderListParamsTest.kt index a3b71dac..0e0c7c6f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderListParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderListParamsTest.kt @@ -4,7 +4,7 @@ package com.tryfinch.api.models import org.junit.jupiter.api.Test -class ProviderListParamsTest { +internal class ProviderListParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderTest.kt index e16e32ae..b3ddae7e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class ProviderTest { +internal class ProviderTest { @Test fun createProvider() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardParamsTest.kt index d754bf09..accc9d4c 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardParamsTest.kt @@ -7,7 +7,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class RequestForwardingForwardParamsTest { +internal class RequestForwardingForwardParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponseTest.kt index c08f7e8f..8717def5 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponseTest.kt @@ -6,7 +6,7 @@ import com.tryfinch.api.core.JsonValue import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class RequestForwardingForwardResponseTest { +internal class RequestForwardingForwardResponseTest { @Test fun createRequestForwardingForwardResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt index 111736a3..cf6524ba 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt @@ -6,7 +6,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class SandboxCompanyUpdateParamsTest { +internal class SandboxCompanyUpdateParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt index 666843c0..220516b3 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt @@ -6,7 +6,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class SandboxConnectionAccountCreateParamsTest { +internal class SandboxConnectionAccountCreateParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt index 4a60449c..925e24fa 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt @@ -6,7 +6,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class SandboxConnectionAccountUpdateParamsTest { +internal class SandboxConnectionAccountUpdateParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt index 1e1fc9ac..58b1da93 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt @@ -6,7 +6,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class SandboxConnectionCreateParamsTest { +internal class SandboxConnectionCreateParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParamsTest.kt index d4b9e47f..27ec26ea 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParamsTest.kt @@ -7,7 +7,7 @@ import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class SandboxDirectoryCreateParamsTest { +internal class SandboxDirectoryCreateParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt index 6e2e0112..600482a1 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt @@ -7,7 +7,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class SandboxEmploymentUpdateParamsTest { +internal class SandboxEmploymentUpdateParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt index 28ebe7b1..d4bf6d37 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt @@ -6,7 +6,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class SandboxIndividualUpdateParamsTest { +internal class SandboxIndividualUpdateParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParamsTest.kt index 297979f1..7d0606c5 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParamsTest.kt @@ -4,7 +4,7 @@ package com.tryfinch.api.models import org.junit.jupiter.api.Test -class SandboxJobConfigurationRetrieveParamsTest { +internal class SandboxJobConfigurationRetrieveParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationTest.kt index 9aceb8c2..f379a2d7 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class SandboxJobConfigurationTest { +internal class SandboxJobConfigurationTest { @Test fun createSandboxJobConfiguration() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParamsTest.kt index 6c748f9b..2d0b8185 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParamsTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class SandboxJobConfigurationUpdateParamsTest { +internal class SandboxJobConfigurationUpdateParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobCreateParamsTest.kt index 1cd761ec..e83a96d3 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobCreateParamsTest.kt @@ -6,7 +6,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class SandboxJobCreateParamsTest { +internal class SandboxJobCreateParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt index 708ed715..7ff6e448 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt @@ -7,7 +7,7 @@ import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class SandboxPaymentCreateParamsTest { +internal class SandboxPaymentCreateParamsTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionNewResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionNewResponseTest.kt index 9ddf00ba..c0d2af8a 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionNewResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionNewResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class SessionNewResponseTest { +internal class SessionNewResponseTest { @Test fun createSessionNewResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionReauthenticateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionReauthenticateResponseTest.kt index e260ceea..f431c7d5 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionReauthenticateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionReauthenticateResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class SessionReauthenticateResponseTest { +internal class SessionReauthenticateResponseTest { @Test fun createSessionReauthenticateResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportPerBenefitTypeTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportPerBenefitTypeTest.kt index 17971b5a..67030736 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportPerBenefitTypeTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportPerBenefitTypeTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class SupportPerBenefitTypeTest { +internal class SupportPerBenefitTypeTest { @Test fun createSupportPerBenefitType() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportedBenefitTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportedBenefitTest.kt index 56ad5909..46fa8e18 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportedBenefitTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportedBenefitTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class SupportedBenefitTest { +internal class SupportedBenefitTest { @Test fun createSupportedBenefit() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt index 6f4f0b7f..916656cb 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class UnenrolledIndividualTest { +internal class UnenrolledIndividualTest { @Test fun createUnenrolledIndividual() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponseTest.kt index 818d0edf..680ac49c 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponseTest.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class UpdateCompanyBenefitResponseTest { +internal class UpdateCompanyBenefitResponseTest { @Test fun createUpdateCompanyBenefitResponse() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42005Test.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42005Test.kt index 4a7f6313..48fda83e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42005Test.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42005Test.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class W42005Test { +internal class W42005Test { @Test fun createW42005() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42020Test.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42020Test.kt index 227e9d74..d2475cf0 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42020Test.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42020Test.kt @@ -5,7 +5,7 @@ package com.tryfinch.api.models import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class W42020Test { +internal class W42020Test { @Test fun createW42020() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ErrorHandlingTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ErrorHandlingTest.kt index f6cea147..601cb6f4 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ErrorHandlingTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ErrorHandlingTest.kt @@ -30,7 +30,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @WireMockTest -class ErrorHandlingTest { +internal class ErrorHandlingTest { companion object { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncTest.kt index 32d058d1..2c9a0a83 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class AccessTokenServiceAsyncTest { +internal class AccessTokenServiceAsyncTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncTest.kt index 62020a50..486debf9 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class AccountServiceAsyncTest { +internal class AccountServiceAsyncTest { @Test fun disconnect() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncTest.kt index 970a3878..a929fd64 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class ProviderServiceAsyncTest { +internal class ProviderServiceAsyncTest { @Test fun list() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncTest.kt index a30f22d6..fe0ef7f9 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class RequestForwardingServiceAsyncTest { +internal class RequestForwardingServiceAsyncTest { @Test fun forward() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncTest.kt index 9b5e85dc..05610d63 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class SessionServiceAsyncTest { +internal class SessionServiceAsyncTest { @Test fun new_() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncTest.kt index 8c2a73eb..549630a8 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncTest.kt @@ -13,7 +13,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class BenefitServiceAsyncTest { +internal class BenefitServiceAsyncTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncTest.kt index f281cf88..b2b53d52 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class CompanyServiceAsyncTest { +internal class CompanyServiceAsyncTest { @Test fun retrieve() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncTest.kt index 82958815..d6453a09 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class DirectoryServiceAsyncTest { +internal class DirectoryServiceAsyncTest { @Test fun list() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncTest.kt index efb50717..1348b9c8 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class DocumentServiceAsyncTest { +internal class DocumentServiceAsyncTest { @Test fun list() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncTest.kt index 1a201342..0bb8b214 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class EmploymentServiceAsyncTest { +internal class EmploymentServiceAsyncTest { @Test fun retrieveMany() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncTest.kt index 5c9271e4..1bb5caf8 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class IndividualServiceAsyncTest { +internal class IndividualServiceAsyncTest { @Test fun retrieveMany() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncTest.kt index 20ec632a..585036ae 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class PayStatementServiceAsyncTest { +internal class PayStatementServiceAsyncTest { @Test fun retrieveMany() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncTest.kt index 3525074f..8d872e71 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class PaymentServiceAsyncTest { +internal class PaymentServiceAsyncTest { @Test fun list() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncTest.kt index e2e0ba6a..28f057fa 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncTest.kt @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class IndividualServiceAsyncTest { +internal class IndividualServiceAsyncTest { @Test fun enrolledIds() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncTest.kt index f8e599de..b1eb7509 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncTest.kt @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class AutomatedServiceAsyncTest { +internal class AutomatedServiceAsyncTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncTest.kt index b0e5e66f..5a095fad 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class ManualServiceAsyncTest { +internal class ManualServiceAsyncTest { @Test fun retrieve() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncTest.kt index 603c5607..c7bf8d63 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class PayGroupServiceAsyncTest { +internal class PayGroupServiceAsyncTest { @Test fun retrieve() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncTest.kt index e4a8d339..dd90399f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class CompanyServiceAsyncTest { +internal class CompanyServiceAsyncTest { @Test fun update() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncTest.kt index d642684f..197e0ec5 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class ConnectionServiceAsyncTest { +internal class ConnectionServiceAsyncTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncTest.kt index c6c5da92..61dc0701 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncTest.kt @@ -12,7 +12,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class DirectoryServiceAsyncTest { +internal class DirectoryServiceAsyncTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncTest.kt index 406c6e9b..9ce17913 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncTest.kt @@ -12,7 +12,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class EmploymentServiceAsyncTest { +internal class EmploymentServiceAsyncTest { @Test fun update() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncTest.kt index e7b71dc4..7f489dbe 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class IndividualServiceAsyncTest { +internal class IndividualServiceAsyncTest { @Test fun update() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncTest.kt index 157e7459..16fde9f4 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class JobServiceAsyncTest { +internal class JobServiceAsyncTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncTest.kt index 88fdddfe..1faf4d8a 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncTest.kt @@ -12,7 +12,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class PaymentServiceAsyncTest { +internal class PaymentServiceAsyncTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncTest.kt index 6e7732ce..ade78aae 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncTest.kt @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class AccountServiceAsyncTest { +internal class AccountServiceAsyncTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncTest.kt index c219443c..e7181ea2 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class ConfigurationServiceAsyncTest { +internal class ConfigurationServiceAsyncTest { @Test fun retrieve() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceTest.kt index c015937d..68a7c439 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class AccessTokenServiceTest { +internal class AccessTokenServiceTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AccountServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AccountServiceTest.kt index d3b6eab2..adb69330 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AccountServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AccountServiceTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class AccountServiceTest { +internal class AccountServiceTest { @Test fun disconnect() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/ProviderServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/ProviderServiceTest.kt index 061ba5ac..ef8de16e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/ProviderServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/ProviderServiceTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class ProviderServiceTest { +internal class ProviderServiceTest { @Test fun list() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceTest.kt index ea604816..a68eed63 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class RequestForwardingServiceTest { +internal class RequestForwardingServiceTest { @Test fun forward() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceTest.kt index 2ddaf852..276f3066 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class SessionServiceTest { +internal class SessionServiceTest { @Test fun new_() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceTest.kt index 488bfb34..e4b2635e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceTest.kt @@ -13,7 +13,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class BenefitServiceTest { +internal class BenefitServiceTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceTest.kt index 79040ece..40988679 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class CompanyServiceTest { +internal class CompanyServiceTest { @Test fun retrieve() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceTest.kt index 61039c9e..a5417bd6 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class DirectoryServiceTest { +internal class DirectoryServiceTest { @Test fun list() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceTest.kt index aee56e24..c90cbabd 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class DocumentServiceTest { +internal class DocumentServiceTest { @Test fun list() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceTest.kt index 1de19a6e..f36ea0d8 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class EmploymentServiceTest { +internal class EmploymentServiceTest { @Test fun retrieveMany() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceTest.kt index 229dbb1a..83d763cf 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class IndividualServiceTest { +internal class IndividualServiceTest { @Test fun retrieveMany() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceTest.kt index 625767fa..14ef62a2 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class PayStatementServiceTest { +internal class PayStatementServiceTest { @Test fun retrieveMany() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceTest.kt index dcdb6295..81898391 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class PaymentServiceTest { +internal class PaymentServiceTest { @Test fun list() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceTest.kt index 7f39fa58..14051f3f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceTest.kt @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class IndividualServiceTest { +internal class IndividualServiceTest { @Test fun enrolledIds() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt index c4d92f41..ee65f389 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class AutomatedServiceTest { +internal class AutomatedServiceTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceTest.kt index fcf6a74d..3ad62102 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class ManualServiceTest { +internal class ManualServiceTest { @Test fun retrieve() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceTest.kt index 569dfb08..5c257d37 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class PayGroupServiceTest { +internal class PayGroupServiceTest { @Test fun retrieve() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceTest.kt index e16c0ee9..a70db440 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class CompanyServiceTest { +internal class CompanyServiceTest { @Test fun update() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceTest.kt index c310e2cc..af59feec 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class ConnectionServiceTest { +internal class ConnectionServiceTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt index bd96b1f1..92f1c20d 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt @@ -12,7 +12,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class DirectoryServiceTest { +internal class DirectoryServiceTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceTest.kt index 578cfb42..96892e6b 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceTest.kt @@ -12,7 +12,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class EmploymentServiceTest { +internal class EmploymentServiceTest { @Test fun update() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceTest.kt index 6171b984..d4138d0c 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class IndividualServiceTest { +internal class IndividualServiceTest { @Test fun update() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceTest.kt index b196352b..b277cd6f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class JobServiceTest { +internal class JobServiceTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceTest.kt index 3d7751cd..3d67e68e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceTest.kt @@ -12,7 +12,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class PaymentServiceTest { +internal class PaymentServiceTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceTest.kt index 2b427d6c..487cbb79 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceTest.kt @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class AccountServiceTest { +internal class AccountServiceTest { @Test fun create() { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceTest.kt index 12e59369..64cd3fad 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class ConfigurationServiceTest { +internal class ConfigurationServiceTest { @Test fun retrieve() { From 9543169b8b1af2c39666c6be1df6ea40f0e1a67f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Mar 2025 17:09:40 +0000 Subject: [PATCH 25/65] chore(internal): add generated comment (#496) --- .../src/main/kotlin/com/tryfinch/api/core/http/QueryParams.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/QueryParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/QueryParams.kt index e35ea929..9d2ff7c5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/QueryParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/QueryParams.kt @@ -1,3 +1,5 @@ +// File generated from our OpenAPI spec by Stainless. + package com.tryfinch.api.core.http import com.tryfinch.api.core.toImmutable From d199989894e98456e329085b6904bc58f889bae6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Mar 2025 21:24:00 +0000 Subject: [PATCH 26/65] docs: add `build` method comments (#497) --- .../api/client/okhttp/FinchOkHttpClient.kt | 5 + .../client/okhttp/FinchOkHttpClientAsync.kt | 5 + .../com/tryfinch/api/core/ClientOptions.kt | 12 + .../kotlin/com/tryfinch/api/core/Timeout.kt | 5 + .../com/tryfinch/api/errors/FinchError.kt | 5 + .../api/models/AccessTokenCreateParams.kt | 24 ++ .../api/models/AccountCreateResponse.kt | 18 ++ .../api/models/AccountDisconnectParams.kt | 5 + .../api/models/AccountIntrospectParams.kt | 5 + .../tryfinch/api/models/AccountUpdateEvent.kt | 217 ++++++++++++++++++ .../api/models/AccountUpdateResponse.kt | 16 ++ .../tryfinch/api/models/AutomatedAsyncJob.kt | 25 ++ .../api/models/AutomatedCreateResponse.kt | 15 ++ .../api/models/AutomatedListResponse.kt | 28 +++ .../tryfinch/api/models/BaseWebhookEvent.kt | 13 ++ .../api/models/BenefitContribution.kt | 5 + .../models/BenefitFeaturesAndOperations.kt | 10 + .../tryfinch/api/models/BenefitsSupport.kt | 5 + .../kotlin/com/tryfinch/api/models/Company.kt | 40 ++++ .../com/tryfinch/api/models/CompanyBenefit.kt | 15 ++ .../com/tryfinch/api/models/CompanyEvent.kt | 18 ++ .../api/models/CompanyUpdateResponse.kt | 39 ++++ .../api/models/ConnectSessionNewParams.kt | 33 +++ .../ConnectSessionReauthenticateParams.kt | 24 ++ .../api/models/ConnectionCreateResponse.kt | 18 ++ .../api/models/CreateAccessTokenResponse.kt | 19 ++ .../models/CreateCompanyBenefitsResponse.kt | 12 + .../com/tryfinch/api/models/DirectoryEvent.kt | 18 ++ .../tryfinch/api/models/DisconnectResponse.kt | 12 + .../api/models/DocumentListResponse.kt | 13 ++ .../tryfinch/api/models/DocumentResponse.kt | 5 + .../com/tryfinch/api/models/EmploymentData.kt | 25 ++ .../api/models/EmploymentDataResponse.kt | 5 + .../tryfinch/api/models/EmploymentEvent.kt | 18 ++ .../api/models/EmploymentUpdateResponse.kt | 25 ++ .../tryfinch/api/models/EnrolledIndividual.kt | 10 + .../api/models/HrisBenefitCreateParams.kt | 10 + .../HrisBenefitIndividualEnrolledIdsParams.kt | 12 + ...nefitIndividualRetrieveManyBenefitsPage.kt | 7 +- ...IndividualRetrieveManyBenefitsPageAsync.kt | 7 +- ...fitIndividualRetrieveManyBenefitsParams.kt | 12 + .../HrisBenefitIndividualUnenrollManyPage.kt | 7 +- ...sBenefitIndividualUnenrollManyPageAsync.kt | 7 +- ...HrisBenefitIndividualUnenrollManyParams.kt | 17 ++ .../api/models/HrisBenefitListPage.kt | 7 +- .../api/models/HrisBenefitListPageAsync.kt | 7 +- .../api/models/HrisBenefitListParams.kt | 5 + .../HrisBenefitListSupportedBenefitsPage.kt | 7 +- ...isBenefitListSupportedBenefitsPageAsync.kt | 7 +- .../HrisBenefitListSupportedBenefitsParams.kt | 5 + .../api/models/HrisBenefitRetrieveParams.kt | 12 + .../api/models/HrisBenefitUpdateParams.kt | 17 ++ .../api/models/HrisCompanyRetrieveParams.kt | 5 + .../HrisDirectoryListIndividualsPage.kt | 8 +- .../HrisDirectoryListIndividualsPageAsync.kt | 8 +- .../HrisDirectoryListIndividualsParams.kt | 5 + .../api/models/HrisDirectoryListPage.kt | 8 +- .../api/models/HrisDirectoryListPageAsync.kt | 8 +- .../api/models/HrisDirectoryListParams.kt | 5 + .../api/models/HrisDocumentListParams.kt | 5 + .../api/models/HrisDocumentRetreiveParams.kt | 12 + .../models/HrisEmploymentRetrieveManyPage.kt | 7 +- .../HrisEmploymentRetrieveManyPageAsync.kt | 7 +- .../HrisEmploymentRetrieveManyParams.kt | 36 +++ .../models/HrisIndividualRetrieveManyPage.kt | 7 +- .../HrisIndividualRetrieveManyPageAsync.kt | 7 +- .../HrisIndividualRetrieveManyParams.kt | 20 ++ .../HrisPayStatementRetrieveManyPage.kt | 7 +- .../HrisPayStatementRetrieveManyPageAsync.kt | 7 +- .../HrisPayStatementRetrieveManyParams.kt | 36 +++ .../api/models/HrisPaymentListPage.kt | 7 +- .../api/models/HrisPaymentListPageAsync.kt | 7 +- .../api/models/HrisPaymentListParams.kt | 13 ++ .../kotlin/com/tryfinch/api/models/Income.kt | 5 + .../com/tryfinch/api/models/Individual.kt | 15 ++ .../tryfinch/api/models/IndividualBenefit.kt | 10 + .../models/IndividualEnrolledIdsResponse.kt | 13 ++ .../tryfinch/api/models/IndividualEvent.kt | 18 ++ .../api/models/IndividualInDirectory.kt | 15 ++ .../tryfinch/api/models/IndividualResponse.kt | 5 + .../api/models/IndividualUpdateResponse.kt | 15 ++ .../com/tryfinch/api/models/Introspection.kt | 42 ++++ .../api/models/JobAutomatedCreateParams.kt | 42 ++++ .../api/models/JobAutomatedListParams.kt | 5 + .../api/models/JobAutomatedRetrieveParams.kt | 12 + .../tryfinch/api/models/JobCompletionEvent.kt | 26 +++ .../tryfinch/api/models/JobCreateResponse.kt | 15 ++ .../api/models/JobManualRetrieveParams.kt | 12 + .../com/tryfinch/api/models/Location.kt | 5 + .../com/tryfinch/api/models/ManualAsyncJob.kt | 14 ++ .../kotlin/com/tryfinch/api/models/Money.kt | 5 + .../api/models/OperationSupportMatrix.kt | 5 + .../kotlin/com/tryfinch/api/models/Paging.kt | 5 + .../api/models/PayGroupListResponse.kt | 5 + .../api/models/PayGroupRetrieveResponse.kt | 15 ++ .../com/tryfinch/api/models/PayStatement.kt | 85 +++++++ .../tryfinch/api/models/PayStatementEvent.kt | 18 ++ .../api/models/PayStatementResponse.kt | 5 + .../api/models/PayStatementResponseBody.kt | 5 + .../kotlin/com/tryfinch/api/models/Payment.kt | 10 + .../api/models/PaymentCreateResponse.kt | 13 ++ .../com/tryfinch/api/models/PaymentEvent.kt | 26 +++ .../api/models/PayrollPayGroupListPage.kt | 7 +- .../models/PayrollPayGroupListPageAsync.kt | 7 +- .../api/models/PayrollPayGroupListParams.kt | 5 + .../models/PayrollPayGroupRetrieveParams.kt | 12 + .../com/tryfinch/api/models/Provider.kt | 179 +++++++++++++++ .../tryfinch/api/models/ProviderListPage.kt | 7 +- .../api/models/ProviderListPageAsync.kt | 7 +- .../tryfinch/api/models/ProviderListParams.kt | 5 + .../models/RequestForwardingForwardParams.kt | 26 +++ .../RequestForwardingForwardResponse.kt | 31 +++ .../api/models/SandboxCompanyUpdateParams.kt | 58 +++++ .../SandboxConnectionAccountCreateParams.kt | 26 +++ .../SandboxConnectionAccountUpdateParams.kt | 10 + .../models/SandboxConnectionCreateParams.kt | 24 ++ .../models/SandboxDirectoryCreateParams.kt | 40 ++++ .../models/SandboxEmploymentUpdateParams.kt | 37 +++ .../models/SandboxIndividualUpdateParams.kt | 27 +++ .../api/models/SandboxJobConfiguration.kt | 13 ++ .../SandboxJobConfigurationRetrieveParams.kt | 5 + .../SandboxJobConfigurationUpdateParams.kt | 12 + .../api/models/SandboxJobCreateParams.kt | 24 ++ .../api/models/SandboxPaymentCreateParams.kt | 99 ++++++++ .../tryfinch/api/models/SessionNewResponse.kt | 13 ++ .../models/SessionReauthenticateResponse.kt | 13 ++ .../api/models/SupportPerBenefitType.kt | 5 + .../tryfinch/api/models/SupportedBenefit.kt | 5 + .../api/models/UnenrolledIndividual.kt | 10 + .../models/UpdateCompanyBenefitResponse.kt | 12 + .../kotlin/com/tryfinch/api/models/W42005.kt | 10 + .../kotlin/com/tryfinch/api/models/W42020.kt | 10 + 132 files changed, 2319 insertions(+), 24 deletions(-) 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 9a28cea2..1be855e9 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 @@ -169,6 +169,11 @@ class FinchOkHttpClient private constructor() { fun fromEnv() = apply { clientOptions.fromEnv() } + /** + * Returns an immutable instance of [FinchClient]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): FinchClient = FinchClientImpl( clientOptions 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 c194befb..d3fbb6e1 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 @@ -169,6 +169,11 @@ class FinchOkHttpClientAsync private constructor() { fun fromEnv() = apply { clientOptions.fromEnv() } + /** + * Returns an immutable instance of [FinchClientAsync]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): FinchClientAsync = FinchClientAsyncImpl( clientOptions 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 f452cccc..e95368ba 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 @@ -215,6 +215,18 @@ private constructor( System.getenv("FINCH_WEBHOOK_SECRET")?.let { webhookSecret(it) } } + /** + * Returns an immutable instance of [ClientOptions]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .httpClient() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): ClientOptions { val httpClient = checkRequired("httpClient", httpClient) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt index 6f5a0f7c..eb2f4b95 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Timeout.kt @@ -132,6 +132,11 @@ private constructor( /** Alias for calling [Builder.request] with `request.orElse(null)`. */ fun request(request: Optional) = request(request.getOrNull()) + /** + * Returns an immutable instance of [Timeout]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Timeout = Timeout(connect, read, write, request) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt index 39ad220f..b543fa9d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt @@ -60,6 +60,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [FinchError]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): FinchError = FinchError(additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt index a799e724..47404520 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt @@ -290,6 +290,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .code() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Body = Body( checkRequired("code", code), @@ -509,6 +521,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [AccessTokenCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .code() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): AccessTokenCreateParams = AccessTokenCreateParams( body.build(), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt index 9e3f277f..bcde9a48 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt @@ -349,6 +349,24 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [AccountCreateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accessToken() + * .accountId() + * .authenticationType() + * .companyId() + * .connectionId() + * .products() + * .providerId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): AccountCreateResponse = AccountCreateResponse( checkRequired("accessToken", accessToken), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt index 9f7514f4..87c2d00e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt @@ -179,6 +179,11 @@ private constructor( keys.forEach(::removeAdditionalBodyProperty) } + /** + * Returns an immutable instance of [AccountDisconnectParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): AccountDisconnectParams = AccountDisconnectParams( additionalHeaders.build(), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt index 032683db..8b1c80a5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt @@ -144,6 +144,11 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [AccountIntrospectParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): AccountIntrospectParams = AccountIntrospectParams(additionalHeaders.build(), additionalQueryParams.build()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt index ebe12c87..cbfd4d03 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt @@ -272,6 +272,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [AccountUpdateEvent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accountId() + * .companyId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): AccountUpdateEvent = AccountUpdateEvent( checkRequired("accountId", accountId), @@ -420,6 +433,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Data]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .authenticationMethod() + * .status() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Data = Data( checkRequired("authenticationMethod", authenticationMethod), @@ -621,6 +647,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [AuthenticationMethod]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): AuthenticationMethod = AuthenticationMethod( benefitsSupport, @@ -953,6 +984,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SupportedFields]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SupportedFields = SupportedFields( company, @@ -1348,6 +1384,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SupportedCompanyFields]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SupportedCompanyFields = SupportedCompanyFields( id, @@ -1614,6 +1655,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Accounts]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Accounts = Accounts( accountName, @@ -1777,6 +1824,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Departments]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Departments = Departments(name, parent, additionalProperties.toImmutable()) } @@ -1885,6 +1938,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Parent]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Parent = Parent(name, additionalProperties.toImmutable()) } @@ -2059,6 +2118,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Entity]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Entity = Entity(subtype, type, additionalProperties.toImmutable()) } @@ -2355,6 +2420,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Locations]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Locations = Locations( city, @@ -2542,6 +2613,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SupportedDirectoryFields]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SupportedDirectoryFields = SupportedDirectoryFields( individuals, @@ -2867,6 +2943,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Individuals]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Individuals = Individuals( id, @@ -2981,6 +3063,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Manager]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Manager = Manager(id, additionalProperties.toImmutable()) } @@ -3155,6 +3243,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Paging]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Paging = Paging(count, offset, additionalProperties.toImmutable()) } @@ -3864,6 +3958,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SupportedEmploymentFields]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SupportedEmploymentFields = SupportedEmploymentFields( id, @@ -3987,6 +4086,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Department]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Department = Department(name, additionalProperties.toImmutable()) } @@ -4145,6 +4250,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Employment]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Employment = Employment(subtype, type, additionalProperties.toImmutable()) } @@ -4335,6 +4446,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Income]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Income = Income(amount, currency, unit, additionalProperties.toImmutable()) } @@ -4630,6 +4747,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Location]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Location = Location( city, @@ -4757,6 +4880,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Manager]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Manager = Manager(id, additionalProperties.toImmutable()) } @@ -5316,6 +5445,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SupportedIndividualFields]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SupportedIndividualFields = SupportedIndividualFields( id, @@ -5465,6 +5599,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Emails]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Emails = Emails(data, type, additionalProperties.toImmutable()) } @@ -5619,6 +5759,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PhoneNumbers]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): PhoneNumbers = PhoneNumbers(data, type, additionalProperties.toImmutable()) } @@ -5915,6 +6061,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Residence]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Residence = Residence( city, @@ -6167,6 +6319,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SupportedPayGroupFields]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SupportedPayGroupFields = SupportedPayGroupFields( id, @@ -6335,6 +6492,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SupportedPayStatementFields]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SupportedPayStatementFields = SupportedPayStatementFields( paging, @@ -6483,6 +6645,20 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Paging]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .count() + * .offset() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Paging = Paging( checkRequired("count", count), @@ -6947,6 +7123,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PayStatements]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): PayStatements = PayStatements( earnings, @@ -7173,6 +7355,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Earnings]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Earnings = Earnings( amount, @@ -7447,6 +7635,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [EmployeeDeductions]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): EmployeeDeductions = EmployeeDeductions( amount, @@ -7654,6 +7848,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [EmployerContributions]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): EmployerContributions = EmployerContributions( amount, @@ -7926,6 +8126,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Taxes]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Taxes = Taxes( amount, @@ -8487,6 +8693,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SupportedPaymentFields]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SupportedPaymentFields = SupportedPaymentFields( id, @@ -8644,6 +8855,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PayPeriod]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): PayPeriod = PayPeriod(endDate, startDate, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt index b1f3a0a2..db848fb6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt @@ -317,6 +317,22 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [AccountUpdateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accountId() + * .authenticationType() + * .companyId() + * .products() + * .providerId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): AccountUpdateResponse = AccountUpdateResponse( checkRequired("accountId", accountId), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt index 8bfc5dfd..9c239497 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt @@ -420,6 +420,26 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [AutomatedAsyncJob]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .completedAt() + * .createdAt() + * .jobId() + * .jobUrl() + * .params() + * .scheduledAt() + * .startedAt() + * .status() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): AutomatedAsyncJob = AutomatedAsyncJob( checkRequired("completedAt", completedAt), @@ -534,6 +554,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Params]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Params = Params(individualId, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt index b469d6c3..9b08718d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt @@ -225,6 +225,21 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [AutomatedCreateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .allowedRefreshes() + * .jobId() + * .jobUrl() + * .remainingRefreshes() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): AutomatedCreateResponse = AutomatedCreateResponse( checkRequired("allowedRefreshes", allowedRefreshes), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt index 512ffa21..bc4087b7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt @@ -156,6 +156,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [AutomatedListResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .data() + * .meta() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): AutomatedListResponse = AutomatedListResponse( checkRequired("data", data).map { it.toImmutable() }, @@ -262,6 +275,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Meta]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Meta = Meta(quotas, additionalProperties.toImmutable()) } @@ -368,6 +386,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Quotas]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Quotas = Quotas(dataSyncAll, additionalProperties.toImmutable()) } @@ -507,6 +530,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [DataSyncAll]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): DataSyncAll = DataSyncAll( allowedRefreshes, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt index 2553c147..9a59d6c4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt @@ -206,6 +206,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [BaseWebhookEvent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accountId() + * .companyId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): BaseWebhookEvent = BaseWebhookEvent( checkRequired("accountId", accountId), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt index 8884c95d..192f8a50 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt @@ -150,6 +150,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [BenefitContribution]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): BenefitContribution = BenefitContribution(amount, type, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt index 61cfef15..e8501bcb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt @@ -154,6 +154,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [BenefitFeaturesAndOperations]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): BenefitFeaturesAndOperations = BenefitFeaturesAndOperations( supportedFeatures, @@ -594,6 +599,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [BenefitFeature]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): BenefitFeature = BenefitFeature( annualMaximum, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt index 47e9e3e8..4d73526d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt @@ -551,6 +551,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [BenefitsSupport]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): BenefitsSupport = BenefitsSupport( commuter, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt index e2acc5a9..d58817ac 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt @@ -470,6 +470,26 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Company]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .accounts() + * .departments() + * .ein() + * .entity() + * .legalName() + * .locations() + * .primaryEmail() + * .primaryPhoneNumber() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Company = Company( checkRequired("id", id), @@ -763,6 +783,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Account]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Account = Account( accountName, @@ -1028,6 +1053,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Department]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Department = Department(name, parent, additionalProperties.toImmutable()) } @@ -1130,6 +1160,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Parent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Parent = Parent(name, additionalProperties.toImmutable()) } @@ -1299,6 +1334,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Entity]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Entity = Entity(subtype, type, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt index 97e49bb2..ed22eabd 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt @@ -223,6 +223,21 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [CompanyBenefit]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .benefitId() + * .description() + * .frequency() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): CompanyBenefit = CompanyBenefit( checkRequired("benefitId", benefitId), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt index 606a5209..1a7da337 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt @@ -275,6 +275,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [CompanyEvent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accountId() + * .companyId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): CompanyEvent = CompanyEvent( checkRequired("accountId", accountId), @@ -345,6 +358,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Data]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Data = Data(additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt index 8da60142..bd46a96f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt @@ -439,6 +439,25 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [CompanyUpdateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accounts() + * .departments() + * .ein() + * .entity() + * .legalName() + * .locations() + * .primaryEmail() + * .primaryPhoneNumber() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): CompanyUpdateResponse = CompanyUpdateResponse( checkRequired("accounts", accounts).map { it.toImmutable() }, @@ -731,6 +750,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Account]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Account = Account( accountName, @@ -996,6 +1020,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Department]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Department = Department(name, parent, additionalProperties.toImmutable()) } @@ -1098,6 +1127,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Parent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Parent = Parent(name, additionalProperties.toImmutable()) } @@ -1267,6 +1301,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Entity]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Entity = Entity(subtype, type, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt index fd75183b..2ccd1e1b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt @@ -591,6 +591,20 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .customerId() + * .customerName() + * .products() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Body = Body( checkRequired("customerId", customerId), @@ -924,6 +938,20 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [ConnectSessionNewParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .customerId() + * .customerName() + * .products() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): ConnectSessionNewParams = ConnectSessionNewParams( body.build(), @@ -1200,6 +1228,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Integration]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Integration = Integration(authMethod, provider, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt index aaee7b98..40eebc8b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt @@ -357,6 +357,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .connectionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Body = Body( checkRequired("connectionId", connectionId), @@ -615,6 +627,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [ConnectSessionReauthenticateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .connectionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): ConnectSessionReauthenticateParams = ConnectSessionReauthenticateParams( body.build(), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt index 3d341e85..58fc2c01 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt @@ -380,6 +380,24 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [ConnectionCreateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accessToken() + * .accountId() + * .authenticationType() + * .companyId() + * .connectionId() + * .products() + * .providerId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): ConnectionCreateResponse = ConnectionCreateResponse( checkRequired("accessToken", accessToken), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt index c90f319e..5f89e0e9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt @@ -477,6 +477,25 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [CreateAccessTokenResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accessToken() + * .accountId() + * .clientType() + * .companyId() + * .connectionId() + * .connectionType() + * .products() + * .providerId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): CreateAccessTokenResponse = CreateAccessTokenResponse( checkRequired("accessToken", accessToken), 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 b66d093d..4a3a3d56 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 @@ -113,6 +113,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [CreateCompanyBenefitsResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .benefitId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): CreateCompanyBenefitsResponse = CreateCompanyBenefitsResponse( checkRequired("benefitId", benefitId), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt index 8daa4499..b7af0fec 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt @@ -271,6 +271,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [DirectoryEvent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accountId() + * .companyId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): DirectoryEvent = DirectoryEvent( checkRequired("accountId", accountId), @@ -380,6 +393,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Data]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Data = Data(individualId, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt index f7831576..0d46f6f3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt @@ -114,6 +114,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [DisconnectResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .status() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): DisconnectResponse = DisconnectResponse(checkRequired("status", status), additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt index cf432ce7..531d8f94 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt @@ -159,6 +159,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [DocumentListResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .documents() + * .paging() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): DocumentListResponse = DocumentListResponse( checkRequired("documents", documents).map { it.toImmutable() }, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt index 1572b138..2a8103d2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt @@ -256,6 +256,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [DocumentResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): DocumentResponse = DocumentResponse(id, individualId, type, url, year, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt index e8b36762..90112e25 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt @@ -857,6 +857,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [EmploymentData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): EmploymentData = EmploymentData( id, @@ -979,6 +984,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [CustomField]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): CustomField = CustomField(name, value, additionalProperties.toImmutable()) } @@ -1096,6 +1106,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Department]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Department = Department(name, additionalProperties.toImmutable()) } @@ -1251,6 +1266,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Employment]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Employment = Employment(subtype, type, additionalProperties.toImmutable()) } @@ -1730,6 +1750,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Manager]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Manager = Manager(id, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt index 194d4a2a..56db2141 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt @@ -167,6 +167,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [EmploymentDataResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): EmploymentDataResponse = EmploymentDataResponse(body, code, individualId, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt index f6ad8900..93014c21 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt @@ -271,6 +271,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [EmploymentEvent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accountId() + * .companyId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): EmploymentEvent = EmploymentEvent( checkRequired("accountId", accountId), @@ -380,6 +393,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Data]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Data = Data(individualId, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt index be949862..7455d2c6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt @@ -805,6 +805,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [EmploymentUpdateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): EmploymentUpdateResponse = EmploymentUpdateResponse( id, @@ -929,6 +934,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [CustomField]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): CustomField = CustomField(name, value, additionalProperties.toImmutable()) } @@ -1046,6 +1056,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Department]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Department = Department(name, additionalProperties.toImmutable()) } @@ -1201,6 +1216,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Employment]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Employment = Employment(subtype, type, additionalProperties.toImmutable()) } @@ -1677,6 +1697,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Manager]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Manager = Manager(id, additionalProperties.toImmutable()) } 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 index 8e9cb4e4..5a9e61cf 100644 --- 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 @@ -169,6 +169,11 @@ private constructor( 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.toImmutable()) } @@ -340,6 +345,11 @@ private constructor( 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.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt index 9a86d079..ab4db171 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt @@ -264,6 +264,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Body = Body(description, frequency, type, additionalProperties.toImmutable()) } @@ -472,6 +477,11 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [HrisBenefitCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): HrisBenefitCreateParams = HrisBenefitCreateParams( body.build(), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt index a7b4b653..5beaeecb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt @@ -168,6 +168,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [HrisBenefitIndividualEnrolledIdsParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .benefitId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): HrisBenefitIndividualEnrolledIdsParams = HrisBenefitIndividualEnrolledIdsParams( checkRequired("benefitId", benefitId), 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 a5bddba3..aaa9ea15 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 @@ -142,7 +142,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(items, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(items, additionalProperties.toImmutable()) } } 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 b3158194..55851a35 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 @@ -145,7 +145,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(items, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(items, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt index a308eb41..ae707b59 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt @@ -196,6 +196,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [HrisBenefitIndividualRetrieveManyBenefitsParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .benefitId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): HrisBenefitIndividualRetrieveManyBenefitsParams = HrisBenefitIndividualRetrieveManyBenefitsParams( checkRequired("benefitId", benefitId), 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 index dc4d6e1e..b6332d39 100644 --- 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 @@ -142,7 +142,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(items, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(items, additionalProperties.toImmutable()) } } 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 index 301a184a..70546335 100644 --- 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 @@ -144,7 +144,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(items, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(items, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt index 14c12f3a..3ad4f2ad 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt @@ -178,6 +178,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Body = Body( (individualIds ?: JsonMissing.of()).map { it.toImmutable() }, @@ -380,6 +385,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [HrisBenefitIndividualUnenrollManyParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .benefitId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): HrisBenefitIndividualUnenrollManyParams = HrisBenefitIndividualUnenrollManyParams( checkRequired("benefitId", benefitId), 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 e30d4a39..5fa4d59b 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 @@ -136,7 +136,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(items, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(items, additionalProperties.toImmutable()) } } 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 298d710a..21e5bc5b 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 @@ -143,7 +143,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(items, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(items, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt index b192711f..2a8c8358 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt @@ -144,6 +144,11 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [HrisBenefitListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): HrisBenefitListParams = HrisBenefitListParams(additionalHeaders.build(), additionalQueryParams.build()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt index 8d70d671..dbcd5230 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt @@ -142,7 +142,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(items, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(items, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt index 328c56e5..6bd07ad6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt @@ -144,7 +144,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(items, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(items, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt index 5dcb05af..95cd1724 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt @@ -150,6 +150,11 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [HrisBenefitListSupportedBenefitsParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): HrisBenefitListSupportedBenefitsParams = HrisBenefitListSupportedBenefitsParams( additionalHeaders.build(), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt index 698a746a..51e08093 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt @@ -164,6 +164,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [HrisBenefitRetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .benefitId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): HrisBenefitRetrieveParams = HrisBenefitRetrieveParams( checkRequired("benefitId", benefitId), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt index 4bd37abf..dc08ddd5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt @@ -163,6 +163,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Body = Body(description, additionalProperties.toImmutable()) } @@ -347,6 +352,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [HrisBenefitUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .benefitId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): HrisBenefitUpdateParams = HrisBenefitUpdateParams( checkRequired("benefitId", benefitId), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt index d61d83f5..09ffb64f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt @@ -146,6 +146,11 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [HrisCompanyRetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): HrisCompanyRetrieveParams = HrisCompanyRetrieveParams(additionalHeaders.build(), additionalQueryParams.build()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt index 9413c2d0..8d815482 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt @@ -177,7 +177,13 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(individuals, paging, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = + Response(individuals, paging, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt index 8c7303e8..a125a282 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt @@ -179,7 +179,13 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(individuals, paging, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = + Response(individuals, paging, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt index 2ddb18b6..e541b782 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt @@ -196,6 +196,11 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [HrisDirectoryListIndividualsParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): HrisDirectoryListIndividualsParams = HrisDirectoryListIndividualsParams( limit, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt index 00326aa5..9df96fbe 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt @@ -175,7 +175,13 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(individuals, paging, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = + Response(individuals, paging, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt index 11e6edbd..b224dc75 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt @@ -178,7 +178,13 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(individuals, paging, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = + Response(individuals, paging, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt index e82bea80..6d24a625 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt @@ -190,6 +190,11 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [HrisDirectoryListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): HrisDirectoryListParams = HrisDirectoryListParams( limit, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt index 2a8059b6..ecdbc1b2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt @@ -246,6 +246,11 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [HrisDocumentListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): HrisDocumentListParams = HrisDocumentListParams( individualIds?.toImmutable(), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt index bd3c0e75..a229d7f1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt @@ -167,6 +167,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [HrisDocumentRetreiveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .documentId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): HrisDocumentRetreiveParams = HrisDocumentRetreiveParams( checkRequired("documentId", documentId), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt index cb021b39..c3484ee4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt @@ -147,7 +147,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(responses, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(responses, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt index ccbed61f..e52e48c1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt @@ -149,7 +149,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(responses, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(responses, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt index 4c7f3344..2c26aa56 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt @@ -172,6 +172,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .requests() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Body = Body( checkRequired("requests", requests).map { it.toImmutable() }, @@ -366,6 +378,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [HrisEmploymentRetrieveManyParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .requests() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): HrisEmploymentRetrieveManyParams = HrisEmploymentRetrieveManyParams( body.build(), @@ -484,6 +508,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Request]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .individualId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Request = Request( checkRequired("individualId", individualId), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt index 891ae028..a086a059 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt @@ -145,7 +145,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(responses, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(responses, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt index 5eb68548..c03fdf79 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt @@ -147,7 +147,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(responses, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(responses, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt index 1d830ce5..f9780b79 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt @@ -207,6 +207,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Body = Body( options, @@ -411,6 +416,11 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [HrisIndividualRetrieveManyParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): HrisIndividualRetrieveManyParams = HrisIndividualRetrieveManyParams( body.build(), @@ -522,6 +532,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Options]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Options = Options( (include ?: JsonMissing.of()).map { it.toImmutable() }, @@ -642,6 +657,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Request]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Request = Request(individualId, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt index 69a33a0f..35834d35 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt @@ -150,7 +150,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(responses, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(responses, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt index 9744e741..875418aa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt @@ -152,7 +152,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(responses, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(responses, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt index 99b493ce..ccab8ddb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt @@ -176,6 +176,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .requests() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Body = Body( checkRequired("requests", requests).map { it.toImmutable() }, @@ -370,6 +382,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [HrisPayStatementRetrieveManyParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .requests() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): HrisPayStatementRetrieveManyParams = HrisPayStatementRetrieveManyParams( body.build(), @@ -543,6 +567,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Request]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .paymentId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Request = Request( checkRequired("paymentId", paymentId), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt index c75e9263..211ba10a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt @@ -135,7 +135,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(items, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(items, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt index f758f458..16db08d8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt @@ -142,7 +142,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(items, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(items, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt index f0f87256..aac51527 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt @@ -176,6 +176,19 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [HrisPaymentListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .endDate() + * .startDate() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): HrisPaymentListParams = HrisPaymentListParams( checkRequired("endDate", endDate), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt index 2f1c68f5..efe28904 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt @@ -237,6 +237,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Income]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Income = Income(amount, currency, effectiveDate, unit, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt index dc2c8fd6..a354aae3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt @@ -577,6 +577,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Individual]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Individual = Individual( id, @@ -716,6 +721,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Email]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Email = Email(data, type, additionalProperties.toImmutable()) } @@ -1207,6 +1217,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PhoneNumber]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): PhoneNumber = PhoneNumber(data, type, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt index f46637d2..9621d2e5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt @@ -166,6 +166,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [IndividualBenefit]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): IndividualBenefit = IndividualBenefit(body, code, individualId, additionalProperties.toImmutable()) } @@ -462,6 +467,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Body = Body( annualMaximum, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt index 5e904c3f..cd3f97b6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt @@ -161,6 +161,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [IndividualEnrolledIdsResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .benefitId() + * .individualIds() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): IndividualEnrolledIdsResponse = IndividualEnrolledIdsResponse( checkRequired("benefitId", benefitId), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt index 39cb31e8..72c534d0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt @@ -271,6 +271,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [IndividualEvent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accountId() + * .companyId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): IndividualEvent = IndividualEvent( checkRequired("accountId", accountId), @@ -380,6 +393,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Data]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Data = Data(individualId, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt index efa5bd79..d087003a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt @@ -330,6 +330,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [IndividualInDirectory]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): IndividualInDirectory = IndividualInDirectory( id, @@ -439,6 +444,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Department]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Department = Department(name, additionalProperties.toImmutable()) } @@ -551,6 +561,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Manager]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Manager = Manager(id, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt index 2a3b3d74..ce7c48fb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt @@ -166,6 +166,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [IndividualResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): IndividualResponse = IndividualResponse(body, code, individualId, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt index e02bd4de..c0530dc9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt @@ -577,6 +577,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [IndividualUpdateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): IndividualUpdateResponse = IndividualUpdateResponse( id, @@ -716,6 +721,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Email]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Email = Email(data, type, additionalProperties.toImmutable()) } @@ -1204,6 +1214,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PhoneNumber]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): PhoneNumber = PhoneNumber(data, type, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt index 43ea9de3..5365ac83 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt @@ -745,6 +745,33 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Introspection]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accountId() + * .authenticationMethods() + * .clientId() + * .clientType() + * .companyId() + * .connectionId() + * .connectionStatus() + * .connectionType() + * .customerEmail() + * .customerId() + * .customerName() + * .manual() + * .payrollProviderId() + * .products() + * .providerId() + * .username() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Introspection = Introspection( checkRequired("accountId", accountId), @@ -946,6 +973,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [AuthenticationMethod]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): AuthenticationMethod = AuthenticationMethod( connectionStatus, @@ -1080,6 +1112,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [ConnectionStatus]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): ConnectionStatus = ConnectionStatus(message, status, additionalProperties.toImmutable()) } @@ -1467,6 +1504,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [ConnectionStatus]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): ConnectionStatus = ConnectionStatus(message, status, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt index e176ec9c..5bbe923d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt @@ -314,6 +314,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [DataSyncAll]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): DataSyncAll = DataSyncAll(checkRequired("type", type), additionalProperties.toImmutable()) } @@ -569,6 +581,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [W4FormEmployeeSync]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .params() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): W4FormEmployeeSync = W4FormEmployeeSync( checkRequired("params", params), @@ -686,6 +711,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Params]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .individualId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Params = Params( checkRequired("individualId", individualId), @@ -982,6 +1019,11 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [JobAutomatedCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): JobAutomatedCreateParams = JobAutomatedCreateParams(body, additionalHeaders.build(), additionalQueryParams.build()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt index 0b38a895..249d0cc4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt @@ -194,6 +194,11 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [JobAutomatedListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): JobAutomatedListParams = JobAutomatedListParams( limit, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParams.kt index 2037c79e..44903f4a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParams.kt @@ -164,6 +164,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [JobAutomatedRetrieveParams]. + * + * 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(): JobAutomatedRetrieveParams = JobAutomatedRetrieveParams( checkRequired("jobId", jobId), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt index c3ebbce3..2b4375ff 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt @@ -271,6 +271,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [JobCompletionEvent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accountId() + * .companyId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): JobCompletionEvent = JobCompletionEvent( checkRequired("accountId", accountId), @@ -415,6 +428,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Data]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .jobId() + * .jobUrl() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Data = Data( checkRequired("jobId", jobId), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt index dc222a4d..74058d1f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt @@ -225,6 +225,21 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [JobCreateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .allowedRefreshes() + * .jobId() + * .jobUrl() + * .remainingRefreshes() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): JobCreateResponse = JobCreateResponse( checkRequired("allowedRefreshes", allowedRefreshes), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobManualRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobManualRetrieveParams.kt index 94d3cffa..c195f88a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobManualRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobManualRetrieveParams.kt @@ -167,6 +167,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [JobManualRetrieveParams]. + * + * 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(): JobManualRetrieveParams = JobManualRetrieveParams( checkRequired("jobId", jobId), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt index a7e56127..eb126368 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt @@ -341,6 +341,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Location]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Location = Location( city, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt index b81b5966..1835f8fa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt @@ -194,6 +194,20 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [ManualAsyncJob]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .body() + * .jobId() + * .status() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): ManualAsyncJob = ManualAsyncJob( checkRequired("body", body).map { it.toImmutable() }, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt index 021b5d20..30dc5fd7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt @@ -145,6 +145,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Money]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Money = Money(amount, currency, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt index ed6b3e96..9dbd43ed 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt @@ -263,6 +263,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [OperationSupportMatrix]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): OperationSupportMatrix = OperationSupportMatrix(create, delete, read, update, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt index 0a3943a0..2b67dfe7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt @@ -135,6 +135,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Paging]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Paging = Paging(count, offset, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt index 5dd3f862..fae1a93b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt @@ -188,6 +188,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PayGroupListResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): PayGroupListResponse = PayGroupListResponse( id, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt index 2948909b..0ae35034 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt @@ -243,6 +243,21 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PayGroupRetrieveResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .individualIds() + * .name() + * .payFrequencies() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): PayGroupRetrieveResponse = PayGroupRetrieveResponse( checkRequired("id", id), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt index 20ad6137..c98dcb83 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt @@ -512,6 +512,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PayStatement]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): PayStatement = PayStatement( (earnings ?: JsonMissing.of()).map { it.toImmutable() }, @@ -821,6 +826,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Earning]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Earning = Earning( amount, @@ -929,6 +939,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Attributes]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Attributes = Attributes(metadata, additionalProperties.toImmutable()) } @@ -1039,6 +1054,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Metadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) } @@ -1113,6 +1133,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [InnerMetadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): InnerMetadata = InnerMetadata(additionalProperties.toImmutable()) } @@ -1647,6 +1672,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [EmployeeDeduction]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): EmployeeDeduction = EmployeeDeduction( amount, @@ -1755,6 +1785,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Attributes]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Attributes = Attributes(metadata, additionalProperties.toImmutable()) } @@ -1865,6 +1900,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Metadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) } @@ -1939,6 +1979,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [InnerMetadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): InnerMetadata = InnerMetadata(additionalProperties.toImmutable()) } @@ -2263,6 +2308,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [EmployerContribution]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): EmployerContribution = EmployerContribution( amount, @@ -2370,6 +2420,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Attributes]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Attributes = Attributes(metadata, additionalProperties.toImmutable()) } @@ -2480,6 +2535,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Metadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) } @@ -2554,6 +2614,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [InnerMetadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): InnerMetadata = InnerMetadata(additionalProperties.toImmutable()) } @@ -3021,6 +3086,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Tax]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Tax = Tax( amount, @@ -3129,6 +3199,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Attributes]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Attributes = Attributes(metadata, additionalProperties.toImmutable()) } @@ -3239,6 +3314,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Metadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) } @@ -3313,6 +3393,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [InnerMetadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): InnerMetadata = InnerMetadata(additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt index fefa3771..1c8b8296 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt @@ -271,6 +271,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PayStatementEvent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accountId() + * .companyId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): PayStatementEvent = PayStatementEvent( checkRequired("accountId", accountId), @@ -413,6 +426,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Data]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Data = Data(individualId, paymentId, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt index 95324f57..1cccee9c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt @@ -162,6 +162,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PayStatementResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): PayStatementResponse = PayStatementResponse(body, code, paymentId, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt index 140addd8..9c3e32c4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt @@ -156,6 +156,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PayStatementResponseBody]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): PayStatementResponseBody = PayStatementResponseBody( paging, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt index f53e5403..7e49d866 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt @@ -552,6 +552,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Payment]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Payment = Payment( id, @@ -838,6 +843,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PayPeriod]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): PayPeriod = PayPeriod(endDate, startDate, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt index 6a37f9be..702ae468 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt @@ -148,6 +148,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PaymentCreateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .payDate() + * .paymentId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): PaymentCreateResponse = PaymentCreateResponse( checkRequired("payDate", payDate), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt index b7e05b37..36e7b100 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt @@ -274,6 +274,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PaymentEvent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accountId() + * .companyId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): PaymentEvent = PaymentEvent( checkRequired("accountId", accountId), @@ -418,6 +431,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PaymentIdentifiers]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .payDate() + * .paymentId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): PaymentIdentifiers = PaymentIdentifiers( checkRequired("payDate", payDate), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt index 367a843e..3be90ee3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt @@ -141,7 +141,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(items, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(items, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt index 6c24b034..f9ea26b2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt @@ -144,7 +144,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(items, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(items, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt index 6045ed03..44c78fac 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt @@ -187,6 +187,11 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [PayrollPayGroupListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): PayrollPayGroupListParams = PayrollPayGroupListParams( individualId, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParams.kt index ba5d1826..7365981a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParams.kt @@ -165,6 +165,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [PayrollPayGroupRetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .payGroupId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): PayrollPayGroupRetrieveParams = PayrollPayGroupRetrieveParams( checkRequired("payGroupId", payGroupId), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt index 52e8fa5f..0e3247b6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt @@ -447,6 +447,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Provider]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Provider = Provider( id, @@ -645,6 +650,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [AuthenticationMethod]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): AuthenticationMethod = AuthenticationMethod( benefitsSupport, @@ -971,6 +981,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SupportedFields]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SupportedFields = SupportedFields( company, @@ -1358,6 +1373,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SupportedCompanyFields]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SupportedCompanyFields = SupportedCompanyFields( id, @@ -1621,6 +1641,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Accounts]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Accounts = Accounts( accountName, @@ -1780,6 +1805,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Departments]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Departments = Departments(name, parent, additionalProperties.toImmutable()) } @@ -1882,6 +1912,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Parent]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Parent = Parent(name, additionalProperties.toImmutable()) } @@ -2049,6 +2085,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Entity]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Entity = Entity(subtype, type, additionalProperties.toImmutable()) } @@ -2330,6 +2371,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Locations]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Locations = Locations( city, @@ -2512,6 +2558,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SupportedDirectoryFields]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SupportedDirectoryFields = SupportedDirectoryFields( individuals, @@ -2830,6 +2881,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Individuals]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Individuals = Individuals( id, @@ -2940,6 +2996,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Manager]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Manager = Manager(id, additionalProperties.toImmutable()) } @@ -3107,6 +3169,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Paging]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Paging = Paging(count, offset, additionalProperties.toImmutable()) } @@ -3803,6 +3870,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SupportedEmploymentFields]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SupportedEmploymentFields = SupportedEmploymentFields( id, @@ -3922,6 +3994,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Department]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Department = Department(name, additionalProperties.toImmutable()) } @@ -4074,6 +4151,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Employment]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Employment = Employment(subtype, type, additionalProperties.toImmutable()) } @@ -4260,6 +4342,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Income]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Income = Income(amount, currency, unit, additionalProperties.toImmutable()) } @@ -4539,6 +4626,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Location]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Location = Location( city, @@ -4663,6 +4755,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Manager]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Manager = Manager(id, additionalProperties.toImmutable()) } @@ -5210,6 +5307,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SupportedIndividualFields]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SupportedIndividualFields = SupportedIndividualFields( id, @@ -5354,6 +5456,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Emails]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Emails = Emails(data, type, additionalProperties.toImmutable()) } @@ -5502,6 +5609,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PhoneNumbers]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): PhoneNumbers = PhoneNumbers(data, type, additionalProperties.toImmutable()) } @@ -5783,6 +5895,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Residence]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Residence = Residence( city, @@ -6032,6 +6149,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SupportedPayGroupFields]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SupportedPayGroupFields = SupportedPayGroupFields( id, @@ -6195,6 +6317,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SupportedPayStatementFields]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SupportedPayStatementFields = SupportedPayStatementFields( paging, @@ -6340,6 +6467,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Paging]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .count() + * .offset() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Paging = Paging( checkRequired("count", count), @@ -6792,6 +6932,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PayStatements]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): PayStatements = PayStatements( earnings, @@ -7008,6 +7153,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Earnings]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Earnings = Earnings( amount, @@ -7272,6 +7423,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [EmployeeDeductions]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): EmployeeDeductions = EmployeeDeductions( amount, @@ -7472,6 +7629,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [EmployerContributions]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): EmployerContributions = EmployerContributions( amount, @@ -7735,6 +7898,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Taxes]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): Taxes = Taxes( amount, @@ -8288,6 +8457,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SupportedPaymentFields]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SupportedPaymentFields = SupportedPaymentFields( id, @@ -8441,6 +8615,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PayPeriod]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): PayPeriod = PayPeriod(endDate, startDate, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt index 98c3f5a1..a24d76c7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt @@ -135,7 +135,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(items, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(items, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt index b9cb81ba..ad126c86 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt @@ -142,7 +142,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = Response(items, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Response]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Response = Response(items, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListParams.kt index 5f694c14..39527df9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListParams.kt @@ -144,6 +144,11 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [ProviderListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): ProviderListParams = ProviderListParams(additionalHeaders.build(), additionalQueryParams.build()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt index 3c4f2f35..aac36e23 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt @@ -322,6 +322,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .method() + * .route() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Body = Body( checkRequired("method", method), @@ -558,6 +571,19 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [RequestForwardingForwardParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .method() + * .route() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): RequestForwardingForwardParams = RequestForwardingForwardParams( body.build(), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt index 26801293..01f7f07a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt @@ -215,6 +215,21 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [RequestForwardingForwardResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .data() + * .headers() + * .request() + * .statusCode() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): RequestForwardingForwardResponse = RequestForwardingForwardResponse( checkRequired("data", data), @@ -440,6 +455,22 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Request]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .data() + * .headers() + * .method() + * .params() + * .route() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Request = Request( checkRequired("data", data), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt index b497f3ce..7d47258a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt @@ -591,6 +591,25 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [CompanyWithoutId]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accounts() + * .departments() + * .ein() + * .entity() + * .legalName() + * .locations() + * .primaryEmail() + * .primaryPhoneNumber() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): CompanyWithoutId = CompanyWithoutId( checkRequired("accounts", accounts).map { it.toImmutable() }, @@ -927,6 +946,25 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [SandboxCompanyUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accounts() + * .departments() + * .ein() + * .entity() + * .legalName() + * .locations() + * .primaryEmail() + * .primaryPhoneNumber() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): SandboxCompanyUpdateParams = SandboxCompanyUpdateParams( body.build(), @@ -1213,6 +1251,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Account]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Account = Account( accountName, @@ -1478,6 +1521,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Department]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Department = Department(name, parent, additionalProperties.toImmutable()) } @@ -1580,6 +1628,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Parent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Parent = Parent(name, additionalProperties.toImmutable()) } @@ -1749,6 +1802,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Entity]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Entity = Entity(subtype, type, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt index 7faad99c..10d2b3f3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt @@ -324,6 +324,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .companyId() + * .providerId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Body = Body( checkRequired("companyId", companyId), @@ -564,6 +577,19 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [SandboxConnectionAccountCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .companyId() + * .providerId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): SandboxConnectionAccountCreateParams = SandboxConnectionAccountCreateParams( body.build(), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt index 8aec6a60..fbf2e699 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt @@ -153,6 +153,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Body = Body(connectionStatus, additionalProperties.toImmutable()) } @@ -337,6 +342,11 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [SandboxConnectionAccountUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SandboxConnectionAccountUpdateParams = SandboxConnectionAccountUpdateParams( body.build(), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt index b991d17b..9334c115 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt @@ -332,6 +332,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .providerId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Body = Body( checkRequired("providerId", providerId), @@ -569,6 +581,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [SandboxConnectionCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .providerId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): SandboxConnectionCreateParams = SandboxConnectionCreateParams( body.build(), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt index 51d5f5c0..ab1ca75a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt @@ -1175,6 +1175,11 @@ private constructor( */ fun title(title: JsonField) = apply { this.title = title } + /** + * Returns an immutable instance of [IndividualOrEmployment]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): IndividualOrEmployment = IndividualOrEmployment( classCode, @@ -1309,6 +1314,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [CustomField]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): CustomField = CustomField(name, value, additionalProperties.toImmutable()) } @@ -1430,6 +1440,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Department]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Department = Department(name, additionalProperties.toImmutable()) } @@ -1576,6 +1591,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Email]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Email = Email(data, type, additionalProperties.toImmutable()) } @@ -1839,6 +1859,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Employment]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Employment = Employment(subtype, type, additionalProperties.toImmutable()) } @@ -2588,6 +2613,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Manager]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Manager = Manager(id, additionalProperties.toImmutable()) } @@ -2733,6 +2763,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PhoneNumber]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): PhoneNumber = PhoneNumber(data, type, additionalProperties.toImmutable()) } @@ -3019,6 +3054,11 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [SandboxDirectoryCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SandboxDirectoryCreateParams = SandboxDirectoryCreateParams( body?.toImmutable(), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt index 6dd0af93..432f6a47 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt @@ -1099,6 +1099,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [EmploymentWithoutId]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): EmploymentWithoutId = EmploymentWithoutId( classCode, @@ -1594,6 +1599,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [SandboxEmploymentUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .individualId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): SandboxEmploymentUpdateParams = SandboxEmploymentUpdateParams( checkRequired("individualId", individualId), @@ -1702,6 +1719,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [CustomField]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): CustomField = CustomField(name, value, additionalProperties.toImmutable()) } @@ -1819,6 +1841,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Department]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Department = Department(name, additionalProperties.toImmutable()) } @@ -1974,6 +2001,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Employment]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Employment = Employment(subtype, type, additionalProperties.toImmutable()) } @@ -2450,6 +2482,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Manager]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Manager = Manager(id, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt index 7a4a5282..fc74657e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt @@ -774,6 +774,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [IndividualWithoutId]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): IndividualWithoutId = IndividualWithoutId( dob, @@ -1166,6 +1171,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [SandboxIndividualUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .individualId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): SandboxIndividualUpdateParams = SandboxIndividualUpdateParams( checkRequired("individualId", individualId), @@ -1295,6 +1312,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Email]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Email = Email(data, type, additionalProperties.toImmutable()) } @@ -1783,6 +1805,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PhoneNumber]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): PhoneNumber = PhoneNumber(data, type, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt index bd9a488f..f7baec68 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt @@ -147,6 +147,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SandboxJobConfiguration]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .completionStatus() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): SandboxJobConfiguration = SandboxJobConfiguration( checkRequired("completionStatus", completionStatus), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt index 4ae86208..8172c944 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt @@ -150,6 +150,11 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [SandboxJobConfigurationRetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SandboxJobConfigurationRetrieveParams = SandboxJobConfigurationRetrieveParams( additionalHeaders.build(), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt index 31f0fedb..d2459c5d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt @@ -169,6 +169,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [SandboxJobConfigurationUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .sandboxJobConfiguration() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): SandboxJobConfigurationUpdateParams = SandboxJobConfigurationUpdateParams( checkRequired("sandboxJobConfiguration", sandboxJobConfiguration), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt index f3dd5452..fbbe2b64 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt @@ -153,6 +153,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): Body = Body(checkRequired("type", type), additionalProperties.toImmutable()) } @@ -332,6 +344,18 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [SandboxJobCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): SandboxJobCreateParams = SandboxJobCreateParams( body.build(), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt index eb63bcab..8302efd2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt @@ -254,6 +254,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Body = Body( endDate, @@ -470,6 +475,11 @@ private constructor( additionalQueryParams.removeAll(keys) } + /** + * Returns an immutable instance of [SandboxPaymentCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SandboxPaymentCreateParams = SandboxPaymentCreateParams( body.build(), @@ -990,6 +1000,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [PayStatement]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): PayStatement = PayStatement( (earnings ?: JsonMissing.of()).map { it.toImmutable() }, @@ -1308,6 +1323,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Earning]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Earning = Earning( amount, @@ -1416,6 +1436,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Attributes]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Attributes = Attributes(metadata, additionalProperties.toImmutable()) } @@ -1528,6 +1553,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Metadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) } @@ -1605,6 +1635,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [InnerMetadata]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): InnerMetadata = InnerMetadata(additionalProperties.toImmutable()) } @@ -2151,6 +2187,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [EmployeeDeduction]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): EmployeeDeduction = EmployeeDeduction( amount, @@ -2259,6 +2300,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Attributes]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Attributes = Attributes(metadata, additionalProperties.toImmutable()) } @@ -2371,6 +2417,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Metadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) } @@ -2448,6 +2499,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [InnerMetadata]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): InnerMetadata = InnerMetadata(additionalProperties.toImmutable()) } @@ -2781,6 +2838,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [EmployerContribution]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): EmployerContribution = EmployerContribution( amount, @@ -2888,6 +2950,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Attributes]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Attributes = Attributes(metadata, additionalProperties.toImmutable()) } @@ -3000,6 +3067,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Metadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) } @@ -3077,6 +3149,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [InnerMetadata]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): InnerMetadata = InnerMetadata(additionalProperties.toImmutable()) } @@ -3558,6 +3636,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Tax]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Tax = Tax( amount, @@ -3666,6 +3749,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Attributes]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Attributes = Attributes(metadata, additionalProperties.toImmutable()) } @@ -3778,6 +3866,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Metadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) } @@ -3855,6 +3948,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [InnerMetadata]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ fun build(): InnerMetadata = InnerMetadata(additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt index d1bb90f9..d80dd9ce 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt @@ -149,6 +149,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SessionNewResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .connectUrl() + * .sessionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): SessionNewResponse = SessionNewResponse( checkRequired("connectUrl", connectUrl), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt index 257d2ec3..7326657d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt @@ -150,6 +150,19 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SessionReauthenticateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .connectUrl() + * .sessionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): SessionReauthenticateResponse = SessionReauthenticateResponse( checkRequired("connectUrl", connectUrl), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt index 83e36a02..9b34ff89 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt @@ -148,6 +148,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SupportPerBenefitType]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SupportPerBenefitType = SupportPerBenefitType( companyBenefits, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt index 3ad658a1..c34a31ee 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt @@ -476,6 +476,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SupportedBenefit]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): SupportedBenefit = SupportedBenefit( annualMaximum, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt index 4e015a2e..089c7ef2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt @@ -168,6 +168,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [UnenrolledIndividual]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): UnenrolledIndividual = UnenrolledIndividual(body, code, individualId, additionalProperties.toImmutable()) } @@ -339,6 +344,11 @@ private constructor( 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.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt index 6f63f391..a85c5e93 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt @@ -112,6 +112,18 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [UpdateCompanyBenefitResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .benefitId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): UpdateCompanyBenefitResponse = UpdateCompanyBenefitResponse( checkRequired("benefitId", benefitId), diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt index b8f8031e..fc5fda1f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt @@ -181,6 +181,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [W42005]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): W42005 = W42005(data, type, year, additionalProperties.toImmutable()) } @@ -468,6 +473,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Data]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Data = Data( additionalWithholding, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt index 8cdeede2..77bb284e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt @@ -181,6 +181,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [W42020]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): W42020 = W42020(data, type, year, additionalProperties.toImmutable()) } @@ -655,6 +660,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Data]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ fun build(): Data = Data( amountForOtherDependents, From 6da412b3e388bc9034c4ec7bdfd5579657b39a47 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 00:05:33 +0000 Subject: [PATCH 27/65] chore(internal): refactor query param serialization impl and tests (#498) --- ...fitIndividualRetrieveManyBenefitsParams.kt | 13 +++++---- .../HrisDirectoryListIndividualsParams.kt | 15 +++++----- .../api/models/HrisDirectoryListParams.kt | 15 +++++----- .../api/models/HrisDocumentListParams.kt | 19 +++++++------ .../api/models/HrisPaymentListParams.kt | 15 +++++----- .../api/models/JobAutomatedListParams.kt | 15 +++++----- .../api/models/PayrollPayGroupListParams.kt | 15 +++++----- ...ndividualRetrieveManyBenefitsParamsTest.kt | 24 ++++++++++------ .../HrisDirectoryListIndividualsParamsTest.kt | 15 ++++++---- .../api/models/HrisDirectoryListParamsTest.kt | 15 ++++++---- .../api/models/HrisDocumentListParamsTest.kt | 24 ++++++++++------ .../api/models/HrisPaymentListParamsTest.kt | 28 +++++++++++++------ .../api/models/JobAutomatedListParamsTest.kt | 15 ++++++---- .../models/PayrollPayGroupListParamsTest.kt | 20 +++++++++---- 14 files changed, 150 insertions(+), 98 deletions(-) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt index ae707b59..752d3484 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt @@ -34,12 +34,13 @@ private constructor( override fun _headers(): Headers = additionalHeaders - override fun _queryParams(): QueryParams { - val queryParams = QueryParams.builder() - this.individualIds?.let { queryParams.put("individual_ids", listOf(it.toString())) } - queryParams.putAll(additionalQueryParams) - return queryParams.build() - } + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + individualIds?.let { put("individual_ids", it) } + putAll(additionalQueryParams) + } + .build() fun getPathParam(index: Int): String { return when (index) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt index e541b782..0faf984f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt @@ -32,13 +32,14 @@ private constructor( override fun _headers(): Headers = additionalHeaders - override fun _queryParams(): QueryParams { - val queryParams = QueryParams.builder() - this.limit?.let { queryParams.put("limit", listOf(it.toString())) } - this.offset?.let { queryParams.put("offset", listOf(it.toString())) } - queryParams.putAll(additionalQueryParams) - return queryParams.build() - } + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + limit?.let { put("limit", it.toString()) } + offset?.let { put("offset", it.toString()) } + putAll(additionalQueryParams) + } + .build() fun toBuilder() = Builder().from(this) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt index 6d24a625..05f1efe9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt @@ -31,13 +31,14 @@ private constructor( override fun _headers(): Headers = additionalHeaders - override fun _queryParams(): QueryParams { - val queryParams = QueryParams.builder() - this.limit?.let { queryParams.put("limit", listOf(it.toString())) } - this.offset?.let { queryParams.put("offset", listOf(it.toString())) } - queryParams.putAll(additionalQueryParams) - return queryParams.build() - } + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + limit?.let { put("limit", it.toString()) } + offset?.let { put("offset", it.toString()) } + putAll(additionalQueryParams) + } + .build() fun toBuilder() = Builder().from(this) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt index ecdbc1b2..50eb91c7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt @@ -47,15 +47,16 @@ private constructor( override fun _headers(): Headers = additionalHeaders - override fun _queryParams(): QueryParams { - val queryParams = QueryParams.builder() - this.individualIds?.let { queryParams.put("individual_ids[]", it.map(Any::toString)) } - this.limit?.let { queryParams.put("limit", listOf(it.toString())) } - this.offset?.let { queryParams.put("offset", listOf(it.toString())) } - this.types?.let { queryParams.put("types[]", it.map(Any::toString)) } - queryParams.putAll(additionalQueryParams) - return queryParams.build() - } + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + individualIds?.forEach { put("individual_ids[]", it) } + limit?.let { put("limit", it.toString()) } + offset?.let { put("offset", it.toString()) } + types?.forEach { put("types[]", it.asString()) } + putAll(additionalQueryParams) + } + .build() fun toBuilder() = Builder().from(this) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt index aac51527..bbfece5d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt @@ -31,13 +31,14 @@ private constructor( override fun _headers(): Headers = additionalHeaders - override fun _queryParams(): QueryParams { - val queryParams = QueryParams.builder() - this.endDate.let { queryParams.put("end_date", listOf(it.toString())) } - this.startDate.let { queryParams.put("start_date", listOf(it.toString())) } - queryParams.putAll(additionalQueryParams) - return queryParams.build() - } + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + put("end_date", endDate.toString()) + put("start_date", startDate.toString()) + putAll(additionalQueryParams) + } + .build() fun toBuilder() = Builder().from(this) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt index 249d0cc4..26e0a437 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt @@ -35,13 +35,14 @@ private constructor( override fun _headers(): Headers = additionalHeaders - override fun _queryParams(): QueryParams { - val queryParams = QueryParams.builder() - this.limit?.let { queryParams.put("limit", listOf(it.toString())) } - this.offset?.let { queryParams.put("offset", listOf(it.toString())) } - queryParams.putAll(additionalQueryParams) - return queryParams.build() - } + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + limit?.let { put("limit", it.toString()) } + offset?.let { put("offset", it.toString()) } + putAll(additionalQueryParams) + } + .build() fun toBuilder() = Builder().from(this) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt index 44c78fac..f5bc60ed 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt @@ -30,13 +30,14 @@ private constructor( override fun _headers(): Headers = additionalHeaders - override fun _queryParams(): QueryParams { - val queryParams = QueryParams.builder() - this.individualId?.let { queryParams.put("individual_id", listOf(it.toString())) } - this.payFrequencies?.let { queryParams.put("pay_frequencies[]", it.map(Any::toString)) } - queryParams.putAll(additionalQueryParams) - return queryParams.build() - } + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + individualId?.let { put("individual_id", it) } + payFrequencies?.forEach { put("pay_frequencies[]", it) } + putAll(additionalQueryParams) + } + .build() fun toBuilder() = Builder().from(this) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParamsTest.kt index c906c158..a0528c33 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParamsTest.kt @@ -27,12 +27,18 @@ internal class HrisBenefitIndividualRetrieveManyBenefitsParamsTest { "d675d2b7-6d7b-41a8-b2d3-001eb3fb88f6,d02a6346-1f08-4312-a064-49ff3cafaa7a" ) .build() - val expected = QueryParams.builder() - expected.put( - "individual_ids", - "d675d2b7-6d7b-41a8-b2d3-001eb3fb88f6,d02a6346-1f08-4312-a064-49ff3cafaa7a", - ) - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put( + "individual_ids", + "d675d2b7-6d7b-41a8-b2d3-001eb3fb88f6,d02a6346-1f08-4312-a064-49ff3cafaa7a", + ) + .build() + ) } @Test @@ -41,8 +47,10 @@ internal class HrisBenefitIndividualRetrieveManyBenefitsParamsTest { HrisBenefitIndividualRetrieveManyBenefitsParams.builder() .benefitId("benefit_id") .build() - val expected = QueryParams.builder() - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParamsTest.kt index d1418f46..340e2a6b 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParamsTest.kt @@ -16,16 +16,19 @@ internal class HrisDirectoryListIndividualsParamsTest { @Test fun queryParams() { val params = HrisDirectoryListIndividualsParams.builder().limit(0L).offset(0L).build() - val expected = QueryParams.builder() - expected.put("limit", "0") - expected.put("offset", "0") - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo(QueryParams.builder().put("limit", "0").put("offset", "0").build()) } @Test fun queryParamsWithoutOptionalFields() { val params = HrisDirectoryListIndividualsParams.builder().build() - val expected = QueryParams.builder() - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListParamsTest.kt index 2414c44e..01611811 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListParamsTest.kt @@ -16,16 +16,19 @@ internal class HrisDirectoryListParamsTest { @Test fun queryParams() { val params = HrisDirectoryListParams.builder().limit(0L).offset(0L).build() - val expected = QueryParams.builder() - expected.put("limit", "0") - expected.put("offset", "0") - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo(QueryParams.builder().put("limit", "0").put("offset", "0").build()) } @Test fun queryParamsWithoutOptionalFields() { val params = HrisDirectoryListParams.builder().build() - val expected = QueryParams.builder() - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentListParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentListParamsTest.kt index 5a9ab2e2..bc450bba 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentListParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentListParamsTest.kt @@ -27,18 +27,26 @@ internal class HrisDocumentListParamsTest { .offset(0L) .addType(HrisDocumentListParams.Type.W4_2020) .build() - val expected = QueryParams.builder() - expected.put("individual_ids[]", "string") - expected.put("limit", "0") - expected.put("offset", "0") - expected.put("types[]", HrisDocumentListParams.Type.W4_2020.toString()) - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("individual_ids[]", "string") + .put("limit", "0") + .put("offset", "0") + .put("types[]", "w4_2020") + .build() + ) } @Test fun queryParamsWithoutOptionalFields() { val params = HrisDocumentListParams.builder().build() - val expected = QueryParams.builder() - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPaymentListParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPaymentListParamsTest.kt index 27d5deb2..a0e4dfe6 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPaymentListParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPaymentListParamsTest.kt @@ -24,10 +24,16 @@ internal class HrisPaymentListParamsTest { .endDate(LocalDate.parse("2021-01-01")) .startDate(LocalDate.parse("2021-01-01")) .build() - val expected = QueryParams.builder() - expected.put("end_date", "2021-01-01") - expected.put("start_date", "2021-01-01") - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("end_date", "2021-01-01") + .put("start_date", "2021-01-01") + .build() + ) } @Test @@ -37,9 +43,15 @@ internal class HrisPaymentListParamsTest { .endDate(LocalDate.parse("2021-01-01")) .startDate(LocalDate.parse("2021-01-01")) .build() - val expected = QueryParams.builder() - expected.put("end_date", "2021-01-01") - expected.put("start_date", "2021-01-01") - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("end_date", "2021-01-01") + .put("start_date", "2021-01-01") + .build() + ) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedListParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedListParamsTest.kt index 0a87d4b8..a6a42d5d 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedListParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedListParamsTest.kt @@ -16,16 +16,19 @@ internal class JobAutomatedListParamsTest { @Test fun queryParams() { val params = JobAutomatedListParams.builder().limit(0L).offset(0L).build() - val expected = QueryParams.builder() - expected.put("limit", "0") - expected.put("offset", "0") - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo(QueryParams.builder().put("limit", "0").put("offset", "0").build()) } @Test fun queryParamsWithoutOptionalFields() { val params = JobAutomatedListParams.builder().build() - val expected = QueryParams.builder() - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayrollPayGroupListParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayrollPayGroupListParamsTest.kt index d96aa5ee..a17dc1ae 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayrollPayGroupListParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayrollPayGroupListParamsTest.kt @@ -23,16 +23,24 @@ internal class PayrollPayGroupListParamsTest { .individualId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addPayFrequency("string") .build() - val expected = QueryParams.builder() - expected.put("individual_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - expected.put("pay_frequencies[]", "string") - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("individual_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("pay_frequencies[]", "string") + .build() + ) } @Test fun queryParamsWithoutOptionalFields() { val params = PayrollPayGroupListParams.builder().build() - val expected = QueryParams.builder() - assertThat(params._queryParams()).isEqualTo(expected.build()) + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } } From d1b1bd2847f0ffa069f9d9bce5702f093b129797 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 01:52:29 +0000 Subject: [PATCH 28/65] chore(internal): rename `getPathParam` (#499) chore(internal): reorder some params methodsc chore(internal): delete duplicate tests chore(internal): refactor some test assertions --- .../HrisBenefitIndividualEnrolledIdsParams.kt | 13 +- ...fitIndividualRetrieveManyBenefitsParams.kt | 13 +- ...HrisBenefitIndividualUnenrollManyParams.kt | 13 +- .../api/models/HrisBenefitRetrieveParams.kt | 13 +- .../api/models/HrisBenefitUpdateParams.kt | 13 +- .../api/models/HrisDocumentRetreiveParams.kt | 13 +- .../api/models/JobAutomatedRetrieveParams.kt | 13 +- .../api/models/JobManualRetrieveParams.kt | 13 +- .../models/PayrollPayGroupRetrieveParams.kt | 13 +- .../models/SandboxEmploymentUpdateParams.kt | 13 +- .../models/SandboxIndividualUpdateParams.kt | 13 +- .../async/hris/BenefitServiceAsyncImpl.kt | 4 +- .../async/hris/DocumentServiceAsyncImpl.kt | 2 +- .../benefits/IndividualServiceAsyncImpl.kt | 6 +- .../async/jobs/AutomatedServiceAsyncImpl.kt | 2 +- .../async/jobs/ManualServiceAsyncImpl.kt | 2 +- .../async/payroll/PayGroupServiceAsyncImpl.kt | 2 +- .../sandbox/EmploymentServiceAsyncImpl.kt | 2 +- .../sandbox/IndividualServiceAsyncImpl.kt | 2 +- .../blocking/hris/BenefitServiceImpl.kt | 4 +- .../blocking/hris/DocumentServiceImpl.kt | 2 +- .../hris/benefits/IndividualServiceImpl.kt | 6 +- .../blocking/jobs/AutomatedServiceImpl.kt | 2 +- .../blocking/jobs/ManualServiceImpl.kt | 2 +- .../blocking/payroll/PayGroupServiceImpl.kt | 2 +- .../blocking/sandbox/EmploymentServiceImpl.kt | 2 +- .../blocking/sandbox/IndividualServiceImpl.kt | 2 +- .../com/tryfinch/api/models/CompanyTest.kt | 7 +- .../api/models/CompanyUpdateResponseTest.kt | 7 +- .../api/models/ConnectSessionNewParamsTest.kt | 6 +- .../ConnectSessionReauthenticateParamsTest.kt | 5 +- .../tryfinch/api/models/EmploymentDataTest.kt | 5 +- .../models/EmploymentUpdateResponseTest.kt | 5 +- ...sBenefitIndividualEnrolledIdsParamsTest.kt | 9 +- ...ndividualRetrieveManyBenefitsParamsTest.kt | 25 +- ...BenefitIndividualUnenrollManyParamsTest.kt | 24 +- .../models/HrisBenefitRetrieveParamsTest.kt | 9 +- .../api/models/HrisBenefitUpdateParamsTest.kt | 19 +- .../models/HrisDocumentRetreiveParamsTest.kt | 9 +- .../HrisEmploymentRetrieveManyParamsTest.kt | 34 +-- .../HrisIndividualRetrieveManyParamsTest.kt | 13 +- .../HrisPayStatementRetrieveManyParamsTest.kt | 20 +- .../api/models/HrisPaymentListParamsTest.kt | 19 -- .../com/tryfinch/api/models/IndividualTest.kt | 5 +- .../models/IndividualUpdateResponseTest.kt | 5 +- .../models/JobAutomatedRetrieveParamsTest.kt | 9 +- .../api/models/JobManualRetrieveParamsTest.kt | 9 +- .../tryfinch/api/models/ManualAsyncJobTest.kt | 3 +- .../api/models/PayGroupListResponseTest.kt | 3 +- .../models/PayStatementResponseBodyTest.kt | 3 +- .../tryfinch/api/models/PayStatementTest.kt | 9 +- .../com/tryfinch/api/models/PaymentTest.kt | 8 +- .../PayrollPayGroupRetrieveParamsTest.kt | 9 +- .../com/tryfinch/api/models/ProviderTest.kt | 5 +- .../models/SandboxCompanyUpdateParamsTest.kt | 77 +++-- ...andboxConnectionAccountCreateParamsTest.kt | 3 +- .../SandboxConnectionCreateParamsTest.kt | 3 +- .../SandboxDirectoryCreateParamsTest.kt | 226 +++++++------- .../SandboxEmploymentUpdateParamsTest.kt | 52 ++-- .../SandboxIndividualUpdateParamsTest.kt | 48 ++- ...SandboxJobConfigurationUpdateParamsTest.kt | 23 -- .../api/models/SandboxJobCreateParamsTest.kt | 11 - .../models/SandboxPaymentCreateParamsTest.kt | 288 +++++++++--------- .../api/models/SupportedBenefitTest.kt | 10 +- 64 files changed, 547 insertions(+), 665 deletions(-) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt index 5beaeecb..47bb02a3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt @@ -23,16 +23,15 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - fun getPathParam(index: Int): String { - return when (index) { + fun _pathParam(index: Int): String = + when (index) { 0 -> benefitId else -> "" } - } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams fun toBuilder() = Builder().from(this) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt index 752d3484..d63f0755 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt @@ -32,6 +32,12 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams + fun _pathParam(index: Int): String = + when (index) { + 0 -> benefitId + else -> "" + } + override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = @@ -42,13 +48,6 @@ private constructor( } .build() - fun getPathParam(index: Int): String { - return when (index) { - 0 -> benefitId - else -> "" - } - } - fun toBuilder() = Builder().from(this) companion object { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt index 3ad4f2ad..fa3c1d75 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt @@ -56,16 +56,15 @@ private constructor( @JvmSynthetic internal fun _body(): Body = body - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - fun getPathParam(index: Int): String { - return when (index) { + fun _pathParam(index: Int): String = + when (index) { 0 -> benefitId else -> "" } - } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect class Body diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt index 51e08093..e6e2081c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt @@ -23,16 +23,15 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - fun getPathParam(index: Int): String { - return when (index) { + fun _pathParam(index: Int): String = + when (index) { 0 -> benefitId else -> "" } - } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams fun toBuilder() = Builder().from(this) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt index dc08ddd5..93f2c71f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt @@ -55,16 +55,15 @@ private constructor( @JvmSynthetic internal fun _body(): Body = body - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - fun getPathParam(index: Int): String { - return when (index) { + fun _pathParam(index: Int): String = + when (index) { 0 -> benefitId else -> "" } - } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect class Body diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt index a229d7f1..ec0e2b2d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt @@ -26,16 +26,15 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - fun getPathParam(index: Int): String { - return when (index) { + fun _pathParam(index: Int): String = + when (index) { 0 -> documentId else -> "" } - } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams fun toBuilder() = Builder().from(this) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParams.kt index 44903f4a..4d9c79eb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParams.kt @@ -23,16 +23,15 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - fun getPathParam(index: Int): String { - return when (index) { + fun _pathParam(index: Int): String = + when (index) { 0 -> jobId else -> "" } - } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams fun toBuilder() = Builder().from(this) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobManualRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobManualRetrieveParams.kt index c195f88a..127849fe 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobManualRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobManualRetrieveParams.kt @@ -26,16 +26,15 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - fun getPathParam(index: Int): String { - return when (index) { + fun _pathParam(index: Int): String = + when (index) { 0 -> jobId else -> "" } - } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams fun toBuilder() = Builder().from(this) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParams.kt index 7365981a..32c9e3bd 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParams.kt @@ -23,16 +23,15 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - fun getPathParam(index: Int): String { - return when (index) { + fun _pathParam(index: Int): String = + when (index) { 0 -> payGroupId else -> "" } - } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams fun toBuilder() = Builder().from(this) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt index 432f6a47..9a95da3a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt @@ -310,16 +310,15 @@ private constructor( @JvmSynthetic internal fun _body(): EmploymentWithoutId = body - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - fun getPathParam(index: Int): String { - return when (index) { + fun _pathParam(index: Int): String = + when (index) { 0 -> individualId else -> "" } - } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect class EmploymentWithoutId diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt index fc74657e..1325a93c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt @@ -219,16 +219,15 @@ private constructor( @JvmSynthetic internal fun _body(): IndividualWithoutId = body - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - fun getPathParam(index: Int): String { - return when (index) { + fun _pathParam(index: Int): String = + when (index) { 0 -> individualId else -> "" } - } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect class IndividualWithoutId diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt index 123e0006..efd7ad43 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt @@ -132,7 +132,7 @@ class BenefitServiceAsyncImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("employer", "benefits", params.getPathParam(0)) + .addPathSegments("employer", "benefits", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) @@ -162,7 +162,7 @@ class BenefitServiceAsyncImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.POST) - .addPathSegments("employer", "benefits", params.getPathParam(0)) + .addPathSegments("employer", "benefits", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt index 87873f13..ec86afd6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt @@ -89,7 +89,7 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("employer", "documents", params.getPathParam(0)) + .addPathSegments("employer", "documents", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt index d75ae1ed..f6115eed 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt @@ -71,7 +71,7 @@ class IndividualServiceAsyncImpl internal constructor(private val clientOptions: val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("employer", "benefits", params.getPathParam(0), "enrolled") + .addPathSegments("employer", "benefits", params._pathParam(0), "enrolled") .build() .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) @@ -101,7 +101,7 @@ class IndividualServiceAsyncImpl internal constructor(private val clientOptions: val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("employer", "benefits", params.getPathParam(0), "individuals") + .addPathSegments("employer", "benefits", params._pathParam(0), "individuals") .build() .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) @@ -141,7 +141,7 @@ class IndividualServiceAsyncImpl internal constructor(private val clientOptions: val request = HttpRequest.builder() .method(HttpMethod.DELETE) - .addPathSegments("employer", "benefits", params.getPathParam(0), "individuals") + .addPathSegments("employer", "benefits", params._pathParam(0), "individuals") .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt index c2ef8bf5..3c0e3bb9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt @@ -99,7 +99,7 @@ class AutomatedServiceAsyncImpl internal constructor(private val clientOptions: val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("jobs", "automated", params.getPathParam(0)) + .addPathSegments("jobs", "automated", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt index 4669943c..e5ab8fe0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt @@ -49,7 +49,7 @@ class ManualServiceAsyncImpl internal constructor(private val clientOptions: Cli val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("jobs", "manual", params.getPathParam(0)) + .addPathSegments("jobs", "manual", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt index 7df11930..3e0af2ea 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt @@ -60,7 +60,7 @@ class PayGroupServiceAsyncImpl internal constructor(private val clientOptions: C val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("employer", "pay-groups", params.getPathParam(0)) + .addPathSegments("employer", "pay-groups", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt index 8efd07c5..81ab3634 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt @@ -51,7 +51,7 @@ class EmploymentServiceAsyncImpl internal constructor(private val clientOptions: val request = HttpRequest.builder() .method(HttpMethod.PUT) - .addPathSegments("sandbox", "employment", params.getPathParam(0)) + .addPathSegments("sandbox", "employment", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt index ee2c9a30..e684cfbb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt @@ -51,7 +51,7 @@ class IndividualServiceAsyncImpl internal constructor(private val clientOptions: val request = HttpRequest.builder() .method(HttpMethod.PUT) - .addPathSegments("sandbox", "individual", params.getPathParam(0)) + .addPathSegments("sandbox", "individual", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt index d078194e..987d5671 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt @@ -126,7 +126,7 @@ class BenefitServiceImpl internal constructor(private val clientOptions: ClientO val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("employer", "benefits", params.getPathParam(0)) + .addPathSegments("employer", "benefits", params._pathParam(0)) .build() .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) @@ -153,7 +153,7 @@ class BenefitServiceImpl internal constructor(private val clientOptions: ClientO val request = HttpRequest.builder() .method(HttpMethod.POST) - .addPathSegments("employer", "benefits", params.getPathParam(0)) + .addPathSegments("employer", "benefits", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt index 6f5541a3..59088faa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt @@ -85,7 +85,7 @@ class DocumentServiceImpl internal constructor(private val clientOptions: Client val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("employer", "documents", params.getPathParam(0)) + .addPathSegments("employer", "documents", params._pathParam(0)) .build() .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt index 432f2d09..8e240552 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt @@ -70,7 +70,7 @@ class IndividualServiceImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("employer", "benefits", params.getPathParam(0), "enrolled") + .addPathSegments("employer", "benefits", params._pathParam(0), "enrolled") .build() .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) @@ -97,7 +97,7 @@ class IndividualServiceImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("employer", "benefits", params.getPathParam(0), "individuals") + .addPathSegments("employer", "benefits", params._pathParam(0), "individuals") .build() .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) @@ -133,7 +133,7 @@ class IndividualServiceImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.DELETE) - .addPathSegments("employer", "benefits", params.getPathParam(0), "individuals") + .addPathSegments("employer", "benefits", params._pathParam(0), "individuals") .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt index 94dc24f1..d1155e2b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt @@ -95,7 +95,7 @@ class AutomatedServiceImpl internal constructor(private val clientOptions: Clien val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("jobs", "automated", params.getPathParam(0)) + .addPathSegments("jobs", "automated", params._pathParam(0)) .build() .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt index f26e3589..6f4424db 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt @@ -48,7 +48,7 @@ class ManualServiceImpl internal constructor(private val clientOptions: ClientOp val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("jobs", "manual", params.getPathParam(0)) + .addPathSegments("jobs", "manual", params._pathParam(0)) .build() .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt index 1eea0891..f81dbc3b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt @@ -59,7 +59,7 @@ class PayGroupServiceImpl internal constructor(private val clientOptions: Client val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("employer", "pay-groups", params.getPathParam(0)) + .addPathSegments("employer", "pay-groups", params._pathParam(0)) .build() .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt index fb69229c..9345aa08 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt @@ -50,7 +50,7 @@ class EmploymentServiceImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.PUT) - .addPathSegments("sandbox", "employment", params.getPathParam(0)) + .addPathSegments("sandbox", "employment", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt index 7cc8a380..9968c497 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt @@ -50,7 +50,7 @@ class IndividualServiceImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.PUT) - .addPathSegments("sandbox", "individual", params.getPathParam(0)) + .addPathSegments("sandbox", "individual", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt index c040a8a7..29f89cba 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -52,7 +53,7 @@ internal class CompanyTest { .build() assertThat(company).isNotNull assertThat(company.id()).isEqualTo("id") - assertThat(company.accounts().get()) + assertThat(company.accounts().getOrNull()) .containsExactly( Company.Account.builder() .accountName("account_name") @@ -62,7 +63,7 @@ internal class CompanyTest { .routingNumber("routing_number") .build() ) - assertThat(company.departments().get()) + assertThat(company.departments().getOrNull()) .containsExactly( Company.Department.builder() .name("name") @@ -78,7 +79,7 @@ internal class CompanyTest { .build() ) assertThat(company.legalName()).contains("legal_name") - assertThat(company.locations().get()) + assertThat(company.locations().getOrNull()) .containsExactly( Location.builder() .city("city") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt index d5578b15..e6852aee 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -52,7 +53,7 @@ internal class CompanyUpdateResponseTest { .primaryPhoneNumber("primary_phone_number") .build() assertThat(companyUpdateResponse).isNotNull - assertThat(companyUpdateResponse.accounts().get()) + assertThat(companyUpdateResponse.accounts().getOrNull()) .containsExactly( CompanyUpdateResponse.Account.builder() .accountName("account_name") @@ -62,7 +63,7 @@ internal class CompanyUpdateResponseTest { .routingNumber("routing_number") .build() ) - assertThat(companyUpdateResponse.departments().get()) + assertThat(companyUpdateResponse.departments().getOrNull()) .containsExactly( CompanyUpdateResponse.Department.builder() .name("name") @@ -78,7 +79,7 @@ internal class CompanyUpdateResponseTest { .build() ) assertThat(companyUpdateResponse.legalName()).contains("legal_name") - assertThat(companyUpdateResponse.locations().get()) + assertThat(companyUpdateResponse.locations().getOrNull()) .containsExactly( Location.builder() .city("city") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt index e75e85ce..5a12d548 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt @@ -53,8 +53,7 @@ internal class ConnectSessionNewParamsTest { assertNotNull(body) assertThat(body.customerId()).isEqualTo("x") assertThat(body.customerName()).isEqualTo("x") - assertThat(body.products()) - .isEqualTo(listOf(ConnectSessionNewParams.ConnectProducts.COMPANY)) + assertThat(body.products()).containsExactly(ConnectSessionNewParams.ConnectProducts.COMPANY) assertThat(body.customerEmail()).contains("dev@stainless.com") assertThat(body.integration()) .contains( @@ -83,7 +82,6 @@ internal class ConnectSessionNewParamsTest { assertNotNull(body) assertThat(body.customerId()).isEqualTo("x") assertThat(body.customerName()).isEqualTo("x") - assertThat(body.products()) - .isEqualTo(listOf(ConnectSessionNewParams.ConnectProducts.COMPANY)) + assertThat(body.products()).containsExactly(ConnectSessionNewParams.ConnectProducts.COMPANY) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt index e685f3bd..cb84c475 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.jvm.optionals.getOrNull import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -33,8 +34,8 @@ internal class ConnectSessionReauthenticateParamsTest { assertNotNull(body) assertThat(body.connectionId()).isEqualTo("connection_id") assertThat(body.minutesToExpire()).contains(0L) - assertThat(body.products()) - .contains(listOf(ConnectSessionReauthenticateParams.ConnectProducts.COMPANY)) + assertThat(body.products().getOrNull()) + .containsExactly(ConnectSessionReauthenticateParams.ConnectProducts.COMPANY) assertThat(body.redirectUri()).contains("https://example.com") } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt index 16cc726b..0d6c2e40 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.models import com.tryfinch.api.core.JsonValue +import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -71,7 +72,7 @@ internal class EmploymentDataTest { assertThat(employmentData).isNotNull assertThat(employmentData.id()).contains("id") assertThat(employmentData.classCode()).contains("class_code") - assertThat(employmentData.customFields().get()) + assertThat(employmentData.customFields().getOrNull()) .containsExactly( EmploymentData.CustomField.builder() .name("name") @@ -100,7 +101,7 @@ internal class EmploymentDataTest { .unit(Income.Unit.YEARLY) .build() ) - assertThat(employmentData.incomeHistory().get()) + assertThat(employmentData.incomeHistory().getOrNull()) .containsExactly( Income.builder() .amount(0L) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt index f4def2ce..2e8ceb24 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.models import com.tryfinch.api.core.JsonValue +import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -70,7 +71,7 @@ internal class EmploymentUpdateResponseTest { assertThat(employmentUpdateResponse).isNotNull assertThat(employmentUpdateResponse.id()).contains("id") assertThat(employmentUpdateResponse.classCode()).contains("class_code") - assertThat(employmentUpdateResponse.customFields().get()) + assertThat(employmentUpdateResponse.customFields().getOrNull()) .containsExactly( EmploymentUpdateResponse.CustomField.builder() .name("name") @@ -99,7 +100,7 @@ internal class EmploymentUpdateResponseTest { .unit(Income.Unit.YEARLY) .build() ) - assertThat(employmentUpdateResponse.incomeHistory().get()) + assertThat(employmentUpdateResponse.incomeHistory().getOrNull()) .containsExactly( Income.builder() .amount(0L) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParamsTest.kt index 88ab3580..5226e6c1 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParamsTest.kt @@ -13,13 +13,12 @@ internal class HrisBenefitIndividualEnrolledIdsParamsTest { } @Test - fun getPathParam() { + fun pathParams() { val params = HrisBenefitIndividualEnrolledIdsParams.builder().benefitId("benefit_id").build() - assertThat(params).isNotNull - // path param "benefitId" - assertThat(params.getPathParam(0)).isEqualTo("benefit_id") + + assertThat(params._pathParam(0)).isEqualTo("benefit_id") // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") + assertThat(params._pathParam(1)).isEqualTo("") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParamsTest.kt index a0528c33..fbd9e20a 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParamsTest.kt @@ -18,6 +18,18 @@ internal class HrisBenefitIndividualRetrieveManyBenefitsParamsTest { .build() } + @Test + fun pathParams() { + val params = + HrisBenefitIndividualRetrieveManyBenefitsParams.builder() + .benefitId("benefit_id") + .build() + + assertThat(params._pathParam(0)).isEqualTo("benefit_id") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + @Test fun queryParams() { val params = @@ -52,17 +64,4 @@ internal class HrisBenefitIndividualRetrieveManyBenefitsParamsTest { assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } - - @Test - fun getPathParam() { - val params = - HrisBenefitIndividualRetrieveManyBenefitsParams.builder() - .benefitId("benefit_id") - .build() - assertThat(params).isNotNull - // path param "benefitId" - assertThat(params.getPathParam(0)).isEqualTo("benefit_id") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt index 8dc66fd7..27c31e2f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.jvm.optionals.getOrNull import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -16,6 +17,16 @@ internal class HrisBenefitIndividualUnenrollManyParamsTest { .build() } + @Test + fun pathParams() { + val params = + HrisBenefitIndividualUnenrollManyParams.builder().benefitId("benefit_id").build() + + assertThat(params._pathParam(0)).isEqualTo("benefit_id") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + @Test fun body() { val params = @@ -27,7 +38,7 @@ internal class HrisBenefitIndividualUnenrollManyParamsTest { val body = params._body() assertNotNull(body) - assertThat(body.individualIds()).contains(listOf("string")) + assertThat(body.individualIds().getOrNull()).containsExactly("string") } @Test @@ -39,15 +50,4 @@ internal class HrisBenefitIndividualUnenrollManyParamsTest { assertNotNull(body) } - - @Test - fun getPathParam() { - val params = - HrisBenefitIndividualUnenrollManyParams.builder().benefitId("benefit_id").build() - assertThat(params).isNotNull - // path param "benefitId" - assertThat(params.getPathParam(0)).isEqualTo("benefit_id") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParamsTest.kt index 7cf83452..7b1d62f4 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParamsTest.kt @@ -13,12 +13,11 @@ internal class HrisBenefitRetrieveParamsTest { } @Test - fun getPathParam() { + fun pathParams() { val params = HrisBenefitRetrieveParams.builder().benefitId("benefit_id").build() - assertThat(params).isNotNull - // path param "benefitId" - assertThat(params.getPathParam(0)).isEqualTo("benefit_id") + + assertThat(params._pathParam(0)).isEqualTo("benefit_id") // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") + assertThat(params._pathParam(1)).isEqualTo("") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt index 0cc495df..c6a378b6 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt @@ -13,6 +13,15 @@ internal class HrisBenefitUpdateParamsTest { HrisBenefitUpdateParams.builder().benefitId("benefit_id").description("description").build() } + @Test + fun pathParams() { + val params = HrisBenefitUpdateParams.builder().benefitId("benefit_id").build() + + assertThat(params._pathParam(0)).isEqualTo("benefit_id") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + @Test fun body() { val params = @@ -35,14 +44,4 @@ internal class HrisBenefitUpdateParamsTest { assertNotNull(body) } - - @Test - fun getPathParam() { - val params = HrisBenefitUpdateParams.builder().benefitId("benefit_id").build() - assertThat(params).isNotNull - // path param "benefitId" - assertThat(params.getPathParam(0)).isEqualTo("benefit_id") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParamsTest.kt index 04925a10..3fbc4678 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParamsTest.kt @@ -13,12 +13,11 @@ internal class HrisDocumentRetreiveParamsTest { } @Test - fun getPathParam() { + fun pathParams() { val params = HrisDocumentRetreiveParams.builder().documentId("document_id").build() - assertThat(params).isNotNull - // path param "documentId" - assertThat(params.getPathParam(0)).isEqualTo("document_id") + + assertThat(params._pathParam(0)).isEqualTo("document_id") // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") + assertThat(params._pathParam(1)).isEqualTo("") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParamsTest.kt index f339dccf..4db05d13 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParamsTest.kt @@ -34,36 +34,10 @@ internal class HrisEmploymentRetrieveManyParamsTest { assertNotNull(body) assertThat(body.requests()) - .isEqualTo( - listOf( - HrisEmploymentRetrieveManyParams.Request.builder() - .individualId("individual_id") - .build() - ) - ) - } - - @Test - fun bodyWithoutOptionalFields() { - val params = - HrisEmploymentRetrieveManyParams.builder() - .addRequest( - HrisEmploymentRetrieveManyParams.Request.builder() - .individualId("individual_id") - .build() - ) - .build() - - val body = params._body() - - assertNotNull(body) - assertThat(body.requests()) - .isEqualTo( - listOf( - HrisEmploymentRetrieveManyParams.Request.builder() - .individualId("individual_id") - .build() - ) + .containsExactly( + HrisEmploymentRetrieveManyParams.Request.builder() + .individualId("individual_id") + .build() ) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt index 1977540e..9680f11c 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.jvm.optionals.getOrNull import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -43,13 +44,11 @@ internal class HrisIndividualRetrieveManyParamsTest { .contains( HrisIndividualRetrieveManyParams.Options.builder().addInclude("string").build() ) - assertThat(body.requests()) - .contains( - listOf( - HrisIndividualRetrieveManyParams.Request.builder() - .individualId("individual_id") - .build() - ) + assertThat(body.requests().getOrNull()) + .containsExactly( + HrisIndividualRetrieveManyParams.Request.builder() + .individualId("individual_id") + .build() ) } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt index cc41f983..7c83fa05 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt @@ -38,14 +38,12 @@ internal class HrisPayStatementRetrieveManyParamsTest { assertNotNull(body) assertThat(body.requests()) - .isEqualTo( - listOf( - HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("string") - .limit(50L) - .offset(0L) - .build() - ) + .containsExactly( + HrisPayStatementRetrieveManyParams.Request.builder() + .paymentId("string") + .limit(50L) + .offset(0L) + .build() ) } @@ -62,10 +60,8 @@ internal class HrisPayStatementRetrieveManyParamsTest { assertNotNull(body) assertThat(body.requests()) - .isEqualTo( - listOf( - HrisPayStatementRetrieveManyParams.Request.builder().paymentId("string").build() - ) + .containsExactly( + HrisPayStatementRetrieveManyParams.Request.builder().paymentId("string").build() ) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPaymentListParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPaymentListParamsTest.kt index a0e4dfe6..f07f49c4 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPaymentListParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPaymentListParamsTest.kt @@ -35,23 +35,4 @@ internal class HrisPaymentListParamsTest { .build() ) } - - @Test - fun queryParamsWithoutOptionalFields() { - val params = - HrisPaymentListParams.builder() - .endDate(LocalDate.parse("2021-01-01")) - .startDate(LocalDate.parse("2021-01-01")) - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams) - .isEqualTo( - QueryParams.builder() - .put("end_date", "2021-01-01") - .put("start_date", "2021-01-01") - .build() - ) - } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt index f7b3c2a3..382f06c8 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -46,7 +47,7 @@ internal class IndividualTest { assertThat(individual).isNotNull assertThat(individual.id()).contains("id") assertThat(individual.dob()).contains("dob") - assertThat(individual.emails().get()) + assertThat(individual.emails().getOrNull()) .containsExactly( Individual.Email.builder().data("data").type(Individual.Email.Type.WORK).build() ) @@ -56,7 +57,7 @@ internal class IndividualTest { assertThat(individual.gender()).contains(Individual.Gender.FEMALE) assertThat(individual.lastName()).contains("last_name") assertThat(individual.middleName()).contains("middle_name") - assertThat(individual.phoneNumbers().get()) + assertThat(individual.phoneNumbers().getOrNull()) .containsExactly( Individual.PhoneNumber.builder() .data("data") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt index 4aec13f7..b28fa5ab 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -49,7 +50,7 @@ internal class IndividualUpdateResponseTest { assertThat(individualUpdateResponse).isNotNull assertThat(individualUpdateResponse.id()).contains("id") assertThat(individualUpdateResponse.dob()).contains("dob") - assertThat(individualUpdateResponse.emails().get()) + assertThat(individualUpdateResponse.emails().getOrNull()) .containsExactly( IndividualUpdateResponse.Email.builder() .data("data") @@ -64,7 +65,7 @@ internal class IndividualUpdateResponseTest { .contains(IndividualUpdateResponse.Gender.FEMALE) assertThat(individualUpdateResponse.lastName()).contains("last_name") assertThat(individualUpdateResponse.middleName()).contains("middle_name") - assertThat(individualUpdateResponse.phoneNumbers().get()) + assertThat(individualUpdateResponse.phoneNumbers().getOrNull()) .containsExactly( IndividualUpdateResponse.PhoneNumber.builder() .data("data") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParamsTest.kt index 3b9dea19..d8c03a77 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParamsTest.kt @@ -13,12 +13,11 @@ internal class JobAutomatedRetrieveParamsTest { } @Test - fun getPathParam() { + fun pathParams() { val params = JobAutomatedRetrieveParams.builder().jobId("job_id").build() - assertThat(params).isNotNull - // path param "jobId" - assertThat(params.getPathParam(0)).isEqualTo("job_id") + + assertThat(params._pathParam(0)).isEqualTo("job_id") // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") + assertThat(params._pathParam(1)).isEqualTo("") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobManualRetrieveParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobManualRetrieveParamsTest.kt index f75a7aec..4d7590ce 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobManualRetrieveParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobManualRetrieveParamsTest.kt @@ -13,12 +13,11 @@ internal class JobManualRetrieveParamsTest { } @Test - fun getPathParam() { + fun pathParams() { val params = JobManualRetrieveParams.builder().jobId("job_id").build() - assertThat(params).isNotNull - // path param "jobId" - assertThat(params.getPathParam(0)).isEqualTo("job_id") + + assertThat(params._pathParam(0)).isEqualTo("job_id") // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") + assertThat(params._pathParam(1)).isEqualTo("") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ManualAsyncJobTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ManualAsyncJobTest.kt index 93f12c76..cc7b2a21 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ManualAsyncJobTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ManualAsyncJobTest.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.models import com.tryfinch.api.core.JsonValue +import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -17,7 +18,7 @@ internal class ManualAsyncJobTest { .status(ManualAsyncJob.Status.PENDING) .build() assertThat(manualAsyncJob).isNotNull - assertThat(manualAsyncJob.body().get()) + assertThat(manualAsyncJob.body().getOrNull()) .containsExactly(JsonValue.from(mapOf())) assertThat(manualAsyncJob.jobId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(manualAsyncJob.status()).isEqualTo(ManualAsyncJob.Status.PENDING) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt index 3346f8d4..a24394ea 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -18,7 +19,7 @@ internal class PayGroupListResponseTest { assertThat(payGroupListResponse).isNotNull assertThat(payGroupListResponse.id()).contains("id") assertThat(payGroupListResponse.name()).contains("name") - assertThat(payGroupListResponse.payFrequencies().get()) + assertThat(payGroupListResponse.payFrequencies().getOrNull()) .containsExactly(PayGroupListResponse.PayFrequency.ANNUALLY) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt index c1ea4fb8..ada41b9f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.models import com.tryfinch.api.core.JsonValue +import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -138,7 +139,7 @@ internal class PayStatementResponseBodyTest { assertThat(payStatementResponseBody).isNotNull assertThat(payStatementResponseBody.paging()) .contains(Paging.builder().count(0L).offset(0L).build()) - assertThat(payStatementResponseBody.payStatements().get()) + assertThat(payStatementResponseBody.payStatements().getOrNull()) .containsExactly( PayStatement.builder() .addEarning( diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt index deb7e2de..fd07027a 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.models import com.tryfinch.api.core.JsonValue +import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -113,7 +114,7 @@ internal class PayStatementTest { .type(PayStatement.Type.REGULAR_PAYROLL) .build() assertThat(payStatement).isNotNull - assertThat(payStatement.earnings().get()) + assertThat(payStatement.earnings().getOrNull()) .containsExactly( PayStatement.Earning.builder() .amount(0L) @@ -137,7 +138,7 @@ internal class PayStatementTest { .type(PayStatement.Earning.Type.SALARY) .build() ) - assertThat(payStatement.employeeDeductions().get()) + assertThat(payStatement.employeeDeductions().getOrNull()) .containsExactly( PayStatement.EmployeeDeduction.builder() .amount(0L) @@ -162,7 +163,7 @@ internal class PayStatementTest { .type(BenefitType._401K) .build() ) - assertThat(payStatement.employerContributions().get()) + assertThat(payStatement.employerContributions().getOrNull()) .containsExactly( PayStatement.EmployerContribution.builder() .amount(0L) @@ -192,7 +193,7 @@ internal class PayStatementTest { assertThat(payStatement.netPay()) .contains(Money.builder().amount(0L).currency("currency").build()) assertThat(payStatement.paymentMethod()).contains(PayStatement.PaymentMethod.CHECK) - assertThat(payStatement.taxes().get()) + assertThat(payStatement.taxes().getOrNull()) .containsExactly( PayStatement.Tax.builder() .amount(0L) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt index d9b612b1..147cbebc 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -37,12 +38,13 @@ internal class PaymentTest { .contains(Money.builder().amount(0L).currency("currency").build()) assertThat(payment.grossPay()) .contains(Money.builder().amount(0L).currency("currency").build()) - assertThat(payment.individualIds().get()).containsExactly("string") + assertThat(payment.individualIds().getOrNull()).containsExactly("string") assertThat(payment.netPay()) .contains(Money.builder().amount(0L).currency("currency").build()) assertThat(payment.payDate()).contains("pay_date") - assertThat(payment.payFrequencies().get()).containsExactly(Payment.PayFrequency.ANNUALLY) - assertThat(payment.payGroupIds().get()).containsExactly("string") + assertThat(payment.payFrequencies().getOrNull()) + .containsExactly(Payment.PayFrequency.ANNUALLY) + assertThat(payment.payGroupIds().getOrNull()).containsExactly("string") assertThat(payment.payPeriod()) .contains( Payment.PayPeriod.builder().endDate("end_date").startDate("start_date").build() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParamsTest.kt index db9a28b8..47419b7f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParamsTest.kt @@ -13,12 +13,11 @@ internal class PayrollPayGroupRetrieveParamsTest { } @Test - fun getPathParam() { + fun pathParams() { val params = PayrollPayGroupRetrieveParams.builder().payGroupId("pay_group_id").build() - assertThat(params).isNotNull - // path param "payGroupId" - assertThat(params.getPathParam(0)).isEqualTo("pay_group_id") + + assertThat(params._pathParam(0)).isEqualTo("pay_group_id") // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") + assertThat(params._pathParam(1)).isEqualTo("") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderTest.kt index b3ddae7e..3537065e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -925,7 +926,7 @@ internal class ProviderTest { .build() assertThat(provider).isNotNull assertThat(provider.id()).contains("id") - assertThat(provider.authenticationMethods().get()) + assertThat(provider.authenticationMethods().getOrNull()) .containsExactly( Provider.AuthenticationMethod.builder() .benefitsSupport( @@ -1833,6 +1834,6 @@ internal class ProviderTest { assertThat(provider.manual()).contains(true) assertThat(provider.mfaRequired()).contains(true) assertThat(provider.primaryColor()).contains("primary_color") - assertThat(provider.products().get()).containsExactly("string") + assertThat(provider.products().getOrNull()).containsExactly("string") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt index cf6524ba..f78f02fe 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.jvm.optionals.getOrNull import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -103,30 +104,24 @@ internal class SandboxCompanyUpdateParamsTest { val body = params._body() assertNotNull(body) - assertThat(body.accounts()) - .contains( - listOf( - SandboxCompanyUpdateParams.Account.builder() - .accountName("account_name") - .accountNumber("account_number") - .accountType(SandboxCompanyUpdateParams.Account.AccountType.CHECKING) - .institutionName("institution_name") - .routingNumber("routing_number") - .build() - ) + assertThat(body.accounts().getOrNull()) + .containsExactly( + SandboxCompanyUpdateParams.Account.builder() + .accountName("account_name") + .accountNumber("account_number") + .accountType(SandboxCompanyUpdateParams.Account.AccountType.CHECKING) + .institutionName("institution_name") + .routingNumber("routing_number") + .build() ) - assertThat(body.departments()) - .contains( - listOf( - SandboxCompanyUpdateParams.Department.builder() - .name("name") - .parent( - SandboxCompanyUpdateParams.Department.Parent.builder() - .name("name") - .build() - ) - .build() - ) + assertThat(body.departments().getOrNull()) + .containsExactly( + SandboxCompanyUpdateParams.Department.builder() + .name("name") + .parent( + SandboxCompanyUpdateParams.Department.Parent.builder().name("name").build() + ) + .build() ) assertThat(body.ein()).contains("ein") assertThat(body.entity()) @@ -137,20 +132,18 @@ internal class SandboxCompanyUpdateParamsTest { .build() ) assertThat(body.legalName()).contains("legal_name") - assertThat(body.locations()) - .contains( - listOf( - Location.builder() - .city("city") - .country("country") - .line1("line1") - .line2("line2") - .name("name") - .postalCode("postal_code") - .sourceId("source_id") - .state("state") - .build() - ) + assertThat(body.locations().getOrNull()) + .containsExactly( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() ) assertThat(body.primaryEmail()).contains("primary_email") assertThat(body.primaryPhoneNumber()).contains("primary_phone_number") @@ -173,14 +166,14 @@ internal class SandboxCompanyUpdateParamsTest { val body = params._body() assertNotNull(body) - assertThat(body.accounts()) - .contains(listOf(SandboxCompanyUpdateParams.Account.builder().build())) - assertThat(body.departments()) - .contains(listOf(SandboxCompanyUpdateParams.Department.builder().build())) + assertThat(body.accounts().getOrNull()) + .containsExactly(SandboxCompanyUpdateParams.Account.builder().build()) + assertThat(body.departments().getOrNull()) + .containsExactly(SandboxCompanyUpdateParams.Department.builder().build()) assertThat(body.ein()).contains("ein") assertThat(body.entity()).contains(SandboxCompanyUpdateParams.Entity.builder().build()) assertThat(body.legalName()).contains("legal_name") - assertThat(body.locations()).contains(listOf(Location.builder().build())) + assertThat(body.locations().getOrNull()).containsExactly(Location.builder().build()) assertThat(body.primaryEmail()).contains("primary_email") assertThat(body.primaryPhoneNumber()).contains("primary_phone_number") } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt index 220516b3..e35c118d 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.jvm.optionals.getOrNull import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -37,7 +38,7 @@ internal class SandboxConnectionAccountCreateParamsTest { assertThat(body.providerId()).isEqualTo("provider_id") assertThat(body.authenticationType()) .contains(SandboxConnectionAccountCreateParams.AuthenticationType.CREDENTIAL) - assertThat(body.products()).contains(listOf("string")) + assertThat(body.products().getOrNull()).containsExactly("string") } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt index 58b1da93..205ff0e3 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.jvm.optionals.getOrNull import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -35,7 +36,7 @@ internal class SandboxConnectionCreateParamsTest { assertThat(body.authenticationType()) .contains(SandboxConnectionCreateParams.AuthenticationType.CREDENTIAL) assertThat(body.employeeSize()).contains(0L) - assertThat(body.products()).contains(listOf("string")) + assertThat(body.products().getOrNull()).containsExactly("string") } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParamsTest.kt index 27ec26ea..a21be284 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParamsTest.kt @@ -250,124 +250,114 @@ internal class SandboxDirectoryCreateParamsTest { val body = params._body().getOrNull() assertThat(body) - .isEqualTo( - listOf( - SandboxDirectoryCreateParams.IndividualOrEmployment.builder() - .classCode("class_code") - .addCustomField( - SandboxDirectoryCreateParams.IndividualOrEmployment.CustomField - .builder() - .name("name") - .value(JsonValue.from(mapOf())) - .build() - ) - .department( - SandboxDirectoryCreateParams.IndividualOrEmployment.Department.builder() - .name("name") - .build() - ) - .dob("dob") - .addEmail( - SandboxDirectoryCreateParams.IndividualOrEmployment.Email.builder() - .data("data") - .type( - SandboxDirectoryCreateParams.IndividualOrEmployment.Email.Type - .WORK - ) - .build() - ) - .employment( - SandboxDirectoryCreateParams.IndividualOrEmployment.Employment.builder() - .subtype( - SandboxDirectoryCreateParams.IndividualOrEmployment.Employment - .Subtype - .FULL_TIME - ) - .type( - SandboxDirectoryCreateParams.IndividualOrEmployment.Employment - .Type - .EMPLOYEE - ) - .build() - ) - .employmentStatus( - SandboxDirectoryCreateParams.IndividualOrEmployment.EmploymentStatus - .ACTIVE - ) - .encryptedSsn("encrypted_ssn") - .endDate("end_date") - .ethnicity( - SandboxDirectoryCreateParams.IndividualOrEmployment.Ethnicity.ASIAN - ) - .firstName("first_name") - .gender(SandboxDirectoryCreateParams.IndividualOrEmployment.Gender.FEMALE) - .income( - Income.builder() - .amount(0L) - .currency("currency") - .effectiveDate("effective_date") - .unit(Income.Unit.YEARLY) - .build() - ) - .addIncomeHistory( - Income.builder() - .amount(0L) - .currency("currency") - .effectiveDate("effective_date") - .unit(Income.Unit.YEARLY) - .build() - ) - .isActive(true) - .lastName("last_name") - .latestRehireDate("latest_rehire_date") - .location( - Location.builder() - .city("city") - .country("country") - .line1("line1") - .line2("line2") - .name("name") - .postalCode("postal_code") - .sourceId("source_id") - .state("state") - .build() - ) - .manager( - SandboxDirectoryCreateParams.IndividualOrEmployment.Manager.builder() - .id("id") - .build() - ) - .middleName("middle_name") - .addPhoneNumber( - SandboxDirectoryCreateParams.IndividualOrEmployment.PhoneNumber - .builder() - .data("data") - .type( - SandboxDirectoryCreateParams.IndividualOrEmployment.PhoneNumber - .Type - .WORK - ) - .build() - ) - .preferredName("preferred_name") - .residence( - Location.builder() - .city("city") - .country("country") - .line1("line1") - .line2("line2") - .name("name") - .postalCode("postal_code") - .sourceId("source_id") - .state("state") - .build() - ) - .sourceId("source_id") - .ssn("ssn") - .startDate("start_date") - .title("title") - .build() - ) + .containsExactly( + SandboxDirectoryCreateParams.IndividualOrEmployment.builder() + .classCode("class_code") + .addCustomField( + SandboxDirectoryCreateParams.IndividualOrEmployment.CustomField.builder() + .name("name") + .value(JsonValue.from(mapOf())) + .build() + ) + .department( + SandboxDirectoryCreateParams.IndividualOrEmployment.Department.builder() + .name("name") + .build() + ) + .dob("dob") + .addEmail( + SandboxDirectoryCreateParams.IndividualOrEmployment.Email.builder() + .data("data") + .type( + SandboxDirectoryCreateParams.IndividualOrEmployment.Email.Type.WORK + ) + .build() + ) + .employment( + SandboxDirectoryCreateParams.IndividualOrEmployment.Employment.builder() + .subtype( + SandboxDirectoryCreateParams.IndividualOrEmployment.Employment + .Subtype + .FULL_TIME + ) + .type( + SandboxDirectoryCreateParams.IndividualOrEmployment.Employment.Type + .EMPLOYEE + ) + .build() + ) + .employmentStatus( + SandboxDirectoryCreateParams.IndividualOrEmployment.EmploymentStatus.ACTIVE + ) + .encryptedSsn("encrypted_ssn") + .endDate("end_date") + .ethnicity(SandboxDirectoryCreateParams.IndividualOrEmployment.Ethnicity.ASIAN) + .firstName("first_name") + .gender(SandboxDirectoryCreateParams.IndividualOrEmployment.Gender.FEMALE) + .income( + Income.builder() + .amount(0L) + .currency("currency") + .effectiveDate("effective_date") + .unit(Income.Unit.YEARLY) + .build() + ) + .addIncomeHistory( + Income.builder() + .amount(0L) + .currency("currency") + .effectiveDate("effective_date") + .unit(Income.Unit.YEARLY) + .build() + ) + .isActive(true) + .lastName("last_name") + .latestRehireDate("latest_rehire_date") + .location( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + ) + .manager( + SandboxDirectoryCreateParams.IndividualOrEmployment.Manager.builder() + .id("id") + .build() + ) + .middleName("middle_name") + .addPhoneNumber( + SandboxDirectoryCreateParams.IndividualOrEmployment.PhoneNumber.builder() + .data("data") + .type( + SandboxDirectoryCreateParams.IndividualOrEmployment.PhoneNumber.Type + .WORK + ) + .build() + ) + .preferredName("preferred_name") + .residence( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + ) + .sourceId("source_id") + .ssn("ssn") + .startDate("start_date") + .title("title") + .build() ) } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt index 600482a1..36f7b736 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.models import com.tryfinch.api.core.JsonValue +import kotlin.jvm.optionals.getOrNull import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -69,6 +70,15 @@ internal class SandboxEmploymentUpdateParamsTest { .build() } + @Test + fun pathParams() { + val params = SandboxEmploymentUpdateParams.builder().individualId("individual_id").build() + + assertThat(params._pathParam(0)).isEqualTo("individual_id") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + @Test fun body() { val params = @@ -133,14 +143,12 @@ internal class SandboxEmploymentUpdateParamsTest { assertNotNull(body) assertThat(body.classCode()).contains("class_code") - assertThat(body.customFields()) - .contains( - listOf( - SandboxEmploymentUpdateParams.CustomField.builder() - .name("name") - .value(JsonValue.from(mapOf())) - .build() - ) + assertThat(body.customFields().getOrNull()) + .containsExactly( + SandboxEmploymentUpdateParams.CustomField.builder() + .name("name") + .value(JsonValue.from(mapOf())) + .build() ) assertThat(body.department()) .contains(SandboxEmploymentUpdateParams.Department.builder().name("name").build()) @@ -164,16 +172,14 @@ internal class SandboxEmploymentUpdateParamsTest { .unit(Income.Unit.YEARLY) .build() ) - assertThat(body.incomeHistory()) - .contains( - listOf( - Income.builder() - .amount(0L) - .currency("currency") - .effectiveDate("effective_date") - .unit(Income.Unit.YEARLY) - .build() - ) + assertThat(body.incomeHistory().getOrNull()) + .containsExactly( + Income.builder() + .amount(0L) + .currency("currency") + .effectiveDate("effective_date") + .unit(Income.Unit.YEARLY) + .build() ) assertThat(body.isActive()).contains(true) assertThat(body.lastName()).contains("last_name") @@ -207,14 +213,4 @@ internal class SandboxEmploymentUpdateParamsTest { assertNotNull(body) } - - @Test - fun getPathParam() { - val params = SandboxEmploymentUpdateParams.builder().individualId("individual_id").build() - assertThat(params).isNotNull - // path param "individualId" - assertThat(params.getPathParam(0)).isEqualTo("individual_id") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt index d4bf6d37..2b08d7a5 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.jvm.optionals.getOrNull import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -48,6 +49,15 @@ internal class SandboxIndividualUpdateParamsTest { .build() } + @Test + fun pathParams() { + val params = SandboxIndividualUpdateParams.builder().individualId("individual_id").build() + + assertThat(params._pathParam(0)).isEqualTo("individual_id") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + @Test fun body() { val params = @@ -92,14 +102,12 @@ internal class SandboxIndividualUpdateParamsTest { assertNotNull(body) assertThat(body.dob()).contains("dob") - assertThat(body.emails()) - .contains( - listOf( - SandboxIndividualUpdateParams.Email.builder() - .data("data") - .type(SandboxIndividualUpdateParams.Email.Type.WORK) - .build() - ) + assertThat(body.emails().getOrNull()) + .containsExactly( + SandboxIndividualUpdateParams.Email.builder() + .data("data") + .type(SandboxIndividualUpdateParams.Email.Type.WORK) + .build() ) assertThat(body.encryptedSsn()).contains("encrypted_ssn") assertThat(body.ethnicity()).contains(SandboxIndividualUpdateParams.Ethnicity.ASIAN) @@ -107,14 +115,12 @@ internal class SandboxIndividualUpdateParamsTest { assertThat(body.gender()).contains(SandboxIndividualUpdateParams.Gender.FEMALE) assertThat(body.lastName()).contains("last_name") assertThat(body.middleName()).contains("middle_name") - assertThat(body.phoneNumbers()) - .contains( - listOf( - SandboxIndividualUpdateParams.PhoneNumber.builder() - .data("data") - .type(SandboxIndividualUpdateParams.PhoneNumber.Type.WORK) - .build() - ) + assertThat(body.phoneNumbers().getOrNull()) + .containsExactly( + SandboxIndividualUpdateParams.PhoneNumber.builder() + .data("data") + .type(SandboxIndividualUpdateParams.PhoneNumber.Type.WORK) + .build() ) assertThat(body.preferredName()).contains("preferred_name") assertThat(body.residence()) @@ -141,14 +147,4 @@ internal class SandboxIndividualUpdateParamsTest { assertNotNull(body) } - - @Test - fun getPathParam() { - val params = SandboxIndividualUpdateParams.builder().individualId("individual_id").build() - assertThat(params).isNotNull - // path param "individualId" - assertThat(params.getPathParam(0)).isEqualTo("individual_id") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParamsTest.kt index 2d0b8185..a9818e71 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParamsTest.kt @@ -41,27 +41,4 @@ internal class SandboxJobConfigurationUpdateParamsTest { .build() ) } - - @Test - fun bodyWithoutOptionalFields() { - val params = - SandboxJobConfigurationUpdateParams.builder() - .sandboxJobConfiguration( - SandboxJobConfiguration.builder() - .completionStatus(SandboxJobConfiguration.CompletionStatus.COMPLETE) - .type(SandboxJobConfiguration.Type.DATA_SYNC_ALL) - .build() - ) - .build() - - val body = params._body() - - assertThat(body) - .isEqualTo( - SandboxJobConfiguration.builder() - .completionStatus(SandboxJobConfiguration.CompletionStatus.COMPLETE) - .type(SandboxJobConfiguration.Type.DATA_SYNC_ALL) - .build() - ) - } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobCreateParamsTest.kt index e83a96d3..ee23e077 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobCreateParamsTest.kt @@ -23,15 +23,4 @@ internal class SandboxJobCreateParamsTest { assertNotNull(body) assertThat(body.type()).isEqualTo(SandboxJobCreateParams.Type.DATA_SYNC_ALL) } - - @Test - fun bodyWithoutOptionalFields() { - val params = - SandboxJobCreateParams.builder().type(SandboxJobCreateParams.Type.DATA_SYNC_ALL).build() - - val body = params._body() - - assertNotNull(body) - assertThat(body.type()).isEqualTo(SandboxJobCreateParams.Type.DATA_SYNC_ALL) - } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt index 7ff6e448..149781a2 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.models import com.tryfinch.api.core.JsonValue +import kotlin.jvm.optionals.getOrNull import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -314,153 +315,146 @@ internal class SandboxPaymentCreateParamsTest { assertNotNull(body) assertThat(body.endDate()).contains("end_date") - assertThat(body.payStatements()) - .contains( - listOf( - SandboxPaymentCreateParams.PayStatement.builder() - .addEarning( - SandboxPaymentCreateParams.PayStatement.Earning.builder() - .amount(0L) - .attributes( - SandboxPaymentCreateParams.PayStatement.Earning.Attributes - .builder() - .metadata( - SandboxPaymentCreateParams.PayStatement.Earning - .Attributes - .Metadata - .builder() - .metadata( - SandboxPaymentCreateParams.PayStatement.Earning - .Attributes - .Metadata - .InnerMetadata - .builder() - .putAdditionalProperty( - "foo", - JsonValue.from("bar"), - ) - .build() - ) - .build() - ) - .build() - ) - .currency("currency") - .hours(0.0) - .name("name") - .type(SandboxPaymentCreateParams.PayStatement.Earning.Type.SALARY) - .build() - ) - .addEmployeeDeduction( - SandboxPaymentCreateParams.PayStatement.EmployeeDeduction.builder() - .amount(2000L) - .attributes( - SandboxPaymentCreateParams.PayStatement.EmployeeDeduction - .Attributes - .builder() - .metadata( - SandboxPaymentCreateParams.PayStatement - .EmployeeDeduction - .Attributes - .Metadata - .builder() - .metadata( - SandboxPaymentCreateParams.PayStatement - .EmployeeDeduction - .Attributes - .Metadata - .InnerMetadata - .builder() - .putAdditionalProperty( - "foo", - JsonValue.from("bar"), - ) - .build() - ) - .build() - ) - .build() - ) - .currency("usd") - .name("401k test") - .preTax(true) - .type(BenefitType._401K) - .build() - ) - .addEmployerContribution( - SandboxPaymentCreateParams.PayStatement.EmployerContribution.builder() - .amount(0L) - .attributes( - SandboxPaymentCreateParams.PayStatement.EmployerContribution - .Attributes - .builder() - .metadata( - SandboxPaymentCreateParams.PayStatement - .EmployerContribution - .Attributes - .Metadata - .builder() - .metadata( - SandboxPaymentCreateParams.PayStatement - .EmployerContribution - .Attributes - .Metadata - .InnerMetadata - .builder() - .putAdditionalProperty( - "foo", - JsonValue.from("bar"), - ) - .build() - ) - .build() - ) - .build() - ) - .currency("currency") - .name("name") - .type(BenefitType._401K) - .build() - ) - .grossPay(Money.builder().amount(0L).currency("currency").build()) - .individualId("b2338cfb-472f-4f72-9faa-e028c083144a") - .netPay(Money.builder().amount(0L).currency("currency").build()) - .paymentMethod(SandboxPaymentCreateParams.PayStatement.PaymentMethod.CHECK) - .addTax( - SandboxPaymentCreateParams.PayStatement.Tax.builder() - .amount(0L) - .attributes( - SandboxPaymentCreateParams.PayStatement.Tax.Attributes.builder() - .metadata( - SandboxPaymentCreateParams.PayStatement.Tax.Attributes - .Metadata - .builder() - .metadata( - SandboxPaymentCreateParams.PayStatement.Tax - .Attributes - .Metadata - .InnerMetadata - .builder() - .putAdditionalProperty( - "foo", - JsonValue.from("bar"), - ) - .build() - ) - .build() - ) - .build() - ) - .currency("currency") - .employer(true) - .name("name") - .type(SandboxPaymentCreateParams.PayStatement.Tax.Type.STATE) - .build() - ) - .totalHours(0.0) - .type(SandboxPaymentCreateParams.PayStatement.Type.REGULAR_PAYROLL) - .build() - ) + assertThat(body.payStatements().getOrNull()) + .containsExactly( + SandboxPaymentCreateParams.PayStatement.builder() + .addEarning( + SandboxPaymentCreateParams.PayStatement.Earning.builder() + .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.Earning.Attributes.builder() + .metadata( + SandboxPaymentCreateParams.PayStatement.Earning.Attributes + .Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement.Earning + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) + .build() + ) + .currency("currency") + .hours(0.0) + .name("name") + .type(SandboxPaymentCreateParams.PayStatement.Earning.Type.SALARY) + .build() + ) + .addEmployeeDeduction( + SandboxPaymentCreateParams.PayStatement.EmployeeDeduction.builder() + .amount(2000L) + .attributes( + SandboxPaymentCreateParams.PayStatement.EmployeeDeduction.Attributes + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement.EmployeeDeduction + .Attributes + .Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployeeDeduction + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) + .build() + ) + .currency("usd") + .name("401k test") + .preTax(true) + .type(BenefitType._401K) + .build() + ) + .addEmployerContribution( + SandboxPaymentCreateParams.PayStatement.EmployerContribution.builder() + .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.EmployerContribution + .Attributes + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement.EmployerContribution + .Attributes + .Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployerContribution + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) + .build() + ) + .currency("currency") + .name("name") + .type(BenefitType._401K) + .build() + ) + .grossPay(Money.builder().amount(0L).currency("currency").build()) + .individualId("b2338cfb-472f-4f72-9faa-e028c083144a") + .netPay(Money.builder().amount(0L).currency("currency").build()) + .paymentMethod(SandboxPaymentCreateParams.PayStatement.PaymentMethod.CHECK) + .addTax( + SandboxPaymentCreateParams.PayStatement.Tax.builder() + .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.Tax.Attributes.builder() + .metadata( + SandboxPaymentCreateParams.PayStatement.Tax.Attributes + .Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement.Tax + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) + .build() + ) + .currency("currency") + .employer(true) + .name("name") + .type(SandboxPaymentCreateParams.PayStatement.Tax.Type.STATE) + .build() + ) + .totalHours(0.0) + .type(SandboxPaymentCreateParams.PayStatement.Type.REGULAR_PAYROLL) + .build() ) assertThat(body.startDate()).contains("start_date") } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportedBenefitTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportedBenefitTest.kt index 46fa8e18..3e7b4c2c 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportedBenefitTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportedBenefitTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -23,13 +24,14 @@ internal class SupportedBenefitTest { assertThat(supportedBenefit).isNotNull assertThat(supportedBenefit.annualMaximum()).contains(true) assertThat(supportedBenefit.catchUp()).contains(true) - assertThat(supportedBenefit.companyContribution().get()) + assertThat(supportedBenefit.companyContribution().getOrNull()) .containsExactly(SupportedBenefit.CompanyContribution.FIXED) assertThat(supportedBenefit.description()).contains("description") - assertThat(supportedBenefit.employeeDeduction().get()) + assertThat(supportedBenefit.employeeDeduction().getOrNull()) .containsExactly(SupportedBenefit.EmployeeDeduction.FIXED) - assertThat(supportedBenefit.frequencies().get()).containsExactly(BenefitFrequency.ONE_TIME) - assertThat(supportedBenefit.hsaContributionLimit().get()) + assertThat(supportedBenefit.frequencies().getOrNull()) + .containsExactly(BenefitFrequency.ONE_TIME) + assertThat(supportedBenefit.hsaContributionLimit().getOrNull()) .containsExactly(SupportedBenefit.HsaContributionLimit.INDIVIDUAL) assertThat(supportedBenefit.type()).contains(BenefitType._401K) } From 35fd7864ce86a276116c74475f5654579f5fd7a2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 04:51:29 +0000 Subject: [PATCH 29/65] chore(internal): reformat some tests (#500) chore(internal): generate more tests --- .../api/models/AccountCreateResponseTest.kt | 4 +- .../api/models/AccountUpdateEventTest.kt | 1962 +++++++++++++++++ .../api/models/AccountUpdateResponseTest.kt | 4 +- .../api/models/AutomatedAsyncJobTest.kt | 4 +- .../api/models/AutomatedCreateResponseTest.kt | 4 +- .../api/models/AutomatedListResponseTest.kt | 4 +- .../api/models/BaseWebhookEventTest.kt | 4 +- .../api/models/BenefitContributionTest.kt | 4 +- .../BenefitFeaturesAndOperationsTest.kt | 4 +- .../api/models/BenefitsSupportTest.kt | 4 +- .../tryfinch/api/models/CompanyBenefitTest.kt | 4 +- .../tryfinch/api/models/CompanyEventTest.kt | 37 + .../com/tryfinch/api/models/CompanyTest.kt | 4 +- .../api/models/CompanyUpdateResponseTest.kt | 4 +- .../models/ConnectionCreateResponseTest.kt | 4 +- .../models/CreateAccessTokenResponseTest.kt | 4 +- .../CreateCompanyBenefitsResponseTest.kt | 4 +- .../tryfinch/api/models/DirectoryEventTest.kt | 28 + .../api/models/DisconnectResponseTest.kt | 4 +- .../api/models/DocumentListResponseTest.kt | 4 +- .../api/models/DocumentResponseTest.kt | 4 +- .../api/models/EmploymentDataResponseTest.kt | 4 +- .../tryfinch/api/models/EmploymentDataTest.kt | 4 +- .../api/models/EmploymentEventTest.kt | 29 + .../models/EmploymentUpdateResponseTest.kt | 4 +- .../api/models/EnrolledIndividualTest.kt | 4 +- .../com/tryfinch/api/models/IncomeTest.kt | 4 +- .../api/models/IndividualBenefitTest.kt | 4 +- .../IndividualEnrolledIdsResponseTest.kt | 4 +- .../api/models/IndividualEventTest.kt | 29 + .../api/models/IndividualInDirectoryTest.kt | 4 +- .../api/models/IndividualResponseTest.kt | 4 +- .../com/tryfinch/api/models/IndividualTest.kt | 4 +- .../models/IndividualUpdateResponseTest.kt | 4 +- .../tryfinch/api/models/IntrospectionTest.kt | 4 +- .../api/models/JobCompletionEventTest.kt | 29 + .../api/models/JobCreateResponseTest.kt | 4 +- .../com/tryfinch/api/models/LocationTest.kt | 4 +- .../tryfinch/api/models/ManualAsyncJobTest.kt | 4 +- .../com/tryfinch/api/models/MoneyTest.kt | 4 +- .../api/models/OperationSupportMatrixTest.kt | 4 +- .../com/tryfinch/api/models/PagingTest.kt | 4 +- .../api/models/PayGroupListResponseTest.kt | 4 +- .../models/PayGroupRetrieveResponseTest.kt | 4 +- .../api/models/PayStatementEventTest.kt | 39 + .../models/PayStatementResponseBodyTest.kt | 4 +- .../api/models/PayStatementResponseTest.kt | 4 +- .../tryfinch/api/models/PayStatementTest.kt | 4 +- .../api/models/PaymentCreateResponseTest.kt | 4 +- .../tryfinch/api/models/PaymentEventTest.kt | 38 + .../com/tryfinch/api/models/PaymentTest.kt | 4 +- .../com/tryfinch/api/models/ProviderTest.kt | 4 +- .../RequestForwardingForwardResponseTest.kt | 4 +- .../api/models/SandboxJobConfigurationTest.kt | 4 +- .../api/models/SessionNewResponseTest.kt | 4 +- .../SessionReauthenticateResponseTest.kt | 4 +- .../api/models/SupportPerBenefitTypeTest.kt | 4 +- .../api/models/SupportedBenefitTest.kt | 4 +- .../api/models/UnenrolledIndividualTest.kt | 4 +- .../UpdateCompanyBenefitResponseTest.kt | 4 +- .../com/tryfinch/api/models/W42005Test.kt | 4 +- .../com/tryfinch/api/models/W42020Test.kt | 4 +- 62 files changed, 2299 insertions(+), 108 deletions(-) create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateEventTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyEventTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/DirectoryEventTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentEventTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEventTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCompletionEventTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementEventTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentEventTest.kt diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountCreateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountCreateResponseTest.kt index 2fc74cd9..17d495cc 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountCreateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountCreateResponseTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class AccountCreateResponseTest { @Test - fun createAccountCreateResponse() { + fun create() { val accountCreateResponse = AccountCreateResponse.builder() .accessToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -19,7 +19,7 @@ internal class AccountCreateResponseTest { .addProduct("string") .providerId("provider_id") .build() - assertThat(accountCreateResponse).isNotNull + assertThat(accountCreateResponse.accessToken()) .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(accountCreateResponse.accountId()) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateEventTest.kt new file mode 100644 index 00000000..a9cf94ff --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateEventTest.kt @@ -0,0 +1,1962 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class AccountUpdateEventTest { + + @Test + fun create() { + val accountUpdateEvent = + AccountUpdateEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data( + AccountUpdateEvent.Data.builder() + .authenticationMethod( + AccountUpdateEvent.Data.AuthenticationMethod.builder() + .benefitsSupport( + BenefitsSupport.builder() + .commuter( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .customPostTax( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .customPreTax( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .fsaDependentCare( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .fsaMedical( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .hsaPost( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .hsaPre( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .s125Dental( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .s125Medical( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .s125Vision( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .simple( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .simpleIra( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .build() + ) + .supportedFields( + AccountUpdateEvent.Data.AuthenticationMethod.SupportedFields + .builder() + .company( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .builder() + .id(true) + .accounts( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Accounts + .builder() + .accountName(true) + .accountNumber(true) + .accountType(true) + .institutionName(true) + .routingNumber(true) + .build() + ) + .departments( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Departments + .builder() + .name(true) + .parent( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Departments + .Parent + .builder() + .name(true) + .build() + ) + .build() + ) + .ein(true) + .entity( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Entity + .builder() + .subtype(true) + .type(true) + .build() + ) + .legalName(true) + .locations( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Locations + .builder() + .city(true) + .country(true) + .line1(true) + .line2(true) + .postalCode(true) + .state(true) + .build() + ) + .primaryEmail(true) + .primaryPhoneNumber(true) + .build() + ) + .directory( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedDirectoryFields + .builder() + .individuals( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedDirectoryFields + .Individuals + .builder() + .id(true) + .department(true) + .firstName(true) + .isActive(true) + .lastName(true) + .manager( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedDirectoryFields + .Individuals + .Manager + .builder() + .id(true) + .build() + ) + .middleName(true) + .build() + ) + .paging( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedDirectoryFields + .Paging + .builder() + .count(true) + .offset(true) + .build() + ) + .build() + ) + .employment( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .builder() + .id(true) + .classCode(true) + .customFields(true) + .department( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Department + .builder() + .name(true) + .build() + ) + .employment( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Employment + .builder() + .subtype(true) + .type(true) + .build() + ) + .employmentStatus(true) + .endDate(true) + .firstName(true) + .income( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Income + .builder() + .amount(true) + .currency(true) + .unit(true) + .build() + ) + .incomeHistory(true) + .isActive(true) + .lastName(true) + .location( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Location + .builder() + .city(true) + .country(true) + .line1(true) + .line2(true) + .postalCode(true) + .state(true) + .build() + ) + .manager( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Manager + .builder() + .id(true) + .build() + ) + .middleName(true) + .startDate(true) + .title(true) + .build() + ) + .individual( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedIndividualFields + .builder() + .id(true) + .dob(true) + .emails( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedIndividualFields + .Emails + .builder() + .data(true) + .type(true) + .build() + ) + .encryptedSsn(true) + .ethnicity(true) + .firstName(true) + .gender(true) + .lastName(true) + .middleName(true) + .phoneNumbers( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedIndividualFields + .PhoneNumbers + .builder() + .data(true) + .type(true) + .build() + ) + .preferredName(true) + .residence( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedIndividualFields + .Residence + .builder() + .city(true) + .country(true) + .line1(true) + .line2(true) + .postalCode(true) + .state(true) + .build() + ) + .ssn(true) + .build() + ) + .payGroup( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayGroupFields + .builder() + .id(true) + .individualIds(true) + .name(true) + .payFrequencies(true) + .build() + ) + .payStatement( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .builder() + .paging( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .Paging + .builder() + .count(true) + .offset(true) + .build() + ) + .payStatements( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .builder() + .earnings( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .Earnings + .builder() + .amount(true) + .currency(true) + .name(true) + .type(true) + .build() + ) + .employeeDeductions( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .EmployeeDeductions + .builder() + .amount(true) + .currency(true) + .name(true) + .preTax(true) + .type(true) + .build() + ) + .employerContributions( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .EmployerContributions + .builder() + .amount(true) + .currency(true) + .name(true) + .build() + ) + .grossPay(true) + .individualId(true) + .netPay(true) + .paymentMethod(true) + .taxes( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .Taxes + .builder() + .amount(true) + .currency(true) + .employer(true) + .name(true) + .type(true) + .build() + ) + .totalHours(true) + .type(true) + .build() + ) + .build() + ) + .payment( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPaymentFields + .builder() + .id(true) + .companyDebit(true) + .debitDate(true) + .employeeTaxes(true) + .employerTaxes(true) + .grossPay(true) + .individualIds(true) + .netPay(true) + .payDate(true) + .payFrequencies(true) + .payGroupIds(true) + .payPeriod( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPaymentFields + .PayPeriod + .builder() + .endDate(true) + .startDate(true) + .build() + ) + .build() + ) + .build() + ) + .type(AccountUpdateEvent.Data.AuthenticationMethod.Type.ASSISTED) + .build() + ) + .status(ConnectionStatusType.PENDING) + .build() + ) + .eventType(AccountUpdateEvent.EventType.ACCOUNT_UPDATED) + .build() + + assertThat(accountUpdateEvent.accountId()).isEqualTo("account_id") + assertThat(accountUpdateEvent.companyId()).isEqualTo("company_id") + assertThat(accountUpdateEvent.connectionId()).contains("connection_id") + assertThat(accountUpdateEvent.data()) + .contains( + AccountUpdateEvent.Data.builder() + .authenticationMethod( + AccountUpdateEvent.Data.AuthenticationMethod.builder() + .benefitsSupport( + BenefitsSupport.builder() + .commuter( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .customPostTax( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .customPreTax( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .fsaDependentCare( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .fsaMedical( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .hsaPost( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .hsaPre( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .s125Dental( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .s125Medical( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .s125Vision( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .simple( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .simpleIra( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .build() + ) + .supportedFields( + AccountUpdateEvent.Data.AuthenticationMethod.SupportedFields + .builder() + .company( + AccountUpdateEvent.Data.AuthenticationMethod.SupportedFields + .SupportedCompanyFields + .builder() + .id(true) + .accounts( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Accounts + .builder() + .accountName(true) + .accountNumber(true) + .accountType(true) + .institutionName(true) + .routingNumber(true) + .build() + ) + .departments( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Departments + .builder() + .name(true) + .parent( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Departments + .Parent + .builder() + .name(true) + .build() + ) + .build() + ) + .ein(true) + .entity( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Entity + .builder() + .subtype(true) + .type(true) + .build() + ) + .legalName(true) + .locations( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Locations + .builder() + .city(true) + .country(true) + .line1(true) + .line2(true) + .postalCode(true) + .state(true) + .build() + ) + .primaryEmail(true) + .primaryPhoneNumber(true) + .build() + ) + .directory( + AccountUpdateEvent.Data.AuthenticationMethod.SupportedFields + .SupportedDirectoryFields + .builder() + .individuals( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedDirectoryFields + .Individuals + .builder() + .id(true) + .department(true) + .firstName(true) + .isActive(true) + .lastName(true) + .manager( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedDirectoryFields + .Individuals + .Manager + .builder() + .id(true) + .build() + ) + .middleName(true) + .build() + ) + .paging( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedDirectoryFields + .Paging + .builder() + .count(true) + .offset(true) + .build() + ) + .build() + ) + .employment( + AccountUpdateEvent.Data.AuthenticationMethod.SupportedFields + .SupportedEmploymentFields + .builder() + .id(true) + .classCode(true) + .customFields(true) + .department( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Department + .builder() + .name(true) + .build() + ) + .employment( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Employment + .builder() + .subtype(true) + .type(true) + .build() + ) + .employmentStatus(true) + .endDate(true) + .firstName(true) + .income( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Income + .builder() + .amount(true) + .currency(true) + .unit(true) + .build() + ) + .incomeHistory(true) + .isActive(true) + .lastName(true) + .location( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Location + .builder() + .city(true) + .country(true) + .line1(true) + .line2(true) + .postalCode(true) + .state(true) + .build() + ) + .manager( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Manager + .builder() + .id(true) + .build() + ) + .middleName(true) + .startDate(true) + .title(true) + .build() + ) + .individual( + AccountUpdateEvent.Data.AuthenticationMethod.SupportedFields + .SupportedIndividualFields + .builder() + .id(true) + .dob(true) + .emails( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedIndividualFields + .Emails + .builder() + .data(true) + .type(true) + .build() + ) + .encryptedSsn(true) + .ethnicity(true) + .firstName(true) + .gender(true) + .lastName(true) + .middleName(true) + .phoneNumbers( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedIndividualFields + .PhoneNumbers + .builder() + .data(true) + .type(true) + .build() + ) + .preferredName(true) + .residence( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedIndividualFields + .Residence + .builder() + .city(true) + .country(true) + .line1(true) + .line2(true) + .postalCode(true) + .state(true) + .build() + ) + .ssn(true) + .build() + ) + .payGroup( + AccountUpdateEvent.Data.AuthenticationMethod.SupportedFields + .SupportedPayGroupFields + .builder() + .id(true) + .individualIds(true) + .name(true) + .payFrequencies(true) + .build() + ) + .payStatement( + AccountUpdateEvent.Data.AuthenticationMethod.SupportedFields + .SupportedPayStatementFields + .builder() + .paging( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .Paging + .builder() + .count(true) + .offset(true) + .build() + ) + .payStatements( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .builder() + .earnings( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .Earnings + .builder() + .amount(true) + .currency(true) + .name(true) + .type(true) + .build() + ) + .employeeDeductions( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .EmployeeDeductions + .builder() + .amount(true) + .currency(true) + .name(true) + .preTax(true) + .type(true) + .build() + ) + .employerContributions( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .EmployerContributions + .builder() + .amount(true) + .currency(true) + .name(true) + .build() + ) + .grossPay(true) + .individualId(true) + .netPay(true) + .paymentMethod(true) + .taxes( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .Taxes + .builder() + .amount(true) + .currency(true) + .employer(true) + .name(true) + .type(true) + .build() + ) + .totalHours(true) + .type(true) + .build() + ) + .build() + ) + .payment( + AccountUpdateEvent.Data.AuthenticationMethod.SupportedFields + .SupportedPaymentFields + .builder() + .id(true) + .companyDebit(true) + .debitDate(true) + .employeeTaxes(true) + .employerTaxes(true) + .grossPay(true) + .individualIds(true) + .netPay(true) + .payDate(true) + .payFrequencies(true) + .payGroupIds(true) + .payPeriod( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPaymentFields + .PayPeriod + .builder() + .endDate(true) + .startDate(true) + .build() + ) + .build() + ) + .build() + ) + .type(AccountUpdateEvent.Data.AuthenticationMethod.Type.ASSISTED) + .build() + ) + .status(ConnectionStatusType.PENDING) + .build() + ) + assertThat(accountUpdateEvent.eventType()) + .contains(AccountUpdateEvent.EventType.ACCOUNT_UPDATED) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateResponseTest.kt index a8beec51..5c995ef4 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateResponseTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class AccountUpdateResponseTest { @Test - fun createAccountUpdateResponse() { + fun create() { val accountUpdateResponse = AccountUpdateResponse.builder() .accountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -18,7 +18,7 @@ internal class AccountUpdateResponseTest { .providerId("provider_id") .connectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() - assertThat(accountUpdateResponse).isNotNull + assertThat(accountUpdateResponse.accountId()) .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(accountUpdateResponse.authenticationType()) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedAsyncJobTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedAsyncJobTest.kt index 368b350b..938789c2 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedAsyncJobTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedAsyncJobTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class AutomatedAsyncJobTest { @Test - fun createAutomatedAsyncJob() { + fun create() { val automatedAsyncJob = AutomatedAsyncJob.builder() .completedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -22,7 +22,7 @@ internal class AutomatedAsyncJobTest { .status(AutomatedAsyncJob.Status.PENDING) .type(AutomatedAsyncJob.Type.DATA_SYNC_ALL) .build() - assertThat(automatedAsyncJob).isNotNull + assertThat(automatedAsyncJob.completedAt()) .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) assertThat(automatedAsyncJob.createdAt()) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedCreateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedCreateResponseTest.kt index faa62bb2..9a4d92e7 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedCreateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedCreateResponseTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class AutomatedCreateResponseTest { @Test - fun createAutomatedCreateResponse() { + fun create() { val automatedCreateResponse = AutomatedCreateResponse.builder() .allowedRefreshes(0L) @@ -16,7 +16,7 @@ internal class AutomatedCreateResponseTest { .jobUrl("job_url") .remainingRefreshes(0L) .build() - assertThat(automatedCreateResponse).isNotNull + assertThat(automatedCreateResponse.allowedRefreshes()).isEqualTo(0L) assertThat(automatedCreateResponse.jobId()) .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedListResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedListResponseTest.kt index c2a2a63a..373b7885 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedListResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedListResponseTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class AutomatedListResponseTest { @Test - fun createAutomatedListResponse() { + fun create() { val automatedListResponse = AutomatedListResponse.builder() .addData( @@ -42,7 +42,7 @@ internal class AutomatedListResponseTest { .build() ) .build() - assertThat(automatedListResponse).isNotNull + assertThat(automatedListResponse.data()) .containsExactly( AutomatedAsyncJob.builder() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BaseWebhookEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BaseWebhookEventTest.kt index 1696ad05..6fca4419 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BaseWebhookEventTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BaseWebhookEventTest.kt @@ -8,14 +8,14 @@ import org.junit.jupiter.api.Test internal class BaseWebhookEventTest { @Test - fun createBaseWebhookEvent() { + fun create() { val baseWebhookEvent = BaseWebhookEvent.builder() .accountId("account_id") .companyId("company_id") .connectionId("connection_id") .build() - assertThat(baseWebhookEvent).isNotNull + assertThat(baseWebhookEvent.accountId()).isEqualTo("account_id") assertThat(baseWebhookEvent.companyId()).isEqualTo("company_id") assertThat(baseWebhookEvent.connectionId()).contains("connection_id") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitContributionTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitContributionTest.kt index 10a46665..750d9524 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitContributionTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitContributionTest.kt @@ -8,10 +8,10 @@ import org.junit.jupiter.api.Test internal class BenefitContributionTest { @Test - fun createBenefitContribution() { + fun create() { val benefitContribution = BenefitContribution.builder().amount(0L).type(BenefitContribution.Type.FIXED).build() - assertThat(benefitContribution).isNotNull + assertThat(benefitContribution.amount()).contains(0L) assertThat(benefitContribution.type()).contains(BenefitContribution.Type.FIXED) } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperationsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperationsTest.kt index 5b1a21ee..ed103e7f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperationsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperationsTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class BenefitFeaturesAndOperationsTest { @Test - fun createBenefitFeaturesAndOperations() { + fun create() { val benefitFeaturesAndOperations = BenefitFeaturesAndOperations.builder() .supportedFeatures( @@ -50,7 +50,7 @@ internal class BenefitFeaturesAndOperationsTest { .build() ) .build() - assertThat(benefitFeaturesAndOperations).isNotNull + assertThat(benefitFeaturesAndOperations.supportedFeatures()) .contains( BenefitFeaturesAndOperations.BenefitFeature.builder() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitsSupportTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitsSupportTest.kt index ba9f3c4e..971be921 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitsSupportTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitsSupportTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class BenefitsSupportTest { @Test - fun createBenefitsSupport() { + fun create() { val benefitsSupport = BenefitsSupport.builder() .commuter( @@ -540,7 +540,7 @@ internal class BenefitsSupportTest { .build() ) .build() - assertThat(benefitsSupport).isNotNull + assertThat(benefitsSupport.commuter()) .contains( BenefitFeaturesAndOperations.builder() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyBenefitTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyBenefitTest.kt index 60c2bb07..5f0b3f8a 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyBenefitTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyBenefitTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class CompanyBenefitTest { @Test - fun createCompanyBenefit() { + fun create() { val companyBenefit = CompanyBenefit.builder() .benefitId("benefit_id") @@ -16,7 +16,7 @@ internal class CompanyBenefitTest { .frequency(BenefitFrequency.ONE_TIME) .type(BenefitType._401K) .build() - assertThat(companyBenefit).isNotNull + assertThat(companyBenefit.benefitId()).isEqualTo("benefit_id") assertThat(companyBenefit.description()).contains("description") assertThat(companyBenefit.frequency()).contains(BenefitFrequency.ONE_TIME) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyEventTest.kt new file mode 100644 index 00000000..8ce177bd --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyEventTest.kt @@ -0,0 +1,37 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.core.JsonValue +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class CompanyEventTest { + + @Test + fun create() { + val companyEvent = + CompanyEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data( + CompanyEvent.Data.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .eventType(CompanyEvent.EventType.COMPANY_UPDATED) + .build() + + assertThat(companyEvent.accountId()).isEqualTo("account_id") + assertThat(companyEvent.companyId()).isEqualTo("company_id") + assertThat(companyEvent.connectionId()).contains("connection_id") + assertThat(companyEvent.data()) + .contains( + CompanyEvent.Data.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + assertThat(companyEvent.eventType()).contains(CompanyEvent.EventType.COMPANY_UPDATED) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt index 29f89cba..b6f8b419 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class CompanyTest { @Test - fun createCompany() { + fun create() { val company = Company.builder() .id("id") @@ -51,7 +51,7 @@ internal class CompanyTest { .primaryEmail("primary_email") .primaryPhoneNumber("primary_phone_number") .build() - assertThat(company).isNotNull + assertThat(company.id()).isEqualTo("id") assertThat(company.accounts().getOrNull()) .containsExactly( diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt index e6852aee..a50c0da3 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class CompanyUpdateResponseTest { @Test - fun createCompanyUpdateResponse() { + fun create() { val companyUpdateResponse = CompanyUpdateResponse.builder() .addAccount( @@ -52,7 +52,7 @@ internal class CompanyUpdateResponseTest { .primaryEmail("primary_email") .primaryPhoneNumber("primary_phone_number") .build() - assertThat(companyUpdateResponse).isNotNull + assertThat(companyUpdateResponse.accounts().getOrNull()) .containsExactly( CompanyUpdateResponse.Account.builder() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectionCreateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectionCreateResponseTest.kt index 9fe69a6a..08ad6fa6 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectionCreateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectionCreateResponseTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class ConnectionCreateResponseTest { @Test - fun createConnectionCreateResponse() { + fun create() { val connectionCreateResponse = ConnectionCreateResponse.builder() .accessToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -20,7 +20,7 @@ internal class ConnectionCreateResponseTest { .providerId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .tokenType("token_type") .build() - assertThat(connectionCreateResponse).isNotNull + assertThat(connectionCreateResponse.accessToken()) .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(connectionCreateResponse.accountId()) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateAccessTokenResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateAccessTokenResponseTest.kt index 68f5c769..ef1a0e1f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateAccessTokenResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateAccessTokenResponseTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class CreateAccessTokenResponseTest { @Test - fun createCreateAccessTokenResponse() { + fun create() { val createAccessTokenResponse = CreateAccessTokenResponse.builder() .accessToken("access_token") @@ -22,7 +22,7 @@ internal class CreateAccessTokenResponseTest { .customerId("customer_id") .tokenType("token_type") .build() - assertThat(createAccessTokenResponse).isNotNull + assertThat(createAccessTokenResponse.accessToken()).isEqualTo("access_token") assertThat(createAccessTokenResponse.accountId()).isEqualTo("account_id") assertThat(createAccessTokenResponse.clientType()) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponseTest.kt index 6bb14863..e6c41cd2 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponseTest.kt @@ -8,10 +8,10 @@ import org.junit.jupiter.api.Test internal class CreateCompanyBenefitsResponseTest { @Test - fun createCreateCompanyBenefitsResponse() { + fun create() { val createCompanyBenefitsResponse = CreateCompanyBenefitsResponse.builder().benefitId("benefit_id").build() - assertThat(createCompanyBenefitsResponse).isNotNull + assertThat(createCompanyBenefitsResponse.benefitId()).isEqualTo("benefit_id") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DirectoryEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DirectoryEventTest.kt new file mode 100644 index 00000000..6ef9f998 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DirectoryEventTest.kt @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class DirectoryEventTest { + + @Test + fun create() { + val directoryEvent = + DirectoryEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data(DirectoryEvent.Data.builder().individualId("individual_id").build()) + .eventType(DirectoryEvent.EventType.DIRECTORY_CREATED) + .build() + + assertThat(directoryEvent.accountId()).isEqualTo("account_id") + assertThat(directoryEvent.companyId()).isEqualTo("company_id") + assertThat(directoryEvent.connectionId()).contains("connection_id") + assertThat(directoryEvent.data()) + .contains(DirectoryEvent.Data.builder().individualId("individual_id").build()) + assertThat(directoryEvent.eventType()).contains(DirectoryEvent.EventType.DIRECTORY_CREATED) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DisconnectResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DisconnectResponseTest.kt index b735757c..5b3f5b72 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DisconnectResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DisconnectResponseTest.kt @@ -8,9 +8,9 @@ import org.junit.jupiter.api.Test internal class DisconnectResponseTest { @Test - fun createDisconnectResponse() { + fun create() { val disconnectResponse = DisconnectResponse.builder().status("status").build() - assertThat(disconnectResponse).isNotNull + assertThat(disconnectResponse.status()).isEqualTo("status") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentListResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentListResponseTest.kt index 9cb20901..adbb5048 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentListResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentListResponseTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class DocumentListResponseTest { @Test - fun createDocumentListResponse() { + fun create() { val documentListResponse = DocumentListResponse.builder() .addDocument( @@ -22,7 +22,7 @@ internal class DocumentListResponseTest { ) .paging(Paging.builder().count(0L).offset(0L).build()) .build() - assertThat(documentListResponse).isNotNull + assertThat(documentListResponse.documents()) .containsExactly( DocumentResponse.builder() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentResponseTest.kt index 41a63977..f2221be1 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentResponseTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class DocumentResponseTest { @Test - fun createDocumentResponse() { + fun create() { val documentResponse = DocumentResponse.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -17,7 +17,7 @@ internal class DocumentResponseTest { .url("https://example.com") .year(0.0) .build() - assertThat(documentResponse).isNotNull + assertThat(documentResponse.id()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(documentResponse.individualId()).contains("individual_id") assertThat(documentResponse.type()).contains(DocumentResponse.Type.W4_2020) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataResponseTest.kt index 09e2d08f..d56cf7fb 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataResponseTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class EmploymentDataResponseTest { @Test - fun createEmploymentDataResponse() { + fun create() { val employmentDataResponse = EmploymentDataResponse.builder() .body( @@ -74,7 +74,7 @@ internal class EmploymentDataResponseTest { .code(0L) .individualId("individual_id") .build() - assertThat(employmentDataResponse).isNotNull + assertThat(employmentDataResponse.body()) .contains( EmploymentData.builder() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt index 0d6c2e40..12543a92 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test internal class EmploymentDataTest { @Test - fun createEmploymentData() { + fun create() { val employmentData = EmploymentData.builder() .id("id") @@ -69,7 +69,7 @@ internal class EmploymentDataTest { .title("title") .workId("work_id") .build() - assertThat(employmentData).isNotNull + assertThat(employmentData.id()).contains("id") assertThat(employmentData.classCode()).contains("class_code") assertThat(employmentData.customFields().getOrNull()) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentEventTest.kt new file mode 100644 index 00000000..26201cbe --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentEventTest.kt @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class EmploymentEventTest { + + @Test + fun create() { + val employmentEvent = + EmploymentEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data(EmploymentEvent.Data.builder().individualId("individual_id").build()) + .eventType(EmploymentEvent.EventType.EMPLOYMENT_CREATED) + .build() + + assertThat(employmentEvent.accountId()).isEqualTo("account_id") + assertThat(employmentEvent.companyId()).isEqualTo("company_id") + assertThat(employmentEvent.connectionId()).contains("connection_id") + assertThat(employmentEvent.data()) + .contains(EmploymentEvent.Data.builder().individualId("individual_id").build()) + assertThat(employmentEvent.eventType()) + .contains(EmploymentEvent.EventType.EMPLOYMENT_CREATED) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt index 2e8ceb24..4fe464e0 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test internal class EmploymentUpdateResponseTest { @Test - fun createEmploymentUpdateResponse() { + fun create() { val employmentUpdateResponse = EmploymentUpdateResponse.builder() .id("id") @@ -68,7 +68,7 @@ internal class EmploymentUpdateResponseTest { .startDate("start_date") .title("title") .build() - assertThat(employmentUpdateResponse).isNotNull + assertThat(employmentUpdateResponse.id()).contains("id") assertThat(employmentUpdateResponse.classCode()).contains("class_code") assertThat(employmentUpdateResponse.customFields().getOrNull()) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EnrolledIndividualTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EnrolledIndividualTest.kt index 164ad62c..3fb9235f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EnrolledIndividualTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EnrolledIndividualTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class EnrolledIndividualTest { @Test - fun createEnrolledIndividual() { + fun create() { val enrolledIndividual = EnrolledIndividual.builder() .body( @@ -21,7 +21,7 @@ internal class EnrolledIndividualTest { .code(EnrolledIndividual.Code.OK) .individualId("individual_id") .build() - assertThat(enrolledIndividual).isNotNull + assertThat(enrolledIndividual.body()) .contains( EnrolledIndividual.Body.builder() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IncomeTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IncomeTest.kt index 234b5bdc..b6e3ef05 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IncomeTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IncomeTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class IncomeTest { @Test - fun createIncome() { + fun create() { val income = Income.builder() .amount(0L) @@ -16,7 +16,7 @@ internal class IncomeTest { .effectiveDate("effective_date") .unit(Income.Unit.YEARLY) .build() - assertThat(income).isNotNull + assertThat(income.amount()).contains(0L) assertThat(income.currency()).contains("currency") assertThat(income.effectiveDate()).contains("effective_date") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualBenefitTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualBenefitTest.kt index 65e14994..1f503b39 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualBenefitTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualBenefitTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class IndividualBenefitTest { @Test - fun createIndividualBenefit() { + fun create() { val individualBenefit = IndividualBenefit.builder() .body( @@ -35,7 +35,7 @@ internal class IndividualBenefitTest { .code(0L) .individualId("individual_id") .build() - assertThat(individualBenefit).isNotNull + assertThat(individualBenefit.body()) .contains( IndividualBenefit.Body.builder() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponseTest.kt index a1bb5e48..72e68b7e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponseTest.kt @@ -8,13 +8,13 @@ import org.junit.jupiter.api.Test internal class IndividualEnrolledIdsResponseTest { @Test - fun createIndividualEnrolledIdsResponse() { + fun create() { val individualEnrolledIdsResponse = IndividualEnrolledIdsResponse.builder() .benefitId("benefit_id") .addIndividualId("string") .build() - assertThat(individualEnrolledIdsResponse).isNotNull + assertThat(individualEnrolledIdsResponse.benefitId()).isEqualTo("benefit_id") assertThat(individualEnrolledIdsResponse.individualIds()).containsExactly("string") } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEventTest.kt new file mode 100644 index 00000000..9ce7e42e --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEventTest.kt @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class IndividualEventTest { + + @Test + fun create() { + val individualEvent = + IndividualEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data(IndividualEvent.Data.builder().individualId("individual_id").build()) + .eventType(IndividualEvent.EventType.INDIVIDUAL_CREATED) + .build() + + assertThat(individualEvent.accountId()).isEqualTo("account_id") + assertThat(individualEvent.companyId()).isEqualTo("company_id") + assertThat(individualEvent.connectionId()).contains("connection_id") + assertThat(individualEvent.data()) + .contains(IndividualEvent.Data.builder().individualId("individual_id").build()) + assertThat(individualEvent.eventType()) + .contains(IndividualEvent.EventType.INDIVIDUAL_CREATED) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualInDirectoryTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualInDirectoryTest.kt index 7c7a2c0b..406378a5 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualInDirectoryTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualInDirectoryTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class IndividualInDirectoryTest { @Test - fun createIndividualInDirectory() { + fun create() { val individualInDirectory = IndividualInDirectory.builder() .id("id") @@ -19,7 +19,7 @@ internal class IndividualInDirectoryTest { .manager(IndividualInDirectory.Manager.builder().id("id").build()) .middleName("middle_name") .build() - assertThat(individualInDirectory).isNotNull + assertThat(individualInDirectory.id()).contains("id") assertThat(individualInDirectory.department()) .contains(IndividualInDirectory.Department.builder().name("name").build()) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualResponseTest.kt index 47c09bce..b489d6a4 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualResponseTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class IndividualResponseTest { @Test - fun createIndividualResponse() { + fun create() { val individualResponse = IndividualResponse.builder() .body( @@ -52,7 +52,7 @@ internal class IndividualResponseTest { .code(0L) .individualId("individual_id") .build() - assertThat(individualResponse).isNotNull + assertThat(individualResponse.body()) .contains( Individual.builder() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt index 382f06c8..54f13cdc 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class IndividualTest { @Test - fun createIndividual() { + fun create() { val individual = Individual.builder() .id("id") @@ -44,7 +44,7 @@ internal class IndividualTest { ) .ssn("ssn") .build() - assertThat(individual).isNotNull + assertThat(individual.id()).contains("id") assertThat(individual.dob()).contains("dob") assertThat(individual.emails().getOrNull()) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt index b28fa5ab..1e3e3326 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class IndividualUpdateResponseTest { @Test - fun createIndividualUpdateResponse() { + fun create() { val individualUpdateResponse = IndividualUpdateResponse.builder() .id("id") @@ -47,7 +47,7 @@ internal class IndividualUpdateResponseTest { ) .ssn("ssn") .build() - assertThat(individualUpdateResponse).isNotNull + assertThat(individualUpdateResponse.id()).contains("id") assertThat(individualUpdateResponse.dob()).contains("dob") assertThat(individualUpdateResponse.emails().getOrNull()) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IntrospectionTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IntrospectionTest.kt index d963baf9..565c16f8 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IntrospectionTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IntrospectionTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class IntrospectionTest { @Test - fun createIntrospection() { + fun create() { val introspection = Introspection.builder() .accountId("account_id") @@ -44,7 +44,7 @@ internal class IntrospectionTest { .providerId("provider_id") .username("username") .build() - assertThat(introspection).isNotNull + assertThat(introspection.accountId()).isEqualTo("account_id") assertThat(introspection.authenticationMethods()) .containsExactly( diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCompletionEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCompletionEventTest.kt new file mode 100644 index 00000000..fc05d74d --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCompletionEventTest.kt @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class JobCompletionEventTest { + + @Test + fun create() { + val jobCompletionEvent = + JobCompletionEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data(JobCompletionEvent.Data.builder().jobId("job_id").jobUrl("job_url").build()) + .eventType(JobCompletionEvent.EventType.JOB_BENEFIT_CREATE_COMPLETED) + .build() + + assertThat(jobCompletionEvent.accountId()).isEqualTo("account_id") + assertThat(jobCompletionEvent.companyId()).isEqualTo("company_id") + assertThat(jobCompletionEvent.connectionId()).contains("connection_id") + assertThat(jobCompletionEvent.data()) + .contains(JobCompletionEvent.Data.builder().jobId("job_id").jobUrl("job_url").build()) + assertThat(jobCompletionEvent.eventType()) + .contains(JobCompletionEvent.EventType.JOB_BENEFIT_CREATE_COMPLETED) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCreateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCreateResponseTest.kt index 5160cdf2..83b9738b 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCreateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCreateResponseTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class JobCreateResponseTest { @Test - fun createJobCreateResponse() { + fun create() { val jobCreateResponse = JobCreateResponse.builder() .allowedRefreshes(0L) @@ -16,7 +16,7 @@ internal class JobCreateResponseTest { .jobUrl("job_url") .remainingRefreshes(0L) .build() - assertThat(jobCreateResponse).isNotNull + assertThat(jobCreateResponse.allowedRefreshes()).isEqualTo(0L) assertThat(jobCreateResponse.jobId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(jobCreateResponse.jobUrl()).isEqualTo("job_url") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/LocationTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/LocationTest.kt index ae70caf7..42c76813 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/LocationTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/LocationTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class LocationTest { @Test - fun createLocation() { + fun create() { val location = Location.builder() .city("city") @@ -20,7 +20,7 @@ internal class LocationTest { .sourceId("source_id") .state("state") .build() - assertThat(location).isNotNull + assertThat(location.city()).contains("city") assertThat(location.country()).contains("country") assertThat(location.line1()).contains("line1") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ManualAsyncJobTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ManualAsyncJobTest.kt index cc7b2a21..c3f16435 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ManualAsyncJobTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ManualAsyncJobTest.kt @@ -10,14 +10,14 @@ import org.junit.jupiter.api.Test internal class ManualAsyncJobTest { @Test - fun createManualAsyncJob() { + fun create() { val manualAsyncJob = ManualAsyncJob.builder() .addBody(JsonValue.from(mapOf())) .jobId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .status(ManualAsyncJob.Status.PENDING) .build() - assertThat(manualAsyncJob).isNotNull + assertThat(manualAsyncJob.body().getOrNull()) .containsExactly(JsonValue.from(mapOf())) assertThat(manualAsyncJob.jobId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/MoneyTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/MoneyTest.kt index 6b2bfbd1..28a22dda 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/MoneyTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/MoneyTest.kt @@ -8,9 +8,9 @@ import org.junit.jupiter.api.Test internal class MoneyTest { @Test - fun createMoney() { + fun create() { val money = Money.builder().amount(0L).currency("currency").build() - assertThat(money).isNotNull + assertThat(money.amount()).contains(0L) assertThat(money.currency()).contains("currency") } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/OperationSupportMatrixTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/OperationSupportMatrixTest.kt index 19c90b35..0d315300 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/OperationSupportMatrixTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/OperationSupportMatrixTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class OperationSupportMatrixTest { @Test - fun createOperationSupportMatrix() { + fun create() { val operationSupportMatrix = OperationSupportMatrix.builder() .create(OperationSupport.SUPPORTED) @@ -16,7 +16,7 @@ internal class OperationSupportMatrixTest { .read(OperationSupport.SUPPORTED) .update(OperationSupport.SUPPORTED) .build() - assertThat(operationSupportMatrix).isNotNull + assertThat(operationSupportMatrix.create()).contains(OperationSupport.SUPPORTED) assertThat(operationSupportMatrix.delete()).contains(OperationSupport.SUPPORTED) assertThat(operationSupportMatrix.read()).contains(OperationSupport.SUPPORTED) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PagingTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PagingTest.kt index 1a5c2b60..3ca471bf 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PagingTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PagingTest.kt @@ -8,9 +8,9 @@ import org.junit.jupiter.api.Test internal class PagingTest { @Test - fun createPaging() { + fun create() { val paging = Paging.builder().count(0L).offset(0L).build() - assertThat(paging).isNotNull + assertThat(paging.count()).contains(0L) assertThat(paging.offset()).contains(0L) } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt index a24394ea..cdcb40ce 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt @@ -9,14 +9,14 @@ import org.junit.jupiter.api.Test internal class PayGroupListResponseTest { @Test - fun createPayGroupListResponse() { + fun create() { val payGroupListResponse = PayGroupListResponse.builder() .id("id") .name("name") .addPayFrequency(PayGroupListResponse.PayFrequency.ANNUALLY) .build() - assertThat(payGroupListResponse).isNotNull + assertThat(payGroupListResponse.id()).contains("id") assertThat(payGroupListResponse.name()).contains("name") assertThat(payGroupListResponse.payFrequencies().getOrNull()) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponseTest.kt index 421db3e7..a4d2281a 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponseTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class PayGroupRetrieveResponseTest { @Test - fun createPayGroupRetrieveResponse() { + fun create() { val payGroupRetrieveResponse = PayGroupRetrieveResponse.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -16,7 +16,7 @@ internal class PayGroupRetrieveResponseTest { .name("name") .addPayFrequency(PayGroupRetrieveResponse.PayFrequency.ANNUALLY) .build() - assertThat(payGroupRetrieveResponse).isNotNull + assertThat(payGroupRetrieveResponse.id()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(payGroupRetrieveResponse.individualIds()) .containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementEventTest.kt new file mode 100644 index 00000000..d1757e76 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementEventTest.kt @@ -0,0 +1,39 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class PayStatementEventTest { + + @Test + fun create() { + val payStatementEvent = + PayStatementEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data( + PayStatementEvent.Data.builder() + .individualId("individual_id") + .paymentId("payment_id") + .build() + ) + .eventType(PayStatementEvent.EventType.PAY_STATEMENT_CREATED) + .build() + + assertThat(payStatementEvent.accountId()).isEqualTo("account_id") + assertThat(payStatementEvent.companyId()).isEqualTo("company_id") + assertThat(payStatementEvent.connectionId()).contains("connection_id") + assertThat(payStatementEvent.data()) + .contains( + PayStatementEvent.Data.builder() + .individualId("individual_id") + .paymentId("payment_id") + .build() + ) + assertThat(payStatementEvent.eventType()) + .contains(PayStatementEvent.EventType.PAY_STATEMENT_CREATED) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt index ada41b9f..809d998b 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test internal class PayStatementResponseBodyTest { @Test - fun createPayStatementResponseBody() { + fun create() { val payStatementResponseBody = PayStatementResponseBody.builder() .paging(Paging.builder().count(0L).offset(0L).build()) @@ -136,7 +136,7 @@ internal class PayStatementResponseBodyTest { .build() ) .build() - assertThat(payStatementResponseBody).isNotNull + assertThat(payStatementResponseBody.paging()) .contains(Paging.builder().count(0L).offset(0L).build()) assertThat(payStatementResponseBody.payStatements().getOrNull()) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt index c4d15a04..cfcf4a11 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class PayStatementResponseTest { @Test - fun createPayStatementResponse() { + fun create() { val payStatementResponse = PayStatementResponse.builder() .body( @@ -146,7 +146,7 @@ internal class PayStatementResponseTest { .code(0L) .paymentId("payment_id") .build() - assertThat(payStatementResponse).isNotNull + assertThat(payStatementResponse.body()) .contains( PayStatementResponseBody.builder() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt index fd07027a..634aa710 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test internal class PayStatementTest { @Test - fun createPayStatement() { + fun create() { val payStatement = PayStatement.builder() .addEarning( @@ -113,7 +113,7 @@ internal class PayStatementTest { .totalHours(0.0) .type(PayStatement.Type.REGULAR_PAYROLL) .build() - assertThat(payStatement).isNotNull + assertThat(payStatement.earnings().getOrNull()) .containsExactly( PayStatement.Earning.builder() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentCreateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentCreateResponseTest.kt index cff66940..54f50224 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentCreateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentCreateResponseTest.kt @@ -8,10 +8,10 @@ import org.junit.jupiter.api.Test internal class PaymentCreateResponseTest { @Test - fun createPaymentCreateResponse() { + fun create() { val paymentCreateResponse = PaymentCreateResponse.builder().payDate("pay_date").paymentId("payment_id").build() - assertThat(paymentCreateResponse).isNotNull + assertThat(paymentCreateResponse.payDate()).isEqualTo("pay_date") assertThat(paymentCreateResponse.paymentId()).isEqualTo("payment_id") } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentEventTest.kt new file mode 100644 index 00000000..e31f2bdd --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentEventTest.kt @@ -0,0 +1,38 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class PaymentEventTest { + + @Test + fun create() { + val paymentEvent = + PaymentEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data( + PaymentEvent.PaymentIdentifiers.builder() + .payDate("pay_date") + .paymentId("payment_id") + .build() + ) + .eventType(PaymentEvent.EventType.PAYMENT_CREATED) + .build() + + assertThat(paymentEvent.accountId()).isEqualTo("account_id") + assertThat(paymentEvent.companyId()).isEqualTo("company_id") + assertThat(paymentEvent.connectionId()).contains("connection_id") + assertThat(paymentEvent.data()) + .contains( + PaymentEvent.PaymentIdentifiers.builder() + .payDate("pay_date") + .paymentId("payment_id") + .build() + ) + assertThat(paymentEvent.eventType()).contains(PaymentEvent.EventType.PAYMENT_CREATED) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt index 147cbebc..9e8f2f19 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class PaymentTest { @Test - fun createPayment() { + fun create() { val payment = Payment.builder() .id("id") @@ -27,7 +27,7 @@ internal class PaymentTest { Payment.PayPeriod.builder().endDate("end_date").startDate("start_date").build() ) .build() - assertThat(payment).isNotNull + assertThat(payment.id()).contains("id") assertThat(payment.companyDebit()) .contains(Money.builder().amount(0L).currency("currency").build()) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderTest.kt index 3537065e..4cc0899c 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class ProviderTest { @Test - fun createProvider() { + fun create() { val provider = Provider.builder() .id("id") @@ -924,7 +924,7 @@ internal class ProviderTest { .primaryColor("primary_color") .addProduct("string") .build() - assertThat(provider).isNotNull + assertThat(provider.id()).contains("id") assertThat(provider.authenticationMethods().getOrNull()) .containsExactly( diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponseTest.kt index 8717def5..03b941d9 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponseTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class RequestForwardingForwardResponseTest { @Test - fun createRequestForwardingForwardResponse() { + fun create() { val requestForwardingForwardResponse = RequestForwardingForwardResponse.builder() .data("data") @@ -25,7 +25,7 @@ internal class RequestForwardingForwardResponseTest { ) .statusCode(0L) .build() - assertThat(requestForwardingForwardResponse).isNotNull + assertThat(requestForwardingForwardResponse.data()).contains("data") assertThat(requestForwardingForwardResponse._headers()) .isEqualTo(JsonValue.from(mapOf())) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationTest.kt index f379a2d7..ea55104f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationTest.kt @@ -8,13 +8,13 @@ import org.junit.jupiter.api.Test internal class SandboxJobConfigurationTest { @Test - fun createSandboxJobConfiguration() { + fun create() { val sandboxJobConfiguration = SandboxJobConfiguration.builder() .completionStatus(SandboxJobConfiguration.CompletionStatus.COMPLETE) .type(SandboxJobConfiguration.Type.DATA_SYNC_ALL) .build() - assertThat(sandboxJobConfiguration).isNotNull + assertThat(sandboxJobConfiguration.completionStatus()) .isEqualTo(SandboxJobConfiguration.CompletionStatus.COMPLETE) assertThat(sandboxJobConfiguration.type()) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionNewResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionNewResponseTest.kt index c0d2af8a..487e6726 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionNewResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionNewResponseTest.kt @@ -8,13 +8,13 @@ import org.junit.jupiter.api.Test internal class SessionNewResponseTest { @Test - fun createSessionNewResponse() { + fun create() { val sessionNewResponse = SessionNewResponse.builder() .connectUrl("https://example.com") .sessionId("session_id") .build() - assertThat(sessionNewResponse).isNotNull + assertThat(sessionNewResponse.connectUrl()).isEqualTo("https://example.com") assertThat(sessionNewResponse.sessionId()).isEqualTo("session_id") } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionReauthenticateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionReauthenticateResponseTest.kt index f431c7d5..43bed076 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionReauthenticateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionReauthenticateResponseTest.kt @@ -8,13 +8,13 @@ import org.junit.jupiter.api.Test internal class SessionReauthenticateResponseTest { @Test - fun createSessionReauthenticateResponse() { + fun create() { val sessionReauthenticateResponse = SessionReauthenticateResponse.builder() .connectUrl("https://example.com") .sessionId("session_id") .build() - assertThat(sessionReauthenticateResponse).isNotNull + assertThat(sessionReauthenticateResponse.connectUrl()).isEqualTo("https://example.com") assertThat(sessionReauthenticateResponse.sessionId()).isEqualTo("session_id") } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportPerBenefitTypeTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportPerBenefitTypeTest.kt index 67030736..444ea4dc 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportPerBenefitTypeTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportPerBenefitTypeTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class SupportPerBenefitTypeTest { @Test - fun createSupportPerBenefitType() { + fun create() { val supportPerBenefitType = SupportPerBenefitType.builder() .companyBenefits( @@ -28,7 +28,7 @@ internal class SupportPerBenefitTypeTest { .build() ) .build() - assertThat(supportPerBenefitType).isNotNull + assertThat(supportPerBenefitType.companyBenefits()) .contains( OperationSupportMatrix.builder() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportedBenefitTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportedBenefitTest.kt index 3e7b4c2c..20e1afa9 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportedBenefitTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportedBenefitTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test internal class SupportedBenefitTest { @Test - fun createSupportedBenefit() { + fun create() { val supportedBenefit = SupportedBenefit.builder() .annualMaximum(true) @@ -21,7 +21,7 @@ internal class SupportedBenefitTest { .addHsaContributionLimit(SupportedBenefit.HsaContributionLimit.INDIVIDUAL) .type(BenefitType._401K) .build() - assertThat(supportedBenefit).isNotNull + assertThat(supportedBenefit.annualMaximum()).contains(true) assertThat(supportedBenefit.catchUp()).contains(true) assertThat(supportedBenefit.companyContribution().getOrNull()) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt index 916656cb..634682aa 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class UnenrolledIndividualTest { @Test - fun createUnenrolledIndividual() { + fun create() { val unenrolledIndividual = UnenrolledIndividual.builder() .body( @@ -21,7 +21,7 @@ internal class UnenrolledIndividualTest { .code(0L) .individualId("individual_id") .build() - assertThat(unenrolledIndividual).isNotNull + assertThat(unenrolledIndividual.body()) .contains( UnenrolledIndividual.Body.builder() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponseTest.kt index 680ac49c..7d5ddc90 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponseTest.kt @@ -8,10 +8,10 @@ import org.junit.jupiter.api.Test internal class UpdateCompanyBenefitResponseTest { @Test - fun createUpdateCompanyBenefitResponse() { + fun create() { val updateCompanyBenefitResponse = UpdateCompanyBenefitResponse.builder().benefitId("benefit_id").build() - assertThat(updateCompanyBenefitResponse).isNotNull + assertThat(updateCompanyBenefitResponse.benefitId()).isEqualTo("benefit_id") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42005Test.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42005Test.kt index 48fda83e..6de89a3f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42005Test.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42005Test.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class W42005Test { @Test - fun createW42005() { + fun create() { val w42005 = W42005.builder() .data( @@ -23,7 +23,7 @@ internal class W42005Test { .type(W42005.Type.W4_2005) .year(0.0) .build() - assertThat(w42005).isNotNull + assertThat(w42005.data()) .contains( W42005.Data.builder() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42020Test.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42020Test.kt index d2475cf0..a2dc0ff4 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42020Test.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42020Test.kt @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test internal class W42020Test { @Test - fun createW42020() { + fun create() { val w42020 = W42020.builder() .data( @@ -26,7 +26,7 @@ internal class W42020Test { .type(W42020.Type.W4_2020) .year(0.0) .build() - assertThat(w42020).isNotNull + assertThat(w42020.data()) .contains( W42020.Data.builder() From 4aff4981754d9336e20b29713c5b95a03819dfec Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 04:59:54 +0000 Subject: [PATCH 30/65] chore(internal): add some tests for union classes (#501) --- .../models/DocumentRetreiveResponseTest.kt | 29 ++++ .../tryfinch/api/models/WebhookEventTest.kt | 144 ++++++++++++++++++ 2 files changed, 173 insertions(+) create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentRetreiveResponseTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/WebhookEventTest.kt diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentRetreiveResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentRetreiveResponseTest.kt new file mode 100644 index 00000000..d7f8e755 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentRetreiveResponseTest.kt @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class DocumentRetreiveResponseTest { + + @Test + fun ofW42020() { + val w42020 = W42020.builder().build() + + val documentRetreiveResponse = DocumentRetreiveResponse.ofW42020(w42020) + + assertThat(documentRetreiveResponse.w42020()).contains(w42020) + assertThat(documentRetreiveResponse.w42005()).isEmpty + } + + @Test + fun ofW42005() { + val w42005 = W42005.builder().build() + + val documentRetreiveResponse = DocumentRetreiveResponse.ofW42005(w42005) + + assertThat(documentRetreiveResponse.w42020()).isEmpty + assertThat(documentRetreiveResponse.w42005()).contains(w42005) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/WebhookEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/WebhookEventTest.kt new file mode 100644 index 00000000..f0d5af29 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/WebhookEventTest.kt @@ -0,0 +1,144 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class WebhookEventTest { + + @Test + fun ofAccountUpdated() { + val accountUpdated = + AccountUpdateEvent.builder().accountId("account_id").companyId("company_id").build() + + val webhookEvent = WebhookEvent.ofAccountUpdated(accountUpdated) + + assertThat(webhookEvent.accountUpdated()).contains(accountUpdated) + assertThat(webhookEvent.jobCompletion()).isEmpty + assertThat(webhookEvent.companyUpdated()).isEmpty + assertThat(webhookEvent.directory()).isEmpty + assertThat(webhookEvent.employment()).isEmpty + assertThat(webhookEvent.individual()).isEmpty + assertThat(webhookEvent.payment()).isEmpty + assertThat(webhookEvent.payStatement()).isEmpty + } + + @Test + fun ofJobCompletion() { + val jobCompletion = + JobCompletionEvent.builder().accountId("account_id").companyId("company_id").build() + + val webhookEvent = WebhookEvent.ofJobCompletion(jobCompletion) + + assertThat(webhookEvent.accountUpdated()).isEmpty + assertThat(webhookEvent.jobCompletion()).contains(jobCompletion) + assertThat(webhookEvent.companyUpdated()).isEmpty + assertThat(webhookEvent.directory()).isEmpty + assertThat(webhookEvent.employment()).isEmpty + assertThat(webhookEvent.individual()).isEmpty + assertThat(webhookEvent.payment()).isEmpty + assertThat(webhookEvent.payStatement()).isEmpty + } + + @Test + fun ofCompanyUpdated() { + val companyUpdated = + CompanyEvent.builder().accountId("account_id").companyId("company_id").build() + + val webhookEvent = WebhookEvent.ofCompanyUpdated(companyUpdated) + + assertThat(webhookEvent.accountUpdated()).isEmpty + assertThat(webhookEvent.jobCompletion()).isEmpty + assertThat(webhookEvent.companyUpdated()).contains(companyUpdated) + assertThat(webhookEvent.directory()).isEmpty + assertThat(webhookEvent.employment()).isEmpty + assertThat(webhookEvent.individual()).isEmpty + assertThat(webhookEvent.payment()).isEmpty + assertThat(webhookEvent.payStatement()).isEmpty + } + + @Test + fun ofDirectory() { + val directory = + DirectoryEvent.builder().accountId("account_id").companyId("company_id").build() + + val webhookEvent = WebhookEvent.ofDirectory(directory) + + assertThat(webhookEvent.accountUpdated()).isEmpty + assertThat(webhookEvent.jobCompletion()).isEmpty + assertThat(webhookEvent.companyUpdated()).isEmpty + assertThat(webhookEvent.directory()).contains(directory) + assertThat(webhookEvent.employment()).isEmpty + assertThat(webhookEvent.individual()).isEmpty + assertThat(webhookEvent.payment()).isEmpty + assertThat(webhookEvent.payStatement()).isEmpty + } + + @Test + fun ofEmployment() { + val employment = + EmploymentEvent.builder().accountId("account_id").companyId("company_id").build() + + val webhookEvent = WebhookEvent.ofEmployment(employment) + + assertThat(webhookEvent.accountUpdated()).isEmpty + assertThat(webhookEvent.jobCompletion()).isEmpty + assertThat(webhookEvent.companyUpdated()).isEmpty + assertThat(webhookEvent.directory()).isEmpty + assertThat(webhookEvent.employment()).contains(employment) + assertThat(webhookEvent.individual()).isEmpty + assertThat(webhookEvent.payment()).isEmpty + assertThat(webhookEvent.payStatement()).isEmpty + } + + @Test + fun ofIndividual() { + val individual = + IndividualEvent.builder().accountId("account_id").companyId("company_id").build() + + val webhookEvent = WebhookEvent.ofIndividual(individual) + + assertThat(webhookEvent.accountUpdated()).isEmpty + assertThat(webhookEvent.jobCompletion()).isEmpty + assertThat(webhookEvent.companyUpdated()).isEmpty + assertThat(webhookEvent.directory()).isEmpty + assertThat(webhookEvent.employment()).isEmpty + assertThat(webhookEvent.individual()).contains(individual) + assertThat(webhookEvent.payment()).isEmpty + assertThat(webhookEvent.payStatement()).isEmpty + } + + @Test + fun ofPayment() { + val payment = PaymentEvent.builder().accountId("account_id").companyId("company_id").build() + + val webhookEvent = WebhookEvent.ofPayment(payment) + + assertThat(webhookEvent.accountUpdated()).isEmpty + assertThat(webhookEvent.jobCompletion()).isEmpty + assertThat(webhookEvent.companyUpdated()).isEmpty + assertThat(webhookEvent.directory()).isEmpty + assertThat(webhookEvent.employment()).isEmpty + assertThat(webhookEvent.individual()).isEmpty + assertThat(webhookEvent.payment()).contains(payment) + assertThat(webhookEvent.payStatement()).isEmpty + } + + @Test + fun ofPayStatement() { + val payStatement = + PayStatementEvent.builder().accountId("account_id").companyId("company_id").build() + + val webhookEvent = WebhookEvent.ofPayStatement(payStatement) + + assertThat(webhookEvent.accountUpdated()).isEmpty + assertThat(webhookEvent.jobCompletion()).isEmpty + assertThat(webhookEvent.companyUpdated()).isEmpty + assertThat(webhookEvent.directory()).isEmpty + assertThat(webhookEvent.employment()).isEmpty + assertThat(webhookEvent.individual()).isEmpty + assertThat(webhookEvent.payment()).isEmpty + assertThat(webhookEvent.payStatement()).contains(payStatement) + } +} From 0fb2cbc5711394b6f823e5e9c985cd64b11bbc21 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 19:27:14 +0000 Subject: [PATCH 31/65] fix(client): support kotlin 1.8 runtime (#502) --- buildSrc/build.gradle.kts | 4 +-- .../src/main/kotlin/finch.java.gradle.kts | 3 +++ .../src/main/kotlin/finch.kotlin.gradle.kts | 25 ++++++++++--------- finch-java-example/build.gradle.kts | 10 +++++--- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index d1ed374d..778c89de 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,6 +1,6 @@ plugins { `kotlin-dsl` - kotlin("jvm") version "2.1.10" + kotlin("jvm") version "1.9.20" id("com.vanniktech.maven.publish") version "0.28.0" } @@ -11,6 +11,6 @@ repositories { dependencies { implementation("com.diffplug.spotless:spotless-plugin-gradle:7.0.2") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.10") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20") implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0") } diff --git a/buildSrc/src/main/kotlin/finch.java.gradle.kts b/buildSrc/src/main/kotlin/finch.java.gradle.kts index 597b6e80..e39d9ac6 100644 --- a/buildSrc/src/main/kotlin/finch.java.gradle.kts +++ b/buildSrc/src/main/kotlin/finch.java.gradle.kts @@ -23,6 +23,9 @@ java { toolchain { languageVersion.set(JavaLanguageVersion.of(17)) } + + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } tasks.withType().configureEach { diff --git a/buildSrc/src/main/kotlin/finch.kotlin.gradle.kts b/buildSrc/src/main/kotlin/finch.kotlin.gradle.kts index 515205ec..2fcf511b 100644 --- a/buildSrc/src/main/kotlin/finch.kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/finch.kotlin.gradle.kts @@ -1,6 +1,6 @@ import com.diffplug.gradle.spotless.SpotlessExtension import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion plugins { id("finch.java") @@ -11,25 +11,26 @@ kotlin { jvmToolchain { languageVersion.set(JavaLanguageVersion.of(17)) } -} - -configure { - kotlin { - ktfmt().kotlinlangStyle() - toggleOffOn() - } -} -tasks.withType().configureEach { compilerOptions { - allWarningsAsErrors = true freeCompilerArgs = listOf( "-Xjvm-default=all", "-Xjdk-release=1.8", // Suppress deprecation warnings because we may still reference and test deprecated members. - "-Xsuppress-warning=DEPRECATION" + // TODO: Replace with `-Xsuppress-warning=DEPRECATION` once we use Kotlin compiler 2.1.0+. + "-nowarn", ) jvmTarget.set(JvmTarget.JVM_1_8) + languageVersion.set(KotlinVersion.KOTLIN_1_8) + apiVersion.set(KotlinVersion.KOTLIN_1_8) + coreLibrariesVersion = "1.8.0" + } +} + +configure { + kotlin { + ktfmt().kotlinlangStyle() + toggleOffOn() } } diff --git a/finch-java-example/build.gradle.kts b/finch-java-example/build.gradle.kts index 29e65075..cd8a4220 100644 --- a/finch-java-example/build.gradle.kts +++ b/finch-java-example/build.gradle.kts @@ -1,16 +1,20 @@ plugins { - id("finch.kotlin") id("java") application } +repositories { + mavenCentral() +} + dependencies { implementation(project(":finch-java")) } -tasks.withType().configureEach { +java { // Allow using more modern APIs, like `List.of` and `Map.of`, in examples. - options.release.set(9) + sourceCompatibility = JavaVersion.VERSION_1_9 + targetCompatibility = JavaVersion.VERSION_1_9 } application { From 8894d8307db6b7bdc92319b6f356addec96c64a5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 19:32:12 +0000 Subject: [PATCH 32/65] chore(internal): refactor enum query param serialization (#503) --- .../api/models/DirectoryCreateResponse.kt | 97 +++++++ .../api/models/HrisDocumentListParams.kt | 2 +- .../async/sandbox/DirectoryServiceAsync.kt | 19 +- .../sandbox/DirectoryServiceAsyncImpl.kt | 21 +- .../blocking/sandbox/DirectoryService.kt | 19 +- .../blocking/sandbox/DirectoryServiceImpl.kt | 21 +- .../api/models/DirectoryCreateResponseTest.kt | 13 + .../sandbox/DirectoryServiceAsyncTest.kt | 1 + .../blocking/sandbox/DirectoryServiceTest.kt | 254 +++++++++--------- 9 files changed, 295 insertions(+), 152 deletions(-) create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryCreateResponse.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/DirectoryCreateResponseTest.kt diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryCreateResponse.kt new file mode 100644 index 00000000..9c8cea55 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryCreateResponse.kt @@ -0,0 +1,97 @@ +// 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.tryfinch.api.core.ExcludeMissing +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap +import com.tryfinch.api.core.toImmutable +import java.util.Objects + +@NoAutoDetect +class DirectoryCreateResponse +@JsonCreator +private constructor( + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap() +) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): DirectoryCreateResponse = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [DirectoryCreateResponse]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DirectoryCreateResponse]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(directoryCreateResponse: DirectoryCreateResponse) = apply { + additionalProperties = directoryCreateResponse.additionalProperties.toMutableMap() + } + + 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 [DirectoryCreateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): DirectoryCreateResponse = + DirectoryCreateResponse(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DirectoryCreateResponse && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "DirectoryCreateResponse{additionalProperties=$additionalProperties}" +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt index 50eb91c7..5a29dbdb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt @@ -53,7 +53,7 @@ private constructor( individualIds?.forEach { put("individual_ids[]", it) } limit?.let { put("limit", it.toString()) } offset?.let { put("offset", it.toString()) } - types?.forEach { put("types[]", it.asString()) } + types?.forEach { put("types[]", it.toString()) } putAll(additionalQueryParams) } .build() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt index a4fdb411..66f7b336 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt @@ -3,9 +3,9 @@ package com.tryfinch.api.services.async.sandbox import com.google.errorprone.annotations.MustBeClosed -import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.models.DirectoryCreateResponse import com.tryfinch.api.models.SandboxDirectoryCreateParams import java.util.concurrent.CompletableFuture @@ -17,21 +17,22 @@ interface DirectoryServiceAsync { fun withRawResponse(): WithRawResponse /** Add new individuals to a sandbox company */ - fun create(): CompletableFuture> = create(SandboxDirectoryCreateParams.none()) + fun create(): CompletableFuture> = + create(SandboxDirectoryCreateParams.none()) /** @see [create] */ fun create( params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** @see [create] */ fun create( params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none() - ): CompletableFuture> = create(params, RequestOptions.none()) + ): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - fun create(requestOptions: RequestOptions): CompletableFuture> = + fun create(requestOptions: RequestOptions): CompletableFuture> = create(SandboxDirectoryCreateParams.none(), requestOptions) /** @@ -44,7 +45,7 @@ interface DirectoryServiceAsync { * [DirectoryServiceAsync.create]. */ @MustBeClosed - fun create(): CompletableFuture>> = + fun create(): CompletableFuture>> = create(SandboxDirectoryCreateParams.none()) /** @see [create] */ @@ -52,20 +53,20 @@ interface DirectoryServiceAsync { fun create( params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture>> + ): CompletableFuture>> /** @see [create] */ @MustBeClosed fun create( params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none() - ): CompletableFuture>> = + ): CompletableFuture>> = create(params, RequestOptions.none()) /** @see [create] */ @MustBeClosed fun create( requestOptions: RequestOptions - ): CompletableFuture>> = + ): CompletableFuture>> = create(SandboxDirectoryCreateParams.none(), requestOptions) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt index 45f5202f..af048b65 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt @@ -3,7 +3,6 @@ package com.tryfinch.api.services.async.sandbox import com.tryfinch.api.core.ClientOptions -import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -16,6 +15,7 @@ import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.errors.FinchError +import com.tryfinch.api.models.DirectoryCreateResponse import com.tryfinch.api.models.SandboxDirectoryCreateParams import java.util.concurrent.CompletableFuture @@ -31,7 +31,7 @@ class DirectoryServiceAsyncImpl internal constructor(private val clientOptions: override fun create( params: SandboxDirectoryCreateParams, requestOptions: RequestOptions, - ): CompletableFuture> = + ): CompletableFuture> = // post /sandbox/directory withRawResponse().create(params, requestOptions).thenApply { it.parse() } @@ -40,13 +40,14 @@ class DirectoryServiceAsyncImpl internal constructor(private val clientOptions: private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val createHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val createHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) override fun create( params: SandboxDirectoryCreateParams, requestOptions: RequestOptions, - ): CompletableFuture>> { + ): CompletableFuture>> { val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -58,7 +59,15 @@ class DirectoryServiceAsyncImpl internal constructor(private val clientOptions: return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } .thenApply { response -> - response.parseable { response.use { createHandler.handle(it) } } + response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + } } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt index c020fa21..afe8fbc5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt @@ -3,9 +3,9 @@ package com.tryfinch.api.services.blocking.sandbox import com.google.errorprone.annotations.MustBeClosed -import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.models.DirectoryCreateResponse import com.tryfinch.api.models.SandboxDirectoryCreateParams interface DirectoryService { @@ -16,21 +16,21 @@ interface DirectoryService { fun withRawResponse(): WithRawResponse /** Add new individuals to a sandbox company */ - fun create(): List = create(SandboxDirectoryCreateParams.none()) + fun create(): List = create(SandboxDirectoryCreateParams.none()) /** @see [create] */ fun create( params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): List + ): List /** @see [create] */ fun create( params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none() - ): List = create(params, RequestOptions.none()) + ): List = create(params, RequestOptions.none()) /** @see [create] */ - fun create(requestOptions: RequestOptions): List = + fun create(requestOptions: RequestOptions): List = create(SandboxDirectoryCreateParams.none(), requestOptions) /** A view of [DirectoryService] that provides access to raw HTTP responses for each method. */ @@ -41,24 +41,25 @@ interface DirectoryService { * [DirectoryService.create]. */ @MustBeClosed - fun create(): HttpResponseFor> = create(SandboxDirectoryCreateParams.none()) + fun create(): HttpResponseFor> = + create(SandboxDirectoryCreateParams.none()) /** @see [create] */ @MustBeClosed fun create( params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor> + ): HttpResponseFor> /** @see [create] */ @MustBeClosed fun create( params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none() - ): HttpResponseFor> = create(params, RequestOptions.none()) + ): HttpResponseFor> = create(params, RequestOptions.none()) /** @see [create] */ @MustBeClosed - fun create(requestOptions: RequestOptions): HttpResponseFor> = + fun create(requestOptions: RequestOptions): HttpResponseFor> = create(SandboxDirectoryCreateParams.none(), requestOptions) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt index 26ad0318..834ea170 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt @@ -3,7 +3,6 @@ package com.tryfinch.api.services.blocking.sandbox import com.tryfinch.api.core.ClientOptions -import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -16,6 +15,7 @@ import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError +import com.tryfinch.api.models.DirectoryCreateResponse import com.tryfinch.api.models.SandboxDirectoryCreateParams class DirectoryServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -30,7 +30,7 @@ class DirectoryServiceImpl internal constructor(private val clientOptions: Clien override fun create( params: SandboxDirectoryCreateParams, requestOptions: RequestOptions, - ): List = + ): List = // post /sandbox/directory withRawResponse().create(params, requestOptions).parse() @@ -39,13 +39,14 @@ class DirectoryServiceImpl internal constructor(private val clientOptions: Clien private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val createHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val createHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) override fun create( params: SandboxDirectoryCreateParams, requestOptions: RequestOptions, - ): HttpResponseFor> { + ): HttpResponseFor> { val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -55,7 +56,15 @@ class DirectoryServiceImpl internal constructor(private val clientOptions: Clien .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) - return response.parseable { response.use { createHandler.handle(it) } } + return response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.forEach { it.validate() } + } + } + } } } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DirectoryCreateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DirectoryCreateResponseTest.kt new file mode 100644 index 00000000..ca37c602 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DirectoryCreateResponseTest.kt @@ -0,0 +1,13 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import org.junit.jupiter.api.Test + +internal class DirectoryCreateResponseTest { + + @Test + fun create() { + val directoryCreateResponse = DirectoryCreateResponse.builder().build() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncTest.kt index 61dc0701..95617991 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncTest.kt @@ -156,5 +156,6 @@ internal class DirectoryServiceAsyncTest { ) val directories = directoriesFuture.get() + directories.forEach { it.validate() } } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt index 92f1c20d..9bc7cf52 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt @@ -23,126 +23,138 @@ internal class DirectoryServiceTest { .build() val directoryService = client.sandbox().directory() - directoryService.create( - SandboxDirectoryCreateParams.builder() - .addBody( - SandboxDirectoryCreateParams.IndividualOrEmployment.builder() - .classCode("class_code") - .addCustomField( - SandboxDirectoryCreateParams.IndividualOrEmployment.CustomField - .builder() - .name("name") - .value(JsonValue.from(mapOf())) - .build() - ) - .department( - SandboxDirectoryCreateParams.IndividualOrEmployment.Department.builder() - .name("name") - .build() - ) - .dob("dob") - .addEmail( - SandboxDirectoryCreateParams.IndividualOrEmployment.Email.builder() - .data("data") - .type( - SandboxDirectoryCreateParams.IndividualOrEmployment.Email.Type - .WORK - ) - .build() - ) - .employment( - SandboxDirectoryCreateParams.IndividualOrEmployment.Employment.builder() - .subtype( - SandboxDirectoryCreateParams.IndividualOrEmployment.Employment - .Subtype - .FULL_TIME - ) - .type( - SandboxDirectoryCreateParams.IndividualOrEmployment.Employment - .Type - .EMPLOYEE - ) - .build() - ) - .employmentStatus( - SandboxDirectoryCreateParams.IndividualOrEmployment.EmploymentStatus - .ACTIVE - ) - .encryptedSsn("encrypted_ssn") - .endDate("end_date") - .ethnicity( - SandboxDirectoryCreateParams.IndividualOrEmployment.Ethnicity.ASIAN - ) - .firstName("first_name") - .gender(SandboxDirectoryCreateParams.IndividualOrEmployment.Gender.FEMALE) - .income( - Income.builder() - .amount(0L) - .currency("currency") - .effectiveDate("effective_date") - .unit(Income.Unit.YEARLY) - .build() - ) - .addIncomeHistory( - Income.builder() - .amount(0L) - .currency("currency") - .effectiveDate("effective_date") - .unit(Income.Unit.YEARLY) - .build() - ) - .isActive(true) - .lastName("last_name") - .latestRehireDate("latest_rehire_date") - .location( - Location.builder() - .city("city") - .country("country") - .line1("line1") - .line2("line2") - .name("name") - .postalCode("postal_code") - .sourceId("source_id") - .state("state") - .build() - ) - .manager( - SandboxDirectoryCreateParams.IndividualOrEmployment.Manager.builder() - .id("id") - .build() - ) - .middleName("middle_name") - .addPhoneNumber( - SandboxDirectoryCreateParams.IndividualOrEmployment.PhoneNumber - .builder() - .data("data") - .type( - SandboxDirectoryCreateParams.IndividualOrEmployment.PhoneNumber - .Type - .WORK - ) - .build() - ) - .preferredName("preferred_name") - .residence( - Location.builder() - .city("city") - .country("country") - .line1("line1") - .line2("line2") - .name("name") - .postalCode("postal_code") - .sourceId("source_id") - .state("state") - .build() - ) - .sourceId("source_id") - .ssn("ssn") - .startDate("start_date") - .title("title") - .build() - ) - .build() - ) + val directories = + directoryService.create( + SandboxDirectoryCreateParams.builder() + .addBody( + SandboxDirectoryCreateParams.IndividualOrEmployment.builder() + .classCode("class_code") + .addCustomField( + SandboxDirectoryCreateParams.IndividualOrEmployment.CustomField + .builder() + .name("name") + .value(JsonValue.from(mapOf())) + .build() + ) + .department( + SandboxDirectoryCreateParams.IndividualOrEmployment.Department + .builder() + .name("name") + .build() + ) + .dob("dob") + .addEmail( + SandboxDirectoryCreateParams.IndividualOrEmployment.Email.builder() + .data("data") + .type( + SandboxDirectoryCreateParams.IndividualOrEmployment.Email + .Type + .WORK + ) + .build() + ) + .employment( + SandboxDirectoryCreateParams.IndividualOrEmployment.Employment + .builder() + .subtype( + SandboxDirectoryCreateParams.IndividualOrEmployment + .Employment + .Subtype + .FULL_TIME + ) + .type( + SandboxDirectoryCreateParams.IndividualOrEmployment + .Employment + .Type + .EMPLOYEE + ) + .build() + ) + .employmentStatus( + SandboxDirectoryCreateParams.IndividualOrEmployment.EmploymentStatus + .ACTIVE + ) + .encryptedSsn("encrypted_ssn") + .endDate("end_date") + .ethnicity( + SandboxDirectoryCreateParams.IndividualOrEmployment.Ethnicity.ASIAN + ) + .firstName("first_name") + .gender( + SandboxDirectoryCreateParams.IndividualOrEmployment.Gender.FEMALE + ) + .income( + Income.builder() + .amount(0L) + .currency("currency") + .effectiveDate("effective_date") + .unit(Income.Unit.YEARLY) + .build() + ) + .addIncomeHistory( + Income.builder() + .amount(0L) + .currency("currency") + .effectiveDate("effective_date") + .unit(Income.Unit.YEARLY) + .build() + ) + .isActive(true) + .lastName("last_name") + .latestRehireDate("latest_rehire_date") + .location( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + ) + .manager( + SandboxDirectoryCreateParams.IndividualOrEmployment.Manager + .builder() + .id("id") + .build() + ) + .middleName("middle_name") + .addPhoneNumber( + SandboxDirectoryCreateParams.IndividualOrEmployment.PhoneNumber + .builder() + .data("data") + .type( + SandboxDirectoryCreateParams.IndividualOrEmployment + .PhoneNumber + .Type + .WORK + ) + .build() + ) + .preferredName("preferred_name") + .residence( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + ) + .sourceId("source_id") + .ssn("ssn") + .startDate("start_date") + .title("title") + .build() + ) + .build() + ) + + directories.forEach { it.validate() } } } From 9be38e0fce500731d023902658ec0fa8926b27e1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 19 Mar 2025 18:02:41 +0000 Subject: [PATCH 33/65] chore(internal): codegen related update (#504) --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 3b0a3a46..dedb27ab 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,12 @@ The Finch Java SDK is similar to the Finch Kotlin SDK but with minor differences 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/4.2.0). + + ## Installation From 4be4f068408cf19a55f8fcc1b64aac6fc24fd73d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 20 Mar 2025 18:49:45 +0000 Subject: [PATCH 34/65] chore(client)!: refactor exception structure and methods (#505) # Migration Previously you would access error JSON on an exception via `exception.error()._additionalProperties()`, which would return `Map`. Now you would access this via `exception.body()`, which returns `JsonValue`. You should no longer assume that the returned error JSON is an object. You can check via `exception.body().asObject()`. --- .../api/client/FinchClientAsyncImpl.kt | 4 +- .../tryfinch/api/client/FinchClientImpl.kt | 4 +- .../api/core/handlers/ErrorHandler.kt | 149 +++++++----------- .../api/errors/BadRequestException.kt | 78 ++++++++- .../com/tryfinch/api/errors/FinchError.kt | 82 ---------- .../api/errors/FinchServiceException.kt | 21 +-- .../api/errors/InternalServerException.kt | 89 ++++++++++- .../tryfinch/api/errors/NotFoundException.kt | 74 ++++++++- .../api/errors/PermissionDeniedException.kt | 78 ++++++++- .../tryfinch/api/errors/RateLimitException.kt | 78 ++++++++- .../api/errors/UnauthorizedException.kt | 78 ++++++++- .../errors/UnexpectedStatusCodeException.kt | 94 ++++++++++- .../errors/UnprocessableEntityException.kt | 78 ++++++++- .../async/AccessTokenServiceAsyncImpl.kt | 4 +- .../services/async/AccountServiceAsyncImpl.kt | 4 +- .../async/ProviderServiceAsyncImpl.kt | 4 +- .../RequestForwardingServiceAsyncImpl.kt | 4 +- .../services/async/WebhookServiceAsyncImpl.kt | 5 - .../async/connect/SessionServiceAsyncImpl.kt | 4 +- .../async/hris/BenefitServiceAsyncImpl.kt | 4 +- .../async/hris/CompanyServiceAsyncImpl.kt | 4 +- .../async/hris/DirectoryServiceAsyncImpl.kt | 4 +- .../async/hris/DocumentServiceAsyncImpl.kt | 4 +- .../async/hris/EmploymentServiceAsyncImpl.kt | 4 +- .../async/hris/IndividualServiceAsyncImpl.kt | 4 +- .../hris/PayStatementServiceAsyncImpl.kt | 4 +- .../async/hris/PaymentServiceAsyncImpl.kt | 4 +- .../benefits/IndividualServiceAsyncImpl.kt | 4 +- .../async/jobs/AutomatedServiceAsyncImpl.kt | 4 +- .../async/jobs/ManualServiceAsyncImpl.kt | 4 +- .../async/payroll/PayGroupServiceAsyncImpl.kt | 4 +- .../async/sandbox/CompanyServiceAsyncImpl.kt | 4 +- .../sandbox/ConnectionServiceAsyncImpl.kt | 4 +- .../sandbox/DirectoryServiceAsyncImpl.kt | 4 +- .../sandbox/EmploymentServiceAsyncImpl.kt | 4 +- .../sandbox/IndividualServiceAsyncImpl.kt | 4 +- .../async/sandbox/JobServiceAsyncImpl.kt | 4 +- .../async/sandbox/PaymentServiceAsyncImpl.kt | 4 +- .../connections/AccountServiceAsyncImpl.kt | 4 +- .../jobs/ConfigurationServiceAsyncImpl.kt | 4 +- .../blocking/AccessTokenServiceImpl.kt | 4 +- .../services/blocking/AccountServiceImpl.kt | 4 +- .../services/blocking/ProviderServiceImpl.kt | 4 +- .../blocking/RequestForwardingServiceImpl.kt | 4 +- .../services/blocking/WebhookServiceImpl.kt | 5 - .../blocking/connect/SessionServiceImpl.kt | 4 +- .../blocking/hris/BenefitServiceImpl.kt | 4 +- .../blocking/hris/CompanyServiceImpl.kt | 4 +- .../blocking/hris/DirectoryServiceImpl.kt | 4 +- .../blocking/hris/DocumentServiceImpl.kt | 4 +- .../blocking/hris/EmploymentServiceImpl.kt | 4 +- .../blocking/hris/IndividualServiceImpl.kt | 4 +- .../blocking/hris/PayStatementServiceImpl.kt | 4 +- .../blocking/hris/PaymentServiceImpl.kt | 4 +- .../hris/benefits/IndividualServiceImpl.kt | 4 +- .../blocking/jobs/AutomatedServiceImpl.kt | 4 +- .../blocking/jobs/ManualServiceImpl.kt | 4 +- .../blocking/payroll/PayGroupServiceImpl.kt | 4 +- .../blocking/sandbox/CompanyServiceImpl.kt | 4 +- .../blocking/sandbox/ConnectionServiceImpl.kt | 4 +- .../blocking/sandbox/DirectoryServiceImpl.kt | 4 +- .../blocking/sandbox/EmploymentServiceImpl.kt | 4 +- .../blocking/sandbox/IndividualServiceImpl.kt | 4 +- .../blocking/sandbox/JobServiceImpl.kt | 4 +- .../blocking/sandbox/PaymentServiceImpl.kt | 4 +- .../sandbox/connections/AccountServiceImpl.kt | 4 +- .../sandbox/jobs/ConfigurationServiceImpl.kt | 4 +- .../api/services/ErrorHandlingTest.kt | 56 ++++--- 68 files changed, 830 insertions(+), 351 deletions(-) delete mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsyncImpl.kt index fef86854..17dc6f2b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsyncImpl.kt @@ -4,6 +4,7 @@ package com.tryfinch.api.client import com.fasterxml.jackson.annotation.JsonProperty import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.getPackageVersion import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -12,7 +13,6 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.json -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.errors.FinchException import com.tryfinch.api.models.* import com.tryfinch.api.services.async.AccessTokenServiceAsync @@ -40,7 +40,7 @@ import java.util.concurrent.CompletableFuture class FinchClientAsyncImpl(private val clientOptions: ClientOptions) : FinchClientAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val clientOptionsWithUserAgent = if (clientOptions.headers.names().contains("User-Agent")) clientOptions diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt index 76053176..aa2b5c8d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt @@ -4,6 +4,7 @@ package com.tryfinch.api.client import com.fasterxml.jackson.annotation.JsonProperty import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.getPackageVersion import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -12,7 +13,6 @@ import com.tryfinch.api.core.http.HttpMethod import com.tryfinch.api.core.http.HttpRequest import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.json -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.errors.FinchException import com.tryfinch.api.models.* import com.tryfinch.api.services.blocking.AccessTokenService @@ -39,7 +39,7 @@ import java.net.URLEncoder class FinchClientImpl(private val clientOptions: ClientOptions) : FinchClient { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val clientOptionsWithUserAgent = if (clientOptions.headers.names().contains("User-Agent")) clientOptions diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/handlers/ErrorHandler.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/handlers/ErrorHandler.kt index e583efa0..578e8a45 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/handlers/ErrorHandler.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/handlers/ErrorHandler.kt @@ -1,13 +1,15 @@ +// File generated from our OpenAPI spec by Stainless. + @file:JvmName("ErrorHandler") package com.tryfinch.api.core.handlers import com.fasterxml.jackson.databind.json.JsonMapper -import com.tryfinch.api.core.http.Headers +import com.tryfinch.api.core.JsonMissing +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.http.HttpResponse import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.errors.BadRequestException -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.errors.InternalServerException import com.tryfinch.api.errors.NotFoundException import com.tryfinch.api.errors.PermissionDeniedException @@ -15,111 +17,68 @@ import com.tryfinch.api.errors.RateLimitException import com.tryfinch.api.errors.UnauthorizedException import com.tryfinch.api.errors.UnexpectedStatusCodeException import com.tryfinch.api.errors.UnprocessableEntityException -import java.io.ByteArrayInputStream -import java.io.InputStream @JvmSynthetic -internal fun errorHandler(jsonMapper: JsonMapper): Handler { - val handler = jsonHandler(jsonMapper) +internal fun errorHandler(jsonMapper: JsonMapper): Handler { + val handler = jsonHandler(jsonMapper) - return object : Handler { - override fun handle(response: HttpResponse): FinchError = + return object : Handler { + override fun handle(response: HttpResponse): JsonValue = try { handler.handle(response) } catch (e: Exception) { - FinchError.builder().build() + JsonMissing.of() } } } @JvmSynthetic -internal fun Handler.withErrorHandler(errorHandler: Handler): Handler = +internal fun Handler.withErrorHandler(errorHandler: Handler): Handler = object : Handler { - override fun handle(response: HttpResponse): T { + override fun handle(response: HttpResponse): T = when (val statusCode = response.statusCode()) { - in 200..299 -> { - return this@withErrorHandler.handle(response) - } - 400 -> { - val buffered = response.buffered() - throw BadRequestException( - buffered.headers(), - stringHandler().handle(buffered), - errorHandler.handle(buffered), - ) - } - 401 -> { - val buffered = response.buffered() - throw UnauthorizedException( - buffered.headers(), - stringHandler().handle(buffered), - errorHandler.handle(buffered), - ) - } - 403 -> { - val buffered = response.buffered() - throw PermissionDeniedException( - buffered.headers(), - stringHandler().handle(buffered), - errorHandler.handle(buffered), - ) - } - 404 -> { - val buffered = response.buffered() - throw NotFoundException( - buffered.headers(), - stringHandler().handle(buffered), - errorHandler.handle(buffered), - ) - } - 422 -> { - val buffered = response.buffered() - throw UnprocessableEntityException( - buffered.headers(), - stringHandler().handle(buffered), - errorHandler.handle(buffered), - ) - } - 429 -> { - val buffered = response.buffered() - throw RateLimitException( - buffered.headers(), - stringHandler().handle(buffered), - errorHandler.handle(buffered), - ) - } - in 500..599 -> { - val buffered = response.buffered() - throw InternalServerException( - statusCode, - buffered.headers(), - stringHandler().handle(buffered), - errorHandler.handle(buffered), - ) - } - else -> { - val buffered = response.buffered() - throw UnexpectedStatusCodeException( - statusCode, - buffered.headers(), - stringHandler().handle(buffered), - errorHandler.handle(buffered), - ) - } + in 200..299 -> this@withErrorHandler.handle(response) + 400 -> + throw BadRequestException.builder() + .headers(response.headers()) + .body(errorHandler.handle(response)) + .build() + 401 -> + throw UnauthorizedException.builder() + .headers(response.headers()) + .body(errorHandler.handle(response)) + .build() + 403 -> + throw PermissionDeniedException.builder() + .headers(response.headers()) + .body(errorHandler.handle(response)) + .build() + 404 -> + throw NotFoundException.builder() + .headers(response.headers()) + .body(errorHandler.handle(response)) + .build() + 422 -> + throw UnprocessableEntityException.builder() + .headers(response.headers()) + .body(errorHandler.handle(response)) + .build() + 429 -> + throw RateLimitException.builder() + .headers(response.headers()) + .body(errorHandler.handle(response)) + .build() + in 500..599 -> + throw InternalServerException.builder() + .statusCode(statusCode) + .headers(response.headers()) + .body(errorHandler.handle(response)) + .build() + else -> + throw UnexpectedStatusCodeException.builder() + .statusCode(statusCode) + .headers(response.headers()) + .body(errorHandler.handle(response)) + .build() } - } - } - -private fun HttpResponse.buffered(): HttpResponse { - val body = body().readBytes() - - return object : HttpResponse { - override fun statusCode(): Int = this@buffered.statusCode() - - override fun headers(): Headers = this@buffered.headers() - - override fun body(): InputStream = ByteArrayInputStream(body) - - override fun close() = this@buffered.close() } -} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/BadRequestException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/BadRequestException.kt index 1375ba00..818ed88b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/BadRequestException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/BadRequestException.kt @@ -1,6 +1,80 @@ +// File generated from our OpenAPI spec by Stainless. + package com.tryfinch.api.errors +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class BadRequestException +private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : + FinchServiceException("400: $body", cause) { + + override fun headers(): Headers = headers + + override fun body(): JsonValue = body + + override fun statusCode(): Int = 400 + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [BadRequestException]. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BadRequestException]. */ + class Builder internal constructor() { + + private var headers: Headers? = null + private var body: JsonValue? = null + private var cause: Throwable? = null + + @JvmSynthetic + internal fun from(badRequestException: BadRequestException) = apply { + headers = badRequestException.headers + body = badRequestException.body + cause = badRequestException.cause + } + + fun headers(headers: Headers) = apply { this.headers = headers } + + fun body(body: JsonValue) = apply { this.body = body } + + fun cause(cause: Throwable?) = apply { this.cause = cause } + + /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ + fun cause(cause: Optional) = cause(cause.getOrNull()) -class BadRequestException(headers: Headers, body: String, error: FinchError) : - FinchServiceException(400, headers, body, error) + /** + * Returns an immutable instance of [BadRequestException]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BadRequestException = + BadRequestException( + checkRequired("headers", headers), + checkRequired("body", body), + cause, + ) + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt deleted file mode 100644 index b543fa9d..00000000 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt +++ /dev/null @@ -1,82 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.tryfinch.api.errors - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.tryfinch.api.core.ExcludeMissing -import com.tryfinch.api.core.JsonValue -import com.tryfinch.api.core.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable -import java.util.Objects - -@NoAutoDetect -class FinchError -@JsonCreator -private constructor( - @JsonAnyGetter - @ExcludeMissing - @JsonAnySetter - @get:JvmName("additionalProperties") - val additionalProperties: Map = immutableEmptyMap() -) { - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [FinchError]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [FinchError]. */ - class Builder internal constructor() { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(finchError: FinchError) = apply { - additionalProperties = finchError.additionalProperties.toMutableMap() - } - - 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 [FinchError]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): FinchError = FinchError(additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is FinchError && additionalProperties == other.additionalProperties /* spotless:on */ - } - - override fun hashCode(): Int = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ - - override fun toString() = "FinchError{additionalProperties=$additionalProperties}" -} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchServiceException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchServiceException.kt index 9fa5ecc4..252842ed 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchServiceException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchServiceException.kt @@ -1,23 +1,16 @@ +// File generated from our OpenAPI spec by Stainless. + package com.tryfinch.api.errors +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.http.Headers abstract class FinchServiceException -@JvmOverloads -constructor( - private val statusCode: Int, - private val headers: Headers, - private val body: String, - private val error: FinchError, - message: String = "$statusCode: $error", - cause: Throwable? = null, -) : FinchException(message, cause) { - - fun statusCode(): Int = statusCode +protected constructor(message: String, cause: Throwable? = null) : FinchException(message, cause) { - fun headers(): Headers = headers + abstract fun statusCode(): Int - fun body(): String = body + abstract fun headers(): Headers - fun error(): FinchError = error + abstract fun body(): JsonValue } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/InternalServerException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/InternalServerException.kt index 8701e4a7..0e432de3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/InternalServerException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/InternalServerException.kt @@ -1,6 +1,91 @@ +// File generated from our OpenAPI spec by Stainless. + package com.tryfinch.api.errors +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class InternalServerException +private constructor( + private val statusCode: Int, + private val headers: Headers, + private val body: JsonValue, + cause: Throwable?, +) : FinchServiceException("$statusCode: $body", cause) { + + override fun statusCode(): Int = statusCode + + override fun headers(): Headers = headers + + override fun body(): JsonValue = body + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [InternalServerException]. + * + * The following fields are required: + * ```java + * .statusCode() + * .headers() + * .body() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InternalServerException]. */ + class Builder internal constructor() { + + private var statusCode: Int? = null + private var headers: Headers? = null + private var body: JsonValue? = null + private var cause: Throwable? = null + + @JvmSynthetic + internal fun from(internalServerException: InternalServerException) = apply { + statusCode = internalServerException.statusCode + headers = internalServerException.headers + body = internalServerException.body + cause = internalServerException.cause + } + + fun statusCode(statusCode: Int) = apply { this.statusCode = statusCode } + + fun headers(headers: Headers) = apply { this.headers = headers } + + fun body(body: JsonValue) = apply { this.body = body } + + fun cause(cause: Throwable?) = apply { this.cause = cause } + + /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ + fun cause(cause: Optional) = cause(cause.getOrNull()) -class InternalServerException(statusCode: Int, headers: Headers, body: String, error: FinchError) : - FinchServiceException(statusCode, headers, body, error) + /** + * Returns an immutable instance of [InternalServerException]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .statusCode() + * .headers() + * .body() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): InternalServerException = + InternalServerException( + checkRequired("statusCode", statusCode), + checkRequired("headers", headers), + checkRequired("body", body), + cause, + ) + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/NotFoundException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/NotFoundException.kt index 370a60c4..4564cb22 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/NotFoundException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/NotFoundException.kt @@ -1,6 +1,76 @@ +// File generated from our OpenAPI spec by Stainless. + package com.tryfinch.api.errors +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class NotFoundException +private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : + FinchServiceException("404: $body", cause) { + + override fun headers(): Headers = headers + + override fun body(): JsonValue = body + + override fun statusCode(): Int = 404 + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [NotFoundException]. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [NotFoundException]. */ + class Builder internal constructor() { + + private var headers: Headers? = null + private var body: JsonValue? = null + private var cause: Throwable? = null + + @JvmSynthetic + internal fun from(notFoundException: NotFoundException) = apply { + headers = notFoundException.headers + body = notFoundException.body + cause = notFoundException.cause + } + + fun headers(headers: Headers) = apply { this.headers = headers } + + fun body(body: JsonValue) = apply { this.body = body } + + fun cause(cause: Throwable?) = apply { this.cause = cause } + + /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ + fun cause(cause: Optional) = cause(cause.getOrNull()) -class NotFoundException(headers: Headers, body: String, error: FinchError) : - FinchServiceException(404, headers, body, error) + /** + * Returns an immutable instance of [NotFoundException]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): NotFoundException = + NotFoundException(checkRequired("headers", headers), checkRequired("body", body), cause) + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/PermissionDeniedException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/PermissionDeniedException.kt index 36058d72..4e131225 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/PermissionDeniedException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/PermissionDeniedException.kt @@ -1,6 +1,80 @@ +// File generated from our OpenAPI spec by Stainless. + package com.tryfinch.api.errors +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class PermissionDeniedException +private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : + FinchServiceException("403: $body", cause) { + + override fun headers(): Headers = headers + + override fun body(): JsonValue = body + + override fun statusCode(): Int = 403 + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [PermissionDeniedException]. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [PermissionDeniedException]. */ + class Builder internal constructor() { + + private var headers: Headers? = null + private var body: JsonValue? = null + private var cause: Throwable? = null + + @JvmSynthetic + internal fun from(permissionDeniedException: PermissionDeniedException) = apply { + headers = permissionDeniedException.headers + body = permissionDeniedException.body + cause = permissionDeniedException.cause + } + + fun headers(headers: Headers) = apply { this.headers = headers } + + fun body(body: JsonValue) = apply { this.body = body } + + fun cause(cause: Throwable?) = apply { this.cause = cause } + + /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ + fun cause(cause: Optional) = cause(cause.getOrNull()) -class PermissionDeniedException(headers: Headers, body: String, error: FinchError) : - FinchServiceException(403, headers, body, error) + /** + * Returns an immutable instance of [PermissionDeniedException]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): PermissionDeniedException = + PermissionDeniedException( + checkRequired("headers", headers), + checkRequired("body", body), + cause, + ) + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/RateLimitException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/RateLimitException.kt index f14024da..767f6baa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/RateLimitException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/RateLimitException.kt @@ -1,6 +1,80 @@ +// File generated from our OpenAPI spec by Stainless. + package com.tryfinch.api.errors +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class RateLimitException +private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : + FinchServiceException("429: $body", cause) { + + override fun headers(): Headers = headers + + override fun body(): JsonValue = body + + override fun statusCode(): Int = 429 + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RateLimitException]. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RateLimitException]. */ + class Builder internal constructor() { + + private var headers: Headers? = null + private var body: JsonValue? = null + private var cause: Throwable? = null + + @JvmSynthetic + internal fun from(rateLimitException: RateLimitException) = apply { + headers = rateLimitException.headers + body = rateLimitException.body + cause = rateLimitException.cause + } + + fun headers(headers: Headers) = apply { this.headers = headers } + + fun body(body: JsonValue) = apply { this.body = body } + + fun cause(cause: Throwable?) = apply { this.cause = cause } + + /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ + fun cause(cause: Optional) = cause(cause.getOrNull()) -class RateLimitException(headers: Headers, body: String, error: FinchError) : - FinchServiceException(429, headers, body, error) + /** + * Returns an immutable instance of [RateLimitException]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RateLimitException = + RateLimitException( + checkRequired("headers", headers), + checkRequired("body", body), + cause, + ) + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnauthorizedException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnauthorizedException.kt index a060f3d4..379dca37 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnauthorizedException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnauthorizedException.kt @@ -1,6 +1,80 @@ +// File generated from our OpenAPI spec by Stainless. + package com.tryfinch.api.errors +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class UnauthorizedException +private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : + FinchServiceException("401: $body", cause) { + + override fun headers(): Headers = headers + + override fun body(): JsonValue = body + + override fun statusCode(): Int = 401 + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [UnauthorizedException]. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [UnauthorizedException]. */ + class Builder internal constructor() { + + private var headers: Headers? = null + private var body: JsonValue? = null + private var cause: Throwable? = null + + @JvmSynthetic + internal fun from(unauthorizedException: UnauthorizedException) = apply { + headers = unauthorizedException.headers + body = unauthorizedException.body + cause = unauthorizedException.cause + } + + fun headers(headers: Headers) = apply { this.headers = headers } + + fun body(body: JsonValue) = apply { this.body = body } + + fun cause(cause: Throwable?) = apply { this.cause = cause } + + /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ + fun cause(cause: Optional) = cause(cause.getOrNull()) -class UnauthorizedException(headers: Headers, body: String, error: FinchError) : - FinchServiceException(401, headers, body, error) + /** + * Returns an immutable instance of [UnauthorizedException]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): UnauthorizedException = + UnauthorizedException( + checkRequired("headers", headers), + checkRequired("body", body), + cause, + ) + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnexpectedStatusCodeException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnexpectedStatusCodeException.kt index 46de2a14..5d89680b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnexpectedStatusCodeException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnexpectedStatusCodeException.kt @@ -1,10 +1,92 @@ +// File generated from our OpenAPI spec by Stainless. + package com.tryfinch.api.errors +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class UnexpectedStatusCodeException +private constructor( + private val statusCode: Int, + private val headers: Headers, + private val body: JsonValue, + cause: Throwable?, +) : FinchServiceException("$statusCode: $body", cause) { + + override fun statusCode(): Int = statusCode + + override fun headers(): Headers = headers + + override fun body(): JsonValue = body + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [UnexpectedStatusCodeException]. + * + * The following fields are required: + * ```java + * .statusCode() + * .headers() + * .body() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [UnexpectedStatusCodeException]. */ + class Builder internal constructor() { + + private var statusCode: Int? = null + private var headers: Headers? = null + private var body: JsonValue? = null + private var cause: Throwable? = null + + @JvmSynthetic + internal fun from(unexpectedStatusCodeException: UnexpectedStatusCodeException) = apply { + statusCode = unexpectedStatusCodeException.statusCode + headers = unexpectedStatusCodeException.headers + body = unexpectedStatusCodeException.body + cause = unexpectedStatusCodeException.cause + } + + fun statusCode(statusCode: Int) = apply { this.statusCode = statusCode } + + fun headers(headers: Headers) = apply { this.headers = headers } + + fun body(body: JsonValue) = apply { this.body = body } + + fun cause(cause: Throwable?) = apply { this.cause = cause } + + /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ + fun cause(cause: Optional) = cause(cause.getOrNull()) -class UnexpectedStatusCodeException( - statusCode: Int, - headers: Headers, - body: String, - error: FinchError, -) : FinchServiceException(statusCode, headers, body, error) + /** + * Returns an immutable instance of [UnexpectedStatusCodeException]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .statusCode() + * .headers() + * .body() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): UnexpectedStatusCodeException = + UnexpectedStatusCodeException( + checkRequired("statusCode", statusCode), + checkRequired("headers", headers), + checkRequired("body", body), + cause, + ) + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnprocessableEntityException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnprocessableEntityException.kt index 6efe853c..bcca6999 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnprocessableEntityException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnprocessableEntityException.kt @@ -1,6 +1,80 @@ +// File generated from our OpenAPI spec by Stainless. + package com.tryfinch.api.errors +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class UnprocessableEntityException +private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : + FinchServiceException("422: $body", cause) { + + override fun headers(): Headers = headers + + override fun body(): JsonValue = body + + override fun statusCode(): Int = 422 + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [UnprocessableEntityException]. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [UnprocessableEntityException]. */ + class Builder internal constructor() { + + private var headers: Headers? = null + private var body: JsonValue? = null + private var cause: Throwable? = null + + @JvmSynthetic + internal fun from(unprocessableEntityException: UnprocessableEntityException) = apply { + headers = unprocessableEntityException.headers + body = unprocessableEntityException.body + cause = unprocessableEntityException.cause + } + + fun headers(headers: Headers) = apply { this.headers = headers } + + fun body(body: JsonValue) = apply { this.body = body } + + fun cause(cause: Throwable?) = apply { this.cause = cause } + + /** Alias for calling [Builder.cause] with `cause.orElse(null)`. */ + fun cause(cause: Optional) = cause(cause.getOrNull()) -class UnprocessableEntityException(headers: Headers, body: String, error: FinchError) : - FinchServiceException(422, headers, body, error) + /** + * Returns an immutable instance of [UnprocessableEntityException]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .headers() + * .body() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): UnprocessableEntityException = + UnprocessableEntityException( + checkRequired("headers", headers), + checkRequired("body", body), + cause, + ) + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt index b7d95430..6ad0bf71 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.errors.FinchException import com.tryfinch.api.models.AccessTokenCreateParams import com.tryfinch.api.models.CreateAccessTokenResponse @@ -40,7 +40,7 @@ class AccessTokenServiceAsyncImpl internal constructor(private val clientOptions class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : AccessTokenServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt index b83e838c..dc00271c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.AccountDisconnectParams import com.tryfinch.api.models.AccountIntrospectParams import com.tryfinch.api.models.DisconnectResponse @@ -47,7 +47,7 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : AccountServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val disconnectHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt index cf52e0a4..a4579fe2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.Provider import com.tryfinch.api.models.ProviderListPageAsync import com.tryfinch.api.models.ProviderListParams @@ -38,7 +38,7 @@ class ProviderServiceAsyncImpl internal constructor(private val clientOptions: C class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : ProviderServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler> = jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt index 928639ef..25b6c483 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.RequestForwardingForwardParams import com.tryfinch.api.models.RequestForwardingForwardResponse import java.util.concurrent.CompletableFuture @@ -38,7 +38,7 @@ internal constructor(private val clientOptions: ClientOptions) : RequestForwardi class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : RequestForwardingServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val forwardHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/WebhookServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/WebhookServiceAsyncImpl.kt index 1a9df250..594a5792 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/WebhookServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/WebhookServiceAsyncImpl.kt @@ -5,10 +5,7 @@ package com.tryfinch.api.services.async import com.fasterxml.jackson.core.JsonProcessingException import com.tryfinch.api.core.ClientOptions import com.tryfinch.api.core.getRequiredHeader -import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.http.Headers -import com.tryfinch.api.core.http.HttpResponse.Handler -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.errors.FinchException import com.tryfinch.api.models.WebhookEvent import java.security.MessageDigest @@ -22,8 +19,6 @@ import kotlin.jvm.optionals.getOrNull class WebhookServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : WebhookServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - override fun unwrap(payload: String, headers: Headers, secret: String?): WebhookEvent { verifySignature(payload, headers, secret) return try { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt index 6fabcee7..b703391c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.connect import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.ConnectSessionNewParams import com.tryfinch.api.models.ConnectSessionReauthenticateParams import com.tryfinch.api.models.SessionNewResponse @@ -47,7 +47,7 @@ class SessionServiceAsyncImpl internal constructor(private val clientOptions: Cl class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : SessionServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val newHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt index efd7ad43..b44c2818 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.hris import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.CompanyBenefit import com.tryfinch.api.models.CreateCompanyBenefitsResponse import com.tryfinch.api.models.HrisBenefitCreateParams @@ -83,7 +83,7 @@ class BenefitServiceAsyncImpl internal constructor(private val clientOptions: Cl class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : BenefitServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val individuals: IndividualServiceAsync.WithRawResponse by lazy { IndividualServiceAsyncImpl.WithRawResponseImpl(clientOptions) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt index 73b3e72f..30733b3c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.hris import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.Company import com.tryfinch.api.models.HrisCompanyRetrieveParams import java.util.concurrent.CompletableFuture @@ -37,7 +37,7 @@ class CompanyServiceAsyncImpl internal constructor(private val clientOptions: Cl class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : CompanyServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt index 14b26db3..9bc43a06 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.hris import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisDirectoryListIndividualsPageAsync import com.tryfinch.api.models.HrisDirectoryListIndividualsParams import com.tryfinch.api.models.HrisDirectoryListPageAsync @@ -47,7 +47,7 @@ class DirectoryServiceAsyncImpl internal constructor(private val clientOptions: class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : DirectoryServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt index ec86afd6..7f6e4636 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.hris import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.DocumentListResponse import com.tryfinch.api.models.DocumentRetreiveResponse import com.tryfinch.api.models.HrisDocumentListParams @@ -46,7 +46,7 @@ class DocumentServiceAsyncImpl internal constructor(private val clientOptions: C class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : DocumentServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt index b8560f58..c78b6123 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.hris import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisEmploymentRetrieveManyPageAsync import com.tryfinch.api.models.HrisEmploymentRetrieveManyParams import java.util.concurrent.CompletableFuture @@ -38,7 +38,7 @@ class EmploymentServiceAsyncImpl internal constructor(private val clientOptions: class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : EmploymentServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val retrieveManyHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt index 5e9396af..8b1f0eb0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.hris import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisIndividualRetrieveManyPageAsync import com.tryfinch.api.models.HrisIndividualRetrieveManyParams import java.util.concurrent.CompletableFuture @@ -38,7 +38,7 @@ class IndividualServiceAsyncImpl internal constructor(private val clientOptions: class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : IndividualServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val retrieveManyHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt index b98f420d..3a2366f1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.hris import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisPayStatementRetrieveManyPageAsync import com.tryfinch.api.models.HrisPayStatementRetrieveManyParams import java.util.concurrent.CompletableFuture @@ -38,7 +38,7 @@ class PayStatementServiceAsyncImpl internal constructor(private val clientOption class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : PayStatementServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val retrieveManyHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt index 6e624d47..fb986187 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.hris import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisPaymentListPageAsync import com.tryfinch.api.models.HrisPaymentListParams import com.tryfinch.api.models.Payment @@ -38,7 +38,7 @@ class PaymentServiceAsyncImpl internal constructor(private val clientOptions: Cl class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : PaymentServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler> = jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt index f6115eed..3c10a2e7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.hris.benefits import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisBenefitIndividualEnrolledIdsParams import com.tryfinch.api.models.HrisBenefitIndividualRetrieveManyBenefitsPageAsync import com.tryfinch.api.models.HrisBenefitIndividualRetrieveManyBenefitsParams @@ -58,7 +58,7 @@ class IndividualServiceAsyncImpl internal constructor(private val clientOptions: class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : IndividualServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val enrolledIdsHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt index 3c0e3bb9..486c207e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.jobs import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.AutomatedAsyncJob import com.tryfinch.api.models.AutomatedCreateResponse import com.tryfinch.api.models.AutomatedListResponse @@ -56,7 +56,7 @@ class AutomatedServiceAsyncImpl internal constructor(private val clientOptions: class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : AutomatedServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt index e5ab8fe0..29425dfd 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.jobs import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.JobManualRetrieveParams import com.tryfinch.api.models.ManualAsyncJob import java.util.concurrent.CompletableFuture @@ -37,7 +37,7 @@ class ManualServiceAsyncImpl internal constructor(private val clientOptions: Cli class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : ManualServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt index 3e0af2ea..e293c454 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.payroll import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.PayGroupListResponse import com.tryfinch.api.models.PayGroupRetrieveResponse import com.tryfinch.api.models.PayrollPayGroupListPageAsync @@ -47,7 +47,7 @@ class PayGroupServiceAsyncImpl internal constructor(private val clientOptions: C class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : PayGroupServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt index c30cd494..bb6bd71a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.sandbox import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.CompanyUpdateResponse import com.tryfinch.api.models.SandboxCompanyUpdateParams import java.util.concurrent.CompletableFuture @@ -38,7 +38,7 @@ class CompanyServiceAsyncImpl internal constructor(private val clientOptions: Cl class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : CompanyServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt index 8788f49f..25170227 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.sandbox import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.ConnectionCreateResponse import com.tryfinch.api.models.SandboxConnectionCreateParams import com.tryfinch.api.services.async.sandbox.connections.AccountServiceAsync @@ -44,7 +44,7 @@ class ConnectionServiceAsyncImpl internal constructor(private val clientOptions: class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : ConnectionServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val accounts: AccountServiceAsync.WithRawResponse by lazy { AccountServiceAsyncImpl.WithRawResponseImpl(clientOptions) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt index af048b65..6da02916 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.sandbox import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.DirectoryCreateResponse import com.tryfinch.api.models.SandboxDirectoryCreateParams import java.util.concurrent.CompletableFuture @@ -38,7 +38,7 @@ class DirectoryServiceAsyncImpl internal constructor(private val clientOptions: class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : DirectoryServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler> = jsonHandler>(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt index 81ab3634..212d7652 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.sandbox import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.EmploymentUpdateResponse import com.tryfinch.api.models.SandboxEmploymentUpdateParams import java.util.concurrent.CompletableFuture @@ -38,7 +38,7 @@ class EmploymentServiceAsyncImpl internal constructor(private val clientOptions: class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : EmploymentServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt index e684cfbb..7cdca716 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.sandbox import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.IndividualUpdateResponse import com.tryfinch.api.models.SandboxIndividualUpdateParams import java.util.concurrent.CompletableFuture @@ -38,7 +38,7 @@ class IndividualServiceAsyncImpl internal constructor(private val clientOptions: class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : IndividualServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt index 429a1aaa..cbb5ae24 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.sandbox import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.JobCreateResponse import com.tryfinch.api.models.SandboxJobCreateParams import com.tryfinch.api.services.async.sandbox.jobs.ConfigurationServiceAsync @@ -46,7 +46,7 @@ class JobServiceAsyncImpl internal constructor(private val clientOptions: Client class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : JobServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val configuration: ConfigurationServiceAsync.WithRawResponse by lazy { ConfigurationServiceAsyncImpl.WithRawResponseImpl(clientOptions) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt index 50278e61..6f4667da 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.sandbox import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.PaymentCreateResponse import com.tryfinch.api.models.SandboxPaymentCreateParams import java.util.concurrent.CompletableFuture @@ -38,7 +38,7 @@ class PaymentServiceAsyncImpl internal constructor(private val clientOptions: Cl class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : PaymentServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt index 5c1d24c3..5f788805 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.sandbox.connections import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.AccountCreateResponse import com.tryfinch.api.models.AccountUpdateResponse import com.tryfinch.api.models.SandboxConnectionAccountCreateParams @@ -47,7 +47,7 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : AccountServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt index d9ba55aa..4002444e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.async.sandbox.jobs import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.SandboxJobConfiguration import com.tryfinch.api.models.SandboxJobConfigurationRetrieveParams import com.tryfinch.api.models.SandboxJobConfigurationUpdateParams @@ -46,7 +46,7 @@ class ConfigurationServiceAsyncImpl internal constructor(private val clientOptio class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : ConfigurationServiceAsync.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val retrieveHandler: Handler> = jsonHandler>(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt index a14fc7e5..40a41b0d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.errors.FinchException import com.tryfinch.api.models.AccessTokenCreateParams import com.tryfinch.api.models.CreateAccessTokenResponse @@ -39,7 +39,7 @@ class AccessTokenServiceImpl internal constructor(private val clientOptions: Cli class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : AccessTokenService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt index 5cfc5591..84261e55 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.AccountDisconnectParams import com.tryfinch.api.models.AccountIntrospectParams import com.tryfinch.api.models.DisconnectResponse @@ -46,7 +46,7 @@ class AccountServiceImpl internal constructor(private val clientOptions: ClientO class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : AccountService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val disconnectHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt index 86a84fe3..ccfb0392 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.Provider import com.tryfinch.api.models.ProviderListPage import com.tryfinch.api.models.ProviderListParams @@ -37,7 +37,7 @@ class ProviderServiceImpl internal constructor(private val clientOptions: Client class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : ProviderService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler> = jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt index 874c63ad..f68e8ce7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.RequestForwardingForwardParams import com.tryfinch.api.models.RequestForwardingForwardResponse @@ -37,7 +37,7 @@ class RequestForwardingServiceImpl internal constructor(private val clientOption class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : RequestForwardingService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val forwardHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/WebhookServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/WebhookServiceImpl.kt index 3ddd9b12..88069c27 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/WebhookServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/WebhookServiceImpl.kt @@ -5,10 +5,7 @@ package com.tryfinch.api.services.blocking import com.fasterxml.jackson.core.JsonProcessingException import com.tryfinch.api.core.ClientOptions import com.tryfinch.api.core.getRequiredHeader -import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.http.Headers -import com.tryfinch.api.core.http.HttpResponse.Handler -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.errors.FinchException import com.tryfinch.api.models.WebhookEvent import java.security.MessageDigest @@ -22,8 +19,6 @@ import kotlin.jvm.optionals.getOrNull class WebhookServiceImpl internal constructor(private val clientOptions: ClientOptions) : WebhookService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - override fun unwrap(payload: String, headers: Headers, secret: String?): WebhookEvent { verifySignature(payload, headers, secret) return try { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt index 47105698..70986f09 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.connect import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.ConnectSessionNewParams import com.tryfinch.api.models.ConnectSessionReauthenticateParams import com.tryfinch.api.models.SessionNewResponse @@ -46,7 +46,7 @@ class SessionServiceImpl internal constructor(private val clientOptions: ClientO class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : SessionService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val newHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt index 987d5671..dc678dfd 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.hris import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.CompanyBenefit import com.tryfinch.api.models.CreateCompanyBenefitsResponse import com.tryfinch.api.models.HrisBenefitCreateParams @@ -80,7 +80,7 @@ class BenefitServiceImpl internal constructor(private val clientOptions: ClientO class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : BenefitService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val individuals: IndividualService.WithRawResponse by lazy { IndividualServiceImpl.WithRawResponseImpl(clientOptions) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt index d008d4eb..bbc9fcea 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.hris import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.Company import com.tryfinch.api.models.HrisCompanyRetrieveParams @@ -36,7 +36,7 @@ class CompanyServiceImpl internal constructor(private val clientOptions: ClientO class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : CompanyService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt index aefa05c7..f286831f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.hris import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisDirectoryListIndividualsPage import com.tryfinch.api.models.HrisDirectoryListIndividualsParams import com.tryfinch.api.models.HrisDirectoryListPage @@ -46,7 +46,7 @@ class DirectoryServiceImpl internal constructor(private val clientOptions: Clien class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : DirectoryService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt index 59088faa..8ddf997d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.hris import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.DocumentListResponse import com.tryfinch.api.models.DocumentRetreiveResponse import com.tryfinch.api.models.HrisDocumentListParams @@ -45,7 +45,7 @@ class DocumentServiceImpl internal constructor(private val clientOptions: Client class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : DocumentService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt index 068ed532..6f5c4811 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.hris import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisEmploymentRetrieveManyPage import com.tryfinch.api.models.HrisEmploymentRetrieveManyParams @@ -37,7 +37,7 @@ class EmploymentServiceImpl internal constructor(private val clientOptions: Clie class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : EmploymentService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val retrieveManyHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt index 134703fc..1eb3e10c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.hris import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisIndividualRetrieveManyPage import com.tryfinch.api.models.HrisIndividualRetrieveManyParams @@ -37,7 +37,7 @@ class IndividualServiceImpl internal constructor(private val clientOptions: Clie class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : IndividualService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val retrieveManyHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt index 70a23159..2f34f4c3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.hris import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisPayStatementRetrieveManyPage import com.tryfinch.api.models.HrisPayStatementRetrieveManyParams @@ -37,7 +37,7 @@ class PayStatementServiceImpl internal constructor(private val clientOptions: Cl class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : PayStatementService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val retrieveManyHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt index 0fc3e15a..2718c030 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.hris import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisPaymentListPage import com.tryfinch.api.models.HrisPaymentListParams import com.tryfinch.api.models.Payment @@ -37,7 +37,7 @@ class PaymentServiceImpl internal constructor(private val clientOptions: ClientO class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : PaymentService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler> = jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt index 8e240552..34bf610b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.hris.benefits import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisBenefitIndividualEnrolledIdsParams import com.tryfinch.api.models.HrisBenefitIndividualRetrieveManyBenefitsPage import com.tryfinch.api.models.HrisBenefitIndividualRetrieveManyBenefitsParams @@ -57,7 +57,7 @@ class IndividualServiceImpl internal constructor(private val clientOptions: Clie class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : IndividualService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val enrolledIdsHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt index d1155e2b..3d20fb5e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.jobs import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.AutomatedAsyncJob import com.tryfinch.api.models.AutomatedCreateResponse import com.tryfinch.api.models.AutomatedListResponse @@ -55,7 +55,7 @@ class AutomatedServiceImpl internal constructor(private val clientOptions: Clien class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : AutomatedService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt index 6f4424db..b055b8e6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.jobs import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.JobManualRetrieveParams import com.tryfinch.api.models.ManualAsyncJob @@ -36,7 +36,7 @@ class ManualServiceImpl internal constructor(private val clientOptions: ClientOp class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : ManualService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt index f81dbc3b..92c6cbcc 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.payroll import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -13,7 +14,6 @@ import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.PayGroupListResponse import com.tryfinch.api.models.PayGroupRetrieveResponse import com.tryfinch.api.models.PayrollPayGroupListPage @@ -46,7 +46,7 @@ class PayGroupServiceImpl internal constructor(private val clientOptions: Client class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : PayGroupService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt index 9be8246e..6289d961 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.sandbox import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.CompanyUpdateResponse import com.tryfinch.api.models.SandboxCompanyUpdateParams @@ -37,7 +37,7 @@ class CompanyServiceImpl internal constructor(private val clientOptions: ClientO class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : CompanyService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt index 9efd11c8..18e96822 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.sandbox import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.ConnectionCreateResponse import com.tryfinch.api.models.SandboxConnectionCreateParams import com.tryfinch.api.services.blocking.sandbox.connections.AccountService @@ -43,7 +43,7 @@ class ConnectionServiceImpl internal constructor(private val clientOptions: Clie class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : ConnectionService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val accounts: AccountService.WithRawResponse by lazy { AccountServiceImpl.WithRawResponseImpl(clientOptions) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt index 834ea170..41ad5a2f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.sandbox import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.DirectoryCreateResponse import com.tryfinch.api.models.SandboxDirectoryCreateParams @@ -37,7 +37,7 @@ class DirectoryServiceImpl internal constructor(private val clientOptions: Clien class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : DirectoryService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler> = jsonHandler>(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt index 9345aa08..da766444 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.sandbox import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.EmploymentUpdateResponse import com.tryfinch.api.models.SandboxEmploymentUpdateParams @@ -37,7 +37,7 @@ class EmploymentServiceImpl internal constructor(private val clientOptions: Clie class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : EmploymentService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt index 9968c497..0570df24 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.sandbox import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.IndividualUpdateResponse import com.tryfinch.api.models.SandboxIndividualUpdateParams @@ -37,7 +37,7 @@ class IndividualServiceImpl internal constructor(private val clientOptions: Clie class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : IndividualService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt index 1919ba6e..5a01752f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.sandbox import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.JobCreateResponse import com.tryfinch.api.models.SandboxJobCreateParams import com.tryfinch.api.services.blocking.sandbox.jobs.ConfigurationService @@ -44,7 +44,7 @@ class JobServiceImpl internal constructor(private val clientOptions: ClientOptio class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : JobService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val configuration: ConfigurationService.WithRawResponse by lazy { ConfigurationServiceImpl.WithRawResponseImpl(clientOptions) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt index 1fa0d6fa..efcd8f16 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.sandbox import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.PaymentCreateResponse import com.tryfinch.api.models.SandboxPaymentCreateParams @@ -37,7 +37,7 @@ class PaymentServiceImpl internal constructor(private val clientOptions: ClientO class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : PaymentService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt index 6603e97c..12f7aeb6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.sandbox.connections import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.AccountCreateResponse import com.tryfinch.api.models.AccountUpdateResponse import com.tryfinch.api.models.SandboxConnectionAccountCreateParams @@ -46,7 +46,7 @@ class AccountServiceImpl internal constructor(private val clientOptions: ClientO class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : AccountService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt index 7af28ebd..ce53138b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.services.blocking.sandbox.jobs import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.handlers.errorHandler import com.tryfinch.api.core.handlers.jsonHandler @@ -14,7 +15,6 @@ import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.core.http.json import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.SandboxJobConfiguration import com.tryfinch.api.models.SandboxJobConfigurationRetrieveParams import com.tryfinch.api.models.SandboxJobConfigurationUpdateParams @@ -45,7 +45,7 @@ class ConfigurationServiceImpl internal constructor(private val clientOptions: C class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : ConfigurationService.WithRawResponse { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val retrieveHandler: Handler> = jsonHandler>(clientOptions.jsonMapper) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ErrorHandlingTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ErrorHandlingTest.kt index 601cb6f4..59b76d6a 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ErrorHandlingTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ErrorHandlingTest.kt @@ -14,7 +14,6 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.jsonMapper import com.tryfinch.api.errors.BadRequestException -import com.tryfinch.api.errors.FinchError import com.tryfinch.api.errors.FinchException import com.tryfinch.api.errors.InternalServerException import com.tryfinch.api.errors.NotFoundException @@ -34,12 +33,9 @@ internal class ErrorHandlingTest { companion object { - private val ERROR: FinchError = - FinchError.builder() - .putAdditionalProperty("errorProperty", JsonValue.from("42")) - .build() + private val ERROR_JSON: JsonValue = JsonValue.from(mapOf("errorProperty" to "42")) - private val ERROR_JSON: ByteArray = jsonMapper().writeValueAsBytes(ERROR) + private val ERROR_JSON_BYTES: ByteArray = jsonMapper().writeValueAsBytes(ERROR_JSON) private const val HEADER_NAME: String = "Error-Header" @@ -64,14 +60,16 @@ internal class ErrorHandlingTest { val companyService = client.hris().company() stubFor( get(anyUrl()) - .willReturn(status(400).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) + .willReturn( + status(400).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON_BYTES) + ) ) val e = assertThrows { companyService.retrieve() } assertThat(e.statusCode()).isEqualTo(400) - assertThat(e.error()).isEqualTo(ERROR) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + assertThat(e.body()).isEqualTo(ERROR_JSON) } @Test @@ -79,14 +77,16 @@ internal class ErrorHandlingTest { val companyService = client.hris().company() stubFor( get(anyUrl()) - .willReturn(status(401).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) + .willReturn( + status(401).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON_BYTES) + ) ) val e = assertThrows { companyService.retrieve() } assertThat(e.statusCode()).isEqualTo(401) - assertThat(e.error()).isEqualTo(ERROR) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + assertThat(e.body()).isEqualTo(ERROR_JSON) } @Test @@ -94,14 +94,16 @@ internal class ErrorHandlingTest { val companyService = client.hris().company() stubFor( get(anyUrl()) - .willReturn(status(403).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) + .willReturn( + status(403).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON_BYTES) + ) ) val e = assertThrows { companyService.retrieve() } assertThat(e.statusCode()).isEqualTo(403) - assertThat(e.error()).isEqualTo(ERROR) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + assertThat(e.body()).isEqualTo(ERROR_JSON) } @Test @@ -109,14 +111,16 @@ internal class ErrorHandlingTest { val companyService = client.hris().company() stubFor( get(anyUrl()) - .willReturn(status(404).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) + .willReturn( + status(404).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON_BYTES) + ) ) val e = assertThrows { companyService.retrieve() } assertThat(e.statusCode()).isEqualTo(404) - assertThat(e.error()).isEqualTo(ERROR) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + assertThat(e.body()).isEqualTo(ERROR_JSON) } @Test @@ -124,14 +128,16 @@ internal class ErrorHandlingTest { val companyService = client.hris().company() stubFor( get(anyUrl()) - .willReturn(status(422).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) + .willReturn( + status(422).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON_BYTES) + ) ) val e = assertThrows { companyService.retrieve() } assertThat(e.statusCode()).isEqualTo(422) - assertThat(e.error()).isEqualTo(ERROR) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + assertThat(e.body()).isEqualTo(ERROR_JSON) } @Test @@ -139,14 +145,16 @@ internal class ErrorHandlingTest { val companyService = client.hris().company() stubFor( get(anyUrl()) - .willReturn(status(429).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) + .willReturn( + status(429).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON_BYTES) + ) ) val e = assertThrows { companyService.retrieve() } assertThat(e.statusCode()).isEqualTo(429) - assertThat(e.error()).isEqualTo(ERROR) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + assertThat(e.body()).isEqualTo(ERROR_JSON) } @Test @@ -154,14 +162,16 @@ internal class ErrorHandlingTest { val companyService = client.hris().company() stubFor( get(anyUrl()) - .willReturn(status(500).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) + .willReturn( + status(500).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON_BYTES) + ) ) val e = assertThrows { companyService.retrieve() } assertThat(e.statusCode()).isEqualTo(500) - assertThat(e.error()).isEqualTo(ERROR) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + assertThat(e.body()).isEqualTo(ERROR_JSON) } @Test @@ -169,14 +179,16 @@ internal class ErrorHandlingTest { val companyService = client.hris().company() stubFor( get(anyUrl()) - .willReturn(status(999).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON)) + .willReturn( + status(999).withHeader(HEADER_NAME, HEADER_VALUE).withBody(ERROR_JSON_BYTES) + ) ) val e = assertThrows { companyService.retrieve() } assertThat(e.statusCode()).isEqualTo(999) - assertThat(e.error()).isEqualTo(ERROR) assertThat(e.headers().toMap()).contains(entry(HEADER_NAME, listOf(HEADER_VALUE))) + assertThat(e.body()).isEqualTo(ERROR_JSON) } @Test From f0417a891f12e01d7040af3ccb07e13f07ca8034 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 20 Mar 2025 20:41:09 +0000 Subject: [PATCH 35/65] docs: refine comments on multipart params (#507) chore(internal): make multipart assertions more robust chore(internal): remove unnecessary `assertNotNull` calls --- .../com/tryfinch/api/core/http/HttpRequestBodies.kt | 11 +++++------ .../api/models/AccessTokenCreateParamsTest.kt | 3 --- .../api/models/ConnectSessionNewParamsTest.kt | 3 --- .../models/ConnectSessionReauthenticateParamsTest.kt | 3 --- .../api/models/HrisBenefitCreateParamsTest.kt | 4 ---- .../HrisBenefitIndividualUnenrollManyParamsTest.kt | 4 ---- .../api/models/HrisBenefitUpdateParamsTest.kt | 4 ---- .../models/HrisEmploymentRetrieveManyParamsTest.kt | 2 -- .../models/HrisIndividualRetrieveManyParamsTest.kt | 4 ---- .../models/HrisPayStatementRetrieveManyParamsTest.kt | 3 --- .../api/models/RequestForwardingForwardParamsTest.kt | 3 --- .../api/models/SandboxCompanyUpdateParamsTest.kt | 3 --- .../SandboxConnectionAccountCreateParamsTest.kt | 3 --- .../SandboxConnectionAccountUpdateParamsTest.kt | 4 ---- .../api/models/SandboxConnectionCreateParamsTest.kt | 3 --- .../api/models/SandboxEmploymentUpdateParamsTest.kt | 4 ---- .../api/models/SandboxIndividualUpdateParamsTest.kt | 4 ---- .../tryfinch/api/models/SandboxJobCreateParamsTest.kt | 2 -- .../api/models/SandboxPaymentCreateParamsTest.kt | 4 ---- 19 files changed, 5 insertions(+), 66 deletions(-) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpRequestBodies.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpRequestBodies.kt index 310010fb..9aee7f83 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpRequestBodies.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpRequestBodies.kt @@ -9,7 +9,6 @@ import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.databind.node.JsonNodeType import com.tryfinch.api.core.MultipartField import com.tryfinch.api.errors.FinchInvalidDataException -import java.io.ByteArrayInputStream import java.io.InputStream import java.io.OutputStream import kotlin.jvm.optionals.getOrNull @@ -74,12 +73,12 @@ internal fun multipartFormData( when (node.nodeType) { JsonNodeType.MISSING, JsonNodeType.NULL -> emptySequence() - JsonNodeType.BINARY -> sequenceOf(name to ByteArrayInputStream(node.binaryValue())) - JsonNodeType.STRING -> sequenceOf(name to node.textValue().toInputStream()) + JsonNodeType.BINARY -> sequenceOf(name to node.binaryValue().inputStream()) + JsonNodeType.STRING -> sequenceOf(name to node.textValue().inputStream()) JsonNodeType.BOOLEAN -> - sequenceOf(name to node.booleanValue().toString().toInputStream()) + sequenceOf(name to node.booleanValue().toString().inputStream()) JsonNodeType.NUMBER -> - sequenceOf(name to node.numberValue().toString().toInputStream()) + sequenceOf(name to node.numberValue().toString().inputStream()) JsonNodeType.ARRAY -> node.elements().asSequence().flatMap { element -> serializePart("$name[]", element) @@ -93,7 +92,7 @@ internal fun multipartFormData( throw FinchInvalidDataException("Unexpected JsonNode type: ${node.nodeType}") } - private fun String.toInputStream(): InputStream = ByteArrayInputStream(toByteArray()) + private fun String.inputStream(): InputStream = toByteArray().inputStream() override fun writeTo(outputStream: OutputStream) = entity.writeTo(outputStream) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccessTokenCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccessTokenCreateParamsTest.kt index c1305e02..f1b2d6f2 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccessTokenCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccessTokenCreateParamsTest.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -30,7 +29,6 @@ internal class AccessTokenCreateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.code()).isEqualTo("") assertThat(body.clientId()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(body.clientSecret()).contains("") @@ -43,7 +41,6 @@ internal class AccessTokenCreateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.code()).isEqualTo("") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt index 5a12d548..548a1249 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -50,7 +49,6 @@ internal class ConnectSessionNewParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.customerId()).isEqualTo("x") assertThat(body.customerName()).isEqualTo("x") assertThat(body.products()).containsExactly(ConnectSessionNewParams.ConnectProducts.COMPANY) @@ -79,7 +77,6 @@ internal class ConnectSessionNewParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.customerId()).isEqualTo("x") assertThat(body.customerName()).isEqualTo("x") assertThat(body.products()).containsExactly(ConnectSessionNewParams.ConnectProducts.COMPANY) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt index cb84c475..f4604548 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt @@ -3,7 +3,6 @@ package com.tryfinch.api.models import kotlin.jvm.optionals.getOrNull -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -31,7 +30,6 @@ internal class ConnectSessionReauthenticateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.connectionId()).isEqualTo("connection_id") assertThat(body.minutesToExpire()).contains(0L) assertThat(body.products().getOrNull()) @@ -46,7 +44,6 @@ internal class ConnectSessionReauthenticateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.connectionId()).isEqualTo("connection_id") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitCreateParamsTest.kt index 2ab7eacd..fea44e47 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitCreateParamsTest.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -28,7 +27,6 @@ internal class HrisBenefitCreateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.description()).contains("description") assertThat(body.frequency()).contains(BenefitFrequency.ONE_TIME) assertThat(body.type()).contains(BenefitType._401K) @@ -39,7 +37,5 @@ internal class HrisBenefitCreateParamsTest { val params = HrisBenefitCreateParams.builder().build() val body = params._body() - - assertNotNull(body) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt index 27c31e2f..ee438af1 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt @@ -3,7 +3,6 @@ package com.tryfinch.api.models import kotlin.jvm.optionals.getOrNull -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -37,7 +36,6 @@ internal class HrisBenefitIndividualUnenrollManyParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.individualIds().getOrNull()).containsExactly("string") } @@ -47,7 +45,5 @@ internal class HrisBenefitIndividualUnenrollManyParamsTest { HrisBenefitIndividualUnenrollManyParams.builder().benefitId("benefit_id").build() val body = params._body() - - assertNotNull(body) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt index c6a378b6..d2c29113 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -32,7 +31,6 @@ internal class HrisBenefitUpdateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.description()).contains("description") } @@ -41,7 +39,5 @@ internal class HrisBenefitUpdateParamsTest { val params = HrisBenefitUpdateParams.builder().benefitId("benefit_id").build() val body = params._body() - - assertNotNull(body) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParamsTest.kt index 4db05d13..89232ae6 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParamsTest.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -32,7 +31,6 @@ internal class HrisEmploymentRetrieveManyParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.requests()) .containsExactly( HrisEmploymentRetrieveManyParams.Request.builder() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt index 9680f11c..141495c8 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt @@ -3,7 +3,6 @@ package com.tryfinch.api.models import kotlin.jvm.optionals.getOrNull -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -39,7 +38,6 @@ internal class HrisIndividualRetrieveManyParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.options()) .contains( HrisIndividualRetrieveManyParams.Options.builder().addInclude("string").build() @@ -57,7 +55,5 @@ internal class HrisIndividualRetrieveManyParamsTest { val params = HrisIndividualRetrieveManyParams.builder().build() val body = params._body() - - assertNotNull(body) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt index 7c83fa05..5162d787 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -36,7 +35,6 @@ internal class HrisPayStatementRetrieveManyParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.requests()) .containsExactly( HrisPayStatementRetrieveManyParams.Request.builder() @@ -58,7 +56,6 @@ internal class HrisPayStatementRetrieveManyParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.requests()) .containsExactly( HrisPayStatementRetrieveManyParams.Request.builder().paymentId("string").build() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardParamsTest.kt index accc9d4c..38808fb4 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardParamsTest.kt @@ -3,7 +3,6 @@ package com.tryfinch.api.models import com.tryfinch.api.core.JsonValue -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -33,7 +32,6 @@ internal class RequestForwardingForwardParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.method()).isEqualTo("POST") assertThat(body.route()).isEqualTo("/people/search") assertThat(body.data()).isEmpty @@ -50,7 +48,6 @@ internal class RequestForwardingForwardParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.method()).isEqualTo("POST") assertThat(body.route()).isEqualTo("/people/search") } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt index f78f02fe..f14348ef 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt @@ -3,7 +3,6 @@ package com.tryfinch.api.models import kotlin.jvm.optionals.getOrNull -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -103,7 +102,6 @@ internal class SandboxCompanyUpdateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.accounts().getOrNull()) .containsExactly( SandboxCompanyUpdateParams.Account.builder() @@ -165,7 +163,6 @@ internal class SandboxCompanyUpdateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.accounts().getOrNull()) .containsExactly(SandboxCompanyUpdateParams.Account.builder().build()) assertThat(body.departments().getOrNull()) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt index e35c118d..7c96bfa4 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt @@ -3,7 +3,6 @@ package com.tryfinch.api.models import kotlin.jvm.optionals.getOrNull -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -33,7 +32,6 @@ internal class SandboxConnectionAccountCreateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.companyId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(body.providerId()).isEqualTo("provider_id") assertThat(body.authenticationType()) @@ -51,7 +49,6 @@ internal class SandboxConnectionAccountCreateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.companyId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(body.providerId()).isEqualTo("provider_id") } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt index 925e24fa..f7037d5f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -24,7 +23,6 @@ internal class SandboxConnectionAccountUpdateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.connectionStatus()).contains(ConnectionStatusType.PENDING) } @@ -33,7 +31,5 @@ internal class SandboxConnectionAccountUpdateParamsTest { val params = SandboxConnectionAccountUpdateParams.builder().build() val body = params._body() - - assertNotNull(body) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt index 205ff0e3..86e80f36 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt @@ -3,7 +3,6 @@ package com.tryfinch.api.models import kotlin.jvm.optionals.getOrNull -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -31,7 +30,6 @@ internal class SandboxConnectionCreateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.providerId()).isEqualTo("provider_id") assertThat(body.authenticationType()) .contains(SandboxConnectionCreateParams.AuthenticationType.CREDENTIAL) @@ -45,7 +43,6 @@ internal class SandboxConnectionCreateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.providerId()).isEqualTo("provider_id") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt index 36f7b736..09a821d3 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt @@ -4,7 +4,6 @@ package com.tryfinch.api.models import com.tryfinch.api.core.JsonValue import kotlin.jvm.optionals.getOrNull -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -141,7 +140,6 @@ internal class SandboxEmploymentUpdateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.classCode()).contains("class_code") assertThat(body.customFields().getOrNull()) .containsExactly( @@ -210,7 +208,5 @@ internal class SandboxEmploymentUpdateParamsTest { val params = SandboxEmploymentUpdateParams.builder().individualId("individual_id").build() val body = params._body() - - assertNotNull(body) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt index 2b08d7a5..65df3b36 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt @@ -3,7 +3,6 @@ package com.tryfinch.api.models import kotlin.jvm.optionals.getOrNull -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -100,7 +99,6 @@ internal class SandboxIndividualUpdateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.dob()).contains("dob") assertThat(body.emails().getOrNull()) .containsExactly( @@ -144,7 +142,5 @@ internal class SandboxIndividualUpdateParamsTest { val params = SandboxIndividualUpdateParams.builder().individualId("individual_id").build() val body = params._body() - - assertNotNull(body) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobCreateParamsTest.kt index ee23e077..f26c5c11 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobCreateParamsTest.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -20,7 +19,6 @@ internal class SandboxJobCreateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.type()).isEqualTo(SandboxJobCreateParams.Type.DATA_SYNC_ALL) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt index 149781a2..68ea6c51 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt @@ -4,7 +4,6 @@ package com.tryfinch.api.models import com.tryfinch.api.core.JsonValue import kotlin.jvm.optionals.getOrNull -import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -313,7 +312,6 @@ internal class SandboxPaymentCreateParamsTest { val body = params._body() - assertNotNull(body) assertThat(body.endDate()).contains("end_date") assertThat(body.payStatements().getOrNull()) .containsExactly( @@ -464,7 +462,5 @@ internal class SandboxPaymentCreateParamsTest { val params = SandboxPaymentCreateParams.builder().build() val body = params._body() - - assertNotNull(body) } } From 89c25c19eca3db5ef766e64e605291d6dad69d05 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 21 Mar 2025 15:33:52 +0000 Subject: [PATCH 36/65] chore(internal): fix example formatting (#508) --- finch-java-example/build.gradle.kts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/finch-java-example/build.gradle.kts b/finch-java-example/build.gradle.kts index cd8a4220..bfcda061 100644 --- a/finch-java-example/build.gradle.kts +++ b/finch-java-example/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("java") + id("finch.java") application } @@ -11,10 +11,9 @@ dependencies { implementation(project(":finch-java")) } -java { +tasks.withType().configureEach { // Allow using more modern APIs, like `List.of` and `Map.of`, in examples. - sourceCompatibility = JavaVersion.VERSION_1_9 - targetCompatibility = JavaVersion.VERSION_1_9 + options.release.set(9) } application { From 4b12e6826583668726201f446ccb63bd4e97d51c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 21 Mar 2025 17:01:54 +0000 Subject: [PATCH 37/65] chore(internal): remove unnecessary import (#509) --- .../src/main/kotlin/com/tryfinch/api/core/http/HttpResponse.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpResponse.kt index ad9844e8..055286f6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpResponse.kt @@ -1,7 +1,8 @@ +// File generated from our OpenAPI spec by Stainless. + package com.tryfinch.api.core.http import java.io.InputStream -import java.lang.AutoCloseable interface HttpResponse : AutoCloseable { From 949341a607502df838f4c062d4a4afaaa4bdf2b8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 21 Mar 2025 21:12:24 +0000 Subject: [PATCH 38/65] docs: update readme exception docs (#510) --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index dedb27ab..de0cc3a6 100644 --- a/README.md +++ b/README.md @@ -199,16 +199,16 @@ The SDK throws custom unchecked exception types: - [`FinchServiceException`](finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code: - | Status | Exception | - | ------ | ------------------------------- | - | 400 | `BadRequestException` | - | 401 | `AuthenticationException` | - | 403 | `PermissionDeniedException` | - | 404 | `NotFoundException` | - | 422 | `UnprocessableEntityException` | - | 429 | `RateLimitException` | - | 5xx | `InternalServerException` | - | others | `UnexpectedStatusCodeException` | + | Status | Exception | + | ------ | --------------------------------------------------------------------------------------------------------------------------- | + | 400 | [`BadRequestException`](finch-java-core/src/main/kotlin/com/tryfinch/api/errors/BadRequestException.kt) | + | 401 | [`UnauthorizedException`](finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnauthorizedException.kt) | + | 403 | [`PermissionDeniedException`](finch-java-core/src/main/kotlin/com/tryfinch/api/errors/PermissionDeniedException.kt) | + | 404 | [`NotFoundException`](finch-java-core/src/main/kotlin/com/tryfinch/api/errors/NotFoundException.kt) | + | 422 | [`UnprocessableEntityException`](finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnprocessableEntityException.kt) | + | 429 | [`RateLimitException`](finch-java-core/src/main/kotlin/com/tryfinch/api/errors/RateLimitException.kt) | + | 5xx | [`InternalServerException`](finch-java-core/src/main/kotlin/com/tryfinch/api/errors/InternalServerException.kt) | + | others | [`UnexpectedStatusCodeException`](finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnexpectedStatusCodeException.kt) | - [`FinchIoException`](finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchIoException.kt): I/O networking errors. From 12e8d474f44c2e32c74eed6beb57a8fa2080de03 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 21 Mar 2025 21:29:42 +0000 Subject: [PATCH 39/65] docs: minor readme tweak (#511) --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index de0cc3a6..72ced69a 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ -The Finch Java SDK provides convenient access to the Finch REST API from applications written in Java. +The Finch Java SDK provides convenient access to the [Finch REST API](https://developer.tryfinch.com/) from applications written in Java. The Finch Java SDK is similar to the Finch Kotlin SDK but with minor differences that make it more ergonomic for use in Java, such as `Optional` instead of nullable values, `Stream` instead of `Sequence`, and `CompletableFuture` instead of suspend functions. @@ -33,9 +33,9 @@ implementation("com.tryfinch.api:finch-java:4.2.0") ```xml - com.tryfinch.api - finch-java - 4.2.0 + com.tryfinch.api + finch-java + 4.2.0 ``` From 289701192191a42ca4f28eabb6ac73651f7d9909 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 25 Mar 2025 05:36:17 +0000 Subject: [PATCH 40/65] feat(client): support a lower jackson version (#512) feat(client): throw on incompatible jackson version --- .../api/client/okhttp/FinchOkHttpClient.kt | 11 + .../client/okhttp/FinchOkHttpClientAsync.kt | 11 + finch-java-core/build.gradle.kts | 13 + .../kotlin/com/tryfinch/api/core/Check.kt | 46 + .../com/tryfinch/api/core/ClientOptions.kt | 14 + .../com/tryfinch/api/core/ObjectMappers.kt | 54 +- .../kotlin/com/tryfinch/api/core/Values.kt | 20 +- .../tryfinch/api/core/handlers/JsonHandler.kt | 4 +- .../api/errors/BadRequestException.kt | 4 +- .../tryfinch/api/errors/NotFoundException.kt | 4 +- .../api/errors/PermissionDeniedException.kt | 4 +- .../tryfinch/api/errors/RateLimitException.kt | 4 +- .../api/errors/UnauthorizedException.kt | 4 +- .../errors/UnprocessableEntityException.kt | 4 +- .../api/models/AccessTokenCreateParams.kt | 498 +-- .../api/models/AccountCreateResponse.kt | 109 +- .../api/models/AccountDisconnectParams.kt | 35 +- .../api/models/AccountIntrospectParams.kt | 10 +- .../tryfinch/api/models/AccountUpdateEvent.kt | 2867 ++++++++++------- .../api/models/AccountUpdateResponse.kt | 99 +- .../tryfinch/api/models/AutomatedAsyncJob.kt | 168 +- .../api/models/AutomatedCreateResponse.kt | 72 +- .../api/models/AutomatedListResponse.kt | 206 +- .../tryfinch/api/models/BaseWebhookEvent.kt | 65 +- .../api/models/BenefitContribution.kt | 52 +- .../models/BenefitFeaturesAndOperations.kt | 170 +- .../tryfinch/api/models/BenefitsSupport.kt | 164 +- .../kotlin/com/tryfinch/api/models/Company.kt | 362 ++- .../com/tryfinch/api/models/CompanyBenefit.kt | 74 +- .../com/tryfinch/api/models/CompanyEvent.kt | 130 +- .../api/models/CompanyUpdateResponse.kt | 356 +- .../api/models/ConnectSessionNewParams.kt | 1308 ++++---- .../ConnectSessionReauthenticateParams.kt | 795 ++--- .../api/models/ConnectionCreateResponse.kt | 117 +- .../api/models/CreateAccessTokenResponse.kt | 137 +- .../models/CreateCompanyBenefitsResponse.kt | 49 +- .../api/models/DirectoryCreateResponse.kt | 42 +- .../com/tryfinch/api/models/DirectoryEvent.kt | 141 +- .../tryfinch/api/models/DisconnectResponse.kt | 49 +- .../api/models/DocumentListResponse.kt | 57 +- .../tryfinch/api/models/DocumentResponse.kt | 71 +- .../com/tryfinch/api/models/EmploymentData.kt | 403 ++- .../api/models/EmploymentDataResponse.kt | 63 +- .../tryfinch/api/models/EmploymentEvent.kt | 141 +- .../api/models/EmploymentUpdateResponse.kt | 395 ++- .../tryfinch/api/models/EnrolledIndividual.kt | 123 +- .../api/models/HrisBenefitCreateParams.kt | 431 +-- .../HrisBenefitIndividualEnrolledIdsParams.kt | 22 +- ...nefitIndividualRetrieveManyBenefitsPage.kt | 30 +- ...IndividualRetrieveManyBenefitsPageAsync.kt | 30 +- ...fitIndividualRetrieveManyBenefitsParams.kt | 34 +- .../HrisBenefitIndividualUnenrollManyPage.kt | 30 +- ...sBenefitIndividualUnenrollManyPageAsync.kt | 30 +- ...HrisBenefitIndividualUnenrollManyParams.kt | 318 +- .../api/models/HrisBenefitListPage.kt | 30 +- .../api/models/HrisBenefitListPageAsync.kt | 30 +- .../api/models/HrisBenefitListParams.kt | 10 +- .../HrisBenefitListSupportedBenefitsPage.kt | 30 +- ...isBenefitListSupportedBenefitsPageAsync.kt | 30 +- .../HrisBenefitListSupportedBenefitsParams.kt | 10 +- .../api/models/HrisBenefitRetrieveParams.kt | 22 +- .../api/models/HrisBenefitUpdateParams.kt | 283 +- .../api/models/HrisCompanyRetrieveParams.kt | 10 +- .../HrisDirectoryListIndividualsPage.kt | 34 +- .../HrisDirectoryListIndividualsPageAsync.kt | 34 +- .../HrisDirectoryListIndividualsParams.kt | 24 +- .../api/models/HrisDirectoryListPage.kt | 34 +- .../api/models/HrisDirectoryListPageAsync.kt | 34 +- .../api/models/HrisDirectoryListParams.kt | 24 +- .../api/models/HrisDocumentListParams.kt | 28 +- .../api/models/HrisDocumentRetreiveParams.kt | 22 +- .../models/HrisEmploymentRetrieveManyPage.kt | 31 +- .../HrisEmploymentRetrieveManyPageAsync.kt | 31 +- .../HrisEmploymentRetrieveManyParams.kt | 376 +-- .../models/HrisIndividualRetrieveManyPage.kt | 31 +- .../HrisIndividualRetrieveManyPageAsync.kt | 31 +- .../HrisIndividualRetrieveManyParams.kt | 451 +-- .../HrisPayStatementRetrieveManyPage.kt | 31 +- .../HrisPayStatementRetrieveManyPageAsync.kt | 31 +- .../HrisPayStatementRetrieveManyParams.kt | 388 +-- .../api/models/HrisPaymentListPage.kt | 29 +- .../api/models/HrisPaymentListPageAsync.kt | 29 +- .../api/models/HrisPaymentListParams.kt | 24 +- .../kotlin/com/tryfinch/api/models/Income.kt | 68 +- .../com/tryfinch/api/models/Individual.kt | 255 +- .../tryfinch/api/models/IndividualBenefit.kt | 152 +- .../models/IndividualEnrolledIdsResponse.kt | 57 +- .../tryfinch/api/models/IndividualEvent.kt | 141 +- .../api/models/IndividualInDirectory.kt | 183 +- .../tryfinch/api/models/IndividualResponse.kt | 63 +- .../api/models/IndividualUpdateResponse.kt | 255 +- .../com/tryfinch/api/models/Introspection.kt | 367 ++- .../api/models/JobAutomatedCreateParams.kt | 478 +-- .../api/models/JobAutomatedListParams.kt | 24 +- .../api/models/JobAutomatedRetrieveParams.kt | 22 +- .../tryfinch/api/models/JobCompletionEvent.kt | 146 +- .../tryfinch/api/models/JobCreateResponse.kt | 72 +- .../api/models/JobManualRetrieveParams.kt | 22 +- .../com/tryfinch/api/models/Location.kt | 90 +- .../com/tryfinch/api/models/ManualAsyncJob.kt | 60 +- .../kotlin/com/tryfinch/api/models/Money.kt | 54 +- .../api/models/OperationSupportMatrix.kt | 82 +- .../kotlin/com/tryfinch/api/models/Paging.kt | 52 +- .../api/models/PayGroupListResponse.kt | 60 +- .../api/models/PayGroupRetrieveResponse.kt | 69 +- .../com/tryfinch/api/models/PayStatement.kt | 1012 +++--- .../tryfinch/api/models/PayStatementEvent.kt | 150 +- .../api/models/PayStatementResponse.kt | 63 +- .../api/models/PayStatementResponseBody.kt | 57 +- .../kotlin/com/tryfinch/api/models/Payment.kt | 206 +- .../api/models/PaymentCreateResponse.kt | 56 +- .../com/tryfinch/api/models/PaymentEvent.kt | 152 +- .../api/models/PayrollPayGroupListPage.kt | 30 +- .../models/PayrollPayGroupListPageAsync.kt | 30 +- .../api/models/PayrollPayGroupListParams.kt | 24 +- .../models/PayrollPayGroupRetrieveParams.kt | 22 +- .../com/tryfinch/api/models/Provider.kt | 2827 +++++++++------- .../tryfinch/api/models/ProviderListPage.kt | 29 +- .../api/models/ProviderListPageAsync.kt | 29 +- .../tryfinch/api/models/ProviderListParams.kt | 10 +- .../models/RequestForwardingForwardParams.kt | 525 +-- .../RequestForwardingForwardResponse.kt | 130 +- .../api/models/SandboxCompanyUpdateParams.kt | 1530 ++++----- .../SandboxConnectionAccountCreateParams.kt | 543 ++-- .../SandboxConnectionAccountUpdateParams.kt | 269 +- .../models/SandboxConnectionCreateParams.kt | 535 +-- .../models/SandboxDirectoryCreateParams.kt | 793 +++-- .../models/SandboxEmploymentUpdateParams.kt | 2271 ++++++------- .../models/SandboxIndividualUpdateParams.kt | 1661 +++++----- .../api/models/SandboxJobConfiguration.kt | 56 +- .../SandboxJobConfigurationRetrieveParams.kt | 10 +- .../SandboxJobConfigurationUpdateParams.kt | 14 +- .../api/models/SandboxJobCreateParams.kt | 285 +- .../api/models/SandboxPaymentCreateParams.kt | 1557 +++++---- .../tryfinch/api/models/SessionNewResponse.kt | 58 +- .../models/SessionReauthenticateResponse.kt | 58 +- .../api/models/SupportPerBenefitType.kt | 60 +- .../tryfinch/api/models/SupportedBenefit.kt | 119 +- .../api/models/UnenrolledIndividual.kt | 123 +- .../models/UpdateCompanyBenefitResponse.kt | 49 +- .../kotlin/com/tryfinch/api/models/W42005.kt | 148 +- .../kotlin/com/tryfinch/api/models/W42020.kt | 178 +- .../tryfinch/api/core/http/SerializerTest.kt | 2 - 143 files changed, 16892 insertions(+), 14173 deletions(-) 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 1be855e9..3e365dbe 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 @@ -38,6 +38,17 @@ class FinchOkHttpClient private constructor() { this.baseUrl = baseUrl } + /** + * Whether to throw an exception if any of the Jackson versions detected at runtime are + * incompatible with the SDK's minimum supported Jackson version (2.13.4). + * + * Defaults to true. Use extreme caution when disabling this option. There is no guarantee + * that the SDK will work correctly when using an incompatible Jackson version. + */ + fun checkJacksonVersionCompatibility(checkJacksonVersionCompatibility: Boolean) = apply { + clientOptions.checkJacksonVersionCompatibility(checkJacksonVersionCompatibility) + } + fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) } fun clock(clock: Clock) = apply { clientOptions.clock(clock) } 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 d3fbb6e1..0a25d955 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 @@ -38,6 +38,17 @@ class FinchOkHttpClientAsync private constructor() { this.baseUrl = baseUrl } + /** + * Whether to throw an exception if any of the Jackson versions detected at runtime are + * incompatible with the SDK's minimum supported Jackson version (2.13.4). + * + * Defaults to true. Use extreme caution when disabling this option. There is no guarantee + * that the SDK will work correctly when using an incompatible Jackson version. + */ + fun checkJacksonVersionCompatibility(checkJacksonVersionCompatibility: Boolean) = apply { + clientOptions.checkJacksonVersionCompatibility(checkJacksonVersionCompatibility) + } + fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) } fun clock(clock: Clock) = apply { clientOptions.clock(clock) } diff --git a/finch-java-core/build.gradle.kts b/finch-java-core/build.gradle.kts index c813a0c9..f7ecabd4 100644 --- a/finch-java-core/build.gradle.kts +++ b/finch-java-core/build.gradle.kts @@ -3,6 +3,19 @@ plugins { id("finch.publish") } +configurations.all { + resolutionStrategy { + // Compile and test against a lower Jackson version to ensure we're compatible with it. + // We publish with a higher version (see below) to ensure users depend on a secure version by default. + force("com.fasterxml.jackson.core:jackson-core:2.13.4") + force("com.fasterxml.jackson.core:jackson-databind:2.13.4") + force("com.fasterxml.jackson.core:jackson-annotations:2.13.4") + force("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.13.4") + force("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.4") + force("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.4") + } +} + dependencies { api("com.fasterxml.jackson.core:jackson-core:2.18.1") api("com.fasterxml.jackson.core:jackson-databind:2.18.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 50c06050..5918fb36 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 @@ -2,6 +2,9 @@ package com.tryfinch.api.core +import com.fasterxml.jackson.core.Version +import com.fasterxml.jackson.core.util.VersionUtil + fun checkRequired(name: String, value: T?): T = checkNotNull(value) { "`$name` is required, but was not set" } @@ -39,3 +42,46 @@ internal fun checkMaxLength(name: String, value: String, maxLength: Int): String "`$name` must have at most length $maxLength, but was ${it.length}" } } + +@JvmSynthetic +internal fun checkJacksonVersionCompatibility() { + val incompatibleJacksonVersions = + RUNTIME_JACKSON_VERSIONS.mapNotNull { + when { + it.majorVersion != MINIMUM_JACKSON_VERSION.majorVersion -> + it to "incompatible major version" + it.minorVersion < MINIMUM_JACKSON_VERSION.minorVersion -> + it to "minor version too low" + it.minorVersion == MINIMUM_JACKSON_VERSION.minorVersion && + it.patchLevel < MINIMUM_JACKSON_VERSION.patchLevel -> + it to "patch version too low" + else -> null + } + } + check(incompatibleJacksonVersions.isEmpty()) { + """ +This SDK depends on Jackson version $MINIMUM_JACKSON_VERSION, but the following incompatible Jackson versions were detected at runtime: + +${incompatibleJacksonVersions.asSequence().map { (version, incompatibilityReason) -> + "- `${version.toFullString().replace("/", ":")}` ($incompatibilityReason)" +}.joinToString("\n")} + +This can happen if you are either: +1. Directly depending on different Jackson versions +2. Depending on some library that depends on different Jackson versions, potentially transitively + +Double-check that you are depending on compatible Jackson versions. + """ + .trimIndent() + } +} + +private val MINIMUM_JACKSON_VERSION: Version = VersionUtil.parseVersion("2.13.4", null, null) +private val RUNTIME_JACKSON_VERSIONS: List = + listOf( + com.fasterxml.jackson.core.json.PackageVersion.VERSION, + com.fasterxml.jackson.databind.cfg.PackageVersion.VERSION, + com.fasterxml.jackson.datatype.jdk8.PackageVersion.VERSION, + com.fasterxml.jackson.datatype.jsr310.PackageVersion.VERSION, + com.fasterxml.jackson.module.kotlin.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 e95368ba..ee2132fe 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 @@ -17,6 +17,7 @@ class ClientOptions private constructor( private val originalHttpClient: HttpClient, @get:JvmName("httpClient") val httpClient: HttpClient, + @get:JvmName("checkJacksonVersionCompatibility") val checkJacksonVersionCompatibility: Boolean, @get:JvmName("jsonMapper") val jsonMapper: JsonMapper, @get:JvmName("clock") val clock: Clock, @get:JvmName("baseUrl") val baseUrl: String, @@ -31,6 +32,12 @@ private constructor( private val webhookSecret: String?, ) { + init { + if (checkJacksonVersionCompatibility) { + checkJacksonVersionCompatibility() + } + } + fun accessToken(): Optional = Optional.ofNullable(accessToken) fun clientId(): Optional = Optional.ofNullable(clientId) @@ -62,6 +69,7 @@ private constructor( class Builder internal constructor() { private var httpClient: HttpClient? = null + private var checkJacksonVersionCompatibility: Boolean = true private var jsonMapper: JsonMapper = jsonMapper() private var clock: Clock = Clock.systemUTC() private var baseUrl: String = PRODUCTION_URL @@ -78,6 +86,7 @@ private constructor( @JvmSynthetic internal fun from(clientOptions: ClientOptions) = apply { httpClient = clientOptions.originalHttpClient + checkJacksonVersionCompatibility = clientOptions.checkJacksonVersionCompatibility jsonMapper = clientOptions.jsonMapper clock = clientOptions.clock baseUrl = clientOptions.baseUrl @@ -94,6 +103,10 @@ private constructor( fun httpClient(httpClient: HttpClient) = apply { this.httpClient = httpClient } + fun checkJacksonVersionCompatibility(checkJacksonVersionCompatibility: Boolean) = apply { + this.checkJacksonVersionCompatibility = checkJacksonVersionCompatibility + } + fun jsonMapper(jsonMapper: JsonMapper) = apply { this.jsonMapper = jsonMapper } fun clock(clock: Clock) = apply { this.clock = clock } @@ -267,6 +280,7 @@ private constructor( .maxRetries(maxRetries) .build() ), + checkJacksonVersionCompatibility, jsonMapper, clock, baseUrl, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt index 7d2508c0..15a04cbb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt @@ -5,23 +5,19 @@ package com.tryfinch.api.core import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.core.JsonGenerator import com.fasterxml.jackson.databind.DeserializationFeature +import com.fasterxml.jackson.databind.MapperFeature import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.databind.cfg.CoercionAction.Fail -import com.fasterxml.jackson.databind.cfg.CoercionInputShape.Integer -import com.fasterxml.jackson.databind.exc.InvalidDefinitionException -import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.databind.module.SimpleModule import com.fasterxml.jackson.datatype.jdk8.Jdk8Module import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule -import com.fasterxml.jackson.module.kotlin.jacksonMapperBuilder -import com.tryfinch.api.errors.FinchException -import com.tryfinch.api.errors.FinchInvalidDataException +import com.fasterxml.jackson.module.kotlin.kotlinModule import java.io.InputStream fun jsonMapper(): JsonMapper = - jacksonMapperBuilder() + JsonMapper.builder() + .addModule(kotlinModule()) .addModule(Jdk8Module()) .addModule(JavaTimeModule()) .addModule(SimpleModule().addSerializer(InputStreamJsonSerializer)) @@ -30,7 +26,12 @@ fun jsonMapper(): JsonMapper = .disable(SerializationFeature.FLUSH_AFTER_WRITE_VALUE) .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .disable(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS) - .withCoercionConfig(String::class.java) { it.setCoercion(Integer, Fail) } + .disable(MapperFeature.ALLOW_COERCION_OF_SCALARS) + .disable(MapperFeature.AUTO_DETECT_CREATORS) + .disable(MapperFeature.AUTO_DETECT_FIELDS) + .disable(MapperFeature.AUTO_DETECT_GETTERS) + .disable(MapperFeature.AUTO_DETECT_IS_GETTERS) + .disable(MapperFeature.AUTO_DETECT_SETTERS) .build() private object InputStreamJsonSerializer : BaseSerializer(InputStream::class) { @@ -47,38 +48,3 @@ private object InputStreamJsonSerializer : BaseSerializer(InputStre } } } - -@JvmSynthetic -internal fun enhanceJacksonException(fallbackMessage: String, e: Exception): Exception { - // These exceptions should only happen if our code is wrong OR if the user is using a binary - // incompatible version of `com.fasterxml.jackson.core:jackson-databind`: - // https://javadoc.io/static/com.fasterxml.jackson.core/jackson-databind/2.18.1/index.html - val isUnexpectedException = - e is UnrecognizedPropertyException || e is InvalidDefinitionException - if (!isUnexpectedException) { - return FinchInvalidDataException(fallbackMessage, e) - } - - val jacksonVersion = JsonMapper::class.java.`package`.implementationVersion - if (jacksonVersion.isNullOrEmpty() || jacksonVersion == COMPILED_JACKSON_VERSION) { - return FinchInvalidDataException(fallbackMessage, e) - } - - return FinchException( - """ - Jackson threw an unexpected exception and its runtime version ($jacksonVersion) mismatches the version the SDK was compiled with ($COMPILED_JACKSON_VERSION). - - You may be using a version of `com.fasterxml.jackson.core:jackson-databind` that's not binary compatible with the SDK. - - This can happen if you are either: - 1. Directly depending on a different Jackson version - 2. Depending on some library that depends on a different Jackson version, potentially transitively - - Double-check that you are depending on a compatible Jackson version. - """ - .trimIndent(), - e, - ) -} - -const val COMPILED_JACKSON_VERSION = "2.18.1" diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt index f51b91e7..e5a88d66 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt @@ -1,8 +1,6 @@ package com.tryfinch.api.core import com.fasterxml.jackson.annotation.JacksonAnnotationsInside -import com.fasterxml.jackson.annotation.JsonAutoDetect -import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.core.JsonGenerator @@ -451,19 +449,9 @@ private constructor( @JsonInclude(JsonInclude.Include.CUSTOM, valueFilter = JsonField.IsMissing::class) annotation class ExcludeMissing -@JacksonAnnotationsInside -@JsonAutoDetect( - getterVisibility = Visibility.NONE, - isGetterVisibility = Visibility.NONE, - setterVisibility = Visibility.NONE, - creatorVisibility = Visibility.NONE, - fieldVisibility = Visibility.NONE, -) -annotation class NoAutoDetect - class MultipartField private constructor( - @get:JvmName("value") val value: JsonField, + @get:com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: JsonField, @get:JvmName("contentType") val contentType: String, private val filename: String?, ) { @@ -481,11 +469,7 @@ private constructor( @JvmSynthetic internal fun map(transform: (T) -> R): MultipartField = - MultipartField.builder() - .value(value.map(transform)) - .contentType(contentType) - .filename(filename) - .build() + builder().value(value.map(transform)).contentType(contentType).filename(filename).build() /** A builder for [MultipartField]. */ class Builder internal constructor() { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/handlers/JsonHandler.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/handlers/JsonHandler.kt index 6943a1e6..f083697d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/handlers/JsonHandler.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/handlers/JsonHandler.kt @@ -4,9 +4,9 @@ package com.tryfinch.api.core.handlers import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.tryfinch.api.core.enhanceJacksonException import com.tryfinch.api.core.http.HttpResponse import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.errors.FinchInvalidDataException @JvmSynthetic internal inline fun jsonHandler(jsonMapper: JsonMapper): Handler = @@ -15,6 +15,6 @@ internal inline fun jsonHandler(jsonMapper: JsonMapper): Handler try { jsonMapper.readValue(response.body(), jacksonTypeRef()) } catch (e: Exception) { - throw enhanceJacksonException("Error reading response", e) + throw FinchInvalidDataException("Error reading response", e) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/BadRequestException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/BadRequestException.kt index 818ed88b..6b42dcad 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/BadRequestException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/BadRequestException.kt @@ -12,12 +12,12 @@ class BadRequestException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : FinchServiceException("400: $body", cause) { + override fun statusCode(): Int = 400 + override fun headers(): Headers = headers override fun body(): JsonValue = body - override fun statusCode(): Int = 400 - fun toBuilder() = Builder().from(this) companion object { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/NotFoundException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/NotFoundException.kt index 4564cb22..78219c0c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/NotFoundException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/NotFoundException.kt @@ -12,12 +12,12 @@ class NotFoundException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : FinchServiceException("404: $body", cause) { + override fun statusCode(): Int = 404 + override fun headers(): Headers = headers override fun body(): JsonValue = body - override fun statusCode(): Int = 404 - fun toBuilder() = Builder().from(this) companion object { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/PermissionDeniedException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/PermissionDeniedException.kt index 4e131225..b43c0875 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/PermissionDeniedException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/PermissionDeniedException.kt @@ -12,12 +12,12 @@ class PermissionDeniedException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : FinchServiceException("403: $body", cause) { + override fun statusCode(): Int = 403 + override fun headers(): Headers = headers override fun body(): JsonValue = body - override fun statusCode(): Int = 403 - fun toBuilder() = Builder().from(this) companion object { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/RateLimitException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/RateLimitException.kt index 767f6baa..02907cfc 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/RateLimitException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/RateLimitException.kt @@ -12,12 +12,12 @@ class RateLimitException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : FinchServiceException("429: $body", cause) { + override fun statusCode(): Int = 429 + override fun headers(): Headers = headers override fun body(): JsonValue = body - override fun statusCode(): Int = 429 - fun toBuilder() = Builder().from(this) companion object { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnauthorizedException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnauthorizedException.kt index 379dca37..91143b9d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnauthorizedException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnauthorizedException.kt @@ -12,12 +12,12 @@ class UnauthorizedException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : FinchServiceException("401: $body", cause) { + override fun statusCode(): Int = 401 + override fun headers(): Headers = headers override fun body(): JsonValue = body - override fun statusCode(): Int = 401 - fun toBuilder() = Builder().from(this) companion object { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnprocessableEntityException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnprocessableEntityException.kt index bcca6999..c937818a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnprocessableEntityException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnprocessableEntityException.kt @@ -12,12 +12,12 @@ class UnprocessableEntityException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : FinchServiceException("422: $body", cause) { + override fun statusCode(): Int = 422 + override fun headers(): Headers = headers override fun body(): JsonValue = body - override fun statusCode(): Int = 422 - fun toBuilder() = Builder().from(this) companion object { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt index 47404520..4e9db5ad 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt @@ -10,14 +10,12 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional @@ -87,32 +85,245 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [AccessTokenCreateParams]. + * + * The following fields are required: + * ```java + * .code() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AccessTokenCreateParams]. */ + class Builder internal constructor() { + + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(accessTokenCreateParams: AccessTokenCreateParams) = apply { + body = accessTokenCreateParams.body.toBuilder() + additionalHeaders = accessTokenCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = accessTokenCreateParams.additionalQueryParams.toBuilder() + } + + fun code(code: String) = apply { body.code(code) } + + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun code(code: JsonField) = apply { body.code(code) } + + fun clientId(clientId: String) = apply { body.clientId(clientId) } + + /** + * Sets [Builder.clientId] to an arbitrary JSON value. + * + * You should usually call [Builder.clientId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun clientId(clientId: JsonField) = apply { body.clientId(clientId) } + + fun clientSecret(clientSecret: String) = apply { body.clientSecret(clientSecret) } + + /** + * Sets [Builder.clientSecret] to an arbitrary JSON value. + * + * You should usually call [Builder.clientSecret] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun clientSecret(clientSecret: JsonField) = apply { + body.clientSecret(clientSecret) + } + + fun redirectUri(redirectUri: String) = apply { body.redirectUri(redirectUri) } + + /** + * Sets [Builder.redirectUri] to an arbitrary JSON value. + * + * You should usually call [Builder.redirectUri] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun redirectUri(redirectUri: JsonField) = apply { body.redirectUri(redirectUri) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [AccessTokenCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .code() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): AccessTokenCreateParams = + AccessTokenCreateParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams - @NoAutoDetect class Body - @JsonCreator private constructor( - @JsonProperty("code") - @ExcludeMissing - private val code: JsonField = JsonMissing.of(), - @JsonProperty("client_id") - @ExcludeMissing - private val clientId: JsonField = JsonMissing.of(), - @JsonProperty("client_secret") - @ExcludeMissing - private val clientSecret: JsonField = JsonMissing.of(), - @JsonProperty("redirect_uri") - @ExcludeMissing - private val redirectUri: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val code: JsonField, + private val clientId: JsonField, + private val clientSecret: JsonField, + private val redirectUri: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("code") @ExcludeMissing code: JsonField = JsonMissing.of(), + @JsonProperty("client_id") + @ExcludeMissing + clientId: JsonField = JsonMissing.of(), + @JsonProperty("client_secret") + @ExcludeMissing + clientSecret: JsonField = JsonMissing.of(), + @JsonProperty("redirect_uri") + @ExcludeMissing + redirectUri: JsonField = JsonMissing.of(), + ) : this(code, clientId, clientSecret, redirectUri, 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). @@ -172,23 +383,15 @@ private constructor( @ExcludeMissing fun _redirectUri(): JsonField = redirectUri + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - code() - clientId() - clientSecret() - redirectUri() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -308,10 +511,24 @@ private constructor( clientId, clientSecret, redirectUri, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + code() + clientId() + clientSecret() + redirectUri() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -330,217 +547,6 @@ private constructor( "Body{code=$code, clientId=$clientId, clientSecret=$clientSecret, redirectUri=$redirectUri, additionalProperties=$additionalProperties}" } - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [AccessTokenCreateParams]. - * - * The following fields are required: - * ```java - * .code() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [AccessTokenCreateParams]. */ - @NoAutoDetect - class Builder internal constructor() { - - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(accessTokenCreateParams: AccessTokenCreateParams) = apply { - body = accessTokenCreateParams.body.toBuilder() - additionalHeaders = accessTokenCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = accessTokenCreateParams.additionalQueryParams.toBuilder() - } - - fun code(code: String) = apply { body.code(code) } - - /** - * Sets [Builder.code] to an arbitrary JSON value. - * - * You should usually call [Builder.code] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun code(code: JsonField) = apply { body.code(code) } - - fun clientId(clientId: String) = apply { body.clientId(clientId) } - - /** - * Sets [Builder.clientId] to an arbitrary JSON value. - * - * You should usually call [Builder.clientId] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun clientId(clientId: JsonField) = apply { body.clientId(clientId) } - - fun clientSecret(clientSecret: String) = apply { body.clientSecret(clientSecret) } - - /** - * Sets [Builder.clientSecret] to an arbitrary JSON value. - * - * You should usually call [Builder.clientSecret] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun clientSecret(clientSecret: JsonField) = apply { - body.clientSecret(clientSecret) - } - - fun redirectUri(redirectUri: String) = apply { body.redirectUri(redirectUri) } - - /** - * Sets [Builder.redirectUri] to an arbitrary JSON value. - * - * You should usually call [Builder.redirectUri] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun redirectUri(redirectUri: JsonField) = apply { body.redirectUri(redirectUri) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [AccessTokenCreateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .code() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): AccessTokenCreateParams = - AccessTokenCreateParams( - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt index bcde9a48..7862f668 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt @@ -11,42 +11,55 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects -@NoAutoDetect class AccountCreateResponse -@JsonCreator private constructor( - @JsonProperty("access_token") - @ExcludeMissing - private val accessToken: JsonField = JsonMissing.of(), - @JsonProperty("account_id") - @ExcludeMissing - private val accountId: JsonField = JsonMissing.of(), - @JsonProperty("authentication_type") - @ExcludeMissing - private val authenticationType: JsonField = JsonMissing.of(), - @JsonProperty("company_id") - @ExcludeMissing - private val companyId: JsonField = JsonMissing.of(), - @JsonProperty("connection_id") - @ExcludeMissing - private val connectionId: JsonField = JsonMissing.of(), - @JsonProperty("products") - @ExcludeMissing - private val products: JsonField> = JsonMissing.of(), - @JsonProperty("provider_id") - @ExcludeMissing - private val providerId: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val accessToken: JsonField, + private val accountId: JsonField, + private val authenticationType: JsonField, + private val companyId: JsonField, + private val connectionId: JsonField, + private val products: JsonField>, + private val providerId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("access_token") + @ExcludeMissing + accessToken: JsonField = JsonMissing.of(), + @JsonProperty("account_id") @ExcludeMissing accountId: JsonField = JsonMissing.of(), + @JsonProperty("authentication_type") + @ExcludeMissing + authenticationType: JsonField = JsonMissing.of(), + @JsonProperty("company_id") @ExcludeMissing companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + connectionId: JsonField = JsonMissing.of(), + @JsonProperty("products") + @ExcludeMissing + products: JsonField> = JsonMissing.of(), + @JsonProperty("provider_id") + @ExcludeMissing + providerId: JsonField = JsonMissing.of(), + ) : this( + accessToken, + accountId, + authenticationType, + companyId, + connectionId, + products, + providerId, + 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). @@ -160,26 +173,15 @@ private constructor( */ @JsonProperty("provider_id") @ExcludeMissing fun _providerId(): JsonField = providerId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): AccountCreateResponse = apply { - if (validated) { - return@apply - } - - accessToken() - accountId() - authenticationType() - companyId() - connectionId() - products() - providerId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -376,10 +378,27 @@ private constructor( checkRequired("connectionId", connectionId), checkRequired("products", products).map { it.toImmutable() }, checkRequired("providerId", providerId), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): AccountCreateResponse = apply { + if (validated) { + return@apply + } + + accessToken() + accountId() + authenticationType() + companyId() + connectionId() + products() + providerId() + validated = true + } + class AuthenticationType @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt index 87c2d00e..fc89011d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt @@ -2,12 +2,14 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonValue -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.toImmutable +import java.util.Collections import java.util.Objects import java.util.Optional @@ -16,22 +18,22 @@ class AccountDisconnectParams private constructor( private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, + private val additionalBodyProperties: MutableMap, ) : Params { fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun _body(): Optional> = - Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - - override fun _headers(): Headers = additionalHeaders + @JsonAnySetter + private fun putAdditionalBodyProperty(key: String, value: JsonValue) { + additionalBodyProperties.put(key, value) + } - override fun _queryParams(): QueryParams = additionalQueryParams + @JsonAnyGetter + @ExcludeMissing + fun _additionalBodyProperties(): Map = + Collections.unmodifiableMap(additionalBodyProperties) fun toBuilder() = Builder().from(this) @@ -44,7 +46,6 @@ private constructor( } /** A builder for [AccountDisconnectParams]. */ - @NoAutoDetect class Builder internal constructor() { private var additionalHeaders: Headers.Builder = Headers.builder() @@ -188,10 +189,18 @@ private constructor( AccountDisconnectParams( additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), + additionalBodyProperties.toMutableMap(), ) } + @JvmSynthetic + internal fun _body(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt index 8b1c80a5..946ad406 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -19,10 +18,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - fun toBuilder() = Builder().from(this) companion object { @@ -34,7 +29,6 @@ private constructor( } /** A builder for [AccountIntrospectParams]. */ - @NoAutoDetect class Builder internal constructor() { private var additionalHeaders: Headers.Builder = Headers.builder() @@ -153,6 +147,10 @@ private constructor( AccountIntrospectParams(additionalHeaders.build(), additionalQueryParams.build()) } + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt index cbfd4d03..a096358b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt @@ -11,35 +11,43 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -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 -@NoAutoDetect class AccountUpdateEvent -@JsonCreator private constructor( - @JsonProperty("account_id") - @ExcludeMissing - private val accountId: JsonField = JsonMissing.of(), - @JsonProperty("company_id") - @ExcludeMissing - private val companyId: JsonField = JsonMissing.of(), - @JsonProperty("connection_id") - @ExcludeMissing - private val connectionId: JsonField = JsonMissing.of(), - @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), - @JsonProperty("event_type") - @ExcludeMissing - private val eventType: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val accountId: JsonField, + private val companyId: JsonField, + private val connectionId: JsonField, + private val data: JsonField, + private val eventType: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("account_id") @ExcludeMissing accountId: JsonField = JsonMissing.of(), + @JsonProperty("company_id") @ExcludeMissing companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + connectionId: JsonField = JsonMissing.of(), + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + eventType: JsonField = JsonMissing.of(), + ) : this(accountId, companyId, connectionId, data, eventType, mutableMapOf()) + + fun toBaseWebhookEvent(): BaseWebhookEvent = + BaseWebhookEvent.builder() + .accountId(accountId) + .companyId(companyId) + .connectionId(connectionId) + .build() + /** * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. @@ -122,31 +130,15 @@ private constructor( */ @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBaseWebhookEvent(): BaseWebhookEvent = - BaseWebhookEvent.builder() - .accountId(accountId) - .companyId(companyId) - .connectionId(connectionId) - .build() - - private var validated: Boolean = false - - fun validate(): AccountUpdateEvent = apply { - if (validated) { - return@apply - } - - accountId() - companyId() - connectionId() - data().ifPresent { it.validate() } - eventType() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -292,24 +284,42 @@ private constructor( connectionId, data, eventType, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): AccountUpdateEvent = apply { + if (validated) { + return@apply + } + + accountId() + companyId() + connectionId() + data().ifPresent { it.validate() } + eventType() + validated = true + } + class Data - @JsonCreator private constructor( - @JsonProperty("authentication_method") - @ExcludeMissing - private val authenticationMethod: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val authenticationMethod: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("authentication_method") + @ExcludeMissing + authenticationMethod: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + status: JsonField = JsonMissing.of(), + ) : this(authenticationMethod, status, 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). @@ -342,21 +352,15 @@ private constructor( @ExcludeMissing fun _status(): JsonField = status + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Data = apply { - if (validated) { - return@apply - } - - authenticationMethod().validate() - status() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -450,27 +454,41 @@ private constructor( Data( checkRequired("authenticationMethod", authenticationMethod), checkRequired("status", status), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): Data = apply { + if (validated) { + return@apply + } + + authenticationMethod().validate() + status() + validated = true + } + class AuthenticationMethod - @JsonCreator private constructor( - @JsonProperty("benefits_support") - @ExcludeMissing - private val benefitsSupport: JsonField = JsonMissing.of(), - @JsonProperty("supported_fields") - @ExcludeMissing - private val supportedFields: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val benefitsSupport: JsonField, + private val supportedFields: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("benefits_support") + @ExcludeMissing + benefitsSupport: JsonField = JsonMissing.of(), + @JsonProperty("supported_fields") + @ExcludeMissing + supportedFields: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(benefitsSupport, supportedFields, type, mutableMapOf()) + /** * Each benefit type and their supported features. If the benefit type is not supported, * the property will be null @@ -525,22 +543,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): AuthenticationMethod = apply { - if (validated) { - return@apply - } - - benefitsSupport().ifPresent { it.validate() } - supportedFields().ifPresent { it.validate() } - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -657,40 +668,70 @@ private constructor( benefitsSupport, supportedFields, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): AuthenticationMethod = apply { + if (validated) { + return@apply + } + + benefitsSupport().ifPresent { it.validate() } + supportedFields().ifPresent { it.validate() } + type() + validated = true + } + /** The supported data fields returned by our HR and payroll endpoints */ - @NoAutoDetect class SupportedFields - @JsonCreator private constructor( - @JsonProperty("company") - @ExcludeMissing - private val company: JsonField = JsonMissing.of(), - @JsonProperty("directory") - @ExcludeMissing - private val directory: JsonField = JsonMissing.of(), - @JsonProperty("employment") - @ExcludeMissing - private val employment: JsonField = JsonMissing.of(), - @JsonProperty("individual") - @ExcludeMissing - private val individual: JsonField = JsonMissing.of(), - @JsonProperty("pay_group") - @ExcludeMissing - private val payGroup: JsonField = JsonMissing.of(), - @JsonProperty("pay_statement") - @ExcludeMissing - private val payStatement: JsonField = JsonMissing.of(), - @JsonProperty("payment") - @ExcludeMissing - private val payment: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val company: JsonField, + private val directory: JsonField, + private val employment: JsonField, + private val individual: JsonField, + private val payGroup: JsonField, + private val payStatement: JsonField, + private val payment: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("company") + @ExcludeMissing + company: JsonField = JsonMissing.of(), + @JsonProperty("directory") + @ExcludeMissing + directory: JsonField = JsonMissing.of(), + @JsonProperty("employment") + @ExcludeMissing + employment: JsonField = JsonMissing.of(), + @JsonProperty("individual") + @ExcludeMissing + individual: JsonField = JsonMissing.of(), + @JsonProperty("pay_group") + @ExcludeMissing + payGroup: JsonField = JsonMissing.of(), + @JsonProperty("pay_statement") + @ExcludeMissing + payStatement: JsonField = JsonMissing.of(), + @JsonProperty("payment") + @ExcludeMissing + payment: JsonField = JsonMissing.of(), + ) : this( + company, + directory, + employment, + individual, + payGroup, + payStatement, + payment, + mutableMapOf(), + ) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -810,26 +851,15 @@ private constructor( @ExcludeMissing fun _payment(): JsonField = payment + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SupportedFields = apply { - if (validated) { - return@apply - } - - company().ifPresent { it.validate() } - directory().ifPresent { it.validate() } - employment().ifPresent { it.validate() } - individual().ifPresent { it.validate() } - payGroup().ifPresent { it.validate() } - payStatement().ifPresent { it.validate() } - payment().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -998,45 +1028,83 @@ private constructor( payGroup, payStatement, payment, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): SupportedFields = apply { + if (validated) { + return@apply + } + + company().ifPresent { it.validate() } + directory().ifPresent { it.validate() } + employment().ifPresent { it.validate() } + individual().ifPresent { it.validate() } + payGroup().ifPresent { it.validate() } + payStatement().ifPresent { it.validate() } + payment().ifPresent { it.validate() } + validated = true + } + class SupportedCompanyFields - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("accounts") - @ExcludeMissing - private val accounts: JsonField = JsonMissing.of(), - @JsonProperty("departments") - @ExcludeMissing - private val departments: JsonField = JsonMissing.of(), - @JsonProperty("ein") - @ExcludeMissing - private val ein: JsonField = JsonMissing.of(), - @JsonProperty("entity") - @ExcludeMissing - private val entity: JsonField = JsonMissing.of(), - @JsonProperty("legal_name") - @ExcludeMissing - private val legalName: JsonField = JsonMissing.of(), - @JsonProperty("locations") - @ExcludeMissing - private val locations: JsonField = JsonMissing.of(), - @JsonProperty("primary_email") - @ExcludeMissing - private val primaryEmail: JsonField = JsonMissing.of(), - @JsonProperty("primary_phone_number") - @ExcludeMissing - private val primaryPhoneNumber: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val accounts: JsonField, + private val departments: JsonField, + private val ein: JsonField, + private val entity: JsonField, + private val legalName: JsonField, + private val locations: JsonField, + private val primaryEmail: JsonField, + private val primaryPhoneNumber: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") + @ExcludeMissing + id: JsonField = JsonMissing.of(), + @JsonProperty("accounts") + @ExcludeMissing + accounts: JsonField = JsonMissing.of(), + @JsonProperty("departments") + @ExcludeMissing + departments: JsonField = JsonMissing.of(), + @JsonProperty("ein") + @ExcludeMissing + ein: JsonField = JsonMissing.of(), + @JsonProperty("entity") + @ExcludeMissing + entity: JsonField = JsonMissing.of(), + @JsonProperty("legal_name") + @ExcludeMissing + legalName: JsonField = JsonMissing.of(), + @JsonProperty("locations") + @ExcludeMissing + locations: JsonField = JsonMissing.of(), + @JsonProperty("primary_email") + @ExcludeMissing + primaryEmail: JsonField = JsonMissing.of(), + @JsonProperty("primary_phone_number") + @ExcludeMissing + primaryPhoneNumber: JsonField = JsonMissing.of(), + ) : this( + id, + accounts, + departments, + ein, + entity, + legalName, + locations, + primaryEmail, + primaryPhoneNumber, + mutableMapOf(), + ) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -1184,32 +1252,19 @@ private constructor( @ExcludeMissing fun _primaryPhoneNumber(): JsonField = primaryPhoneNumber + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - private var validated: Boolean = false + fun toBuilder() = Builder().from(this) - fun validate(): SupportedCompanyFields = apply { - if (validated) { - return@apply - } - - id() - accounts().ifPresent { it.validate() } - departments().ifPresent { it.validate() } - ein() - entity().ifPresent { it.validate() } - legalName() - locations().ifPresent { it.validate() } - primaryEmail() - primaryPhoneNumber() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { + companion object { /** * Returns a mutable builder for constructing an instance of @@ -1400,34 +1455,65 @@ private constructor( locations, primaryEmail, primaryPhoneNumber, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): SupportedCompanyFields = apply { + if (validated) { + return@apply + } + + id() + accounts().ifPresent { it.validate() } + departments().ifPresent { it.validate() } + ein() + entity().ifPresent { it.validate() } + legalName() + locations().ifPresent { it.validate() } + primaryEmail() + primaryPhoneNumber() + validated = true + } + class Accounts - @JsonCreator private constructor( - @JsonProperty("account_name") - @ExcludeMissing - private val accountName: JsonField = JsonMissing.of(), - @JsonProperty("account_number") - @ExcludeMissing - private val accountNumber: JsonField = JsonMissing.of(), - @JsonProperty("account_type") - @ExcludeMissing - private val accountType: JsonField = JsonMissing.of(), - @JsonProperty("institution_name") - @ExcludeMissing - private val institutionName: JsonField = JsonMissing.of(), - @JsonProperty("routing_number") - @ExcludeMissing - private val routingNumber: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val accountName: JsonField, + private val accountNumber: JsonField, + private val accountType: JsonField, + private val institutionName: JsonField, + private val routingNumber: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("account_name") + @ExcludeMissing + accountName: JsonField = JsonMissing.of(), + @JsonProperty("account_number") + @ExcludeMissing + accountNumber: JsonField = JsonMissing.of(), + @JsonProperty("account_type") + @ExcludeMissing + accountType: JsonField = JsonMissing.of(), + @JsonProperty("institution_name") + @ExcludeMissing + institutionName: JsonField = JsonMissing.of(), + @JsonProperty("routing_number") + @ExcludeMissing + routingNumber: JsonField = JsonMissing.of(), + ) : this( + accountName, + accountNumber, + accountType, + institutionName, + routingNumber, + mutableMapOf(), + ) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -1513,24 +1599,15 @@ private constructor( @ExcludeMissing fun _routingNumber(): JsonField = routingNumber + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Accounts = apply { - if (validated) { - return@apply - } - - accountName() - accountNumber() - accountType() - institutionName() - routingNumber() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1668,10 +1745,25 @@ private constructor( accountType, institutionName, routingNumber, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Accounts = apply { + if (validated) { + return@apply + } + + accountName() + accountNumber() + accountType() + institutionName() + routingNumber() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1690,21 +1782,23 @@ private constructor( "Accounts{accountName=$accountName, accountNumber=$accountNumber, accountType=$accountType, institutionName=$institutionName, routingNumber=$routingNumber, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Departments - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("parent") - @ExcludeMissing - private val parent: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val name: JsonField, + private val parent: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + @JsonProperty("parent") + @ExcludeMissing + parent: JsonField = JsonMissing.of(), + ) : this(name, parent, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -1737,21 +1831,15 @@ private constructor( @ExcludeMissing fun _parent(): JsonField = parent + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Departments = apply { - if (validated) { - return@apply - } - - name() - parent().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1831,21 +1919,34 @@ private constructor( * instance. */ fun build(): Departments = - Departments(name, parent, additionalProperties.toImmutable()) + Departments(name, parent, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Departments = apply { + if (validated) { + return@apply + } + + name() + parent().ifPresent { it.validate() } + validated = true } - @NoAutoDetect class Parent - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val name: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of() + ) : this(name, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -1863,21 +1964,15 @@ private constructor( @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = - additionalProperties - - private var validated: Boolean = false - - fun validate(): Parent = apply { - if (validated) { - return@apply - } - - name() - validated = true - } + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1945,7 +2040,18 @@ private constructor( * instance. */ fun build(): Parent = - Parent(name, additionalProperties.toImmutable()) + Parent(name, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Parent = apply { + if (validated) { + return@apply + } + + name() + validated = true } override fun equals(other: Any?): Boolean { @@ -1984,21 +2090,23 @@ private constructor( "Departments{name=$name, parent=$parent, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Entity - @JsonCreator private constructor( - @JsonProperty("subtype") - @ExcludeMissing - private val subtype: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val subtype: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("subtype") + @ExcludeMissing + subtype: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(subtype, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -2031,21 +2139,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Entity = apply { - if (validated) { - return@apply - } - - subtype() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2125,7 +2227,19 @@ private constructor( * instance. */ fun build(): Entity = - Entity(subtype, type, additionalProperties.toImmutable()) + Entity(subtype, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Entity = apply { + if (validated) { + return@apply + } + + subtype() + type() + validated = true } override fun equals(other: Any?): Boolean { @@ -2146,33 +2260,39 @@ private constructor( "Entity{subtype=$subtype, type=$type, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Locations - @JsonCreator private constructor( - @JsonProperty("city") - @ExcludeMissing - private val city: JsonField = JsonMissing.of(), - @JsonProperty("country") - @ExcludeMissing - private val country: JsonField = JsonMissing.of(), - @JsonProperty("line1") - @ExcludeMissing - private val line1: JsonField = JsonMissing.of(), - @JsonProperty("line2") - @ExcludeMissing - private val line2: JsonField = JsonMissing.of(), - @JsonProperty("postal_code") - @ExcludeMissing - private val postalCode: JsonField = JsonMissing.of(), - @JsonProperty("state") - @ExcludeMissing - private val state: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val city: JsonField, + private val country: JsonField, + private val line1: JsonField, + private val line2: JsonField, + private val postalCode: JsonField, + private val state: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("city") + @ExcludeMissing + city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + country: JsonField = JsonMissing.of(), + @JsonProperty("line1") + @ExcludeMissing + line1: JsonField = JsonMissing.of(), + @JsonProperty("line2") + @ExcludeMissing + line2: JsonField = JsonMissing.of(), + @JsonProperty("postal_code") + @ExcludeMissing + postalCode: JsonField = JsonMissing.of(), + @JsonProperty("state") + @ExcludeMissing + state: JsonField = JsonMissing.of(), + ) : this(city, country, line1, line2, postalCode, state, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -2273,25 +2393,15 @@ private constructor( @ExcludeMissing fun _state(): JsonField = state + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Locations = apply { - if (validated) { - return@apply - } - - city() - country() - line1() - line2() - postalCode() - state() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2434,10 +2544,26 @@ private constructor( line2, postalCode, state, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Locations = apply { + if (validated) { + return@apply + } + + city() + country() + line1() + line2() + postalCode() + state() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2474,20 +2600,23 @@ private constructor( "SupportedCompanyFields{id=$id, accounts=$accounts, departments=$departments, ein=$ein, entity=$entity, legalName=$legalName, locations=$locations, primaryEmail=$primaryEmail, primaryPhoneNumber=$primaryPhoneNumber, additionalProperties=$additionalProperties}" } - @NoAutoDetect class SupportedDirectoryFields - @JsonCreator private constructor( - @JsonProperty("individuals") - @ExcludeMissing - private val individuals: JsonField = JsonMissing.of(), - @JsonProperty("paging") - @ExcludeMissing - private val paging: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val individuals: JsonField, + private val paging: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("individuals") + @ExcludeMissing + individuals: JsonField = JsonMissing.of(), + @JsonProperty("paging") + @ExcludeMissing + paging: JsonField = JsonMissing.of(), + ) : this(individuals, paging, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -2522,21 +2651,15 @@ private constructor( @ExcludeMissing fun _paging(): JsonField = paging + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SupportedDirectoryFields = apply { - if (validated) { - return@apply - } - - individuals().ifPresent { it.validate() } - paging().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2622,40 +2745,68 @@ private constructor( SupportedDirectoryFields( individuals, paging, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): SupportedDirectoryFields = apply { + if (validated) { + return@apply + } + + individuals().ifPresent { it.validate() } + paging().ifPresent { it.validate() } + validated = true + } + class Individuals - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("department") - @ExcludeMissing - private val department: JsonField = JsonMissing.of(), - @JsonProperty("first_name") - @ExcludeMissing - private val firstName: JsonField = JsonMissing.of(), - @JsonProperty("is_active") - @ExcludeMissing - private val isActive: JsonField = JsonMissing.of(), - @JsonProperty("last_name") - @ExcludeMissing - private val lastName: JsonField = JsonMissing.of(), - @JsonProperty("manager") - @ExcludeMissing - private val manager: JsonField = JsonMissing.of(), - @JsonProperty("middle_name") - @ExcludeMissing - private val middleName: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val id: JsonField, + private val department: JsonField, + private val firstName: JsonField, + private val isActive: JsonField, + private val lastName: JsonField, + private val manager: JsonField, + private val middleName: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") + @ExcludeMissing + id: JsonField = JsonMissing.of(), + @JsonProperty("department") + @ExcludeMissing + department: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + firstName: JsonField = JsonMissing.of(), + @JsonProperty("is_active") + @ExcludeMissing + isActive: JsonField = JsonMissing.of(), + @JsonProperty("last_name") + @ExcludeMissing + lastName: JsonField = JsonMissing.of(), + @JsonProperty("manager") + @ExcludeMissing + manager: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + middleName: JsonField = JsonMissing.of(), + ) : this( + id, + department, + firstName, + isActive, + lastName, + manager, + middleName, + mutableMapOf(), + ) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -2772,26 +2923,15 @@ private constructor( @ExcludeMissing fun _middleName(): JsonField = middleName + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Individuals = apply { - if (validated) { - return@apply - } - - id() - department() - firstName() - isActive() - lastName() - manager().ifPresent { it.validate() } - middleName() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2958,22 +3098,40 @@ private constructor( lastName, manager, middleName, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): Individuals = apply { + if (validated) { + return@apply + } + + id() + department() + firstName() + isActive() + lastName() + manager().ifPresent { it.validate() } + middleName() + validated = true + } + class Manager - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val id: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") + @ExcludeMissing + id: JsonField = JsonMissing.of() + ) : this(id, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -2988,21 +3146,15 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = - additionalProperties - - private var validated: Boolean = false - - fun validate(): Manager = apply { - if (validated) { - return@apply - } - - id() - validated = true - } + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3070,7 +3222,18 @@ private constructor( * instance. */ fun build(): Manager = - Manager(id, additionalProperties.toImmutable()) + Manager(id, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Manager = apply { + if (validated) { + return@apply + } + + id() + validated = true } override fun equals(other: Any?): Boolean { @@ -3109,21 +3272,23 @@ private constructor( "Individuals{id=$id, department=$department, firstName=$firstName, isActive=$isActive, lastName=$lastName, manager=$manager, middleName=$middleName, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Paging - @JsonCreator private constructor( - @JsonProperty("count") - @ExcludeMissing - private val count: JsonField = JsonMissing.of(), - @JsonProperty("offset") - @ExcludeMissing - private val offset: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val count: JsonField, + private val offset: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("count") + @ExcludeMissing + count: JsonField = JsonMissing.of(), + @JsonProperty("offset") + @ExcludeMissing + offset: JsonField = JsonMissing.of(), + ) : this(count, offset, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -3158,21 +3323,15 @@ private constructor( @ExcludeMissing fun _offset(): JsonField = offset + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Paging = apply { - if (validated) { - return@apply - } - - count() - offset() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3250,7 +3409,19 @@ private constructor( * instance. */ fun build(): Paging = - Paging(count, offset, additionalProperties.toImmutable()) + Paging(count, offset, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Paging = apply { + if (validated) { + return@apply + } + + count() + offset() + validated = true } override fun equals(other: Any?): Boolean { @@ -3289,65 +3460,102 @@ private constructor( "SupportedDirectoryFields{individuals=$individuals, paging=$paging, additionalProperties=$additionalProperties}" } - @NoAutoDetect class SupportedEmploymentFields - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("class_code") - @ExcludeMissing - private val classCode: JsonField = JsonMissing.of(), - @JsonProperty("custom_fields") - @ExcludeMissing - private val customFields: JsonField = JsonMissing.of(), - @JsonProperty("department") - @ExcludeMissing - private val department: JsonField = JsonMissing.of(), - @JsonProperty("employment") - @ExcludeMissing - private val employment: JsonField = JsonMissing.of(), - @JsonProperty("employment_status") - @ExcludeMissing - private val employmentStatus: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("first_name") - @ExcludeMissing - private val firstName: JsonField = JsonMissing.of(), - @JsonProperty("income") - @ExcludeMissing - private val income: JsonField = JsonMissing.of(), - @JsonProperty("income_history") - @ExcludeMissing - private val incomeHistory: JsonField = JsonMissing.of(), - @JsonProperty("is_active") - @ExcludeMissing - private val isActive: JsonField = JsonMissing.of(), - @JsonProperty("last_name") - @ExcludeMissing - private val lastName: JsonField = JsonMissing.of(), - @JsonProperty("location") - @ExcludeMissing - private val location: JsonField = JsonMissing.of(), - @JsonProperty("manager") - @ExcludeMissing - private val manager: JsonField = JsonMissing.of(), - @JsonProperty("middle_name") - @ExcludeMissing - private val middleName: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("title") - @ExcludeMissing - private val title: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val classCode: JsonField, + private val customFields: JsonField, + private val department: JsonField, + private val employment: JsonField, + private val employmentStatus: JsonField, + private val endDate: JsonField, + private val firstName: JsonField, + private val income: JsonField, + private val incomeHistory: JsonField, + private val isActive: JsonField, + private val lastName: JsonField, + private val location: JsonField, + private val manager: JsonField, + private val middleName: JsonField, + private val startDate: JsonField, + private val title: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") + @ExcludeMissing + id: JsonField = JsonMissing.of(), + @JsonProperty("class_code") + @ExcludeMissing + classCode: JsonField = JsonMissing.of(), + @JsonProperty("custom_fields") + @ExcludeMissing + customFields: JsonField = JsonMissing.of(), + @JsonProperty("department") + @ExcludeMissing + department: JsonField = JsonMissing.of(), + @JsonProperty("employment") + @ExcludeMissing + employment: JsonField = JsonMissing.of(), + @JsonProperty("employment_status") + @ExcludeMissing + employmentStatus: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + endDate: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + firstName: JsonField = JsonMissing.of(), + @JsonProperty("income") + @ExcludeMissing + income: JsonField = JsonMissing.of(), + @JsonProperty("income_history") + @ExcludeMissing + incomeHistory: JsonField = JsonMissing.of(), + @JsonProperty("is_active") + @ExcludeMissing + isActive: JsonField = JsonMissing.of(), + @JsonProperty("last_name") + @ExcludeMissing + lastName: JsonField = JsonMissing.of(), + @JsonProperty("location") + @ExcludeMissing + location: JsonField = JsonMissing.of(), + @JsonProperty("manager") + @ExcludeMissing + manager: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + middleName: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + startDate: JsonField = JsonMissing.of(), + @JsonProperty("title") + @ExcludeMissing + title: JsonField = JsonMissing.of(), + ) : this( + id, + classCode, + customFields, + department, + employment, + employmentStatus, + endDate, + firstName, + income, + incomeHistory, + isActive, + lastName, + location, + manager, + middleName, + startDate, + title, + mutableMapOf(), + ) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -3631,36 +3839,15 @@ private constructor( */ @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SupportedEmploymentFields = apply { - if (validated) { - return@apply - } - - id() - classCode() - customFields() - department().ifPresent { it.validate() } - employment().ifPresent { it.validate() } - employmentStatus() - endDate() - firstName() - income().ifPresent { it.validate() } - incomeHistory() - isActive() - lastName() - location().ifPresent { it.validate() } - manager().ifPresent { it.validate() } - middleName() - startDate() - title() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3982,22 +4169,50 @@ private constructor( middleName, startDate, title, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): SupportedEmploymentFields = apply { + if (validated) { + return@apply + } + + id() + classCode() + customFields() + department().ifPresent { it.validate() } + employment().ifPresent { it.validate() } + employmentStatus() + endDate() + firstName() + income().ifPresent { it.validate() } + incomeHistory() + isActive() + lastName() + location().ifPresent { it.validate() } + manager().ifPresent { it.validate() } + middleName() + startDate() + title() + validated = true + } + class Department - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val name: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of() + ) : this(name, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -4013,20 +4228,15 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Department = apply { - if (validated) { - return@apply - } - - name() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -4093,7 +4303,18 @@ private constructor( * instance. */ fun build(): Department = - Department(name, additionalProperties.toImmutable()) + Department(name, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Department = apply { + if (validated) { + return@apply + } + + name() + validated = true } override fun equals(other: Any?): Boolean { @@ -4114,21 +4335,23 @@ private constructor( "Department{name=$name, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Employment - @JsonCreator private constructor( - @JsonProperty("subtype") - @ExcludeMissing - private val subtype: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val subtype: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("subtype") + @ExcludeMissing + subtype: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(subtype, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -4161,21 +4384,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Employment = apply { - if (validated) { - return@apply - } - - subtype() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -4257,7 +4474,19 @@ private constructor( * instance. */ fun build(): Employment = - Employment(subtype, type, additionalProperties.toImmutable()) + Employment(subtype, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Employment = apply { + if (validated) { + return@apply + } + + subtype() + type() + validated = true } override fun equals(other: Any?): Boolean { @@ -4278,24 +4507,27 @@ private constructor( "Employment{subtype=$subtype, type=$type, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Income - @JsonCreator private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("unit") - @ExcludeMissing - private val unit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val amount: JsonField, + private val currency: JsonField, + private val unit: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("unit") + @ExcludeMissing + unit: JsonField = JsonMissing.of(), + ) : this(amount, currency, unit, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -4345,22 +4577,15 @@ private constructor( */ @JsonProperty("unit") @ExcludeMissing fun _unit(): JsonField = unit + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Income = apply { - if (validated) { - return@apply - } - - amount() - currency() - unit() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -4453,7 +4678,20 @@ private constructor( * instance. */ fun build(): Income = - Income(amount, currency, unit, additionalProperties.toImmutable()) + Income(amount, currency, unit, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Income = apply { + if (validated) { + return@apply + } + + amount() + currency() + unit() + validated = true } override fun equals(other: Any?): Boolean { @@ -4474,33 +4712,39 @@ private constructor( "Income{amount=$amount, currency=$currency, unit=$unit, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Location - @JsonCreator private constructor( - @JsonProperty("city") - @ExcludeMissing - private val city: JsonField = JsonMissing.of(), - @JsonProperty("country") - @ExcludeMissing - private val country: JsonField = JsonMissing.of(), - @JsonProperty("line1") - @ExcludeMissing - private val line1: JsonField = JsonMissing.of(), - @JsonProperty("line2") - @ExcludeMissing - private val line2: JsonField = JsonMissing.of(), - @JsonProperty("postal_code") - @ExcludeMissing - private val postalCode: JsonField = JsonMissing.of(), - @JsonProperty("state") - @ExcludeMissing - private val state: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val city: JsonField, + private val country: JsonField, + private val line1: JsonField, + private val line2: JsonField, + private val postalCode: JsonField, + private val state: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("city") + @ExcludeMissing + city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + country: JsonField = JsonMissing.of(), + @JsonProperty("line1") + @ExcludeMissing + line1: JsonField = JsonMissing.of(), + @JsonProperty("line2") + @ExcludeMissing + line2: JsonField = JsonMissing.of(), + @JsonProperty("postal_code") + @ExcludeMissing + postalCode: JsonField = JsonMissing.of(), + @JsonProperty("state") + @ExcludeMissing + state: JsonField = JsonMissing.of(), + ) : this(city, country, line1, line2, postalCode, state, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -4601,25 +4845,15 @@ private constructor( @ExcludeMissing fun _state(): JsonField = state + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Location = apply { - if (validated) { - return@apply - } - - city() - country() - line1() - line2() - postalCode() - state() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -4761,10 +4995,26 @@ private constructor( line2, postalCode, state, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Location = apply { + if (validated) { + return@apply + } + + city() + country() + line1() + line2() + postalCode() + state() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4783,18 +5033,19 @@ private constructor( "Location{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Manager - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val id: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") + @ExcludeMissing + id: JsonField = JsonMissing.of() + ) : this(id, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -4809,21 +5060,16 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Manager = apply { - if (validated) { - return@apply - } - - id() - validated = true + @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 { @@ -4886,7 +5132,18 @@ private constructor( * Further updates to this [Builder] will not mutate the returned * instance. */ - fun build(): Manager = Manager(id, additionalProperties.toImmutable()) + fun build(): Manager = Manager(id, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Manager = apply { + if (validated) { + return@apply + } + + id() + validated = true } override fun equals(other: Any?): Boolean { @@ -4925,53 +5182,82 @@ private constructor( "SupportedEmploymentFields{id=$id, classCode=$classCode, customFields=$customFields, department=$department, employment=$employment, employmentStatus=$employmentStatus, endDate=$endDate, firstName=$firstName, income=$income, incomeHistory=$incomeHistory, isActive=$isActive, lastName=$lastName, location=$location, manager=$manager, middleName=$middleName, startDate=$startDate, title=$title, additionalProperties=$additionalProperties}" } - @NoAutoDetect class SupportedIndividualFields - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("dob") - @ExcludeMissing - private val dob: JsonField = JsonMissing.of(), - @JsonProperty("emails") - @ExcludeMissing - private val emails: JsonField = JsonMissing.of(), - @JsonProperty("encrypted_ssn") - @ExcludeMissing - private val encryptedSsn: JsonField = JsonMissing.of(), - @JsonProperty("ethnicity") - @ExcludeMissing - private val ethnicity: JsonField = JsonMissing.of(), - @JsonProperty("first_name") - @ExcludeMissing - private val firstName: JsonField = JsonMissing.of(), - @JsonProperty("gender") - @ExcludeMissing - private val gender: JsonField = JsonMissing.of(), - @JsonProperty("last_name") - @ExcludeMissing - private val lastName: JsonField = JsonMissing.of(), - @JsonProperty("middle_name") - @ExcludeMissing - private val middleName: JsonField = JsonMissing.of(), - @JsonProperty("phone_numbers") - @ExcludeMissing - private val phoneNumbers: JsonField = JsonMissing.of(), - @JsonProperty("preferred_name") - @ExcludeMissing - private val preferredName: JsonField = JsonMissing.of(), - @JsonProperty("residence") - @ExcludeMissing - private val residence: JsonField = JsonMissing.of(), - @JsonProperty("ssn") - @ExcludeMissing - private val ssn: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val dob: JsonField, + private val emails: JsonField, + private val encryptedSsn: JsonField, + private val ethnicity: JsonField, + private val firstName: JsonField, + private val gender: JsonField, + private val lastName: JsonField, + private val middleName: JsonField, + private val phoneNumbers: JsonField, + private val preferredName: JsonField, + private val residence: JsonField, + private val ssn: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") + @ExcludeMissing + id: JsonField = JsonMissing.of(), + @JsonProperty("dob") + @ExcludeMissing + dob: JsonField = JsonMissing.of(), + @JsonProperty("emails") + @ExcludeMissing + emails: JsonField = JsonMissing.of(), + @JsonProperty("encrypted_ssn") + @ExcludeMissing + encryptedSsn: JsonField = JsonMissing.of(), + @JsonProperty("ethnicity") + @ExcludeMissing + ethnicity: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + firstName: JsonField = JsonMissing.of(), + @JsonProperty("gender") + @ExcludeMissing + gender: JsonField = JsonMissing.of(), + @JsonProperty("last_name") + @ExcludeMissing + lastName: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + middleName: JsonField = JsonMissing.of(), + @JsonProperty("phone_numbers") + @ExcludeMissing + phoneNumbers: JsonField = JsonMissing.of(), + @JsonProperty("preferred_name") + @ExcludeMissing + preferredName: JsonField = JsonMissing.of(), + @JsonProperty("residence") + @ExcludeMissing + residence: JsonField = JsonMissing.of(), + @JsonProperty("ssn") + @ExcludeMissing + ssn: JsonField = JsonMissing.of(), + ) : this( + id, + dob, + emails, + encryptedSsn, + ethnicity, + firstName, + gender, + lastName, + middleName, + phoneNumbers, + preferredName, + residence, + ssn, + mutableMapOf(), + ) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -5184,32 +5470,15 @@ private constructor( */ @JsonProperty("ssn") @ExcludeMissing fun _ssn(): JsonField = ssn + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SupportedIndividualFields = apply { - if (validated) { - return@apply - } - - id() - dob() - emails().ifPresent { it.validate() } - encryptedSsn() - ethnicity() - firstName() - gender() - lastName() - middleName() - phoneNumbers().ifPresent { it.validate() } - preferredName() - residence().ifPresent { it.validate() } - ssn() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -5465,25 +5734,50 @@ private constructor( preferredName, residence, ssn, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): SupportedIndividualFields = apply { + if (validated) { + return@apply + } + + id() + dob() + emails().ifPresent { it.validate() } + encryptedSsn() + ethnicity() + firstName() + gender() + lastName() + middleName() + phoneNumbers().ifPresent { it.validate() } + preferredName() + residence().ifPresent { it.validate() } + ssn() + validated = true + } + class Emails - @JsonCreator private constructor( - @JsonProperty("data") - @ExcludeMissing - private val data: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val data: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("data") + @ExcludeMissing + data: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(data, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -5514,21 +5808,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Emails = apply { - if (validated) { - return@apply - } - - data() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -5606,7 +5894,19 @@ private constructor( * instance. */ fun build(): Emails = - Emails(data, type, additionalProperties.toImmutable()) + Emails(data, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Emails = apply { + if (validated) { + return@apply + } + + data() + type() + validated = true } override fun equals(other: Any?): Boolean { @@ -5627,21 +5927,23 @@ private constructor( "Emails{data=$data, type=$type, additionalProperties=$additionalProperties}" } - @NoAutoDetect class PhoneNumbers - @JsonCreator private constructor( - @JsonProperty("data") - @ExcludeMissing - private val data: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val data: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("data") + @ExcludeMissing + data: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(data, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -5672,21 +5974,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PhoneNumbers = apply { - if (validated) { - return@apply - } - - data() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -5766,7 +6062,19 @@ private constructor( * instance. */ fun build(): PhoneNumbers = - PhoneNumbers(data, type, additionalProperties.toImmutable()) + PhoneNumbers(data, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): PhoneNumbers = apply { + if (validated) { + return@apply + } + + data() + type() + validated = true } override fun equals(other: Any?): Boolean { @@ -5787,33 +6095,39 @@ private constructor( "PhoneNumbers{data=$data, type=$type, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Residence - @JsonCreator private constructor( - @JsonProperty("city") - @ExcludeMissing - private val city: JsonField = JsonMissing.of(), - @JsonProperty("country") - @ExcludeMissing - private val country: JsonField = JsonMissing.of(), - @JsonProperty("line1") - @ExcludeMissing - private val line1: JsonField = JsonMissing.of(), - @JsonProperty("line2") - @ExcludeMissing - private val line2: JsonField = JsonMissing.of(), - @JsonProperty("postal_code") - @ExcludeMissing - private val postalCode: JsonField = JsonMissing.of(), - @JsonProperty("state") - @ExcludeMissing - private val state: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val city: JsonField, + private val country: JsonField, + private val line1: JsonField, + private val line2: JsonField, + private val postalCode: JsonField, + private val state: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("city") + @ExcludeMissing + city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + country: JsonField = JsonMissing.of(), + @JsonProperty("line1") + @ExcludeMissing + line1: JsonField = JsonMissing.of(), + @JsonProperty("line2") + @ExcludeMissing + line2: JsonField = JsonMissing.of(), + @JsonProperty("postal_code") + @ExcludeMissing + postalCode: JsonField = JsonMissing.of(), + @JsonProperty("state") + @ExcludeMissing + state: JsonField = JsonMissing.of(), + ) : this(city, country, line1, line2, postalCode, state, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -5914,25 +6228,15 @@ private constructor( @ExcludeMissing fun _state(): JsonField = state + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Residence = apply { - if (validated) { - return@apply - } - - city() - country() - line1() - line2() - postalCode() - state() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -6075,10 +6379,26 @@ private constructor( line2, postalCode, state, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Residence = apply { + if (validated) { + return@apply + } + + city() + country() + line1() + line2() + postalCode() + state() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6115,26 +6435,31 @@ private constructor( "SupportedIndividualFields{id=$id, dob=$dob, emails=$emails, encryptedSsn=$encryptedSsn, ethnicity=$ethnicity, firstName=$firstName, gender=$gender, lastName=$lastName, middleName=$middleName, phoneNumbers=$phoneNumbers, preferredName=$preferredName, residence=$residence, ssn=$ssn, additionalProperties=$additionalProperties}" } - @NoAutoDetect class SupportedPayGroupFields - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("individual_ids") - @ExcludeMissing - private val individualIds: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("pay_frequencies") - @ExcludeMissing - private val payFrequencies: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val individualIds: JsonField, + private val name: JsonField, + private val payFrequencies: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") + @ExcludeMissing + id: JsonField = JsonMissing.of(), + @JsonProperty("individual_ids") + @ExcludeMissing + individualIds: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + @JsonProperty("pay_frequencies") + @ExcludeMissing + payFrequencies: JsonField = JsonMissing.of(), + ) : this(id, individualIds, name, payFrequencies, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -6197,23 +6522,15 @@ private constructor( @ExcludeMissing fun _payFrequencies(): JsonField = payFrequencies + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SupportedPayGroupFields = apply { - if (validated) { - return@apply - } - - id() - individualIds() - name() - payFrequencies() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -6330,10 +6647,24 @@ private constructor( individualIds, name, payFrequencies, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): SupportedPayGroupFields = apply { + if (validated) { + return@apply + } + + id() + individualIds() + name() + payFrequencies() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6352,20 +6683,23 @@ private constructor( "SupportedPayGroupFields{id=$id, individualIds=$individualIds, name=$name, payFrequencies=$payFrequencies, additionalProperties=$additionalProperties}" } - @NoAutoDetect class SupportedPayStatementFields - @JsonCreator private constructor( - @JsonProperty("paging") - @ExcludeMissing - private val paging: JsonField = JsonMissing.of(), - @JsonProperty("pay_statements") - @ExcludeMissing - private val payStatements: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val paging: JsonField, + private val payStatements: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("paging") + @ExcludeMissing + paging: JsonField = JsonMissing.of(), + @JsonProperty("pay_statements") + @ExcludeMissing + payStatements: JsonField = JsonMissing.of(), + ) : this(paging, payStatements, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -6400,21 +6734,15 @@ private constructor( @ExcludeMissing fun _payStatements(): JsonField = payStatements + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SupportedPayStatementFields = apply { - if (validated) { - return@apply - } - - paging().ifPresent { it.validate() } - payStatements().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -6501,25 +6829,39 @@ private constructor( SupportedPayStatementFields( paging, payStatements, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): SupportedPayStatementFields = apply { + if (validated) { + return@apply + } + + paging().ifPresent { it.validate() } + payStatements().ifPresent { it.validate() } + validated = true + } + class Paging - @JsonCreator private constructor( - @JsonProperty("count") - @ExcludeMissing - private val count: JsonField = JsonMissing.of(), - @JsonProperty("offset") - @ExcludeMissing - private val offset: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val count: JsonField, + private val offset: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("count") + @ExcludeMissing + count: JsonField = JsonMissing.of(), + @JsonProperty("offset") + @ExcludeMissing + offset: JsonField = JsonMissing.of(), + ) : this(count, offset, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type or is unexpectedly missing or null (e.g. if the server responded @@ -6554,21 +6896,15 @@ private constructor( @ExcludeMissing fun _offset(): JsonField = offset + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Paging = apply { - if (validated) { - return@apply - } - - count() - offset() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -6663,10 +6999,22 @@ private constructor( Paging( checkRequired("count", count), checkRequired("offset", offset), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Paging = apply { + if (validated) { + return@apply + } + + count() + offset() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6685,47 +7033,68 @@ private constructor( "Paging{count=$count, offset=$offset, additionalProperties=$additionalProperties}" } - @NoAutoDetect class PayStatements - @JsonCreator private constructor( - @JsonProperty("earnings") - @ExcludeMissing - private val earnings: JsonField = JsonMissing.of(), - @JsonProperty("employee_deductions") - @ExcludeMissing - private val employeeDeductions: JsonField = - JsonMissing.of(), - @JsonProperty("employer_contributions") - @ExcludeMissing - private val employerContributions: JsonField = - JsonMissing.of(), - @JsonProperty("gross_pay") - @ExcludeMissing - private val grossPay: JsonField = JsonMissing.of(), - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonProperty("net_pay") - @ExcludeMissing - private val netPay: JsonField = JsonMissing.of(), - @JsonProperty("payment_method") - @ExcludeMissing - private val paymentMethod: JsonField = JsonMissing.of(), - @JsonProperty("taxes") - @ExcludeMissing - private val taxes: JsonField = JsonMissing.of(), - @JsonProperty("total_hours") - @ExcludeMissing - private val totalHours: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val earnings: JsonField, + private val employeeDeductions: JsonField, + private val employerContributions: JsonField, + private val grossPay: JsonField, + private val individualId: JsonField, + private val netPay: JsonField, + private val paymentMethod: JsonField, + private val taxes: JsonField, + private val totalHours: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("earnings") + @ExcludeMissing + earnings: JsonField = JsonMissing.of(), + @JsonProperty("employee_deductions") + @ExcludeMissing + employeeDeductions: JsonField = JsonMissing.of(), + @JsonProperty("employer_contributions") + @ExcludeMissing + employerContributions: JsonField = + JsonMissing.of(), + @JsonProperty("gross_pay") + @ExcludeMissing + grossPay: JsonField = JsonMissing.of(), + @JsonProperty("individual_id") + @ExcludeMissing + individualId: JsonField = JsonMissing.of(), + @JsonProperty("net_pay") + @ExcludeMissing + netPay: JsonField = JsonMissing.of(), + @JsonProperty("payment_method") + @ExcludeMissing + paymentMethod: JsonField = JsonMissing.of(), + @JsonProperty("taxes") + @ExcludeMissing + taxes: JsonField = JsonMissing.of(), + @JsonProperty("total_hours") + @ExcludeMissing + totalHours: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this( + earnings, + employeeDeductions, + employerContributions, + grossPay, + individualId, + netPay, + paymentMethod, + taxes, + totalHours, + type, + mutableMapOf(), + ) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -6900,29 +7269,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PayStatements = apply { - if (validated) { - return@apply - } - - earnings().ifPresent { it.validate() } - employeeDeductions().ifPresent { it.validate() } - employerContributions().ifPresent { it.validate() } - grossPay() - individualId() - netPay() - paymentMethod() - taxes().ifPresent { it.validate() } - totalHours() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -7141,31 +7496,55 @@ private constructor( taxes, totalHours, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): PayStatements = apply { + if (validated) { + return@apply + } + + earnings().ifPresent { it.validate() } + employeeDeductions().ifPresent { it.validate() } + employerContributions().ifPresent { it.validate() } + grossPay() + individualId() + netPay() + paymentMethod() + taxes().ifPresent { it.validate() } + totalHours() + type() + validated = true + } + class Earnings - @JsonCreator private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val amount: JsonField, + private val currency: JsonField, + private val name: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(amount, currency, name, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -7234,24 +7613,15 @@ private constructor( @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = - additionalProperties - - private var validated: Boolean = false - - fun validate(): Earnings = apply { - if (validated) { - return@apply - } - - amount() - currency() - name() - type() - validated = true - } + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -7367,10 +7737,24 @@ private constructor( currency, name, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Earnings = apply { + if (validated) { + return@apply + } + + amount() + currency() + name() + type() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -7387,32 +7771,37 @@ private constructor( override fun toString() = "Earnings{amount=$amount, currency=$currency, name=$name, type=$type, additionalProperties=$additionalProperties}" - } - - @NoAutoDetect - class EmployeeDeductions - @JsonCreator - private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("pre_tax") - @ExcludeMissing - private val preTax: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + } + + class EmployeeDeductions + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val name: JsonField, + private val preTax: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + @JsonProperty("pre_tax") + @ExcludeMissing + preTax: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(amount, currency, name, preTax, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -7498,25 +7887,15 @@ private constructor( @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = - additionalProperties - - private var validated: Boolean = false - - fun validate(): EmployeeDeductions = apply { - if (validated) { - return@apply - } - - amount() - currency() - name() - preTax() - type() - validated = true - } + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -7648,10 +8027,25 @@ private constructor( name, preTax, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): EmployeeDeductions = apply { + if (validated) { + return@apply + } + + amount() + currency() + name() + preTax() + type() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -7670,24 +8064,27 @@ private constructor( "EmployeeDeductions{amount=$amount, currency=$currency, name=$name, preTax=$preTax, type=$type, additionalProperties=$additionalProperties}" } - @NoAutoDetect class EmployerContributions - @JsonCreator private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val amount: JsonField, + private val currency: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + ) : this(amount, currency, name, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -7739,23 +8136,15 @@ private constructor( @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = - additionalProperties - - private var validated: Boolean = false - - fun validate(): EmployerContributions = apply { - if (validated) { - return@apply - } - - amount() - currency() - name() - validated = true - } + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -7859,10 +8248,23 @@ private constructor( amount, currency, name, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): EmployerContributions = apply { + if (validated) { + return@apply + } + + amount() + currency() + name() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -7881,30 +8283,35 @@ private constructor( "EmployerContributions{amount=$amount, currency=$currency, name=$name, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Taxes - @JsonCreator private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("employer") - @ExcludeMissing - private val employer: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val amount: JsonField, + private val currency: JsonField, + private val employer: JsonField, + private val name: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("employer") + @ExcludeMissing + employer: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(amount, currency, employer, name, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -7990,25 +8397,15 @@ private constructor( @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = - additionalProperties - - private var validated: Boolean = false - - fun validate(): Taxes = apply { - if (validated) { - return@apply - } - - amount() - currency() - employer() - name() - type() - validated = true - } + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -8139,10 +8536,25 @@ private constructor( employer, name, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Taxes = apply { + if (validated) { + return@apply + } + + amount() + currency() + employer() + name() + type() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -8197,50 +8609,77 @@ private constructor( "SupportedPayStatementFields{paging=$paging, payStatements=$payStatements, additionalProperties=$additionalProperties}" } - @NoAutoDetect class SupportedPaymentFields - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("company_debit") - @ExcludeMissing - private val companyDebit: JsonField = JsonMissing.of(), - @JsonProperty("debit_date") - @ExcludeMissing - private val debitDate: JsonField = JsonMissing.of(), - @JsonProperty("employee_taxes") - @ExcludeMissing - private val employeeTaxes: JsonField = JsonMissing.of(), - @JsonProperty("employer_taxes") - @ExcludeMissing - private val employerTaxes: JsonField = JsonMissing.of(), - @JsonProperty("gross_pay") - @ExcludeMissing - private val grossPay: JsonField = JsonMissing.of(), - @JsonProperty("individual_ids") - @ExcludeMissing - private val individualIds: JsonField = JsonMissing.of(), - @JsonProperty("net_pay") - @ExcludeMissing - private val netPay: JsonField = JsonMissing.of(), - @JsonProperty("pay_date") - @ExcludeMissing - private val payDate: JsonField = JsonMissing.of(), - @JsonProperty("pay_frequencies") - @ExcludeMissing - private val payFrequencies: JsonField = JsonMissing.of(), - @JsonProperty("pay_group_ids") - @ExcludeMissing - private val payGroupIds: JsonField = JsonMissing.of(), - @JsonProperty("pay_period") - @ExcludeMissing - private val payPeriod: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val companyDebit: JsonField, + private val debitDate: JsonField, + private val employeeTaxes: JsonField, + private val employerTaxes: JsonField, + private val grossPay: JsonField, + private val individualIds: JsonField, + private val netPay: JsonField, + private val payDate: JsonField, + private val payFrequencies: JsonField, + private val payGroupIds: JsonField, + private val payPeriod: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") + @ExcludeMissing + id: JsonField = JsonMissing.of(), + @JsonProperty("company_debit") + @ExcludeMissing + companyDebit: JsonField = JsonMissing.of(), + @JsonProperty("debit_date") + @ExcludeMissing + debitDate: JsonField = JsonMissing.of(), + @JsonProperty("employee_taxes") + @ExcludeMissing + employeeTaxes: JsonField = JsonMissing.of(), + @JsonProperty("employer_taxes") + @ExcludeMissing + employerTaxes: JsonField = JsonMissing.of(), + @JsonProperty("gross_pay") + @ExcludeMissing + grossPay: JsonField = JsonMissing.of(), + @JsonProperty("individual_ids") + @ExcludeMissing + individualIds: JsonField = JsonMissing.of(), + @JsonProperty("net_pay") + @ExcludeMissing + netPay: JsonField = JsonMissing.of(), + @JsonProperty("pay_date") + @ExcludeMissing + payDate: JsonField = JsonMissing.of(), + @JsonProperty("pay_frequencies") + @ExcludeMissing + payFrequencies: JsonField = JsonMissing.of(), + @JsonProperty("pay_group_ids") + @ExcludeMissing + payGroupIds: JsonField = JsonMissing.of(), + @JsonProperty("pay_period") + @ExcludeMissing + payPeriod: JsonField = JsonMissing.of(), + ) : this( + id, + companyDebit, + debitDate, + employeeTaxes, + employerTaxes, + grossPay, + individualIds, + netPay, + payDate, + payFrequencies, + payGroupIds, + payPeriod, + mutableMapOf(), + ) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -8442,31 +8881,15 @@ private constructor( @ExcludeMissing fun _payPeriod(): JsonField = payPeriod + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SupportedPaymentFields = apply { - if (validated) { - return@apply - } - - id() - companyDebit() - debitDate() - employeeTaxes() - employerTaxes() - grossPay() - individualIds() - netPay() - payDate() - payFrequencies() - payGroupIds() - payPeriod().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -8712,25 +9135,49 @@ private constructor( payFrequencies, payGroupIds, payPeriod, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): SupportedPaymentFields = apply { + if (validated) { + return@apply + } + + id() + companyDebit() + debitDate() + employeeTaxes() + employerTaxes() + grossPay() + individualIds() + netPay() + payDate() + payFrequencies() + payGroupIds() + payPeriod().ifPresent { it.validate() } + validated = true + } + class PayPeriod - @JsonCreator private constructor( - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val endDate: JsonField, + private val startDate: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("end_date") + @ExcludeMissing + endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + startDate: JsonField = JsonMissing.of(), + ) : this(endDate, startDate, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -8765,21 +9212,15 @@ private constructor( @ExcludeMissing fun _startDate(): JsonField = startDate + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PayPeriod = apply { - if (validated) { - return@apply - } - - endDate() - startDate() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -8862,7 +9303,19 @@ private constructor( * instance. */ fun build(): PayPeriod = - PayPeriod(endDate, startDate, additionalProperties.toImmutable()) + PayPeriod(endDate, startDate, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): PayPeriod = apply { + if (validated) { + return@apply + } + + endDate() + startDate() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt index db848fb6..4400446f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt @@ -11,40 +11,51 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional -@NoAutoDetect class AccountUpdateResponse -@JsonCreator private constructor( - @JsonProperty("account_id") - @ExcludeMissing - private val accountId: JsonField = JsonMissing.of(), - @JsonProperty("authentication_type") - @ExcludeMissing - private val authenticationType: JsonField = JsonMissing.of(), - @JsonProperty("company_id") - @ExcludeMissing - private val companyId: JsonField = JsonMissing.of(), - @JsonProperty("products") - @ExcludeMissing - private val products: JsonField> = JsonMissing.of(), - @JsonProperty("provider_id") - @ExcludeMissing - private val providerId: JsonField = JsonMissing.of(), - @JsonProperty("connection_id") - @ExcludeMissing - private val connectionId: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val accountId: JsonField, + private val authenticationType: JsonField, + private val companyId: JsonField, + private val products: JsonField>, + private val providerId: JsonField, + private val connectionId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("account_id") @ExcludeMissing accountId: JsonField = JsonMissing.of(), + @JsonProperty("authentication_type") + @ExcludeMissing + authenticationType: JsonField = JsonMissing.of(), + @JsonProperty("company_id") @ExcludeMissing companyId: JsonField = JsonMissing.of(), + @JsonProperty("products") + @ExcludeMissing + products: JsonField> = JsonMissing.of(), + @JsonProperty("provider_id") + @ExcludeMissing + providerId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + connectionId: JsonField = JsonMissing.of(), + ) : this( + accountId, + authenticationType, + companyId, + products, + providerId, + connectionId, + mutableMapOf(), + ) + /** * [DEPRECATED] Use `connection_id` to associate a connection with an access token * @@ -144,25 +155,15 @@ private constructor( @ExcludeMissing fun _connectionId(): JsonField = connectionId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): AccountUpdateResponse = apply { - if (validated) { - return@apply - } - - accountId() - authenticationType() - companyId() - products() - providerId() - connectionId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -341,10 +342,26 @@ private constructor( checkRequired("products", products).map { it.toImmutable() }, checkRequired("providerId", providerId), connectionId, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): AccountUpdateResponse = apply { + if (validated) { + return@apply + } + + accountId() + authenticationType() + companyId() + products() + providerId() + connectionId() + validated = true + } + class AuthenticationType @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt index 9c239497..53bcf788 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt @@ -11,46 +11,60 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.time.OffsetDateTime +import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -@NoAutoDetect class AutomatedAsyncJob -@JsonCreator private constructor( - @JsonProperty("completed_at") - @ExcludeMissing - private val completedAt: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("job_id") @ExcludeMissing private val jobId: JsonField = JsonMissing.of(), - @JsonProperty("job_url") - @ExcludeMissing - private val jobUrl: JsonField = JsonMissing.of(), - @JsonProperty("params") - @ExcludeMissing - private val params: JsonField = JsonMissing.of(), - @JsonProperty("scheduled_at") - @ExcludeMissing - private val scheduledAt: JsonField = JsonMissing.of(), - @JsonProperty("started_at") - @ExcludeMissing - private val startedAt: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val completedAt: JsonField, + private val createdAt: JsonField, + private val jobId: JsonField, + private val jobUrl: JsonField, + private val params: JsonField, + private val scheduledAt: JsonField, + private val startedAt: JsonField, + private val status: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("completed_at") + @ExcludeMissing + completedAt: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("job_id") @ExcludeMissing jobId: JsonField = JsonMissing.of(), + @JsonProperty("job_url") @ExcludeMissing jobUrl: JsonField = JsonMissing.of(), + @JsonProperty("params") @ExcludeMissing params: JsonField = JsonMissing.of(), + @JsonProperty("scheduled_at") + @ExcludeMissing + scheduledAt: JsonField = JsonMissing.of(), + @JsonProperty("started_at") + @ExcludeMissing + startedAt: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this( + completedAt, + createdAt, + jobId, + jobUrl, + params, + scheduledAt, + startedAt, + status, + type, + mutableMapOf(), + ) + /** * The datetime the job completed. * @@ -197,28 +211,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): AutomatedAsyncJob = apply { - if (validated) { - return@apply - } - - completedAt() - createdAt() - jobId() - jobUrl() - params().ifPresent { it.validate() } - scheduledAt() - startedAt() - status() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -451,22 +452,43 @@ private constructor( checkRequired("startedAt", startedAt), checkRequired("status", status), checkRequired("type", type), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): AutomatedAsyncJob = apply { + if (validated) { + return@apply + } + + completedAt() + createdAt() + jobId() + jobUrl() + params().ifPresent { it.validate() } + scheduledAt() + startedAt() + status() + type() + validated = true + } + /** The input parameters for the job. */ - @NoAutoDetect class Params - @JsonCreator private constructor( - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val individualId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("individual_id") + @ExcludeMissing + individualId: JsonField = JsonMissing.of() + ) : this(individualId, mutableMapOf()) + /** * The ID of the individual that the job was completed for. * @@ -486,20 +508,15 @@ private constructor( @ExcludeMissing fun _individualId(): JsonField = individualId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Params = apply { - if (validated) { - return@apply - } - - individualId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -559,7 +576,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Params = Params(individualId, additionalProperties.toImmutable()) + fun build(): Params = Params(individualId, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Params = apply { + if (validated) { + return@apply + } + + individualId() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt index 9b08718d..6e9399ec 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt @@ -10,30 +10,32 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects -@NoAutoDetect class AutomatedCreateResponse -@JsonCreator private constructor( - @JsonProperty("allowed_refreshes") - @ExcludeMissing - private val allowedRefreshes: JsonField = JsonMissing.of(), - @JsonProperty("job_id") @ExcludeMissing private val jobId: JsonField = JsonMissing.of(), - @JsonProperty("job_url") - @ExcludeMissing - private val jobUrl: JsonField = JsonMissing.of(), - @JsonProperty("remaining_refreshes") - @ExcludeMissing - private val remainingRefreshes: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val allowedRefreshes: JsonField, + private val jobId: JsonField, + private val jobUrl: JsonField, + private val remainingRefreshes: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("allowed_refreshes") + @ExcludeMissing + allowedRefreshes: JsonField = JsonMissing.of(), + @JsonProperty("job_id") @ExcludeMissing jobId: JsonField = JsonMissing.of(), + @JsonProperty("job_url") @ExcludeMissing jobUrl: JsonField = JsonMissing.of(), + @JsonProperty("remaining_refreshes") + @ExcludeMissing + remainingRefreshes: JsonField = JsonMissing.of(), + ) : this(allowedRefreshes, jobId, jobUrl, remainingRefreshes, mutableMapOf()) + /** * The number of allowed refreshes per hour (per hour, fixed window) * @@ -100,23 +102,15 @@ private constructor( @ExcludeMissing fun _remainingRefreshes(): JsonField = remainingRefreshes + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): AutomatedCreateResponse = apply { - if (validated) { - return@apply - } - - allowedRefreshes() - jobId() - jobUrl() - remainingRefreshes() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -246,10 +240,24 @@ private constructor( checkRequired("jobId", jobId), checkRequired("jobUrl", jobUrl), checkRequired("remainingRefreshes", remainingRefreshes), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): AutomatedCreateResponse = apply { + if (validated) { + return@apply + } + + allowedRefreshes() + jobId() + jobUrl() + remainingRefreshes() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt index bc4087b7..88839a6d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt @@ -10,26 +10,29 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional -@NoAutoDetect class AutomatedListResponse -@JsonCreator private constructor( - @JsonProperty("data") - @ExcludeMissing - private val data: JsonField> = JsonMissing.of(), - @JsonProperty("meta") @ExcludeMissing private val meta: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val data: JsonField>, + private val meta: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("data") + @ExcludeMissing + data: JsonField> = JsonMissing.of(), + @JsonProperty("meta") @ExcludeMissing meta: JsonField = JsonMissing.of(), + ) : this(data, meta, 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). @@ -56,21 +59,15 @@ private constructor( */ @JsonProperty("meta") @ExcludeMissing fun _meta(): JsonField = meta + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): AutomatedListResponse = apply { - if (validated) { - return@apply - } - - data().forEach { it.validate() } - meta().validate() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -173,21 +170,33 @@ private constructor( AutomatedListResponse( checkRequired("data", data).map { it.toImmutable() }, checkRequired("meta", meta), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): AutomatedListResponse = apply { + if (validated) { + return@apply + } + + data().forEach { it.validate() } + meta().validate() + validated = true + } + class Meta - @JsonCreator private constructor( - @JsonProperty("quotas") - @ExcludeMissing - private val quotas: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val quotas: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("quotas") @ExcludeMissing quotas: JsonField = JsonMissing.of() + ) : this(quotas, mutableMapOf()) + /** * Information about remaining quotas for this connection. Only applicable for customers * opted in to use Finch's Data Sync Refresh endpoint (`POST /jobs/automated`). Please @@ -205,20 +214,15 @@ private constructor( */ @JsonProperty("quotas") @ExcludeMissing fun _quotas(): JsonField = quotas + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Meta = apply { - if (validated) { - return@apply - } - - quotas().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -280,7 +284,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Meta = Meta(quotas, additionalProperties.toImmutable()) + fun build(): Meta = Meta(quotas, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Meta = apply { + if (validated) { + return@apply + } + + quotas().ifPresent { it.validate() } + validated = true } /** @@ -288,17 +303,19 @@ private constructor( * opted in to use Finch's Data Sync Refresh endpoint (`POST /jobs/automated`). Please * contact a Finch representative for more details. */ - @NoAutoDetect class Quotas - @JsonCreator private constructor( - @JsonProperty("data_sync_all") - @ExcludeMissing - private val dataSyncAll: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val dataSyncAll: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("data_sync_all") + @ExcludeMissing + dataSyncAll: JsonField = JsonMissing.of() + ) : this(dataSyncAll, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -316,20 +333,15 @@ private constructor( @ExcludeMissing fun _dataSyncAll(): JsonField = dataSyncAll + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Quotas = apply { - if (validated) { - return@apply - } - - dataSyncAll().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -391,23 +403,37 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Quotas = Quotas(dataSyncAll, additionalProperties.toImmutable()) + fun build(): Quotas = Quotas(dataSyncAll, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Quotas = apply { + if (validated) { + return@apply + } + + dataSyncAll().ifPresent { it.validate() } + validated = true } - @NoAutoDetect class DataSyncAll - @JsonCreator private constructor( - @JsonProperty("allowed_refreshes") - @ExcludeMissing - private val allowedRefreshes: JsonField = JsonMissing.of(), - @JsonProperty("remaining_refreshes") - @ExcludeMissing - private val remainingRefreshes: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val allowedRefreshes: JsonField, + private val remainingRefreshes: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("allowed_refreshes") + @ExcludeMissing + allowedRefreshes: JsonField = JsonMissing.of(), + @JsonProperty("remaining_refreshes") + @ExcludeMissing + remainingRefreshes: JsonField = JsonMissing.of(), + ) : this(allowedRefreshes, remainingRefreshes, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -442,21 +468,15 @@ private constructor( @ExcludeMissing fun _remainingRefreshes(): JsonField = remainingRefreshes + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): DataSyncAll = apply { - if (validated) { - return@apply - } - - allowedRefreshes() - remainingRefreshes() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -539,10 +559,22 @@ private constructor( DataSyncAll( allowedRefreshes, remainingRefreshes, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): DataSyncAll = apply { + if (validated) { + return@apply + } + + allowedRefreshes() + remainingRefreshes() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt index 9a59d6c4..01fe10d5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt @@ -10,30 +10,29 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional -@NoAutoDetect class BaseWebhookEvent -@JsonCreator private constructor( - @JsonProperty("account_id") - @ExcludeMissing - private val accountId: JsonField = JsonMissing.of(), - @JsonProperty("company_id") - @ExcludeMissing - private val companyId: JsonField = JsonMissing.of(), - @JsonProperty("connection_id") - @ExcludeMissing - private val connectionId: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val accountId: JsonField, + private val companyId: JsonField, + private val connectionId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("account_id") @ExcludeMissing accountId: JsonField = JsonMissing.of(), + @JsonProperty("company_id") @ExcludeMissing companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + connectionId: JsonField = JsonMissing.of(), + ) : this(accountId, companyId, connectionId, mutableMapOf()) + /** * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. @@ -90,22 +89,15 @@ private constructor( @ExcludeMissing fun _connectionId(): JsonField = connectionId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): BaseWebhookEvent = apply { - if (validated) { - return@apply - } - - accountId() - companyId() - connectionId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -224,10 +216,23 @@ private constructor( checkRequired("accountId", accountId), checkRequired("companyId", companyId), connectionId, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): BaseWebhookEvent = apply { + if (validated) { + return@apply + } + + accountId() + companyId() + connectionId() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt index 192f8a50..823f5611 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt @@ -11,23 +11,25 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -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 -@NoAutoDetect class BenefitContribution -@JsonCreator private constructor( - @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val amount: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(amount, type, mutableMapOf()) + /** * Contribution amount in cents (if `fixed`) or basis points (if `percent`). * @@ -58,21 +60,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): BenefitContribution = apply { - if (validated) { - return@apply - } - - amount() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -156,7 +152,19 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): BenefitContribution = - BenefitContribution(amount, type, additionalProperties.toImmutable()) + BenefitContribution(amount, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): BenefitContribution = apply { + if (validated) { + return@apply + } + + amount() + type() + validated = true } /** Contribution type. */ diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt index e8501bcb..a49bd18d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt @@ -11,28 +11,31 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown -import com.tryfinch.api.core.immutableEmptyMap 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 -@NoAutoDetect class BenefitFeaturesAndOperations -@JsonCreator private constructor( - @JsonProperty("supported_features") - @ExcludeMissing - private val supportedFeatures: JsonField = JsonMissing.of(), - @JsonProperty("supported_operations") - @ExcludeMissing - private val supportedOperations: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val supportedFeatures: JsonField, + private val supportedOperations: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("supported_features") + @ExcludeMissing + supportedFeatures: JsonField = JsonMissing.of(), + @JsonProperty("supported_operations") + @ExcludeMissing + supportedOperations: JsonField = JsonMissing.of(), + ) : this(supportedFeatures, supportedOperations, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -67,21 +70,15 @@ private constructor( @ExcludeMissing fun _supportedOperations(): JsonField = supportedOperations + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): BenefitFeaturesAndOperations = apply { - if (validated) { - return@apply - } - - supportedFeatures().ifPresent { it.validate() } - supportedOperations().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -163,39 +160,68 @@ private constructor( BenefitFeaturesAndOperations( supportedFeatures, supportedOperations, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): BenefitFeaturesAndOperations = apply { + if (validated) { + return@apply + } + + supportedFeatures().ifPresent { it.validate() } + supportedOperations().ifPresent { it.validate() } + validated = true + } + class BenefitFeature - @JsonCreator private constructor( - @JsonProperty("annual_maximum") - @ExcludeMissing - private val annualMaximum: JsonField = JsonMissing.of(), - @JsonProperty("catch_up") - @ExcludeMissing - private val catchUp: JsonField = JsonMissing.of(), - @JsonProperty("company_contribution") - @ExcludeMissing - private val companyContribution: JsonField> = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("employee_deduction") - @ExcludeMissing - private val employeeDeduction: JsonField> = JsonMissing.of(), - @JsonProperty("frequencies") - @ExcludeMissing - private val frequencies: JsonField> = JsonMissing.of(), - @JsonProperty("hsa_contribution_limit") - @ExcludeMissing - private val hsaContributionLimit: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + 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. * @@ -323,26 +349,15 @@ private constructor( @ExcludeMissing fun _hsaContributionLimit(): JsonField> = hsaContributionLimit + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): BenefitFeature = apply { - if (validated) { - return@apply - } - - annualMaximum() - catchUp() - companyContribution() - description() - employeeDeduction() - frequencies() - hsaContributionLimit() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -613,10 +628,27 @@ private constructor( (employeeDeduction ?: JsonMissing.of()).map { it.toImmutable() }, (frequencies ?: JsonMissing.of()).map { it.toImmutable() }, (hsaContributionLimit ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): BenefitFeature = apply { + if (validated) { + return@apply + } + + annualMaximum() + catchUp() + companyContribution() + description() + employeeDeduction() + frequencies() + hsaContributionLimit() + validated = true + } + class CompanyContribution @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt index 4d73526d..46b8077d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -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 @@ -22,49 +20,77 @@ import kotlin.jvm.optionals.getOrNull * Each benefit type and their supported features. If the benefit type is not supported, the * property will be null */ -@NoAutoDetect class BenefitsSupport -@JsonCreator private constructor( - @JsonProperty("commuter") - @ExcludeMissing - private val commuter: JsonField = JsonMissing.of(), - @JsonProperty("custom_post_tax") - @ExcludeMissing - private val customPostTax: JsonField = JsonMissing.of(), - @JsonProperty("custom_pre_tax") - @ExcludeMissing - private val customPreTax: JsonField = JsonMissing.of(), - @JsonProperty("fsa_dependent_care") - @ExcludeMissing - private val fsaDependentCare: JsonField = JsonMissing.of(), - @JsonProperty("fsa_medical") - @ExcludeMissing - private val fsaMedical: JsonField = JsonMissing.of(), - @JsonProperty("hsa_post") - @ExcludeMissing - private val hsaPost: JsonField = JsonMissing.of(), - @JsonProperty("hsa_pre") - @ExcludeMissing - private val hsaPre: JsonField = JsonMissing.of(), - @JsonProperty("s125_dental") - @ExcludeMissing - private val s125Dental: JsonField = JsonMissing.of(), - @JsonProperty("s125_medical") - @ExcludeMissing - private val s125Medical: JsonField = JsonMissing.of(), - @JsonProperty("s125_vision") - @ExcludeMissing - private val s125Vision: JsonField = JsonMissing.of(), - @JsonProperty("simple") - @ExcludeMissing - private val simple: JsonField = JsonMissing.of(), - @JsonProperty("simple_ira") - @ExcludeMissing - private val simpleIra: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val commuter: JsonField, + private val customPostTax: JsonField, + private val customPreTax: JsonField, + private val fsaDependentCare: JsonField, + private val fsaMedical: JsonField, + private val hsaPost: JsonField, + private val hsaPre: JsonField, + private val s125Dental: JsonField, + private val s125Medical: JsonField, + private val s125Vision: JsonField, + private val simple: JsonField, + private val simpleIra: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("commuter") + @ExcludeMissing + commuter: JsonField = JsonMissing.of(), + @JsonProperty("custom_post_tax") + @ExcludeMissing + customPostTax: JsonField = JsonMissing.of(), + @JsonProperty("custom_pre_tax") + @ExcludeMissing + customPreTax: JsonField = JsonMissing.of(), + @JsonProperty("fsa_dependent_care") + @ExcludeMissing + fsaDependentCare: JsonField = JsonMissing.of(), + @JsonProperty("fsa_medical") + @ExcludeMissing + fsaMedical: JsonField = JsonMissing.of(), + @JsonProperty("hsa_post") + @ExcludeMissing + hsaPost: JsonField = JsonMissing.of(), + @JsonProperty("hsa_pre") + @ExcludeMissing + hsaPre: JsonField = JsonMissing.of(), + @JsonProperty("s125_dental") + @ExcludeMissing + s125Dental: JsonField = JsonMissing.of(), + @JsonProperty("s125_medical") + @ExcludeMissing + s125Medical: JsonField = JsonMissing.of(), + @JsonProperty("s125_vision") + @ExcludeMissing + s125Vision: JsonField = JsonMissing.of(), + @JsonProperty("simple") + @ExcludeMissing + simple: JsonField = JsonMissing.of(), + @JsonProperty("simple_ira") + @ExcludeMissing + simpleIra: JsonField = JsonMissing.of(), + ) : this( + commuter, + customPostTax, + customPreTax, + fsaDependentCare, + fsaMedical, + hsaPost, + hsaPre, + s125Dental, + s125Medical, + s125Vision, + simple, + simpleIra, + mutableMapOf(), + ) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -258,31 +284,15 @@ private constructor( @ExcludeMissing fun _simpleIra(): JsonField = simpleIra + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): BenefitsSupport = apply { - if (validated) { - return@apply - } - - commuter().ifPresent { it.validate() } - customPostTax().ifPresent { it.validate() } - customPreTax().ifPresent { it.validate() } - fsaDependentCare().ifPresent { it.validate() } - fsaMedical().ifPresent { it.validate() } - hsaPost().ifPresent { it.validate() } - hsaPre().ifPresent { it.validate() } - s125Dental().ifPresent { it.validate() } - s125Medical().ifPresent { it.validate() } - s125Vision().ifPresent { it.validate() } - simple().ifPresent { it.validate() } - simpleIra().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -570,10 +580,32 @@ private constructor( s125Vision, simple, simpleIra, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): BenefitsSupport = apply { + if (validated) { + return@apply + } + + commuter().ifPresent { it.validate() } + customPostTax().ifPresent { it.validate() } + customPreTax().ifPresent { it.validate() } + fsaDependentCare().ifPresent { it.validate() } + fsaMedical().ifPresent { it.validate() } + hsaPost().ifPresent { it.validate() } + hsaPre().ifPresent { it.validate() } + s125Dental().ifPresent { it.validate() } + s125Medical().ifPresent { it.validate() } + s125Vision().ifPresent { it.validate() } + simple().ifPresent { it.validate() } + simpleIra().ifPresent { it.validate() } + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt index d58817ac..2445f95d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt @@ -11,46 +11,63 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap 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 -@NoAutoDetect class Company -@JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("accounts") - @ExcludeMissing - private val accounts: JsonField> = JsonMissing.of(), - @JsonProperty("departments") - @ExcludeMissing - private val departments: JsonField> = JsonMissing.of(), - @JsonProperty("ein") @ExcludeMissing private val ein: JsonField = JsonMissing.of(), - @JsonProperty("entity") - @ExcludeMissing - private val entity: JsonField = JsonMissing.of(), - @JsonProperty("legal_name") - @ExcludeMissing - private val legalName: JsonField = JsonMissing.of(), - @JsonProperty("locations") - @ExcludeMissing - private val locations: JsonField> = JsonMissing.of(), - @JsonProperty("primary_email") - @ExcludeMissing - private val primaryEmail: JsonField = JsonMissing.of(), - @JsonProperty("primary_phone_number") - @ExcludeMissing - private val primaryPhoneNumber: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val accounts: JsonField>, + private val departments: JsonField>, + private val ein: JsonField, + private val entity: JsonField, + private val legalName: JsonField, + private val locations: JsonField>, + private val primaryEmail: JsonField, + private val primaryPhoneNumber: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("accounts") + @ExcludeMissing + accounts: JsonField> = JsonMissing.of(), + @JsonProperty("departments") + @ExcludeMissing + departments: JsonField> = JsonMissing.of(), + @JsonProperty("ein") @ExcludeMissing ein: JsonField = JsonMissing.of(), + @JsonProperty("entity") @ExcludeMissing entity: JsonField = JsonMissing.of(), + @JsonProperty("legal_name") @ExcludeMissing legalName: JsonField = JsonMissing.of(), + @JsonProperty("locations") + @ExcludeMissing + locations: JsonField> = JsonMissing.of(), + @JsonProperty("primary_email") + @ExcludeMissing + primaryEmail: JsonField = JsonMissing.of(), + @JsonProperty("primary_phone_number") + @ExcludeMissing + primaryPhoneNumber: JsonField = JsonMissing.of(), + ) : this( + id, + accounts, + departments, + ein, + entity, + legalName, + locations, + primaryEmail, + primaryPhoneNumber, + mutableMapOf(), + ) + /** * A stable Finch `id` (UUID v4) for the company. * @@ -197,28 +214,15 @@ private constructor( @ExcludeMissing fun _primaryPhoneNumber(): JsonField = primaryPhoneNumber + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Company = apply { - if (validated) { - return@apply - } - - id() - accounts().ifPresent { it.forEach { it.validate() } } - departments().ifPresent { it.forEach { it?.validate() } } - ein() - entity().ifPresent { it.validate() } - legalName() - locations().ifPresent { it.forEach { it?.validate() } } - primaryEmail() - primaryPhoneNumber() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -501,33 +505,65 @@ private constructor( checkRequired("locations", locations).map { it.toImmutable() }, checkRequired("primaryEmail", primaryEmail), checkRequired("primaryPhoneNumber", primaryPhoneNumber), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): Company = apply { + if (validated) { + return@apply + } + + id() + accounts().ifPresent { it.forEach { it.validate() } } + departments().ifPresent { it.forEach { it?.validate() } } + ein() + entity().ifPresent { it.validate() } + legalName() + locations().ifPresent { it.forEach { it?.validate() } } + primaryEmail() + primaryPhoneNumber() + validated = true + } + class Account - @JsonCreator private constructor( - @JsonProperty("account_name") - @ExcludeMissing - private val accountName: JsonField = JsonMissing.of(), - @JsonProperty("account_number") - @ExcludeMissing - private val accountNumber: JsonField = JsonMissing.of(), - @JsonProperty("account_type") - @ExcludeMissing - private val accountType: JsonField = JsonMissing.of(), - @JsonProperty("institution_name") - @ExcludeMissing - private val institutionName: JsonField = JsonMissing.of(), - @JsonProperty("routing_number") - @ExcludeMissing - private val routingNumber: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val accountName: JsonField, + private val accountNumber: JsonField, + private val accountType: JsonField, + private val institutionName: JsonField, + private val routingNumber: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("account_name") + @ExcludeMissing + accountName: JsonField = JsonMissing.of(), + @JsonProperty("account_number") + @ExcludeMissing + accountNumber: JsonField = JsonMissing.of(), + @JsonProperty("account_type") + @ExcludeMissing + accountType: JsonField = JsonMissing.of(), + @JsonProperty("institution_name") + @ExcludeMissing + institutionName: JsonField = JsonMissing.of(), + @JsonProperty("routing_number") + @ExcludeMissing + routingNumber: JsonField = JsonMissing.of(), + ) : this( + accountName, + accountNumber, + accountType, + institutionName, + routingNumber, + mutableMapOf(), + ) + /** * The name of the bank associated in the payroll/HRIS system. * @@ -621,24 +657,15 @@ private constructor( @ExcludeMissing fun _routingNumber(): JsonField = routingNumber + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Account = apply { - if (validated) { - return@apply - } - - accountName() - accountNumber() - accountType() - institutionName() - routingNumber() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -795,10 +822,25 @@ private constructor( accountType, institutionName, routingNumber, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Account = apply { + if (validated) { + return@apply + } + + accountName() + accountNumber() + accountType() + institutionName() + routingNumber() + validated = true + } + /** The type of bank account. */ class AccountType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -922,20 +964,19 @@ private constructor( "Account{accountName=$accountName, accountNumber=$accountNumber, accountType=$accountType, institutionName=$institutionName, routingNumber=$routingNumber, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Department - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("parent") - @ExcludeMissing - private val parent: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val name: JsonField, + private val parent: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("parent") @ExcludeMissing parent: JsonField = JsonMissing.of(), + ) : this(name, parent, mutableMapOf()) + /** * The department name. * @@ -966,21 +1007,15 @@ private constructor( */ @JsonProperty("parent") @ExcludeMissing fun _parent(): JsonField = parent + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Department = apply { - if (validated) { - return@apply - } - - name() - parent().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1058,21 +1093,33 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Department = Department(name, parent, additionalProperties.toImmutable()) + fun build(): Department = Department(name, parent, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Department = apply { + if (validated) { + return@apply + } + + name() + parent().ifPresent { it.validate() } + validated = true } /** The parent department, if present. */ - @NoAutoDetect class Parent - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val name: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of() + ) : this(name, mutableMapOf()) + /** * The parent department's name. * @@ -1088,20 +1135,15 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Parent = apply { - if (validated) { - return@apply - } - - name() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1165,7 +1207,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Parent = Parent(name, additionalProperties.toImmutable()) + fun build(): Parent = Parent(name, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Parent = apply { + if (validated) { + return@apply + } + + name() + validated = true } override fun equals(other: Any?): Boolean { @@ -1205,18 +1258,19 @@ private constructor( } /** The entity type object. */ - @NoAutoDetect class Entity - @JsonCreator private constructor( - @JsonProperty("subtype") - @ExcludeMissing - private val subtype: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val subtype: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("subtype") @ExcludeMissing subtype: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(subtype, type, mutableMapOf()) + /** * The tax payer subtype of the company. * @@ -1247,21 +1301,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Entity = apply { - if (validated) { - return@apply - } - - subtype() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1339,7 +1387,19 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Entity = Entity(subtype, type, additionalProperties.toImmutable()) + fun build(): Entity = Entity(subtype, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Entity = apply { + if (validated) { + return@apply + } + + subtype() + type() + validated = true } /** The tax payer subtype of the company. */ diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt index ed22eabd..00feff71 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt @@ -10,34 +10,34 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -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 -@NoAutoDetect class CompanyBenefit -@JsonCreator private constructor( - @JsonProperty("benefit_id") - @ExcludeMissing - private val benefitId: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("frequency") - @ExcludeMissing - private val frequency: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val benefitId: JsonField, + private val description: JsonField, + private val frequency: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("benefit_id") @ExcludeMissing benefitId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("frequency") + @ExcludeMissing + frequency: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(benefitId, description, frequency, type, 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). @@ -96,23 +96,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): CompanyBenefit = apply { - if (validated) { - return@apply - } - - benefitId() - description() - frequency() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -244,10 +236,24 @@ private constructor( checkRequired("description", description), checkRequired("frequency", frequency), checkRequired("type", type), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): CompanyBenefit = apply { + if (validated) { + return@apply + } + + benefitId() + description() + frequency() + type() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt index 1a7da337..f916b070 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt @@ -11,35 +11,43 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -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 -@NoAutoDetect class CompanyEvent -@JsonCreator private constructor( - @JsonProperty("account_id") - @ExcludeMissing - private val accountId: JsonField = JsonMissing.of(), - @JsonProperty("company_id") - @ExcludeMissing - private val companyId: JsonField = JsonMissing.of(), - @JsonProperty("connection_id") - @ExcludeMissing - private val connectionId: JsonField = JsonMissing.of(), - @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), - @JsonProperty("event_type") - @ExcludeMissing - private val eventType: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val accountId: JsonField, + private val companyId: JsonField, + private val connectionId: JsonField, + private val data: JsonField, + private val eventType: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("account_id") @ExcludeMissing accountId: JsonField = JsonMissing.of(), + @JsonProperty("company_id") @ExcludeMissing companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + connectionId: JsonField = JsonMissing.of(), + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + eventType: JsonField = JsonMissing.of(), + ) : this(accountId, companyId, connectionId, data, eventType, mutableMapOf()) + + fun toBaseWebhookEvent(): BaseWebhookEvent = + BaseWebhookEvent.builder() + .accountId(accountId) + .companyId(companyId) + .connectionId(connectionId) + .build() + /** * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. @@ -122,31 +130,15 @@ private constructor( */ @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBaseWebhookEvent(): BaseWebhookEvent = - BaseWebhookEvent.builder() - .accountId(accountId) - .companyId(companyId) - .connectionId(connectionId) - .build() - - private var validated: Boolean = false - - fun validate(): CompanyEvent = apply { - if (validated) { - return@apply - } - - accountId() - companyId() - connectionId() - data().ifPresent { it.validate() } - eventType() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -295,32 +287,40 @@ private constructor( connectionId, data, eventType, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect - class Data - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap() - ) { + private var validated: Boolean = false - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun validate(): CompanyEvent = apply { + if (validated) { + return@apply + } - private var validated: Boolean = false + accountId() + companyId() + connectionId() + data().ifPresent { it.validate() } + eventType() + validated = true + } - fun validate(): Data = apply { - if (validated) { - return@apply - } + class Data + private constructor(private val additionalProperties: MutableMap) { - validated = true + @JsonCreator private constructor() : this(mutableMapOf()) + + @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 { @@ -363,7 +363,17 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Data = Data(additionalProperties.toImmutable()) + fun build(): Data = Data(additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Data = apply { + if (validated) { + return@apply + } + + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt index bd46a96f..664e177e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt @@ -11,45 +11,60 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap 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 -@NoAutoDetect class CompanyUpdateResponse -@JsonCreator private constructor( - @JsonProperty("accounts") - @ExcludeMissing - private val accounts: JsonField> = JsonMissing.of(), - @JsonProperty("departments") - @ExcludeMissing - private val departments: JsonField> = JsonMissing.of(), - @JsonProperty("ein") @ExcludeMissing private val ein: JsonField = JsonMissing.of(), - @JsonProperty("entity") - @ExcludeMissing - private val entity: JsonField = JsonMissing.of(), - @JsonProperty("legal_name") - @ExcludeMissing - private val legalName: JsonField = JsonMissing.of(), - @JsonProperty("locations") - @ExcludeMissing - private val locations: JsonField> = JsonMissing.of(), - @JsonProperty("primary_email") - @ExcludeMissing - private val primaryEmail: JsonField = JsonMissing.of(), - @JsonProperty("primary_phone_number") - @ExcludeMissing - private val primaryPhoneNumber: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val accounts: JsonField>, + private val departments: JsonField>, + private val ein: JsonField, + private val entity: JsonField, + private val legalName: JsonField, + private val locations: JsonField>, + private val primaryEmail: JsonField, + private val primaryPhoneNumber: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("accounts") + @ExcludeMissing + accounts: JsonField> = JsonMissing.of(), + @JsonProperty("departments") + @ExcludeMissing + departments: JsonField> = JsonMissing.of(), + @JsonProperty("ein") @ExcludeMissing ein: JsonField = JsonMissing.of(), + @JsonProperty("entity") @ExcludeMissing entity: JsonField = JsonMissing.of(), + @JsonProperty("legal_name") @ExcludeMissing legalName: JsonField = JsonMissing.of(), + @JsonProperty("locations") + @ExcludeMissing + locations: JsonField> = JsonMissing.of(), + @JsonProperty("primary_email") + @ExcludeMissing + primaryEmail: JsonField = JsonMissing.of(), + @JsonProperty("primary_phone_number") + @ExcludeMissing + primaryPhoneNumber: JsonField = JsonMissing.of(), + ) : this( + accounts, + departments, + ein, + entity, + legalName, + locations, + primaryEmail, + primaryPhoneNumber, + mutableMapOf(), + ) + /** * An array of bank account objects associated with the payroll/HRIS system. * @@ -181,27 +196,15 @@ private constructor( @ExcludeMissing fun _primaryPhoneNumber(): JsonField = primaryPhoneNumber + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): CompanyUpdateResponse = apply { - if (validated) { - return@apply - } - - accounts().ifPresent { it.forEach { it.validate() } } - departments().ifPresent { it.forEach { it?.validate() } } - ein() - entity().ifPresent { it.validate() } - legalName() - locations().ifPresent { it.forEach { it?.validate() } } - primaryEmail() - primaryPhoneNumber() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -468,33 +471,64 @@ private constructor( checkRequired("locations", locations).map { it.toImmutable() }, checkRequired("primaryEmail", primaryEmail), checkRequired("primaryPhoneNumber", primaryPhoneNumber), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): CompanyUpdateResponse = apply { + if (validated) { + return@apply + } + + accounts().ifPresent { it.forEach { it.validate() } } + departments().ifPresent { it.forEach { it?.validate() } } + ein() + entity().ifPresent { it.validate() } + legalName() + locations().ifPresent { it.forEach { it?.validate() } } + primaryEmail() + primaryPhoneNumber() + validated = true + } + class Account - @JsonCreator private constructor( - @JsonProperty("account_name") - @ExcludeMissing - private val accountName: JsonField = JsonMissing.of(), - @JsonProperty("account_number") - @ExcludeMissing - private val accountNumber: JsonField = JsonMissing.of(), - @JsonProperty("account_type") - @ExcludeMissing - private val accountType: JsonField = JsonMissing.of(), - @JsonProperty("institution_name") - @ExcludeMissing - private val institutionName: JsonField = JsonMissing.of(), - @JsonProperty("routing_number") - @ExcludeMissing - private val routingNumber: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val accountName: JsonField, + private val accountNumber: JsonField, + private val accountType: JsonField, + private val institutionName: JsonField, + private val routingNumber: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("account_name") + @ExcludeMissing + accountName: JsonField = JsonMissing.of(), + @JsonProperty("account_number") + @ExcludeMissing + accountNumber: JsonField = JsonMissing.of(), + @JsonProperty("account_type") + @ExcludeMissing + accountType: JsonField = JsonMissing.of(), + @JsonProperty("institution_name") + @ExcludeMissing + institutionName: JsonField = JsonMissing.of(), + @JsonProperty("routing_number") + @ExcludeMissing + routingNumber: JsonField = JsonMissing.of(), + ) : this( + accountName, + accountNumber, + accountType, + institutionName, + routingNumber, + mutableMapOf(), + ) + /** * The name of the bank associated in the payroll/HRIS system. * @@ -588,24 +622,15 @@ private constructor( @ExcludeMissing fun _routingNumber(): JsonField = routingNumber + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Account = apply { - if (validated) { - return@apply - } - - accountName() - accountNumber() - accountType() - institutionName() - routingNumber() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -762,10 +787,25 @@ private constructor( accountType, institutionName, routingNumber, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Account = apply { + if (validated) { + return@apply + } + + accountName() + accountNumber() + accountType() + institutionName() + routingNumber() + validated = true + } + /** The type of bank account. */ class AccountType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -889,20 +929,19 @@ private constructor( "Account{accountName=$accountName, accountNumber=$accountNumber, accountType=$accountType, institutionName=$institutionName, routingNumber=$routingNumber, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Department - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("parent") - @ExcludeMissing - private val parent: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val name: JsonField, + private val parent: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("parent") @ExcludeMissing parent: JsonField = JsonMissing.of(), + ) : this(name, parent, mutableMapOf()) + /** * The department name. * @@ -933,21 +972,15 @@ private constructor( */ @JsonProperty("parent") @ExcludeMissing fun _parent(): JsonField = parent + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Department = apply { - if (validated) { - return@apply - } - - name() - parent().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1025,21 +1058,33 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Department = Department(name, parent, additionalProperties.toImmutable()) + fun build(): Department = Department(name, parent, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Department = apply { + if (validated) { + return@apply + } + + name() + parent().ifPresent { it.validate() } + validated = true } /** The parent department, if present. */ - @NoAutoDetect class Parent - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val name: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of() + ) : this(name, mutableMapOf()) + /** * The parent department's name. * @@ -1055,20 +1100,15 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Parent = apply { - if (validated) { - return@apply - } - - name() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1132,7 +1172,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Parent = Parent(name, additionalProperties.toImmutable()) + fun build(): Parent = Parent(name, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Parent = apply { + if (validated) { + return@apply + } + + name() + validated = true } override fun equals(other: Any?): Boolean { @@ -1172,18 +1223,19 @@ private constructor( } /** The entity type object. */ - @NoAutoDetect class Entity - @JsonCreator private constructor( - @JsonProperty("subtype") - @ExcludeMissing - private val subtype: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val subtype: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("subtype") @ExcludeMissing subtype: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(subtype, type, mutableMapOf()) + /** * The tax payer subtype of the company. * @@ -1214,21 +1266,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Entity = apply { - if (validated) { - return@apply - } - - subtype() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1306,7 +1352,19 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Entity = Entity(subtype, type, additionalProperties.toImmutable()) + fun build(): Entity = Entity(subtype, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Entity = apply { + if (validated) { + return@apply + } + + subtype() + type() + validated = true } /** The tax payer subtype of the company. */ diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt index 2ccd1e1b..ddc3b85f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt @@ -11,15 +11,14 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap 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 @@ -157,493 +156,309 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams + fun toBuilder() = Builder().from(this) - @NoAutoDetect - class Body - @JsonCreator - private constructor( - @JsonProperty("customer_id") - @ExcludeMissing - private val customerId: JsonField = JsonMissing.of(), - @JsonProperty("customer_name") - @ExcludeMissing - private val customerName: JsonField = JsonMissing.of(), - @JsonProperty("products") - @ExcludeMissing - private val products: JsonField> = JsonMissing.of(), - @JsonProperty("customer_email") - @ExcludeMissing - private val customerEmail: JsonField = JsonMissing.of(), - @JsonProperty("integration") - @ExcludeMissing - private val integration: JsonField = JsonMissing.of(), - @JsonProperty("manual") - @ExcludeMissing - private val manual: JsonField = JsonMissing.of(), - @JsonProperty("minutes_to_expire") - @ExcludeMissing - private val minutesToExpire: JsonField = JsonMissing.of(), - @JsonProperty("redirect_uri") - @ExcludeMissing - private val redirectUri: JsonField = JsonMissing.of(), - @JsonProperty("sandbox") - @ExcludeMissing - private val sandbox: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + companion object { /** - * @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). + * Returns a mutable builder for constructing an instance of [ConnectSessionNewParams]. + * + * The following fields are required: + * ```java + * .customerId() + * .customerName() + * .products() + * ``` */ - fun customerId(): String = customerId.getRequired("customer_id") + @JvmStatic fun builder() = Builder() + } - /** - * @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 customerName(): String = customerName.getRequired("customer_name") + /** A builder for [ConnectSessionNewParams]. */ + class Builder internal constructor() { - /** - * @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 products(): List = products.getRequired("products") + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun customerEmail(): Optional = - Optional.ofNullable(customerEmail.getNullable("customer_email")) + @JvmSynthetic + internal fun from(connectSessionNewParams: ConnectSessionNewParams) = apply { + body = connectSessionNewParams.body.toBuilder() + additionalHeaders = connectSessionNewParams.additionalHeaders.toBuilder() + additionalQueryParams = connectSessionNewParams.additionalQueryParams.toBuilder() + } - /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun integration(): Optional = - Optional.ofNullable(integration.getNullable("integration")) + fun customerId(customerId: String) = apply { body.customerId(customerId) } /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * Sets [Builder.customerId] to an arbitrary JSON value. + * + * You should usually call [Builder.customerId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun manual(): Optional = Optional.ofNullable(manual.getNullable("manual")) + fun customerId(customerId: JsonField) = apply { body.customerId(customerId) } + + fun customerName(customerName: String) = apply { body.customerName(customerName) } /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 days) + * Sets [Builder.customerName] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.customerName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun minutesToExpire(): Optional = - Optional.ofNullable(minutesToExpire.getNullable("minutes_to_expire")) + fun customerName(customerName: JsonField) = apply { + body.customerName(customerName) + } + + fun products(products: List) = apply { body.products(products) } /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * Sets [Builder.products] to an arbitrary JSON value. + * + * You should usually call [Builder.products] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun redirectUri(): Optional = - Optional.ofNullable(redirectUri.getNullable("redirect_uri")) + fun products(products: JsonField>) = apply { body.products(products) } /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * Adds a single [ConnectProducts] to [products]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ - fun sandbox(): Optional = Optional.ofNullable(sandbox.getNullable("sandbox")) + fun addProduct(product: ConnectProducts) = apply { body.addProduct(product) } + + fun customerEmail(customerEmail: String?) = apply { body.customerEmail(customerEmail) } + + /** Alias for calling [Builder.customerEmail] with `customerEmail.orElse(null)`. */ + fun customerEmail(customerEmail: Optional) = + customerEmail(customerEmail.getOrNull()) /** - * Returns the raw JSON value of [customerId]. + * Sets [Builder.customerEmail] to an arbitrary JSON value. * - * Unlike [customerId], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.customerEmail] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - @JsonProperty("customer_id") - @ExcludeMissing - fun _customerId(): JsonField = customerId + fun customerEmail(customerEmail: JsonField) = apply { + body.customerEmail(customerEmail) + } + + fun integration(integration: Integration?) = apply { body.integration(integration) } + + /** Alias for calling [Builder.integration] with `integration.orElse(null)`. */ + fun integration(integration: Optional) = integration(integration.getOrNull()) /** - * Returns the raw JSON value of [customerName]. + * Sets [Builder.integration] to an arbitrary JSON value. * - * Unlike [customerName], this method doesn't throw if the JSON field has an unexpected - * type. + * You should usually call [Builder.integration] with a well-typed [Integration] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - @JsonProperty("customer_name") - @ExcludeMissing - fun _customerName(): JsonField = customerName + fun integration(integration: JsonField) = apply { + body.integration(integration) + } + + fun manual(manual: Boolean?) = apply { body.manual(manual) } /** - * Returns the raw JSON value of [products]. + * Alias for [Builder.manual]. * - * Unlike [products], this method doesn't throw if the JSON field has an unexpected type. + * This unboxed primitive overload exists for backwards compatibility. */ - @JsonProperty("products") - @ExcludeMissing - fun _products(): JsonField> = products + fun manual(manual: Boolean) = manual(manual as Boolean?) + + /** Alias for calling [Builder.manual] with `manual.orElse(null)`. */ + fun manual(manual: Optional) = manual(manual.getOrNull()) /** - * Returns the raw JSON value of [customerEmail]. + * Sets [Builder.manual] to an arbitrary JSON value. * - * Unlike [customerEmail], this method doesn't throw if the JSON field has an unexpected - * type. + * You should usually call [Builder.manual] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - @JsonProperty("customer_email") - @ExcludeMissing - fun _customerEmail(): JsonField = customerEmail + fun manual(manual: JsonField) = apply { body.manual(manual) } /** - * Returns the raw JSON value of [integration]. - * - * Unlike [integration], this method doesn't throw if the JSON field has an unexpected type. + * The number of minutes until the session expires (defaults to 43,200, which is 30 days) */ - @JsonProperty("integration") - @ExcludeMissing - fun _integration(): JsonField = integration + fun minutesToExpire(minutesToExpire: Double?) = apply { + body.minutesToExpire(minutesToExpire) + } /** - * Returns the raw JSON value of [manual]. + * Alias for [Builder.minutesToExpire]. * - * Unlike [manual], this method doesn't throw if the JSON field has an unexpected type. + * This unboxed primitive overload exists for backwards compatibility. */ - @JsonProperty("manual") @ExcludeMissing fun _manual(): JsonField = manual + fun minutesToExpire(minutesToExpire: Double) = minutesToExpire(minutesToExpire as Double?) + + /** Alias for calling [Builder.minutesToExpire] with `minutesToExpire.orElse(null)`. */ + fun minutesToExpire(minutesToExpire: Optional) = + minutesToExpire(minutesToExpire.getOrNull()) /** - * Returns the raw JSON value of [minutesToExpire]. + * Sets [Builder.minutesToExpire] to an arbitrary JSON value. * - * Unlike [minutesToExpire], this method doesn't throw if the JSON field has an unexpected - * type. + * You should usually call [Builder.minutesToExpire] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - @JsonProperty("minutes_to_expire") - @ExcludeMissing - fun _minutesToExpire(): JsonField = minutesToExpire + fun minutesToExpire(minutesToExpire: JsonField) = apply { + body.minutesToExpire(minutesToExpire) + } + + fun redirectUri(redirectUri: String?) = apply { body.redirectUri(redirectUri) } + + /** Alias for calling [Builder.redirectUri] with `redirectUri.orElse(null)`. */ + fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.getOrNull()) /** - * Returns the raw JSON value of [redirectUri]. + * Sets [Builder.redirectUri] to an arbitrary JSON value. * - * Unlike [redirectUri], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.redirectUri] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - @JsonProperty("redirect_uri") - @ExcludeMissing - fun _redirectUri(): JsonField = redirectUri + fun redirectUri(redirectUri: JsonField) = apply { body.redirectUri(redirectUri) } + + fun sandbox(sandbox: Sandbox?) = apply { body.sandbox(sandbox) } + + /** Alias for calling [Builder.sandbox] with `sandbox.orElse(null)`. */ + fun sandbox(sandbox: Optional) = sandbox(sandbox.getOrNull()) /** - * Returns the raw JSON value of [sandbox]. + * Sets [Builder.sandbox] to an arbitrary JSON value. * - * Unlike [sandbox], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.sandbox] with a well-typed [Sandbox] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - @JsonProperty("sandbox") @ExcludeMissing fun _sandbox(): JsonField = sandbox + fun sandbox(sandbox: JsonField) = apply { body.sandbox(sandbox) } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } - private var validated: Boolean = false + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } - fun validate(): Body = apply { - if (validated) { - return@apply + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) } - customerId() - customerName() - products() - customerEmail() - integration().ifPresent { it.validate() } - manual() - minutesToExpire() - redirectUri() - sandbox() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - /** - * Returns a mutable builder for constructing an instance of [Body]. - * - * The following fields are required: - * ```java - * .customerId() - * .customerName() - * .products() - * ``` - */ - @JvmStatic fun builder() = Builder() + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) } - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var customerId: JsonField? = null - private var customerName: JsonField? = null - private var products: JsonField>? = null - private var customerEmail: JsonField = JsonMissing.of() - private var integration: JsonField = JsonMissing.of() - private var manual: JsonField = JsonMissing.of() - private var minutesToExpire: JsonField = JsonMissing.of() - private var redirectUri: JsonField = JsonMissing.of() - private var sandbox: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - customerId = body.customerId - customerName = body.customerName - products = body.products.map { it.toMutableList() } - customerEmail = body.customerEmail - integration = body.integration - manual = body.manual - minutesToExpire = body.minutesToExpire - redirectUri = body.redirectUri - sandbox = body.sandbox - additionalProperties = body.additionalProperties.toMutableMap() - } - - fun customerId(customerId: String) = customerId(JsonField.of(customerId)) - - /** - * Sets [Builder.customerId] to an arbitrary JSON value. - * - * You should usually call [Builder.customerId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun customerId(customerId: JsonField) = apply { this.customerId = customerId } - - fun customerName(customerName: String) = customerName(JsonField.of(customerName)) - - /** - * Sets [Builder.customerName] to an arbitrary JSON value. - * - * You should usually call [Builder.customerName] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun customerName(customerName: JsonField) = apply { - this.customerName = customerName - } - - fun products(products: List) = products(JsonField.of(products)) - - /** - * Sets [Builder.products] to an arbitrary JSON value. - * - * You should usually call [Builder.products] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun products(products: JsonField>) = apply { - this.products = products.map { it.toMutableList() } - } - - /** - * Adds a single [ConnectProducts] to [products]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addProduct(product: ConnectProducts) = apply { - products = - (products ?: JsonField.of(mutableListOf())).also { - checkKnown("products", it).add(product) - } - } - - fun customerEmail(customerEmail: String?) = - customerEmail(JsonField.ofNullable(customerEmail)) - - /** Alias for calling [Builder.customerEmail] with `customerEmail.orElse(null)`. */ - fun customerEmail(customerEmail: Optional) = - customerEmail(customerEmail.getOrNull()) - - /** - * Sets [Builder.customerEmail] to an arbitrary JSON value. - * - * You should usually call [Builder.customerEmail] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun customerEmail(customerEmail: JsonField) = apply { - this.customerEmail = customerEmail - } - - fun integration(integration: Integration?) = - integration(JsonField.ofNullable(integration)) - - /** Alias for calling [Builder.integration] with `integration.orElse(null)`. */ - fun integration(integration: Optional) = - integration(integration.getOrNull()) - - /** - * Sets [Builder.integration] to an arbitrary JSON value. - * - * You should usually call [Builder.integration] with a well-typed [Integration] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun integration(integration: JsonField) = apply { - this.integration = integration - } - - fun manual(manual: Boolean?) = manual(JsonField.ofNullable(manual)) - - /** - * Alias for [Builder.manual]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun manual(manual: Boolean) = manual(manual as Boolean?) - - /** Alias for calling [Builder.manual] with `manual.orElse(null)`. */ - fun manual(manual: Optional) = manual(manual.getOrNull()) - - /** - * Sets [Builder.manual] to an arbitrary JSON value. - * - * You should usually call [Builder.manual] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun manual(manual: JsonField) = apply { this.manual = manual } + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 - * days) - */ - fun minutesToExpire(minutesToExpire: Double?) = - minutesToExpire(JsonField.ofNullable(minutesToExpire)) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - /** - * Alias for [Builder.minutesToExpire]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun minutesToExpire(minutesToExpire: Double) = - minutesToExpire(minutesToExpire as Double?) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } - /** Alias for calling [Builder.minutesToExpire] with `minutesToExpire.orElse(null)`. */ - fun minutesToExpire(minutesToExpire: Optional) = - minutesToExpire(minutesToExpire.getOrNull()) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } - /** - * Sets [Builder.minutesToExpire] to an arbitrary JSON value. - * - * You should usually call [Builder.minutesToExpire] with a well-typed [Double] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun minutesToExpire(minutesToExpire: JsonField) = apply { - this.minutesToExpire = minutesToExpire - } + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } - fun redirectUri(redirectUri: String?) = redirectUri(JsonField.ofNullable(redirectUri)) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } - /** Alias for calling [Builder.redirectUri] with `redirectUri.orElse(null)`. */ - fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.getOrNull()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } - /** - * Sets [Builder.redirectUri] to an arbitrary JSON value. - * - * You should usually call [Builder.redirectUri] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun redirectUri(redirectUri: JsonField) = apply { - this.redirectUri = redirectUri - } + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } - fun sandbox(sandbox: Sandbox?) = sandbox(JsonField.ofNullable(sandbox)) + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } - /** Alias for calling [Builder.sandbox] with `sandbox.orElse(null)`. */ - fun sandbox(sandbox: Optional) = sandbox(sandbox.getOrNull()) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } - /** - * Sets [Builder.sandbox] to an arbitrary JSON value. - * - * You should usually call [Builder.sandbox] with a well-typed [Sandbox] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun sandbox(sandbox: JsonField) = apply { this.sandbox = sandbox } + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .customerId() - * .customerName() - * .products() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body( - checkRequired("customerId", customerId), - checkRequired("customerName", customerName), - checkRequired("products", products).map { it.toImmutable() }, - customerEmail, - integration, - manual, - minutesToExpire, - redirectUri, - sandbox, - additionalProperties.toImmutable(), - ) + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) } - return /* spotless:off */ other is Body && customerId == other.customerId && customerName == other.customerName && products == other.products && customerEmail == other.customerEmail && integration == other.integration && manual == other.manual && minutesToExpire == other.minutesToExpire && redirectUri == other.redirectUri && sandbox == other.sandbox && additionalProperties == other.additionalProperties /* spotless:on */ + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(customerId, customerName, products, customerEmail, integration, manual, minutesToExpire, redirectUri, sandbox, additionalProperties) } - /* spotless:on */ + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } - override fun hashCode(): Int = hashCode + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } - override fun toString() = - "Body{customerId=$customerId, customerName=$customerName, products=$products, customerEmail=$customerEmail, integration=$integration, manual=$manual, minutesToExpire=$minutesToExpire, redirectUri=$redirectUri, sandbox=$sandbox, additionalProperties=$additionalProperties}" - } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } - fun toBuilder() = Builder().from(this) + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - companion object { + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } /** - * Returns a mutable builder for constructing an instance of [ConnectSessionNewParams]. + * Returns an immutable instance of [ConnectSessionNewParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java @@ -651,313 +466,519 @@ private constructor( * .customerName() * .products() * ``` + * + * @throws IllegalStateException if any required field is unset. */ - @JvmStatic fun builder() = Builder() + fun build(): ConnectSessionNewParams = + ConnectSessionNewParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) } - /** A builder for [ConnectSessionNewParams]. */ - @NoAutoDetect - class Builder internal constructor() { + @JvmSynthetic internal fun _body(): Body = body - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + override fun _headers(): Headers = additionalHeaders - @JvmSynthetic - internal fun from(connectSessionNewParams: ConnectSessionNewParams) = apply { - body = connectSessionNewParams.body.toBuilder() - additionalHeaders = connectSessionNewParams.additionalHeaders.toBuilder() - additionalQueryParams = connectSessionNewParams.additionalQueryParams.toBuilder() - } + override fun _queryParams(): QueryParams = additionalQueryParams - fun customerId(customerId: String) = apply { body.customerId(customerId) } + class Body + private constructor( + private val customerId: JsonField, + private val customerName: JsonField, + private val products: JsonField>, + private val customerEmail: JsonField, + private val integration: JsonField, + private val manual: JsonField, + private val minutesToExpire: JsonField, + private val redirectUri: JsonField, + private val sandbox: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("customer_id") + @ExcludeMissing + customerId: JsonField = JsonMissing.of(), + @JsonProperty("customer_name") + @ExcludeMissing + customerName: JsonField = JsonMissing.of(), + @JsonProperty("products") + @ExcludeMissing + products: JsonField> = JsonMissing.of(), + @JsonProperty("customer_email") + @ExcludeMissing + customerEmail: JsonField = JsonMissing.of(), + @JsonProperty("integration") + @ExcludeMissing + integration: JsonField = JsonMissing.of(), + @JsonProperty("manual") @ExcludeMissing manual: JsonField = JsonMissing.of(), + @JsonProperty("minutes_to_expire") + @ExcludeMissing + minutesToExpire: JsonField = JsonMissing.of(), + @JsonProperty("redirect_uri") + @ExcludeMissing + redirectUri: JsonField = JsonMissing.of(), + @JsonProperty("sandbox") @ExcludeMissing sandbox: JsonField = JsonMissing.of(), + ) : this( + customerId, + customerName, + products, + customerEmail, + integration, + manual, + minutesToExpire, + redirectUri, + sandbox, + mutableMapOf(), + ) /** - * Sets [Builder.customerId] to an arbitrary JSON value. + * @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 customerId(): String = customerId.getRequired("customer_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 customerName(): String = customerName.getRequired("customer_name") + + /** + * @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 products(): List = products.getRequired("products") + + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun customerEmail(): Optional = + Optional.ofNullable(customerEmail.getNullable("customer_email")) + + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun integration(): Optional = + Optional.ofNullable(integration.getNullable("integration")) + + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun manual(): Optional = Optional.ofNullable(manual.getNullable("manual")) + + /** + * The number of minutes until the session expires (defaults to 43,200, which is 30 days) * - * You should usually call [Builder.customerId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun customerId(customerId: JsonField) = apply { body.customerId(customerId) } + fun minutesToExpire(): Optional = + Optional.ofNullable(minutesToExpire.getNullable("minutes_to_expire")) - fun customerName(customerName: String) = apply { body.customerName(customerName) } + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun redirectUri(): Optional = + Optional.ofNullable(redirectUri.getNullable("redirect_uri")) /** - * Sets [Builder.customerName] to an arbitrary JSON value. + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun sandbox(): Optional = Optional.ofNullable(sandbox.getNullable("sandbox")) + + /** + * Returns the raw JSON value of [customerId]. * - * You should usually call [Builder.customerName] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * Unlike [customerId], this method doesn't throw if the JSON field has an unexpected type. */ - fun customerName(customerName: JsonField) = apply { - body.customerName(customerName) - } + @JsonProperty("customer_id") + @ExcludeMissing + fun _customerId(): JsonField = customerId - fun products(products: List) = apply { body.products(products) } + /** + * Returns the raw JSON value of [customerName]. + * + * Unlike [customerName], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("customer_name") + @ExcludeMissing + fun _customerName(): JsonField = customerName /** - * Sets [Builder.products] to an arbitrary JSON value. + * Returns the raw JSON value of [products]. * - * You should usually call [Builder.products] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * Unlike [products], this method doesn't throw if the JSON field has an unexpected type. */ - fun products(products: JsonField>) = apply { body.products(products) } + @JsonProperty("products") + @ExcludeMissing + fun _products(): JsonField> = products /** - * Adds a single [ConnectProducts] to [products]. + * Returns the raw JSON value of [customerEmail]. * - * @throws IllegalStateException if the field was previously set to a non-list. + * Unlike [customerEmail], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun addProduct(product: ConnectProducts) = apply { body.addProduct(product) } - - fun customerEmail(customerEmail: String?) = apply { body.customerEmail(customerEmail) } - - /** Alias for calling [Builder.customerEmail] with `customerEmail.orElse(null)`. */ - fun customerEmail(customerEmail: Optional) = - customerEmail(customerEmail.getOrNull()) + @JsonProperty("customer_email") + @ExcludeMissing + fun _customerEmail(): JsonField = customerEmail /** - * Sets [Builder.customerEmail] to an arbitrary JSON value. + * Returns the raw JSON value of [integration]. * - * You should usually call [Builder.customerEmail] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * Unlike [integration], this method doesn't throw if the JSON field has an unexpected type. */ - fun customerEmail(customerEmail: JsonField) = apply { - body.customerEmail(customerEmail) - } - - fun integration(integration: Integration?) = apply { body.integration(integration) } - - /** Alias for calling [Builder.integration] with `integration.orElse(null)`. */ - fun integration(integration: Optional) = integration(integration.getOrNull()) + @JsonProperty("integration") + @ExcludeMissing + fun _integration(): JsonField = integration /** - * Sets [Builder.integration] to an arbitrary JSON value. + * Returns the raw JSON value of [manual]. * - * You should usually call [Builder.integration] with a well-typed [Integration] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * Unlike [manual], this method doesn't throw if the JSON field has an unexpected type. */ - fun integration(integration: JsonField) = apply { - body.integration(integration) - } - - fun manual(manual: Boolean?) = apply { body.manual(manual) } + @JsonProperty("manual") @ExcludeMissing fun _manual(): JsonField = manual /** - * Alias for [Builder.manual]. + * Returns the raw JSON value of [minutesToExpire]. * - * This unboxed primitive overload exists for backwards compatibility. + * Unlike [minutesToExpire], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun manual(manual: Boolean) = manual(manual as Boolean?) - - /** Alias for calling [Builder.manual] with `manual.orElse(null)`. */ - fun manual(manual: Optional) = manual(manual.getOrNull()) + @JsonProperty("minutes_to_expire") + @ExcludeMissing + fun _minutesToExpire(): JsonField = minutesToExpire /** - * Sets [Builder.manual] to an arbitrary JSON value. + * Returns the raw JSON value of [redirectUri]. * - * You should usually call [Builder.manual] with a well-typed [Boolean] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * Unlike [redirectUri], this method doesn't throw if the JSON field has an unexpected type. */ - fun manual(manual: JsonField) = apply { body.manual(manual) } + @JsonProperty("redirect_uri") + @ExcludeMissing + fun _redirectUri(): JsonField = redirectUri /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 days) + * Returns the raw JSON value of [sandbox]. + * + * Unlike [sandbox], this method doesn't throw if the JSON field has an unexpected type. */ - fun minutesToExpire(minutesToExpire: Double?) = apply { - body.minutesToExpire(minutesToExpire) + @JsonProperty("sandbox") @ExcludeMissing fun _sandbox(): JsonField = sandbox + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } - /** - * Alias for [Builder.minutesToExpire]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun minutesToExpire(minutesToExpire: Double) = minutesToExpire(minutesToExpire as Double?) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** Alias for calling [Builder.minutesToExpire] with `minutesToExpire.orElse(null)`. */ - fun minutesToExpire(minutesToExpire: Optional) = - minutesToExpire(minutesToExpire.getOrNull()) + fun toBuilder() = Builder().from(this) - /** - * Sets [Builder.minutesToExpire] to an arbitrary JSON value. - * - * You should usually call [Builder.minutesToExpire] with a well-typed [Double] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun minutesToExpire(minutesToExpire: JsonField) = apply { - body.minutesToExpire(minutesToExpire) + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .customerId() + * .customerName() + * .products() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun redirectUri(redirectUri: String?) = apply { body.redirectUri(redirectUri) } + /** A builder for [Body]. */ + class Builder internal constructor() { - /** Alias for calling [Builder.redirectUri] with `redirectUri.orElse(null)`. */ - fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.getOrNull()) + private var customerId: JsonField? = null + private var customerName: JsonField? = null + private var products: JsonField>? = null + private var customerEmail: JsonField = JsonMissing.of() + private var integration: JsonField = JsonMissing.of() + private var manual: JsonField = JsonMissing.of() + private var minutesToExpire: JsonField = JsonMissing.of() + private var redirectUri: JsonField = JsonMissing.of() + private var sandbox: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Sets [Builder.redirectUri] to an arbitrary JSON value. - * - * You should usually call [Builder.redirectUri] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun redirectUri(redirectUri: JsonField) = apply { body.redirectUri(redirectUri) } + @JvmSynthetic + internal fun from(body: Body) = apply { + customerId = body.customerId + customerName = body.customerName + products = body.products.map { it.toMutableList() } + customerEmail = body.customerEmail + integration = body.integration + manual = body.manual + minutesToExpire = body.minutesToExpire + redirectUri = body.redirectUri + sandbox = body.sandbox + additionalProperties = body.additionalProperties.toMutableMap() + } - fun sandbox(sandbox: Sandbox?) = apply { body.sandbox(sandbox) } + fun customerId(customerId: String) = customerId(JsonField.of(customerId)) - /** Alias for calling [Builder.sandbox] with `sandbox.orElse(null)`. */ - fun sandbox(sandbox: Optional) = sandbox(sandbox.getOrNull()) + /** + * Sets [Builder.customerId] to an arbitrary JSON value. + * + * You should usually call [Builder.customerId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun customerId(customerId: JsonField) = apply { this.customerId = customerId } - /** - * Sets [Builder.sandbox] to an arbitrary JSON value. - * - * You should usually call [Builder.sandbox] with a well-typed [Sandbox] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun sandbox(sandbox: JsonField) = apply { body.sandbox(sandbox) } + fun customerName(customerName: String) = customerName(JsonField.of(customerName)) - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } + /** + * Sets [Builder.customerName] to an arbitrary JSON value. + * + * You should usually call [Builder.customerName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun customerName(customerName: JsonField) = apply { + this.customerName = customerName + } - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } + fun products(products: List) = products(JsonField.of(products)) - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) + /** + * Sets [Builder.products] to an arbitrary JSON value. + * + * You should usually call [Builder.products] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun products(products: JsonField>) = apply { + this.products = products.map { it.toMutableList() } + } + + /** + * Adds a single [ConnectProducts] to [products]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addProduct(product: ConnectProducts) = apply { + products = + (products ?: JsonField.of(mutableListOf())).also { + checkKnown("products", it).add(product) + } + } + + fun customerEmail(customerEmail: String?) = + customerEmail(JsonField.ofNullable(customerEmail)) + + /** Alias for calling [Builder.customerEmail] with `customerEmail.orElse(null)`. */ + fun customerEmail(customerEmail: Optional) = + customerEmail(customerEmail.getOrNull()) + + /** + * Sets [Builder.customerEmail] to an arbitrary JSON value. + * + * You should usually call [Builder.customerEmail] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun customerEmail(customerEmail: JsonField) = apply { + this.customerEmail = customerEmail + } + + fun integration(integration: Integration?) = + integration(JsonField.ofNullable(integration)) + + /** Alias for calling [Builder.integration] with `integration.orElse(null)`. */ + fun integration(integration: Optional) = + integration(integration.getOrNull()) + + /** + * Sets [Builder.integration] to an arbitrary JSON value. + * + * You should usually call [Builder.integration] with a well-typed [Integration] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun integration(integration: JsonField) = apply { + this.integration = integration } - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + fun manual(manual: Boolean?) = manual(JsonField.ofNullable(manual)) + + /** + * Alias for [Builder.manual]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun manual(manual: Boolean) = manual(manual as Boolean?) + + /** Alias for calling [Builder.manual] with `manual.orElse(null)`. */ + fun manual(manual: Optional) = manual(manual.getOrNull()) - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } + /** + * Sets [Builder.manual] to an arbitrary JSON value. + * + * You should usually call [Builder.manual] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun manual(manual: JsonField) = apply { this.manual = manual } - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } + /** + * The number of minutes until the session expires (defaults to 43,200, which is 30 + * days) + */ + fun minutesToExpire(minutesToExpire: Double?) = + minutesToExpire(JsonField.ofNullable(minutesToExpire)) - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } + /** + * Alias for [Builder.minutesToExpire]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun minutesToExpire(minutesToExpire: Double) = + minutesToExpire(minutesToExpire as Double?) - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } + /** Alias for calling [Builder.minutesToExpire] with `minutesToExpire.orElse(null)`. */ + fun minutesToExpire(minutesToExpire: Optional) = + minutesToExpire(minutesToExpire.getOrNull()) - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } + /** + * Sets [Builder.minutesToExpire] to an arbitrary JSON value. + * + * You should usually call [Builder.minutesToExpire] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun minutesToExpire(minutesToExpire: JsonField) = apply { + this.minutesToExpire = minutesToExpire + } - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + fun redirectUri(redirectUri: String?) = redirectUri(JsonField.ofNullable(redirectUri)) - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + /** Alias for calling [Builder.redirectUri] with `redirectUri.orElse(null)`. */ + fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.getOrNull()) - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } + /** + * Sets [Builder.redirectUri] to an arbitrary JSON value. + * + * You should usually call [Builder.redirectUri] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun redirectUri(redirectUri: JsonField) = apply { + this.redirectUri = redirectUri + } - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } + fun sandbox(sandbox: Sandbox?) = sandbox(JsonField.ofNullable(sandbox)) - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + /** Alias for calling [Builder.sandbox] with `sandbox.orElse(null)`. */ + fun sandbox(sandbox: Optional) = sandbox(sandbox.getOrNull()) - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + /** + * Sets [Builder.sandbox] to an arbitrary JSON value. + * + * You should usually call [Builder.sandbox] with a well-typed [Sandbox] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun sandbox(sandbox: JsonField) = apply { this.sandbox = sandbox } - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .customerId() + * .customerName() + * .products() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("customerId", customerId), + checkRequired("customerName", customerName), + checkRequired("products", products).map { it.toImmutable() }, + customerEmail, + integration, + manual, + minutesToExpire, + redirectUri, + sandbox, + additionalProperties.toMutableMap(), + ) } - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } + private var validated: Boolean = false - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) + fun validate(): Body = apply { + if (validated) { + return@apply } - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) + customerId() + customerName() + products() + customerEmail() + integration().ifPresent { it.validate() } + manual() + minutesToExpire() + redirectUri() + sandbox() + validated = true } - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) + return /* spotless:off */ other is Body && customerId == other.customerId && customerName == other.customerName && products == other.products && customerEmail == other.customerEmail && integration == other.integration && manual == other.manual && minutesToExpire == other.minutesToExpire && redirectUri == other.redirectUri && sandbox == other.sandbox && additionalProperties == other.additionalProperties /* spotless:on */ } - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(customerId, customerName, products, customerEmail, integration, manual, minutesToExpire, redirectUri, sandbox, additionalProperties) } + /* spotless:on */ - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } + override fun hashCode(): Int = hashCode - /** - * Returns an immutable instance of [ConnectSessionNewParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .customerId() - * .customerName() - * .products() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): ConnectSessionNewParams = - ConnectSessionNewParams( - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) + override fun toString() = + "Body{customerId=$customerId, customerName=$customerName, products=$products, customerEmail=$customerEmail, integration=$integration, manual=$manual, minutesToExpire=$minutesToExpire, redirectUri=$redirectUri, sandbox=$sandbox, additionalProperties=$additionalProperties}" } /** The Finch products that can be requested during the Connect flow. */ @@ -1098,20 +1119,21 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class Integration - @JsonCreator private constructor( - @JsonProperty("auth_method") - @ExcludeMissing - private val authMethod: JsonField = JsonMissing.of(), - @JsonProperty("provider") - @ExcludeMissing - private val provider: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val authMethod: JsonField, + private val provider: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("auth_method") + @ExcludeMissing + authMethod: JsonField = JsonMissing.of(), + @JsonProperty("provider") @ExcludeMissing provider: JsonField = JsonMissing.of(), + ) : this(authMethod, provider, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1141,21 +1163,15 @@ private constructor( */ @JsonProperty("provider") @ExcludeMissing fun _provider(): JsonField = provider + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Integration = apply { - if (validated) { - return@apply - } - - authMethod() - provider() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1234,7 +1250,19 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Integration = - Integration(authMethod, provider, additionalProperties.toImmutable()) + Integration(authMethod, provider, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Integration = apply { + if (validated) { + return@apply + } + + authMethod() + provider() + validated = true } class AuthMethod @JsonCreator private constructor(private val value: JsonField) : diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt index 40eebc8b..34998a03 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt @@ -11,15 +11,14 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap 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 @@ -98,197 +97,443 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams + fun toBuilder() = Builder().from(this) - @NoAutoDetect - class Body - @JsonCreator - private constructor( - @JsonProperty("connection_id") - @ExcludeMissing - private val connectionId: JsonField = JsonMissing.of(), - @JsonProperty("minutes_to_expire") - @ExcludeMissing - private val minutesToExpire: JsonField = JsonMissing.of(), - @JsonProperty("products") - @ExcludeMissing - private val products: JsonField> = JsonMissing.of(), - @JsonProperty("redirect_uri") - @ExcludeMissing - private val redirectUri: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + companion object { /** - * The ID of the existing connection to reauthenticate + * Returns a mutable builder for constructing an instance of + * [ConnectSessionReauthenticateParams]. * - * @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). + * The following fields are required: + * ```java + * .connectionId() + * ``` */ - fun connectionId(): String = connectionId.getRequired("connection_id") + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ConnectSessionReauthenticateParams]. */ + class Builder internal constructor() { + + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(connectSessionReauthenticateParams: ConnectSessionReauthenticateParams) = + apply { + body = connectSessionReauthenticateParams.body.toBuilder() + additionalHeaders = connectSessionReauthenticateParams.additionalHeaders.toBuilder() + additionalQueryParams = + connectSessionReauthenticateParams.additionalQueryParams.toBuilder() + } + + /** The ID of the existing connection to reauthenticate */ + fun connectionId(connectionId: String) = apply { body.connectionId(connectionId) } /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 days) + * Sets [Builder.connectionId] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.connectionId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun minutesToExpire(): Optional = - Optional.ofNullable(minutesToExpire.getNullable("minutes_to_expire")) + fun connectionId(connectionId: JsonField) = apply { + body.connectionId(connectionId) + } /** - * The products to request access to (optional for reauthentication) - * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * The number of minutes until the session expires (defaults to 43,200, which is 30 days) */ - fun products(): Optional> = - Optional.ofNullable(products.getNullable("products")) + fun minutesToExpire(minutesToExpire: Long?) = apply { + body.minutesToExpire(minutesToExpire) + } /** - * The URI to redirect to after the Connect flow is completed + * Alias for [Builder.minutesToExpire]. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * This unboxed primitive overload exists for backwards compatibility. */ - fun redirectUri(): Optional = - Optional.ofNullable(redirectUri.getNullable("redirect_uri")) + fun minutesToExpire(minutesToExpire: Long) = minutesToExpire(minutesToExpire as Long?) + + /** Alias for calling [Builder.minutesToExpire] with `minutesToExpire.orElse(null)`. */ + fun minutesToExpire(minutesToExpire: Optional) = + minutesToExpire(minutesToExpire.getOrNull()) /** - * Returns the raw JSON value of [connectionId]. + * Sets [Builder.minutesToExpire] to an arbitrary JSON value. * - * Unlike [connectionId], this method doesn't throw if the JSON field has an unexpected - * type. + * You should usually call [Builder.minutesToExpire] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - @JsonProperty("connection_id") - @ExcludeMissing - fun _connectionId(): JsonField = connectionId + fun minutesToExpire(minutesToExpire: JsonField) = apply { + body.minutesToExpire(minutesToExpire) + } + + /** The products to request access to (optional for reauthentication) */ + fun products(products: List?) = apply { body.products(products) } + + /** Alias for calling [Builder.products] with `products.orElse(null)`. */ + fun products(products: Optional>) = products(products.getOrNull()) /** - * Returns the raw JSON value of [minutesToExpire]. + * Sets [Builder.products] to an arbitrary JSON value. * - * Unlike [minutesToExpire], this method doesn't throw if the JSON field has an unexpected - * type. + * You should usually call [Builder.products] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - @JsonProperty("minutes_to_expire") - @ExcludeMissing - fun _minutesToExpire(): JsonField = minutesToExpire + fun products(products: JsonField>) = apply { body.products(products) } /** - * Returns the raw JSON value of [products]. + * Adds a single [ConnectProducts] to [products]. * - * Unlike [products], this method doesn't throw if the JSON field has an unexpected type. + * @throws IllegalStateException if the field was previously set to a non-list. */ - @JsonProperty("products") - @ExcludeMissing - fun _products(): JsonField> = products + fun addProduct(product: ConnectProducts) = apply { body.addProduct(product) } + + /** The URI to redirect to after the Connect flow is completed */ + fun redirectUri(redirectUri: String?) = apply { body.redirectUri(redirectUri) } + + /** Alias for calling [Builder.redirectUri] with `redirectUri.orElse(null)`. */ + fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.getOrNull()) /** - * Returns the raw JSON value of [redirectUri]. + * Sets [Builder.redirectUri] to an arbitrary JSON value. * - * Unlike [redirectUri], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.redirectUri] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - @JsonProperty("redirect_uri") - @ExcludeMissing - fun _redirectUri(): JsonField = redirectUri + fun redirectUri(redirectUri: JsonField) = apply { body.redirectUri(redirectUri) } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } - private var validated: Boolean = false + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } - fun validate(): Body = apply { - if (validated) { - return@apply + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) } - connectionId() - minutesToExpire() - products() - redirectUri() - validated = true + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) } - fun toBuilder() = Builder().from(this) + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - companion object { + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - /** - * Returns a mutable builder for constructing an instance of [Body]. - * - * The following fields are required: - * ```java - * .connectionId() - * ``` - */ - @JvmStatic fun builder() = Builder() + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - /** A builder for [Body]. */ - class Builder internal constructor() { + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } - private var connectionId: JsonField? = null - private var minutesToExpire: JsonField = JsonMissing.of() - private var products: JsonField>? = null - private var redirectUri: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } - @JvmSynthetic - internal fun from(body: Body) = apply { - connectionId = body.connectionId - minutesToExpire = body.minutesToExpire - products = body.products.map { it.toMutableList() } - redirectUri = body.redirectUri - additionalProperties = body.additionalProperties.toMutableMap() - } + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } - /** The ID of the existing connection to reauthenticate */ - fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } - /** - * Sets [Builder.connectionId] to an arbitrary JSON value. - * - * You should usually call [Builder.connectionId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun connectionId(connectionId: JsonField) = apply { - this.connectionId = connectionId - } + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } - /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 - * days) - */ - fun minutesToExpire(minutesToExpire: Long?) = - minutesToExpire(JsonField.ofNullable(minutesToExpire)) + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } - /** - * Alias for [Builder.minutesToExpire]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun minutesToExpire(minutesToExpire: Long) = minutesToExpire(minutesToExpire as Long?) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } - /** Alias for calling [Builder.minutesToExpire] with `minutesToExpire.orElse(null)`. */ - fun minutesToExpire(minutesToExpire: Optional) = - minutesToExpire(minutesToExpire.getOrNull()) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - /** - * Sets [Builder.minutesToExpire] to an arbitrary JSON value. - * - * You should usually call [Builder.minutesToExpire] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun minutesToExpire(minutesToExpire: JsonField) = apply { - this.minutesToExpire = minutesToExpire + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [ConnectSessionReauthenticateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .connectionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ConnectSessionReauthenticateParams = + ConnectSessionReauthenticateParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + @JvmSynthetic internal fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + private constructor( + private val connectionId: JsonField, + private val minutesToExpire: JsonField, + private val products: JsonField>, + private val redirectUri: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("connection_id") + @ExcludeMissing + connectionId: JsonField = JsonMissing.of(), + @JsonProperty("minutes_to_expire") + @ExcludeMissing + minutesToExpire: JsonField = JsonMissing.of(), + @JsonProperty("products") + @ExcludeMissing + products: JsonField> = JsonMissing.of(), + @JsonProperty("redirect_uri") + @ExcludeMissing + redirectUri: JsonField = JsonMissing.of(), + ) : this(connectionId, minutesToExpire, products, redirectUri, mutableMapOf()) + + /** + * The ID of the existing connection to reauthenticate + * + * @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 connectionId(): String = connectionId.getRequired("connection_id") + + /** + * The number of minutes until the session expires (defaults to 43,200, which is 30 days) + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun minutesToExpire(): Optional = + Optional.ofNullable(minutesToExpire.getNullable("minutes_to_expire")) + + /** + * The products to request access to (optional for reauthentication) + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun products(): Optional> = + Optional.ofNullable(products.getNullable("products")) + + /** + * The URI to redirect to after the Connect flow is completed + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun redirectUri(): Optional = + Optional.ofNullable(redirectUri.getNullable("redirect_uri")) + + /** + * Returns the raw JSON value of [connectionId]. + * + * Unlike [connectionId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("connection_id") + @ExcludeMissing + fun _connectionId(): JsonField = connectionId + + /** + * Returns the raw JSON value of [minutesToExpire]. + * + * Unlike [minutesToExpire], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("minutes_to_expire") + @ExcludeMissing + fun _minutesToExpire(): JsonField = minutesToExpire + + /** + * Returns the raw JSON value of [products]. + * + * Unlike [products], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("products") + @ExcludeMissing + fun _products(): JsonField> = products + + /** + * Returns the raw JSON value of [redirectUri]. + * + * Unlike [redirectUri], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("redirect_uri") + @ExcludeMissing + fun _redirectUri(): JsonField = redirectUri + + @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]. + * + * The following fields are required: + * ```java + * .connectionId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var connectionId: JsonField? = null + private var minutesToExpire: JsonField = JsonMissing.of() + private var products: JsonField>? = null + private var redirectUri: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + connectionId = body.connectionId + minutesToExpire = body.minutesToExpire + products = body.products.map { it.toMutableList() } + redirectUri = body.redirectUri + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The ID of the existing connection to reauthenticate */ + fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) + + /** + * Sets [Builder.connectionId] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun connectionId(connectionId: JsonField) = apply { + this.connectionId = connectionId + } + + /** + * The number of minutes until the session expires (defaults to 43,200, which is 30 + * days) + */ + fun minutesToExpire(minutesToExpire: Long?) = + minutesToExpire(JsonField.ofNullable(minutesToExpire)) + + /** + * Alias for [Builder.minutesToExpire]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun minutesToExpire(minutesToExpire: Long) = minutesToExpire(minutesToExpire as Long?) + + /** Alias for calling [Builder.minutesToExpire] with `minutesToExpire.orElse(null)`. */ + fun minutesToExpire(minutesToExpire: Optional) = + minutesToExpire(minutesToExpire.getOrNull()) + + /** + * Sets [Builder.minutesToExpire] to an arbitrary JSON value. + * + * You should usually call [Builder.minutesToExpire] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun minutesToExpire(minutesToExpire: JsonField) = apply { + this.minutesToExpire = minutesToExpire } /** The products to request access to (optional for reauthentication) */ @@ -375,10 +620,24 @@ private constructor( minutesToExpire, (products ?: JsonMissing.of()).map { it.toImmutable() }, redirectUri, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + connectionId() + minutesToExpire() + products() + redirectUri() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -397,256 +656,6 @@ private constructor( "Body{connectionId=$connectionId, minutesToExpire=$minutesToExpire, products=$products, redirectUri=$redirectUri, additionalProperties=$additionalProperties}" } - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [ConnectSessionReauthenticateParams]. - * - * The following fields are required: - * ```java - * .connectionId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [ConnectSessionReauthenticateParams]. */ - @NoAutoDetect - class Builder internal constructor() { - - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(connectSessionReauthenticateParams: ConnectSessionReauthenticateParams) = - apply { - body = connectSessionReauthenticateParams.body.toBuilder() - additionalHeaders = connectSessionReauthenticateParams.additionalHeaders.toBuilder() - additionalQueryParams = - connectSessionReauthenticateParams.additionalQueryParams.toBuilder() - } - - /** The ID of the existing connection to reauthenticate */ - fun connectionId(connectionId: String) = apply { body.connectionId(connectionId) } - - /** - * Sets [Builder.connectionId] to an arbitrary JSON value. - * - * You should usually call [Builder.connectionId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun connectionId(connectionId: JsonField) = apply { - body.connectionId(connectionId) - } - - /** - * The number of minutes until the session expires (defaults to 43,200, which is 30 days) - */ - fun minutesToExpire(minutesToExpire: Long?) = apply { - body.minutesToExpire(minutesToExpire) - } - - /** - * Alias for [Builder.minutesToExpire]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun minutesToExpire(minutesToExpire: Long) = minutesToExpire(minutesToExpire as Long?) - - /** Alias for calling [Builder.minutesToExpire] with `minutesToExpire.orElse(null)`. */ - fun minutesToExpire(minutesToExpire: Optional) = - minutesToExpire(minutesToExpire.getOrNull()) - - /** - * Sets [Builder.minutesToExpire] to an arbitrary JSON value. - * - * You should usually call [Builder.minutesToExpire] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun minutesToExpire(minutesToExpire: JsonField) = apply { - body.minutesToExpire(minutesToExpire) - } - - /** The products to request access to (optional for reauthentication) */ - fun products(products: List?) = apply { body.products(products) } - - /** Alias for calling [Builder.products] with `products.orElse(null)`. */ - fun products(products: Optional>) = products(products.getOrNull()) - - /** - * Sets [Builder.products] to an arbitrary JSON value. - * - * You should usually call [Builder.products] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun products(products: JsonField>) = apply { body.products(products) } - - /** - * Adds a single [ConnectProducts] to [products]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addProduct(product: ConnectProducts) = apply { body.addProduct(product) } - - /** The URI to redirect to after the Connect flow is completed */ - fun redirectUri(redirectUri: String?) = apply { body.redirectUri(redirectUri) } - - /** Alias for calling [Builder.redirectUri] with `redirectUri.orElse(null)`. */ - fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.getOrNull()) - - /** - * Sets [Builder.redirectUri] to an arbitrary JSON value. - * - * You should usually call [Builder.redirectUri] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun redirectUri(redirectUri: JsonField) = apply { body.redirectUri(redirectUri) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [ConnectSessionReauthenticateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .connectionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): ConnectSessionReauthenticateParams = - ConnectSessionReauthenticateParams( - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - /** The Finch products that can be requested during the Connect flow. */ class ConnectProducts @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt index 58fc2c01..9b90cbb1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt @@ -11,46 +11,59 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional -@NoAutoDetect class ConnectionCreateResponse -@JsonCreator private constructor( - @JsonProperty("access_token") - @ExcludeMissing - private val accessToken: JsonField = JsonMissing.of(), - @JsonProperty("account_id") - @ExcludeMissing - private val accountId: JsonField = JsonMissing.of(), - @JsonProperty("authentication_type") - @ExcludeMissing - private val authenticationType: JsonField = JsonMissing.of(), - @JsonProperty("company_id") - @ExcludeMissing - private val companyId: JsonField = JsonMissing.of(), - @JsonProperty("connection_id") - @ExcludeMissing - private val connectionId: JsonField = JsonMissing.of(), - @JsonProperty("products") - @ExcludeMissing - private val products: JsonField> = JsonMissing.of(), - @JsonProperty("provider_id") - @ExcludeMissing - private val providerId: JsonField = JsonMissing.of(), - @JsonProperty("token_type") - @ExcludeMissing - private val tokenType: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val accessToken: JsonField, + private val accountId: JsonField, + private val authenticationType: JsonField, + private val companyId: JsonField, + private val connectionId: JsonField, + private val products: JsonField>, + private val providerId: JsonField, + private val tokenType: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("access_token") + @ExcludeMissing + accessToken: JsonField = JsonMissing.of(), + @JsonProperty("account_id") @ExcludeMissing accountId: JsonField = JsonMissing.of(), + @JsonProperty("authentication_type") + @ExcludeMissing + authenticationType: JsonField = JsonMissing.of(), + @JsonProperty("company_id") @ExcludeMissing companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + connectionId: JsonField = JsonMissing.of(), + @JsonProperty("products") + @ExcludeMissing + products: JsonField> = JsonMissing.of(), + @JsonProperty("provider_id") + @ExcludeMissing + providerId: JsonField = JsonMissing.of(), + @JsonProperty("token_type") @ExcludeMissing tokenType: JsonField = JsonMissing.of(), + ) : this( + accessToken, + accountId, + authenticationType, + companyId, + connectionId, + products, + providerId, + tokenType, + 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). @@ -177,27 +190,15 @@ private constructor( */ @JsonProperty("token_type") @ExcludeMissing fun _tokenType(): JsonField = tokenType + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): ConnectionCreateResponse = apply { - if (validated) { - return@apply - } - - accessToken() - accountId() - authenticationType() - companyId() - connectionId() - products() - providerId() - tokenType() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -408,10 +409,28 @@ private constructor( checkRequired("products", products).map { it.toImmutable() }, checkRequired("providerId", providerId), tokenType, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): ConnectionCreateResponse = apply { + if (validated) { + return@apply + } + + accessToken() + accountId() + authenticationType() + companyId() + connectionId() + products() + providerId() + tokenType() + validated = true + } + class AuthenticationType @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt index 5f89e0e9..091bfa7b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt @@ -11,53 +11,70 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap 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 -@NoAutoDetect class CreateAccessTokenResponse -@JsonCreator private constructor( - @JsonProperty("access_token") - @ExcludeMissing - private val accessToken: JsonField = JsonMissing.of(), - @JsonProperty("account_id") - @ExcludeMissing - private val accountId: JsonField = JsonMissing.of(), - @JsonProperty("client_type") - @ExcludeMissing - private val clientType: JsonField = JsonMissing.of(), - @JsonProperty("company_id") - @ExcludeMissing - private val companyId: JsonField = JsonMissing.of(), - @JsonProperty("connection_id") - @ExcludeMissing - private val connectionId: JsonField = JsonMissing.of(), - @JsonProperty("connection_type") - @ExcludeMissing - private val connectionType: JsonField = JsonMissing.of(), - @JsonProperty("products") - @ExcludeMissing - private val products: JsonField> = JsonMissing.of(), - @JsonProperty("provider_id") - @ExcludeMissing - private val providerId: JsonField = JsonMissing.of(), - @JsonProperty("customer_id") - @ExcludeMissing - private val customerId: JsonField = JsonMissing.of(), - @JsonProperty("token_type") - @ExcludeMissing - private val tokenType: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val accessToken: JsonField, + private val accountId: JsonField, + private val clientType: JsonField, + private val companyId: JsonField, + private val connectionId: JsonField, + private val connectionType: JsonField, + private val products: JsonField>, + private val providerId: JsonField, + private val customerId: JsonField, + private val tokenType: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("access_token") + @ExcludeMissing + accessToken: JsonField = JsonMissing.of(), + @JsonProperty("account_id") @ExcludeMissing accountId: JsonField = JsonMissing.of(), + @JsonProperty("client_type") + @ExcludeMissing + clientType: JsonField = JsonMissing.of(), + @JsonProperty("company_id") @ExcludeMissing companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + connectionId: JsonField = JsonMissing.of(), + @JsonProperty("connection_type") + @ExcludeMissing + connectionType: JsonField = JsonMissing.of(), + @JsonProperty("products") + @ExcludeMissing + products: JsonField> = JsonMissing.of(), + @JsonProperty("provider_id") + @ExcludeMissing + providerId: JsonField = JsonMissing.of(), + @JsonProperty("customer_id") + @ExcludeMissing + customerId: JsonField = JsonMissing.of(), + @JsonProperty("token_type") @ExcludeMissing tokenType: JsonField = JsonMissing.of(), + ) : this( + accessToken, + accountId, + clientType, + companyId, + connectionId, + connectionType, + products, + providerId, + customerId, + tokenType, + mutableMapOf(), + ) + /** * The access token for the connection. * @@ -225,29 +242,15 @@ private constructor( */ @JsonProperty("token_type") @ExcludeMissing fun _tokenType(): JsonField = tokenType + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): CreateAccessTokenResponse = apply { - if (validated) { - return@apply - } - - accessToken() - accountId() - clientType() - companyId() - connectionId() - connectionType() - products() - providerId() - customerId() - tokenType() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -508,10 +511,30 @@ private constructor( checkRequired("providerId", providerId), customerId, tokenType, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): CreateAccessTokenResponse = apply { + if (validated) { + return@apply + } + + accessToken() + accountId() + clientType() + companyId() + connectionId() + connectionType() + products() + providerId() + customerId() + tokenType() + validated = true + } + /** The type of application associated with a token. */ class ClientType @JsonCreator private constructor(private val value: JsonField) : Enum { 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 4a3a3d56..08366225 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 @@ -10,23 +10,22 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects -@NoAutoDetect class CreateCompanyBenefitsResponse -@JsonCreator private constructor( - @JsonProperty("benefit_id") - @ExcludeMissing - private val benefitId: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val benefitId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("benefit_id") @ExcludeMissing benefitId: JsonField = JsonMissing.of() + ) : this(benefitId, 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). @@ -40,20 +39,15 @@ private constructor( */ @JsonProperty("benefit_id") @ExcludeMissing fun _benefitId(): JsonField = benefitId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): CreateCompanyBenefitsResponse = apply { - if (validated) { - return@apply - } - - benefitId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -128,10 +122,21 @@ private constructor( fun build(): CreateCompanyBenefitsResponse = CreateCompanyBenefitsResponse( checkRequired("benefitId", benefitId), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): CreateCompanyBenefitsResponse = apply { + if (validated) { + return@apply + } + + benefitId() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryCreateResponse.kt index 9c8cea55..b8cb2537 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryCreateResponse.kt @@ -7,32 +7,24 @@ import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonValue -import com.tryfinch.api.core.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable +import java.util.Collections import java.util.Objects -@NoAutoDetect class DirectoryCreateResponse -@JsonCreator -private constructor( - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap() -) { +private constructor(private val additionalProperties: MutableMap) { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): DirectoryCreateResponse = apply { - if (validated) { - return@apply - } + @JsonCreator private constructor() : this(mutableMapOf()) - validated = true + @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 { @@ -76,7 +68,17 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): DirectoryCreateResponse = - DirectoryCreateResponse(additionalProperties.toImmutable()) + DirectoryCreateResponse(additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): DirectoryCreateResponse = apply { + if (validated) { + return@apply + } + + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt index b7af0fec..e9d07752 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt @@ -11,34 +11,42 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional -@NoAutoDetect class DirectoryEvent -@JsonCreator private constructor( - @JsonProperty("account_id") - @ExcludeMissing - private val accountId: JsonField = JsonMissing.of(), - @JsonProperty("company_id") - @ExcludeMissing - private val companyId: JsonField = JsonMissing.of(), - @JsonProperty("connection_id") - @ExcludeMissing - private val connectionId: JsonField = JsonMissing.of(), - @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), - @JsonProperty("event_type") - @ExcludeMissing - private val eventType: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val accountId: JsonField, + private val companyId: JsonField, + private val connectionId: JsonField, + private val data: JsonField, + private val eventType: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("account_id") @ExcludeMissing accountId: JsonField = JsonMissing.of(), + @JsonProperty("company_id") @ExcludeMissing companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + connectionId: JsonField = JsonMissing.of(), + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + eventType: JsonField = JsonMissing.of(), + ) : this(accountId, companyId, connectionId, data, eventType, mutableMapOf()) + + fun toBaseWebhookEvent(): BaseWebhookEvent = + BaseWebhookEvent.builder() + .accountId(accountId) + .companyId(companyId) + .connectionId(connectionId) + .build() + /** * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. @@ -121,31 +129,15 @@ private constructor( */ @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBaseWebhookEvent(): BaseWebhookEvent = - BaseWebhookEvent.builder() - .accountId(accountId) - .companyId(companyId) - .connectionId(connectionId) - .build() - - private var validated: Boolean = false - - fun validate(): DirectoryEvent = apply { - if (validated) { - return@apply - } - - accountId() - companyId() - connectionId() - data().ifPresent { it.validate() } - eventType() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -291,21 +283,38 @@ private constructor( connectionId, data, eventType, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): DirectoryEvent = apply { + if (validated) { + return@apply + } + + accountId() + companyId() + connectionId() + data().ifPresent { it.validate() } + eventType() + validated = true + } + class Data - @JsonCreator private constructor( - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val individualId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("individual_id") + @ExcludeMissing + individualId: JsonField = JsonMissing.of() + ) : this(individualId, mutableMapOf()) + /** * The ID of the individual related to the event. * @@ -325,20 +334,15 @@ private constructor( @ExcludeMissing fun _individualId(): JsonField = individualId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Data = apply { - if (validated) { - return@apply - } - - individualId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -398,7 +402,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Data = Data(individualId, additionalProperties.toImmutable()) + fun build(): Data = Data(individualId, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Data = apply { + if (validated) { + return@apply + } + + individualId() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt index 0d46f6f3..a988ef07 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt @@ -10,23 +10,22 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects -@NoAutoDetect class DisconnectResponse -@JsonCreator private constructor( - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val status: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of() + ) : this(status, mutableMapOf()) + /** * If the request is successful, Finch will return “success” (HTTP 200 status). * @@ -42,20 +41,15 @@ private constructor( */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): DisconnectResponse = apply { - if (validated) { - return@apply - } - - status() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -127,7 +121,18 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): DisconnectResponse = - DisconnectResponse(checkRequired("status", status), additionalProperties.toImmutable()) + DisconnectResponse(checkRequired("status", status), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): DisconnectResponse = apply { + if (validated) { + return@apply + } + + status() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt index 531d8f94..ba4d517f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt @@ -10,27 +10,28 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects -@NoAutoDetect class DocumentListResponse -@JsonCreator private constructor( - @JsonProperty("documents") - @ExcludeMissing - private val documents: JsonField> = JsonMissing.of(), - @JsonProperty("paging") - @ExcludeMissing - private val paging: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val documents: JsonField>, + private val paging: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("documents") + @ExcludeMissing + documents: JsonField> = JsonMissing.of(), + @JsonProperty("paging") @ExcludeMissing paging: JsonField = JsonMissing.of(), + ) : this(documents, paging, 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). @@ -59,21 +60,15 @@ private constructor( */ @JsonProperty("paging") @ExcludeMissing fun _paging(): JsonField = paging + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): DocumentListResponse = apply { - if (validated) { - return@apply - } - - documents().forEach { it.validate() } - paging().validate() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -176,10 +171,22 @@ private constructor( DocumentListResponse( checkRequired("documents", documents).map { it.toImmutable() }, checkRequired("paging", paging), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): DocumentListResponse = apply { + if (validated) { + return@apply + } + + documents().forEach { it.validate() } + paging().validate() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt index 2a8103d2..befd7f3f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt @@ -11,28 +11,33 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -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 -@NoAutoDetect class DocumentResponse -@JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonProperty("url") @ExcludeMissing private val url: JsonField = JsonMissing.of(), - @JsonProperty("year") @ExcludeMissing private val year: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val individualId: JsonField, + private val type: JsonField, + private val url: JsonField, + private val year: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("individual_id") + @ExcludeMissing + individualId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("url") @ExcludeMissing url: JsonField = JsonMissing.of(), + @JsonProperty("year") @ExcludeMissing year: JsonField = JsonMissing.of(), + ) : this(id, individualId, type, url, year, mutableMapOf()) + /** * A stable Finch id for the document. * @@ -113,24 +118,15 @@ private constructor( */ @JsonProperty("year") @ExcludeMissing fun _year(): JsonField = year + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): DocumentResponse = apply { - if (validated) { - return@apply - } - - id() - individualId() - type() - url() - year() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -262,7 +258,22 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): DocumentResponse = - DocumentResponse(id, individualId, type, url, year, additionalProperties.toImmutable()) + DocumentResponse(id, individualId, type, url, year, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): DocumentResponse = apply { + if (validated) { + return@apply + } + + id() + individualId() + type() + url() + year() + validated = true } /** The type of document. */ diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt index 90112e25..dd9961a4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt @@ -11,78 +11,99 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown -import com.tryfinch.api.core.immutableEmptyMap 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 -@NoAutoDetect class EmploymentData -@JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("class_code") - @ExcludeMissing - private val classCode: JsonField = JsonMissing.of(), - @JsonProperty("custom_fields") - @ExcludeMissing - private val customFields: JsonField> = JsonMissing.of(), - @JsonProperty("department") - @ExcludeMissing - private val department: JsonField = JsonMissing.of(), - @JsonProperty("employment") - @ExcludeMissing - private val employment: JsonField = JsonMissing.of(), - @JsonProperty("employment_status") - @ExcludeMissing - private val employmentStatus: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("first_name") - @ExcludeMissing - private val firstName: JsonField = JsonMissing.of(), - @JsonProperty("income") - @ExcludeMissing - private val income: JsonField = JsonMissing.of(), - @JsonProperty("income_history") - @ExcludeMissing - private val incomeHistory: JsonField> = JsonMissing.of(), - @JsonProperty("is_active") - @ExcludeMissing - private val isActive: JsonField = JsonMissing.of(), - @JsonProperty("last_name") - @ExcludeMissing - private val lastName: JsonField = JsonMissing.of(), - @JsonProperty("latest_rehire_date") - @ExcludeMissing - private val latestRehireDate: JsonField = JsonMissing.of(), - @JsonProperty("location") - @ExcludeMissing - private val location: JsonField = JsonMissing.of(), - @JsonProperty("manager") - @ExcludeMissing - private val manager: JsonField = JsonMissing.of(), - @JsonProperty("middle_name") - @ExcludeMissing - private val middleName: JsonField = JsonMissing.of(), - @JsonProperty("source_id") - @ExcludeMissing - private val sourceId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("title") @ExcludeMissing private val title: JsonField = JsonMissing.of(), - @JsonProperty("work_id") - @ExcludeMissing - private val workId: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val classCode: JsonField, + private val customFields: JsonField>, + private val department: JsonField, + private val employment: JsonField, + private val employmentStatus: JsonField, + private val endDate: JsonField, + private val firstName: JsonField, + private val income: JsonField, + private val incomeHistory: JsonField>, + private val isActive: JsonField, + private val lastName: JsonField, + private val latestRehireDate: JsonField, + private val location: JsonField, + private val manager: JsonField, + private val middleName: JsonField, + private val sourceId: JsonField, + private val startDate: JsonField, + private val title: JsonField, + private val workId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("class_code") @ExcludeMissing classCode: JsonField = JsonMissing.of(), + @JsonProperty("custom_fields") + @ExcludeMissing + customFields: JsonField> = JsonMissing.of(), + @JsonProperty("department") + @ExcludeMissing + department: JsonField = JsonMissing.of(), + @JsonProperty("employment") + @ExcludeMissing + employment: JsonField = JsonMissing.of(), + @JsonProperty("employment_status") + @ExcludeMissing + employmentStatus: JsonField = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), + @JsonProperty("first_name") @ExcludeMissing firstName: JsonField = JsonMissing.of(), + @JsonProperty("income") @ExcludeMissing income: JsonField = JsonMissing.of(), + @JsonProperty("income_history") + @ExcludeMissing + incomeHistory: JsonField> = JsonMissing.of(), + @JsonProperty("is_active") @ExcludeMissing isActive: JsonField = JsonMissing.of(), + @JsonProperty("last_name") @ExcludeMissing lastName: JsonField = JsonMissing.of(), + @JsonProperty("latest_rehire_date") + @ExcludeMissing + latestRehireDate: JsonField = JsonMissing.of(), + @JsonProperty("location") @ExcludeMissing location: JsonField = JsonMissing.of(), + @JsonProperty("manager") @ExcludeMissing manager: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + middleName: JsonField = JsonMissing.of(), + @JsonProperty("source_id") @ExcludeMissing sourceId: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing startDate: JsonField = JsonMissing.of(), + @JsonProperty("title") @ExcludeMissing title: JsonField = JsonMissing.of(), + @JsonProperty("work_id") @ExcludeMissing workId: JsonField = JsonMissing.of(), + ) : this( + id, + classCode, + customFields, + department, + employment, + employmentStatus, + endDate, + firstName, + income, + incomeHistory, + isActive, + lastName, + latestRehireDate, + location, + manager, + middleName, + sourceId, + startDate, + title, + workId, + mutableMapOf(), + ) + /** * string A stable Finch `id` (UUID v4) for an individual in the company. * @@ -403,39 +424,15 @@ private constructor( @ExcludeMissing fun _workId(): JsonField = workId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): EmploymentData = apply { - if (validated) { - return@apply - } - - id() - classCode() - customFields().ifPresent { it.forEach { it.validate() } } - department().ifPresent { it.validate() } - employment().ifPresent { it.validate() } - employmentStatus() - endDate() - firstName() - income().ifPresent { it.validate() } - incomeHistory().ifPresent { it.forEach { it?.validate() } } - isActive() - lastName() - latestRehireDate() - location().ifPresent { it.validate() } - manager().ifPresent { it.validate() } - middleName() - sourceId() - startDate() - title() - workId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -884,22 +881,53 @@ private constructor( startDate, title, workId, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): EmploymentData = apply { + if (validated) { + return@apply + } + + id() + classCode() + customFields().ifPresent { it.forEach { it.validate() } } + department().ifPresent { it.validate() } + employment().ifPresent { it.validate() } + employmentStatus() + endDate() + firstName() + income().ifPresent { it.validate() } + incomeHistory().ifPresent { it.forEach { it?.validate() } } + isActive() + lastName() + latestRehireDate() + location().ifPresent { it.validate() } + manager().ifPresent { it.validate() } + middleName() + sourceId() + startDate() + title() + workId() + validated = true + } + class CustomField - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("value") @ExcludeMissing private val value: JsonValue = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val name: JsonField, + private val value: JsonValue, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonValue = JsonMissing.of(), + ) : this(name, value, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -915,20 +943,15 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): CustomField = apply { - if (validated) { - return@apply - } - - name() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -989,7 +1012,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): CustomField = CustomField(name, value, additionalProperties.toImmutable()) + fun build(): CustomField = CustomField(name, value, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): CustomField = apply { + if (validated) { + return@apply + } + + name() + validated = true } override fun equals(other: Any?): Boolean { @@ -1011,17 +1045,17 @@ private constructor( } /** The department object. */ - @NoAutoDetect class Department - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val name: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of() + ) : this(name, mutableMapOf()) + /** * The name of the department associated with the individual. * @@ -1037,20 +1071,15 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Department = apply { - if (validated) { - return@apply - } - - name() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1111,7 +1140,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Department = Department(name, additionalProperties.toImmutable()) + fun build(): Department = Department(name, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Department = apply { + if (validated) { + return@apply + } + + name() + validated = true } override fun equals(other: Any?): Boolean { @@ -1133,18 +1173,19 @@ private constructor( } /** The employment object. */ - @NoAutoDetect class Employment - @JsonCreator private constructor( - @JsonProperty("subtype") - @ExcludeMissing - private val subtype: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val subtype: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("subtype") @ExcludeMissing subtype: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(subtype, type, mutableMapOf()) + /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, * `intern`, `temp`, `seasonal` and `individual_contractor`. @@ -1176,21 +1217,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Employment = apply { - if (validated) { - return@apply - } - - subtype() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1271,7 +1306,19 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Employment = Employment(subtype, type, additionalProperties.toImmutable()) + fun build(): Employment = Employment(subtype, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Employment = apply { + if (validated) { + return@apply + } + + subtype() + type() + validated = true } /** @@ -1660,15 +1707,17 @@ private constructor( } /** The manager object representing the manager of the individual within the org. */ - @NoAutoDetect class Manager - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of() + ) : this(id, mutableMapOf()) + /** * A stable Finch `id` (UUID v4) for an individual in the company. * @@ -1684,20 +1733,15 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Manager = apply { - if (validated) { - return@apply - } - - id() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1755,7 +1799,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Manager = Manager(id, additionalProperties.toImmutable()) + fun build(): Manager = Manager(id, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Manager = apply { + if (validated) { + return@apply + } + + id() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt index 56db2141..a63c32b9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt @@ -10,27 +10,28 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional -@NoAutoDetect class EmploymentDataResponse -@JsonCreator private constructor( - @JsonProperty("body") - @ExcludeMissing - private val body: JsonField = JsonMissing.of(), - @JsonProperty("code") @ExcludeMissing private val code: JsonField = JsonMissing.of(), - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + 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). @@ -73,22 +74,15 @@ private constructor( @ExcludeMissing fun _individualId(): JsonField = individualId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): EmploymentDataResponse = apply { - if (validated) { - return@apply - } - - body().ifPresent { it.validate() } - code() - individualId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -173,7 +167,20 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): EmploymentDataResponse = - EmploymentDataResponse(body, code, individualId, additionalProperties.toImmutable()) + EmploymentDataResponse(body, code, individualId, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): EmploymentDataResponse = apply { + if (validated) { + return@apply + } + + body().ifPresent { it.validate() } + code() + individualId() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt index 93014c21..7fd21bce 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt @@ -11,34 +11,42 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional -@NoAutoDetect class EmploymentEvent -@JsonCreator private constructor( - @JsonProperty("account_id") - @ExcludeMissing - private val accountId: JsonField = JsonMissing.of(), - @JsonProperty("company_id") - @ExcludeMissing - private val companyId: JsonField = JsonMissing.of(), - @JsonProperty("connection_id") - @ExcludeMissing - private val connectionId: JsonField = JsonMissing.of(), - @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), - @JsonProperty("event_type") - @ExcludeMissing - private val eventType: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val accountId: JsonField, + private val companyId: JsonField, + private val connectionId: JsonField, + private val data: JsonField, + private val eventType: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("account_id") @ExcludeMissing accountId: JsonField = JsonMissing.of(), + @JsonProperty("company_id") @ExcludeMissing companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + connectionId: JsonField = JsonMissing.of(), + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + eventType: JsonField = JsonMissing.of(), + ) : this(accountId, companyId, connectionId, data, eventType, mutableMapOf()) + + fun toBaseWebhookEvent(): BaseWebhookEvent = + BaseWebhookEvent.builder() + .accountId(accountId) + .companyId(companyId) + .connectionId(connectionId) + .build() + /** * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. @@ -121,31 +129,15 @@ private constructor( */ @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBaseWebhookEvent(): BaseWebhookEvent = - BaseWebhookEvent.builder() - .accountId(accountId) - .companyId(companyId) - .connectionId(connectionId) - .build() - - private var validated: Boolean = false - - fun validate(): EmploymentEvent = apply { - if (validated) { - return@apply - } - - accountId() - companyId() - connectionId() - data().ifPresent { it.validate() } - eventType() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -291,21 +283,38 @@ private constructor( connectionId, data, eventType, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): EmploymentEvent = apply { + if (validated) { + return@apply + } + + accountId() + companyId() + connectionId() + data().ifPresent { it.validate() } + eventType() + validated = true + } + class Data - @JsonCreator private constructor( - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val individualId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("individual_id") + @ExcludeMissing + individualId: JsonField = JsonMissing.of() + ) : this(individualId, mutableMapOf()) + /** * The ID of the individual related to the event. * @@ -325,20 +334,15 @@ private constructor( @ExcludeMissing fun _individualId(): JsonField = individualId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Data = apply { - if (validated) { - return@apply - } - - individualId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -398,7 +402,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Data = Data(individualId, additionalProperties.toImmutable()) + fun build(): Data = Data(individualId, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Data = apply { + if (validated) { + return@apply + } + + individualId() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt index 7455d2c6..6dec26c8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt @@ -11,75 +11,96 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown -import com.tryfinch.api.core.immutableEmptyMap 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 -@NoAutoDetect class EmploymentUpdateResponse -@JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("class_code") - @ExcludeMissing - private val classCode: JsonField = JsonMissing.of(), - @JsonProperty("custom_fields") - @ExcludeMissing - private val customFields: JsonField> = JsonMissing.of(), - @JsonProperty("department") - @ExcludeMissing - private val department: JsonField = JsonMissing.of(), - @JsonProperty("employment") - @ExcludeMissing - private val employment: JsonField = JsonMissing.of(), - @JsonProperty("employment_status") - @ExcludeMissing - private val employmentStatus: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("first_name") - @ExcludeMissing - private val firstName: JsonField = JsonMissing.of(), - @JsonProperty("income") - @ExcludeMissing - private val income: JsonField = JsonMissing.of(), - @JsonProperty("income_history") - @ExcludeMissing - private val incomeHistory: JsonField> = JsonMissing.of(), - @JsonProperty("is_active") - @ExcludeMissing - private val isActive: JsonField = JsonMissing.of(), - @JsonProperty("last_name") - @ExcludeMissing - private val lastName: JsonField = JsonMissing.of(), - @JsonProperty("latest_rehire_date") - @ExcludeMissing - private val latestRehireDate: JsonField = JsonMissing.of(), - @JsonProperty("location") - @ExcludeMissing - private val location: JsonField = JsonMissing.of(), - @JsonProperty("manager") - @ExcludeMissing - private val manager: JsonField = JsonMissing.of(), - @JsonProperty("middle_name") - @ExcludeMissing - private val middleName: JsonField = JsonMissing.of(), - @JsonProperty("source_id") - @ExcludeMissing - private val sourceId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("title") @ExcludeMissing private val title: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val classCode: JsonField, + private val customFields: JsonField>, + private val department: JsonField, + private val employment: JsonField, + private val employmentStatus: JsonField, + private val endDate: JsonField, + private val firstName: JsonField, + private val income: JsonField, + private val incomeHistory: JsonField>, + private val isActive: JsonField, + private val lastName: JsonField, + private val latestRehireDate: JsonField, + private val location: JsonField, + private val manager: JsonField, + private val middleName: JsonField, + private val sourceId: JsonField, + private val startDate: JsonField, + private val title: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("class_code") @ExcludeMissing classCode: JsonField = JsonMissing.of(), + @JsonProperty("custom_fields") + @ExcludeMissing + customFields: JsonField> = JsonMissing.of(), + @JsonProperty("department") + @ExcludeMissing + department: JsonField = JsonMissing.of(), + @JsonProperty("employment") + @ExcludeMissing + employment: JsonField = JsonMissing.of(), + @JsonProperty("employment_status") + @ExcludeMissing + employmentStatus: JsonField = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), + @JsonProperty("first_name") @ExcludeMissing firstName: JsonField = JsonMissing.of(), + @JsonProperty("income") @ExcludeMissing income: JsonField = JsonMissing.of(), + @JsonProperty("income_history") + @ExcludeMissing + incomeHistory: JsonField> = JsonMissing.of(), + @JsonProperty("is_active") @ExcludeMissing isActive: JsonField = JsonMissing.of(), + @JsonProperty("last_name") @ExcludeMissing lastName: JsonField = JsonMissing.of(), + @JsonProperty("latest_rehire_date") + @ExcludeMissing + latestRehireDate: JsonField = JsonMissing.of(), + @JsonProperty("location") @ExcludeMissing location: JsonField = JsonMissing.of(), + @JsonProperty("manager") @ExcludeMissing manager: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + middleName: JsonField = JsonMissing.of(), + @JsonProperty("source_id") @ExcludeMissing sourceId: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing startDate: JsonField = JsonMissing.of(), + @JsonProperty("title") @ExcludeMissing title: JsonField = JsonMissing.of(), + ) : this( + id, + classCode, + customFields, + department, + employment, + employmentStatus, + endDate, + firstName, + income, + incomeHistory, + isActive, + lastName, + latestRehireDate, + location, + manager, + middleName, + sourceId, + startDate, + title, + mutableMapOf(), + ) + /** * A stable Finch `id` (UUID v4) for an individual in the company. * @@ -380,38 +401,15 @@ private constructor( */ @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): EmploymentUpdateResponse = apply { - if (validated) { - return@apply - } - - id() - classCode() - customFields().ifPresent { it.forEach { it.validate() } } - department().ifPresent { it.validate() } - employment().ifPresent { it.validate() } - employmentStatus() - endDate() - firstName() - income().ifPresent { it.validate() } - incomeHistory().ifPresent { it.forEach { it?.validate() } } - isActive() - lastName() - latestRehireDate() - location().ifPresent { it.validate() } - manager().ifPresent { it.validate() } - middleName() - sourceId() - startDate() - title() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -831,22 +829,52 @@ private constructor( sourceId, startDate, title, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): EmploymentUpdateResponse = apply { + if (validated) { + return@apply + } + + id() + classCode() + customFields().ifPresent { it.forEach { it.validate() } } + department().ifPresent { it.validate() } + employment().ifPresent { it.validate() } + employmentStatus() + endDate() + firstName() + income().ifPresent { it.validate() } + incomeHistory().ifPresent { it.forEach { it?.validate() } } + isActive() + lastName() + latestRehireDate() + location().ifPresent { it.validate() } + manager().ifPresent { it.validate() } + middleName() + sourceId() + startDate() + title() + validated = true + } + class CustomField - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("value") @ExcludeMissing private val value: JsonValue = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val name: JsonField, + private val value: JsonValue, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonValue = JsonMissing.of(), + ) : this(name, value, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -862,20 +890,15 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): CustomField = apply { - if (validated) { - return@apply - } - - name() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -939,7 +962,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): CustomField = CustomField(name, value, additionalProperties.toImmutable()) + fun build(): CustomField = CustomField(name, value, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): CustomField = apply { + if (validated) { + return@apply + } + + name() + validated = true } override fun equals(other: Any?): Boolean { @@ -961,17 +995,17 @@ private constructor( } /** The department object. */ - @NoAutoDetect class Department - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val name: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of() + ) : this(name, mutableMapOf()) + /** * The name of the department associated with the individual. * @@ -987,20 +1021,15 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Department = apply { - if (validated) { - return@apply - } - - name() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1061,7 +1090,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Department = Department(name, additionalProperties.toImmutable()) + fun build(): Department = Department(name, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Department = apply { + if (validated) { + return@apply + } + + name() + validated = true } override fun equals(other: Any?): Boolean { @@ -1083,18 +1123,19 @@ private constructor( } /** The employment object. */ - @NoAutoDetect class Employment - @JsonCreator private constructor( - @JsonProperty("subtype") - @ExcludeMissing - private val subtype: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val subtype: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("subtype") @ExcludeMissing subtype: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(subtype, type, mutableMapOf()) + /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, * `intern`, `temp`, `seasonal` and `individual_contractor`. @@ -1126,21 +1167,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Employment = apply { - if (validated) { - return@apply - } - - subtype() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1221,7 +1256,19 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Employment = Employment(subtype, type, additionalProperties.toImmutable()) + fun build(): Employment = Employment(subtype, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Employment = apply { + if (validated) { + return@apply + } + + subtype() + type() + validated = true } /** @@ -1607,15 +1654,17 @@ private constructor( } /** The manager object representing the manager of the individual within the org. */ - @NoAutoDetect class Manager - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of() + ) : this(id, mutableMapOf()) + /** * A stable Finch `id` (UUID v4) for an individual in the company. * @@ -1631,20 +1680,15 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Manager = apply { - if (validated) { - return@apply - } - - id() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1702,7 +1746,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Manager = Manager(id, additionalProperties.toImmutable()) + fun build(): Manager = Manager(id, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Manager = apply { + if (validated) { + return@apply + } + + id() + validated = true } override fun equals(other: Any?): Boolean { 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 index 5a9e61cf..ca8189dc 100644 --- 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 @@ -11,26 +11,29 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -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 -@NoAutoDetect class EnrolledIndividual -@JsonCreator private constructor( - @JsonProperty("body") @ExcludeMissing private val body: JsonField = JsonMissing.of(), - @JsonProperty("code") @ExcludeMissing private val code: JsonField = JsonMissing.of(), - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + 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). @@ -75,22 +78,15 @@ private constructor( @ExcludeMissing fun _individualId(): JsonField = individualId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): EnrolledIndividual = apply { - if (validated) { - return@apply - } - - body().ifPresent { it.validate() } - code() - individualId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -175,26 +171,39 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): EnrolledIndividual = - EnrolledIndividual(body, code, individualId, additionalProperties.toImmutable()) + EnrolledIndividual(body, code, individualId, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): EnrolledIndividual = apply { + if (validated) { + return@apply + } + + body().ifPresent { it.validate() } + code() + individualId() + validated = true } - @NoAutoDetect class Body - @JsonCreator private constructor( - @JsonProperty("finch_code") - @ExcludeMissing - private val finchCode: JsonField = JsonMissing.of(), - @JsonProperty("message") - @ExcludeMissing - private val message: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + 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 * @@ -240,22 +249,15 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - finchCode() - message() - name() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -350,7 +352,20 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Body = Body(finchCode, message, name, additionalProperties.toImmutable()) + 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 } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt index ab4db171..323fa76d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt @@ -10,13 +10,11 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap -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 @@ -82,215 +80,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - @NoAutoDetect - class Body - @JsonCreator - private constructor( - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("frequency") - @ExcludeMissing - private val frequency: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** - * Name of the benefit as it appears in the provider and pay statements. Recommend limiting - * this to <30 characters due to limitations in specific providers (e.g. Justworks). - * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) - - /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun frequency(): Optional = - Optional.ofNullable(frequency.getNullable("frequency")) - - /** - * Type of benefit. - * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - - /** - * Returns the raw JSON value of [description]. - * - * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("description") - @ExcludeMissing - fun _description(): JsonField = description - - /** - * Returns the raw JSON value of [frequency]. - * - * Unlike [frequency], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("frequency") - @ExcludeMissing - fun _frequency(): JsonField = frequency - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - description() - frequency() - type() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Body]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var description: JsonField = JsonMissing.of() - private var frequency: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - description = body.description - frequency = body.frequency - type = body.type - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** - * Name of the benefit as it appears in the provider and pay statements. Recommend - * limiting this to <30 characters due to limitations in specific providers (e.g. - * Justworks). - */ - fun description(description: String) = description(JsonField.of(description)) - - /** - * Sets [Builder.description] to an arbitrary JSON value. - * - * You should usually call [Builder.description] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun description(description: JsonField) = apply { - this.description = description - } - - fun frequency(frequency: BenefitFrequency?) = frequency(JsonField.ofNullable(frequency)) - - /** Alias for calling [Builder.frequency] with `frequency.orElse(null)`. */ - fun frequency(frequency: Optional) = frequency(frequency.getOrNull()) - - /** - * Sets [Builder.frequency] to an arbitrary JSON value. - * - * You should usually call [Builder.frequency] with a well-typed [BenefitFrequency] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun frequency(frequency: JsonField) = apply { - this.frequency = frequency - } - - /** Type of benefit. */ - fun type(type: BenefitType?) = type(JsonField.ofNullable(type)) - - /** Alias for calling [Builder.type] with `type.orElse(null)`. */ - fun type(type: Optional) = type(type.getOrNull()) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [BenefitType] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun type(type: JsonField) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = 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(description, frequency, type, additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Body && description == other.description && frequency == other.frequency && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(description, frequency, type, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{description=$description, frequency=$frequency, type=$type, additionalProperties=$additionalProperties}" - } - fun toBuilder() = Builder().from(this) companion object { @@ -302,7 +91,6 @@ private constructor( } /** A builder for [HrisBenefitCreateParams]. */ - @NoAutoDetect class Builder internal constructor() { private var body: Body.Builder = Body.builder() @@ -490,6 +278,223 @@ private constructor( ) } + @JvmSynthetic internal fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + private constructor( + private val description: JsonField, + private val frequency: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("frequency") + @ExcludeMissing + frequency: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(description, frequency, type, mutableMapOf()) + + /** + * Name of the benefit as it appears in the provider and pay statements. Recommend limiting + * this to <30 characters due to limitations in specific providers (e.g. Justworks). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) + + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun frequency(): Optional = + Optional.ofNullable(frequency.getNullable("frequency")) + + /** + * Type of benefit. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [frequency]. + * + * Unlike [frequency], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("frequency") + @ExcludeMissing + fun _frequency(): JsonField = frequency + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Body]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var description: JsonField = JsonMissing.of() + private var frequency: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + description = body.description + frequency = body.frequency + type = body.type + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** + * Name of the benefit as it appears in the provider and pay statements. Recommend + * limiting this to <30 characters due to limitations in specific providers (e.g. + * Justworks). + */ + fun description(description: String) = description(JsonField.of(description)) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + fun frequency(frequency: BenefitFrequency?) = frequency(JsonField.ofNullable(frequency)) + + /** Alias for calling [Builder.frequency] with `frequency.orElse(null)`. */ + fun frequency(frequency: Optional) = frequency(frequency.getOrNull()) + + /** + * Sets [Builder.frequency] to an arbitrary JSON value. + * + * You should usually call [Builder.frequency] with a well-typed [BenefitFrequency] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun frequency(frequency: JsonField) = apply { + this.frequency = frequency + } + + /** Type of benefit. */ + fun type(type: BenefitType?) = type(JsonField.ofNullable(type)) + + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ + fun type(type: Optional) = type(type.getOrNull()) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [BenefitType] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = 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(description, frequency, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + description() + frequency() + type() + validated = true + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Body && description == other.description && frequency == other.frequency && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(description, frequency, type, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{description=$description, frequency=$frequency, type=$type, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt index 47bb02a3..ed8fb88a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers @@ -23,16 +22,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _pathParam(index: Int): String = - when (index) { - 0 -> benefitId - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - fun toBuilder() = Builder().from(this) companion object { @@ -50,7 +39,6 @@ private constructor( } /** A builder for [HrisBenefitIndividualEnrolledIdsParams]. */ - @NoAutoDetect class Builder internal constructor() { private var benefitId: String? = null @@ -187,6 +175,16 @@ private constructor( ) } + fun _pathParam(index: Int): String = + when (index) { + 0 -> benefitId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true 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 aaa9ea15..ce5d2e4e 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 @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable 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 @@ -69,24 +67,30 @@ private constructor( ) = HrisBenefitIndividualRetrieveManyBenefitsPage(individualsService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("items") - private val items: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + 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.getNullable("items") ?: 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 = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -147,7 +151,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(items, additionalProperties.toImmutable()) + fun build(): Response = Response(items, additionalProperties.toMutableMap()) } } 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 55851a35..29f26bc2 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 @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable 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 @@ -72,24 +70,30 @@ private constructor( ) = HrisBenefitIndividualRetrieveManyBenefitsPageAsync(individualsService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("items") - private val items: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + 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.getNullable("items") ?: 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 = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -150,7 +154,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(items, additionalProperties.toImmutable()) + fun build(): Response = Response(items, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt index d63f0755..dd2e70a8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers @@ -32,22 +31,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _pathParam(index: Int): String = - when (index) { - 0 -> benefitId - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - individualIds?.let { put("individual_ids", it) } - putAll(additionalQueryParams) - } - .build() - fun toBuilder() = Builder().from(this) companion object { @@ -65,7 +48,6 @@ private constructor( } /** A builder for [HrisBenefitIndividualRetrieveManyBenefitsParams]. */ - @NoAutoDetect class Builder internal constructor() { private var benefitId: String? = null @@ -217,6 +199,22 @@ private constructor( ) } + fun _pathParam(index: Int): String = + when (index) { + 0 -> benefitId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + individualIds?.let { put("individual_ids", it) } + putAll(additionalQueryParams) + } + .build() + override fun equals(other: Any?): Boolean { if (this === other) { return true 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 index b6332d39..8fc2b027 100644 --- 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 @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable 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 @@ -69,24 +67,30 @@ private constructor( ) = HrisBenefitIndividualUnenrollManyPage(individualsService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("items") - private val items: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + 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.getNullable("items") ?: 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 = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -147,7 +151,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(items, additionalProperties.toImmutable()) + fun build(): Response = Response(items, additionalProperties.toMutableMap()) } } 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 index 70546335..86cc73b9 100644 --- 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 @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable 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 @@ -71,24 +69,30 @@ private constructor( ) = HrisBenefitIndividualUnenrollManyPageAsync(individualsService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("items") - private val items: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + 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.getNullable("items") ?: 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 = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -149,7 +153,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(items, additionalProperties.toImmutable()) + fun build(): Response = Response(items, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt index fa3c1d75..42011764 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt @@ -10,15 +10,14 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional @@ -54,159 +53,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): Body = body - - fun _pathParam(index: Int): String = - when (index) { - 0 -> benefitId - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - @NoAutoDetect - class Body - @JsonCreator - private constructor( - @JsonProperty("individual_ids") - @ExcludeMissing - private val individualIds: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** - * Array of individual_ids to unenroll. - * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun individualIds(): Optional> = - Optional.ofNullable(individualIds.getNullable("individual_ids")) - - /** - * Returns the raw JSON value of [individualIds]. - * - * Unlike [individualIds], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("individual_ids") - @ExcludeMissing - fun _individualIds(): JsonField> = individualIds - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - individualIds() - validated = true - } - - 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 individualIds: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - individualIds = body.individualIds.map { it.toMutableList() } - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** Array of individual_ids to unenroll. */ - fun individualIds(individualIds: List) = - individualIds(JsonField.of(individualIds)) - - /** - * Sets [Builder.individualIds] to an arbitrary JSON value. - * - * You should usually call [Builder.individualIds] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun individualIds(individualIds: JsonField>) = apply { - this.individualIds = individualIds.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [individualIds]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addIndividualId(individualId: String) = apply { - individualIds = - (individualIds ?: JsonField.of(mutableListOf())).also { - checkKnown("individualIds", it).add(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 [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Body = - Body( - (individualIds ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Body && individualIds == other.individualIds && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(individualIds, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{individualIds=$individualIds, additionalProperties=$additionalProperties}" - } - fun toBuilder() = Builder().from(this) companion object { @@ -224,7 +70,6 @@ private constructor( } /** A builder for [HrisBenefitIndividualUnenrollManyParams]. */ - @NoAutoDetect class Builder internal constructor() { private var benefitId: String? = null @@ -405,6 +250,167 @@ private constructor( ) } + @JvmSynthetic internal fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> benefitId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + private constructor( + private val individualIds: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("individual_ids") + @ExcludeMissing + individualIds: JsonField> = JsonMissing.of() + ) : this(individualIds, mutableMapOf()) + + /** + * Array of individual_ids to unenroll. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun individualIds(): Optional> = + Optional.ofNullable(individualIds.getNullable("individual_ids")) + + /** + * Returns the raw JSON value of [individualIds]. + * + * Unlike [individualIds], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("individual_ids") + @ExcludeMissing + fun _individualIds(): JsonField> = individualIds + + @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 individualIds: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + individualIds = body.individualIds.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** Array of individual_ids to unenroll. */ + fun individualIds(individualIds: List) = + individualIds(JsonField.of(individualIds)) + + /** + * Sets [Builder.individualIds] to an arbitrary JSON value. + * + * You should usually call [Builder.individualIds] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun individualIds(individualIds: JsonField>) = apply { + this.individualIds = individualIds.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [individualIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addIndividualId(individualId: String) = apply { + individualIds = + (individualIds ?: JsonField.of(mutableListOf())).also { + checkKnown("individualIds", it).add(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 [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Body = + Body( + (individualIds ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + individualIds() + validated = true + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Body && individualIds == other.individualIds && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(individualIds, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{individualIds=$individualIds, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true 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 5fa4d59b..ef6cff70 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 @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable 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 @@ -66,24 +64,30 @@ private constructor( HrisBenefitListPage(benefitsService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("items") - private val items: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + 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.getNullable("items") ?: 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 = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -141,7 +145,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(items, additionalProperties.toImmutable()) + fun build(): Response = Response(items, additionalProperties.toMutableMap()) } } 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 21e5bc5b..08c0e585 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 @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable 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 @@ -71,24 +69,30 @@ private constructor( ) = HrisBenefitListPageAsync(benefitsService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("items") - private val items: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + 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.getNullable("items") ?: 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 = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -148,7 +152,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(items, additionalProperties.toImmutable()) + fun build(): Response = Response(items, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt index 2a8c8358..daaa4c63 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -19,10 +18,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - fun toBuilder() = Builder().from(this) companion object { @@ -34,7 +29,6 @@ private constructor( } /** A builder for [HrisBenefitListParams]. */ - @NoAutoDetect class Builder internal constructor() { private var additionalHeaders: Headers.Builder = Headers.builder() @@ -153,6 +147,10 @@ private constructor( HrisBenefitListParams(additionalHeaders.build(), additionalQueryParams.build()) } + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt index dbcd5230..82f8cbfe 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable 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 @@ -69,24 +67,30 @@ private constructor( ) = HrisBenefitListSupportedBenefitsPage(benefitsService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("items") - private val items: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + 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.getNullable("items") ?: 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 = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -147,7 +151,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(items, additionalProperties.toImmutable()) + fun build(): Response = Response(items, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt index 6bd07ad6..6f0261d6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable 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 @@ -71,24 +69,30 @@ private constructor( ) = HrisBenefitListSupportedBenefitsPageAsync(benefitsService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("items") - private val items: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + 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.getNullable("items") ?: 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 = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -149,7 +153,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(items, additionalProperties.toImmutable()) + fun build(): Response = Response(items, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt index 95cd1724..df408510 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -19,10 +18,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - fun toBuilder() = Builder().from(this) companion object { @@ -37,7 +32,6 @@ private constructor( } /** A builder for [HrisBenefitListSupportedBenefitsParams]. */ - @NoAutoDetect class Builder internal constructor() { private var additionalHeaders: Headers.Builder = Headers.builder() @@ -162,6 +156,10 @@ private constructor( ) } + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt index e6e2081c..0167113d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers @@ -23,16 +22,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _pathParam(index: Int): String = - when (index) { - 0 -> benefitId - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - fun toBuilder() = Builder().from(this) companion object { @@ -49,7 +38,6 @@ private constructor( } /** A builder for [HrisBenefitRetrieveParams]. */ - @NoAutoDetect class Builder internal constructor() { private var benefitId: String? = null @@ -183,6 +171,16 @@ private constructor( ) } + fun _pathParam(index: Int): String = + when (index) { + 0 -> benefitId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt index 93f2c71f..112cc16e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt @@ -10,14 +10,12 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional @@ -53,141 +51,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): Body = body - - fun _pathParam(index: Int): String = - when (index) { - 0 -> benefitId - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - @NoAutoDetect - class Body - @JsonCreator - private constructor( - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** - * Updated name or description. - * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) - - /** - * 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 - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - description() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Body]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var description: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - description = body.description - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** Updated name or description. */ - fun description(description: String) = description(JsonField.of(description)) - - /** - * Sets [Builder.description] to an arbitrary JSON value. - * - * You should usually call [Builder.description] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun description(description: JsonField) = apply { - this.description = description - } - - 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(description, additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Body && description == other.description && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(description, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{description=$description, additionalProperties=$additionalProperties}" - } - fun toBuilder() = Builder().from(this) companion object { @@ -204,7 +67,6 @@ private constructor( } /** A builder for [HrisBenefitUpdateParams]. */ - @NoAutoDetect class Builder internal constructor() { private var benefitId: String? = null @@ -372,6 +234,149 @@ private constructor( ) } + @JvmSynthetic internal fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> benefitId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + private constructor( + private val description: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of() + ) : this(description, mutableMapOf()) + + /** + * Updated name or description. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) + + /** + * 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 + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Body]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var description: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + description = body.description + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** Updated name or description. */ + fun description(description: String) = description(JsonField.of(description)) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + 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(description, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + description() + validated = true + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Body && description == other.description && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(description, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{description=$description, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt index 09ffb64f..ddb27057 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -19,10 +18,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - fun toBuilder() = Builder().from(this) companion object { @@ -36,7 +31,6 @@ private constructor( } /** A builder for [HrisCompanyRetrieveParams]. */ - @NoAutoDetect class Builder internal constructor() { private var additionalHeaders: Headers.Builder = Headers.builder() @@ -155,6 +149,10 @@ private constructor( HrisCompanyRetrieveParams(additionalHeaders.build(), additionalQueryParams.build()) } + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt index 8d815482..abf208ab 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.hris.DirectoryService +import java.util.Collections import java.util.Objects import java.util.Optional import java.util.stream.Stream @@ -86,17 +84,19 @@ private constructor( ) = HrisDirectoryListIndividualsPage(directoryService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("individuals") - private val individuals: JsonField> = JsonMissing.of(), - @JsonProperty("paging") private val paging: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + class Response( + private val individuals: JsonField>, + private val paging: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("individuals") + individuals: JsonField> = JsonMissing.of(), + @JsonProperty("paging") paging: JsonField = JsonMissing.of(), + ) : this(individuals, paging, mutableMapOf()) + fun individuals(): List = individuals.getNullable("individuals") ?: listOf() @@ -109,9 +109,15 @@ private constructor( @JsonProperty("paging") fun _paging(): Optional> = Optional.ofNullable(paging) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -183,7 +189,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Response = - Response(individuals, paging, additionalProperties.toImmutable()) + Response(individuals, paging, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt index a125a282..c1aea587 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.hris.DirectoryServiceAsync +import java.util.Collections import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture @@ -88,17 +86,19 @@ private constructor( ) = HrisDirectoryListIndividualsPageAsync(directoryService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("individuals") - private val individuals: JsonField> = JsonMissing.of(), - @JsonProperty("paging") private val paging: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + class Response( + private val individuals: JsonField>, + private val paging: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("individuals") + individuals: JsonField> = JsonMissing.of(), + @JsonProperty("paging") paging: JsonField = JsonMissing.of(), + ) : this(individuals, paging, mutableMapOf()) + fun individuals(): List = individuals.getNullable("individuals") ?: listOf() @@ -111,9 +111,15 @@ private constructor( @JsonProperty("paging") fun _paging(): Optional> = Optional.ofNullable(paging) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -185,7 +191,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Response = - Response(individuals, paging, additionalProperties.toImmutable()) + Response(individuals, paging, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt index 0faf984f..6975371d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -30,17 +29,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - limit?.let { put("limit", it.toString()) } - offset?.let { put("offset", it.toString()) } - putAll(additionalQueryParams) - } - .build() - fun toBuilder() = Builder().from(this) companion object { @@ -55,7 +43,6 @@ private constructor( } /** A builder for [HrisDirectoryListIndividualsParams]. */ - @NoAutoDetect class Builder internal constructor() { private var limit: Long? = null @@ -211,6 +198,17 @@ private constructor( ) } + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + limit?.let { put("limit", it.toString()) } + offset?.let { put("offset", it.toString()) } + putAll(additionalQueryParams) + } + .build() + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt index 9df96fbe..83b38d4c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.hris.DirectoryService +import java.util.Collections import java.util.Objects import java.util.Optional import java.util.stream.Stream @@ -85,17 +83,19 @@ private constructor( ) = HrisDirectoryListPage(directoryService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("individuals") - private val individuals: JsonField> = JsonMissing.of(), - @JsonProperty("paging") private val paging: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + class Response( + private val individuals: JsonField>, + private val paging: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("individuals") + individuals: JsonField> = JsonMissing.of(), + @JsonProperty("paging") paging: JsonField = JsonMissing.of(), + ) : this(individuals, paging, mutableMapOf()) + fun individuals(): List = individuals.getNullable("individuals") ?: listOf() @@ -108,9 +108,15 @@ private constructor( @JsonProperty("paging") fun _paging(): Optional> = Optional.ofNullable(paging) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -181,7 +187,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Response = - Response(individuals, paging, additionalProperties.toImmutable()) + Response(individuals, paging, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt index b224dc75..a468dcb8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.hris.DirectoryServiceAsync +import java.util.Collections import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture @@ -87,17 +85,19 @@ private constructor( ) = HrisDirectoryListPageAsync(directoryService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("individuals") - private val individuals: JsonField> = JsonMissing.of(), - @JsonProperty("paging") private val paging: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + class Response( + private val individuals: JsonField>, + private val paging: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("individuals") + individuals: JsonField> = JsonMissing.of(), + @JsonProperty("paging") paging: JsonField = JsonMissing.of(), + ) : this(individuals, paging, mutableMapOf()) + fun individuals(): List = individuals.getNullable("individuals") ?: listOf() @@ -110,9 +110,15 @@ private constructor( @JsonProperty("paging") fun _paging(): Optional> = Optional.ofNullable(paging) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -184,7 +190,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Response = - Response(individuals, paging, additionalProperties.toImmutable()) + Response(individuals, paging, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt index 05f1efe9..be838dc8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -29,17 +28,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - limit?.let { put("limit", it.toString()) } - offset?.let { put("offset", it.toString()) } - putAll(additionalQueryParams) - } - .build() - fun toBuilder() = Builder().from(this) companion object { @@ -51,7 +39,6 @@ private constructor( } /** A builder for [HrisDirectoryListParams]. */ - @NoAutoDetect class Builder internal constructor() { private var limit: Long? = null @@ -205,6 +192,17 @@ private constructor( ) } + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + limit?.let { put("limit", it.toString()) } + offset?.let { put("offset", it.toString()) } + putAll(additionalQueryParams) + } + .build() + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt index 5a29dbdb..bad93273 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt @@ -5,7 +5,6 @@ package com.tryfinch.api.models import com.fasterxml.jackson.annotation.JsonCreator import com.tryfinch.api.core.Enum import com.tryfinch.api.core.JsonField -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -45,19 +44,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - individualIds?.forEach { put("individual_ids[]", it) } - limit?.let { put("limit", it.toString()) } - offset?.let { put("offset", it.toString()) } - types?.forEach { put("types[]", it.toString()) } - putAll(additionalQueryParams) - } - .build() - fun toBuilder() = Builder().from(this) companion object { @@ -69,7 +55,6 @@ private constructor( } /** A builder for [HrisDocumentListParams]. */ - @NoAutoDetect class Builder internal constructor() { private var individualIds: MutableList? = null @@ -263,6 +248,19 @@ private constructor( ) } + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + individualIds?.forEach { put("individual_ids[]", it) } + limit?.let { put("limit", it.toString()) } + offset?.let { put("offset", it.toString()) } + types?.forEach { put("types[]", it.toString()) } + putAll(additionalQueryParams) + } + .build() + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt index ec0e2b2d..5de75843 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers @@ -26,16 +25,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _pathParam(index: Int): String = - when (index) { - 0 -> documentId - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - fun toBuilder() = Builder().from(this) companion object { @@ -52,7 +41,6 @@ private constructor( } /** A builder for [HrisDocumentRetreiveParams]. */ - @NoAutoDetect class Builder internal constructor() { private var documentId: String? = null @@ -186,6 +174,16 @@ private constructor( ) } + fun _pathParam(index: Int): String = + when (index) { + 0 -> documentId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt index c3484ee4..8add822b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.hris.EmploymentService +import java.util.Collections import java.util.Objects import java.util.Optional import java.util.stream.Stream @@ -69,16 +67,17 @@ private constructor( ) = HrisEmploymentRetrieveManyPage(employmentsService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("responses") - private val responses: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + class Response( + private val responses: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("responses") + responses: JsonField> = JsonMissing.of() + ) : this(responses, mutableMapOf()) + fun responses(): List = responses.getNullable("responses") ?: listOf() @@ -86,9 +85,15 @@ private constructor( fun _responses(): Optional>> = Optional.ofNullable(responses) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -152,7 +157,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(responses, additionalProperties.toImmutable()) + fun build(): Response = Response(responses, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt index e52e48c1..eb91301b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.hris.EmploymentServiceAsync +import java.util.Collections import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture @@ -71,16 +69,17 @@ private constructor( ) = HrisEmploymentRetrieveManyPageAsync(employmentsService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("responses") - private val responses: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + class Response( + private val responses: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("responses") + responses: JsonField> = JsonMissing.of() + ) : this(responses, mutableMapOf()) + fun responses(): List = responses.getNullable("responses") ?: listOf() @@ -88,9 +87,15 @@ private constructor( fun _responses(): Optional>> = Optional.ofNullable(responses) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -154,7 +159,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(responses, additionalProperties.toImmutable()) + fun build(): Response = Response(responses, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt index 2c26aa56..ad18d402 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt @@ -10,15 +10,14 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects /** Read individual employment and income data */ @@ -50,165 +49,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - /** Individual Ids Request Body */ - @NoAutoDetect - class Body - @JsonCreator - private constructor( - @JsonProperty("requests") - @ExcludeMissing - private val requests: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** - * The array of batch requests. - * - * @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 requests(): List = requests.getRequired("requests") - - /** - * Returns the raw JSON value of [requests]. - * - * Unlike [requests], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("requests") - @ExcludeMissing - fun _requests(): JsonField> = requests - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - requests().forEach { it.validate() } - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Body]. - * - * The following fields are required: - * ```java - * .requests() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var requests: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - requests = body.requests.map { it.toMutableList() } - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** The array of batch requests. */ - fun requests(requests: List) = requests(JsonField.of(requests)) - - /** - * Sets [Builder.requests] to an arbitrary JSON value. - * - * You should usually call [Builder.requests] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun requests(requests: JsonField>) = apply { - this.requests = requests.map { it.toMutableList() } - } - - /** - * Adds a single [Request] to [requests]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addRequest(request: Request) = apply { - requests = - (requests ?: JsonField.of(mutableListOf())).also { - checkKnown("requests", it).add(request) - } - } - - 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. - * - * The following fields are required: - * ```java - * .requests() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body( - checkRequired("requests", requests).map { it.toImmutable() }, - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Body && requests == other.requests && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(requests, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{requests=$requests, additionalProperties=$additionalProperties}" - } - fun toBuilder() = Builder().from(this) companion object { @@ -226,7 +66,6 @@ private constructor( } /** A builder for [HrisEmploymentRetrieveManyParams]. */ - @NoAutoDetect class Builder internal constructor() { private var body: Body.Builder = Body.builder() @@ -398,17 +237,186 @@ private constructor( ) } - @NoAutoDetect - class Request - @JsonCreator + @JvmSynthetic internal fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + /** Individual Ids Request Body */ + class Body private constructor( - @JsonProperty("individual_id") + private val requests: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("requests") + @ExcludeMissing + requests: JsonField> = JsonMissing.of() + ) : this(requests, mutableMapOf()) + + /** + * The array of batch requests. + * + * @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 requests(): List = requests.getRequired("requests") + + /** + * Returns the raw JSON value of [requests]. + * + * Unlike [requests], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("requests") @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), + fun _requests(): JsonField> = requests + @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + 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]. + * + * The following fields are required: + * ```java + * .requests() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var requests: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + requests = body.requests.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The array of batch requests. */ + fun requests(requests: List) = requests(JsonField.of(requests)) + + /** + * Sets [Builder.requests] to an arbitrary JSON value. + * + * You should usually call [Builder.requests] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun requests(requests: JsonField>) = apply { + this.requests = requests.map { it.toMutableList() } + } + + /** + * Adds a single [Request] to [requests]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addRequest(request: Request) = apply { + requests = + (requests ?: JsonField.of(mutableListOf())).also { + checkKnown("requests", it).add(request) + } + } + + 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. + * + * The following fields are required: + * ```java + * .requests() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("requests", requests).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + requests().forEach { it.validate() } + validated = true + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Body && requests == other.requests && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(requests, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{requests=$requests, additionalProperties=$additionalProperties}" + } + + class Request + private constructor( + private val individualId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("individual_id") + @ExcludeMissing + individualId: JsonField = JsonMissing.of() + ) : this(individualId, mutableMapOf()) + /** * A stable Finch `id` (UUID v4) for an individual in the company. There is no limit to the * number of `individual_id` to send per request. It is preferantial to send all ids in a @@ -429,20 +437,15 @@ private constructor( @ExcludeMissing fun _individualId(): JsonField = individualId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Request = apply { - if (validated) { - return@apply - } - - individualId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -523,10 +526,21 @@ private constructor( fun build(): Request = Request( checkRequired("individualId", individualId), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Request = apply { + if (validated) { + return@apply + } + + individualId() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt index a086a059..6d690971 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.hris.IndividualService +import java.util.Collections import java.util.Objects import java.util.Optional import java.util.stream.Stream @@ -69,25 +67,32 @@ private constructor( ) = HrisIndividualRetrieveManyPage(individualsService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("responses") - private val responses: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + class Response( + private val responses: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("responses") + responses: JsonField> = JsonMissing.of() + ) : this(responses, mutableMapOf()) + fun responses(): List = responses.getNullable("responses") ?: listOf() @JsonProperty("responses") fun _responses(): Optional>> = Optional.ofNullable(responses) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -150,7 +155,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(responses, additionalProperties.toImmutable()) + fun build(): Response = Response(responses, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt index c03fdf79..122692b1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.hris.IndividualServiceAsync +import java.util.Collections import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture @@ -71,25 +69,32 @@ private constructor( ) = HrisIndividualRetrieveManyPageAsync(individualsService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("responses") - private val responses: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + class Response( + private val responses: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("responses") + responses: JsonField> = JsonMissing.of() + ) : this(responses, mutableMapOf()) + fun responses(): List = responses.getNullable("responses") ?: listOf() @JsonProperty("responses") fun _responses(): Optional>> = Optional.ofNullable(responses) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -152,7 +157,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(responses, additionalProperties.toImmutable()) + fun build(): Response = Response(responses, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt index f9780b79..5acd586f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt @@ -10,14 +10,13 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap 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 @@ -62,182 +61,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - @NoAutoDetect - class Body - @JsonCreator - private constructor( - @JsonProperty("options") - @ExcludeMissing - private val options: JsonField = JsonMissing.of(), - @JsonProperty("requests") - @ExcludeMissing - private val requests: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun options(): Optional = Optional.ofNullable(options.getNullable("options")) - - /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun requests(): Optional> = - Optional.ofNullable(requests.getNullable("requests")) - - /** - * Returns the raw JSON value of [options]. - * - * Unlike [options], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("options") @ExcludeMissing fun _options(): JsonField = options - - /** - * Returns the raw JSON value of [requests]. - * - * Unlike [requests], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("requests") - @ExcludeMissing - fun _requests(): JsonField> = requests - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - options().ifPresent { it.validate() } - requests().ifPresent { it.forEach { it.validate() } } - validated = true - } - - 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 options: JsonField = JsonMissing.of() - private var requests: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - options = body.options - requests = body.requests.map { it.toMutableList() } - additionalProperties = body.additionalProperties.toMutableMap() - } - - fun options(options: Options?) = options(JsonField.ofNullable(options)) - - /** Alias for calling [Builder.options] with `options.orElse(null)`. */ - fun options(options: Optional) = options(options.getOrNull()) - - /** - * Sets [Builder.options] to an arbitrary JSON value. - * - * You should usually call [Builder.options] with a well-typed [Options] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun options(options: JsonField) = apply { this.options = options } - - fun requests(requests: List) = requests(JsonField.of(requests)) - - /** - * Sets [Builder.requests] to an arbitrary JSON value. - * - * You should usually call [Builder.requests] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun requests(requests: JsonField>) = apply { - this.requests = requests.map { it.toMutableList() } - } - - /** - * Adds a single [Request] to [requests]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addRequest(request: Request) = apply { - requests = - (requests ?: JsonField.of(mutableListOf())).also { - checkKnown("requests", it).add(request) - } - } - - 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( - options, - (requests ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Body && options == other.options && requests == other.requests && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(options, requests, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{options=$options, requests=$requests, additionalProperties=$additionalProperties}" - } - fun toBuilder() = Builder().from(this) companion object { @@ -252,7 +75,6 @@ private constructor( } /** A builder for [HrisIndividualRetrieveManyParams]. */ - @NoAutoDetect class Builder internal constructor() { private var body: Body.Builder = Body.builder() @@ -429,45 +251,225 @@ private constructor( ) } - @NoAutoDetect - class Options - @JsonCreator + @JvmSynthetic internal fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body private constructor( - @JsonProperty("include") - @ExcludeMissing - private val include: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val options: JsonField, + private val requests: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("options") @ExcludeMissing options: JsonField = JsonMissing.of(), + @JsonProperty("requests") + @ExcludeMissing + requests: JsonField> = JsonMissing.of(), + ) : this(options, requests, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun include(): Optional> = Optional.ofNullable(include.getNullable("include")) + fun options(): Optional = Optional.ofNullable(options.getNullable("options")) /** - * Returns the raw JSON value of [include]. + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun requests(): Optional> = + Optional.ofNullable(requests.getNullable("requests")) + + /** + * Returns the raw JSON value of [options]. * - * Unlike [include], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [options], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("include") @ExcludeMissing fun _include(): JsonField> = include + @JsonProperty("options") @ExcludeMissing fun _options(): JsonField = options + + /** + * Returns the raw JSON value of [requests]. + * + * Unlike [requests], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("requests") + @ExcludeMissing + fun _requests(): JsonField> = requests + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + 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 options: JsonField = JsonMissing.of() + private var requests: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + options = body.options + requests = body.requests.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun options(options: Options?) = options(JsonField.ofNullable(options)) + + /** Alias for calling [Builder.options] with `options.orElse(null)`. */ + fun options(options: Optional) = options(options.getOrNull()) + + /** + * Sets [Builder.options] to an arbitrary JSON value. + * + * You should usually call [Builder.options] with a well-typed [Options] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun options(options: JsonField) = apply { this.options = options } + + fun requests(requests: List) = requests(JsonField.of(requests)) + + /** + * Sets [Builder.requests] to an arbitrary JSON value. + * + * You should usually call [Builder.requests] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun requests(requests: JsonField>) = apply { + this.requests = requests.map { it.toMutableList() } + } + + /** + * Adds a single [Request] to [requests]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addRequest(request: Request) = apply { + requests = + (requests ?: JsonField.of(mutableListOf())).also { + checkKnown("requests", it).add(request) + } + } + + 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( + options, + (requests ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } private var validated: Boolean = false - fun validate(): Options = apply { + fun validate(): Body = apply { if (validated) { return@apply } - include() + options().ifPresent { it.validate() } + requests().ifPresent { it.forEach { it.validate() } } validated = true } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Body && options == other.options && requests == other.requests && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(options, requests, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{options=$options, requests=$requests, additionalProperties=$additionalProperties}" + } + + class Options + private constructor( + private val include: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("include") + @ExcludeMissing + include: JsonField> = JsonMissing.of() + ) : this(include, mutableMapOf()) + + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun include(): Optional> = Optional.ofNullable(include.getNullable("include")) + + /** + * Returns the raw JSON value of [include]. + * + * Unlike [include], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("include") @ExcludeMissing fun _include(): JsonField> = include + + @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 { @@ -540,10 +542,21 @@ private constructor( fun build(): Options = Options( (include ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Options = apply { + if (validated) { + return@apply + } + + include() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -562,17 +575,19 @@ private constructor( "Options{include=$include, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Request - @JsonCreator private constructor( - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val individualId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("individual_id") + @ExcludeMissing + individualId: JsonField = JsonMissing.of() + ) : this(individualId, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -590,20 +605,15 @@ private constructor( @ExcludeMissing fun _individualId(): JsonField = individualId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Request = apply { - if (validated) { - return@apply - } - - individualId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -662,7 +672,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Request = Request(individualId, additionalProperties.toImmutable()) + fun build(): Request = Request(individualId, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Request = apply { + if (validated) { + return@apply + } + + individualId() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt index 35834d35..d8fa7562 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.hris.PayStatementService +import java.util.Collections import java.util.Objects import java.util.Optional import java.util.stream.Stream @@ -73,25 +71,32 @@ private constructor( ) = HrisPayStatementRetrieveManyPage(payStatementsService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("responses") - private val responses: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + class Response( + private val responses: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("responses") + responses: JsonField> = JsonMissing.of() + ) : this(responses, mutableMapOf()) + fun responses(): List = responses.getNullable("responses") ?: listOf() @JsonProperty("responses") fun _responses(): Optional>> = Optional.ofNullable(responses) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -155,7 +160,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(responses, additionalProperties.toImmutable()) + fun build(): Response = Response(responses, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt index 875418aa..8dfdaa54 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.hris.PayStatementServiceAsync +import java.util.Collections import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture @@ -75,25 +73,32 @@ private constructor( ) = HrisPayStatementRetrieveManyPageAsync(payStatementsService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("responses") - private val responses: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + class Response( + private val responses: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("responses") + responses: JsonField> = JsonMissing.of() + ) : this(responses, mutableMapOf()) + fun responses(): List = responses.getNullable("responses") ?: listOf() @JsonProperty("responses") fun _responses(): Optional>> = Optional.ofNullable(responses) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -157,7 +162,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(responses, additionalProperties.toImmutable()) + fun build(): Response = Response(responses, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt index ccab8ddb..3af58f7f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt @@ -10,15 +10,14 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional @@ -55,164 +54,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - @NoAutoDetect - class Body - @JsonCreator - private constructor( - @JsonProperty("requests") - @ExcludeMissing - private val requests: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** - * The array of batch requests. - * - * @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 requests(): List = requests.getRequired("requests") - - /** - * Returns the raw JSON value of [requests]. - * - * Unlike [requests], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("requests") - @ExcludeMissing - fun _requests(): JsonField> = requests - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - requests().forEach { it.validate() } - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Body]. - * - * The following fields are required: - * ```java - * .requests() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var requests: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - requests = body.requests.map { it.toMutableList() } - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** The array of batch requests. */ - fun requests(requests: List) = requests(JsonField.of(requests)) - - /** - * Sets [Builder.requests] to an arbitrary JSON value. - * - * You should usually call [Builder.requests] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun requests(requests: JsonField>) = apply { - this.requests = requests.map { it.toMutableList() } - } - - /** - * Adds a single [Request] to [requests]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addRequest(request: Request) = apply { - requests = - (requests ?: JsonField.of(mutableListOf())).also { - checkKnown("requests", it).add(request) - } - } - - 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. - * - * The following fields are required: - * ```java - * .requests() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body( - checkRequired("requests", requests).map { it.toImmutable() }, - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Body && requests == other.requests && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(requests, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{requests=$requests, additionalProperties=$additionalProperties}" - } - fun toBuilder() = Builder().from(this) companion object { @@ -230,7 +71,6 @@ private constructor( } /** A builder for [HrisPayStatementRetrieveManyParams]. */ - @NoAutoDetect class Builder internal constructor() { private var body: Body.Builder = Body.builder() @@ -402,23 +242,189 @@ private constructor( ) } - @NoAutoDetect - class Request - @JsonCreator + @JvmSynthetic internal fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body private constructor( - @JsonProperty("payment_id") - @ExcludeMissing - private val paymentId: JsonField = JsonMissing.of(), - @JsonProperty("limit") - @ExcludeMissing - private val limit: JsonField = JsonMissing.of(), - @JsonProperty("offset") + private val requests: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("requests") + @ExcludeMissing + requests: JsonField> = JsonMissing.of() + ) : this(requests, mutableMapOf()) + + /** + * The array of batch requests. + * + * @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 requests(): List = requests.getRequired("requests") + + /** + * Returns the raw JSON value of [requests]. + * + * Unlike [requests], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("requests") @ExcludeMissing - private val offset: JsonField = JsonMissing.of(), + fun _requests(): JsonField> = requests + @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + 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]. + * + * The following fields are required: + * ```java + * .requests() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var requests: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + requests = body.requests.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The array of batch requests. */ + fun requests(requests: List) = requests(JsonField.of(requests)) + + /** + * Sets [Builder.requests] to an arbitrary JSON value. + * + * You should usually call [Builder.requests] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun requests(requests: JsonField>) = apply { + this.requests = requests.map { it.toMutableList() } + } + + /** + * Adds a single [Request] to [requests]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addRequest(request: Request) = apply { + requests = + (requests ?: JsonField.of(mutableListOf())).also { + checkKnown("requests", it).add(request) + } + } + + 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. + * + * The following fields are required: + * ```java + * .requests() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("requests", requests).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + requests().forEach { it.validate() } + validated = true + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Body && requests == other.requests && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(requests, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{requests=$requests, additionalProperties=$additionalProperties}" + } + + class Request + private constructor( + private val paymentId: JsonField, + private val limit: JsonField, + private val offset: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("payment_id") + @ExcludeMissing + paymentId: JsonField = JsonMissing.of(), + @JsonProperty("limit") @ExcludeMissing limit: JsonField = JsonMissing.of(), + @JsonProperty("offset") @ExcludeMissing offset: JsonField = JsonMissing.of(), + ) : this(paymentId, limit, offset, mutableMapOf()) + /** * A stable Finch `id` (UUID v4) for a payment. * @@ -464,22 +470,15 @@ private constructor( */ @JsonProperty("offset") @ExcludeMissing fun _offset(): JsonField = offset + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Request = apply { - if (validated) { - return@apply - } - - paymentId() - limit() - offset() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -584,10 +583,23 @@ private constructor( checkRequired("paymentId", paymentId), limit, offset, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Request = apply { + if (validated) { + return@apply + } + + paymentId() + limit() + offset() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt index 211ba10a..f0913915 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.hris.PaymentService +import java.util.Collections import java.util.Objects import java.util.Optional import java.util.stream.Stream @@ -66,23 +64,30 @@ private constructor( HrisPaymentListPage(paymentsService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("items") private val items: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + 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.getNullable("items") ?: 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 = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -140,7 +145,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(items, additionalProperties.toImmutable()) + fun build(): Response = Response(items, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt index 16db08d8..4caac89d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.hris.PaymentServiceAsync +import java.util.Collections import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture @@ -71,23 +69,30 @@ private constructor( ) = HrisPaymentListPageAsync(paymentsService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("items") private val items: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + 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.getNullable("items") ?: 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 = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -147,7 +152,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(items, additionalProperties.toImmutable()) + fun build(): Response = Response(items, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt index bbfece5d..918a4ba6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers @@ -29,17 +28,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - put("end_date", endDate.toString()) - put("start_date", startDate.toString()) - putAll(additionalQueryParams) - } - .build() - fun toBuilder() = Builder().from(this) companion object { @@ -57,7 +45,6 @@ private constructor( } /** A builder for [HrisPaymentListParams]. */ - @NoAutoDetect class Builder internal constructor() { private var endDate: LocalDate? = null @@ -199,6 +186,17 @@ private constructor( ) } + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + put("end_date", endDate.toString()) + put("start_date", startDate.toString()) + putAll(additionalQueryParams) + } + .build() + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt index efe28904..fe56733d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt @@ -11,10 +11,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -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 @@ -24,21 +22,25 @@ import kotlin.jvm.optionals.getOrNull * may be in units of bi-weekly, semi-monthly, daily, etc, depending on what information the * provider returns. */ -@NoAutoDetect class Income -@JsonCreator private constructor( - @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("effective_date") - @ExcludeMissing - private val effectiveDate: JsonField = JsonMissing.of(), - @JsonProperty("unit") @ExcludeMissing private val unit: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val amount: JsonField, + private val currency: JsonField, + private val effectiveDate: JsonField, + private val unit: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), + @JsonProperty("effective_date") + @ExcludeMissing + effectiveDate: JsonField = JsonMissing.of(), + @JsonProperty("unit") @ExcludeMissing unit: JsonField = JsonMissing.of(), + ) : this(amount, currency, effectiveDate, unit, mutableMapOf()) + /** * The income amount in cents. * @@ -103,23 +105,15 @@ private constructor( */ @JsonProperty("unit") @ExcludeMissing fun _unit(): JsonField = unit + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Income = apply { - if (validated) { - return@apply - } - - amount() - currency() - effectiveDate() - unit() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -243,7 +237,21 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Income = - Income(amount, currency, effectiveDate, unit, additionalProperties.toImmutable()) + Income(amount, currency, effectiveDate, unit, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Income = apply { + if (validated) { + return@apply + } + + amount() + currency() + effectiveDate() + unit() + validated = true } /** diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt index a354aae3..55779ae1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt @@ -11,55 +11,76 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown -import com.tryfinch.api.core.immutableEmptyMap 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 -@NoAutoDetect class Individual -@JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("dob") @ExcludeMissing private val dob: JsonField = JsonMissing.of(), - @JsonProperty("emails") - @ExcludeMissing - private val emails: JsonField> = JsonMissing.of(), - @JsonProperty("encrypted_ssn") - @ExcludeMissing - private val encryptedSsn: JsonField = JsonMissing.of(), - @JsonProperty("ethnicity") - @ExcludeMissing - private val ethnicity: JsonField = JsonMissing.of(), - @JsonProperty("first_name") - @ExcludeMissing - private val firstName: JsonField = JsonMissing.of(), - @JsonProperty("gender") - @ExcludeMissing - private val gender: JsonField = JsonMissing.of(), - @JsonProperty("last_name") - @ExcludeMissing - private val lastName: JsonField = JsonMissing.of(), - @JsonProperty("middle_name") - @ExcludeMissing - private val middleName: JsonField = JsonMissing.of(), - @JsonProperty("phone_numbers") - @ExcludeMissing - private val phoneNumbers: JsonField> = JsonMissing.of(), - @JsonProperty("preferred_name") - @ExcludeMissing - private val preferredName: JsonField = JsonMissing.of(), - @JsonProperty("residence") - @ExcludeMissing - private val residence: JsonField = JsonMissing.of(), - @JsonProperty("ssn") @ExcludeMissing private val ssn: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val dob: JsonField, + private val emails: JsonField>, + private val encryptedSsn: JsonField, + private val ethnicity: JsonField, + private val firstName: JsonField, + private val gender: JsonField, + private val lastName: JsonField, + private val middleName: JsonField, + private val phoneNumbers: JsonField>, + private val preferredName: JsonField, + private val residence: JsonField, + private val ssn: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dob") @ExcludeMissing dob: JsonField = JsonMissing.of(), + @JsonProperty("emails") @ExcludeMissing emails: JsonField> = JsonMissing.of(), + @JsonProperty("encrypted_ssn") + @ExcludeMissing + encryptedSsn: JsonField = JsonMissing.of(), + @JsonProperty("ethnicity") + @ExcludeMissing + ethnicity: JsonField = JsonMissing.of(), + @JsonProperty("first_name") @ExcludeMissing firstName: JsonField = JsonMissing.of(), + @JsonProperty("gender") @ExcludeMissing gender: JsonField = JsonMissing.of(), + @JsonProperty("last_name") @ExcludeMissing lastName: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + middleName: JsonField = JsonMissing.of(), + @JsonProperty("phone_numbers") + @ExcludeMissing + phoneNumbers: JsonField> = JsonMissing.of(), + @JsonProperty("preferred_name") + @ExcludeMissing + preferredName: JsonField = JsonMissing.of(), + @JsonProperty("residence") + @ExcludeMissing + residence: JsonField = JsonMissing.of(), + @JsonProperty("ssn") @ExcludeMissing ssn: JsonField = JsonMissing.of(), + ) : this( + id, + dob, + emails, + encryptedSsn, + ethnicity, + firstName, + gender, + lastName, + middleName, + phoneNumbers, + preferredName, + residence, + ssn, + mutableMapOf(), + ) + /** * A stable Finch `id` (UUID v4) for an individual in the company. * @@ -260,32 +281,15 @@ private constructor( */ @JsonProperty("ssn") @ExcludeMissing fun _ssn(): JsonField = ssn + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Individual = apply { - if (validated) { - return@apply - } - - id() - dob() - emails().ifPresent { it.forEach { it.validate() } } - encryptedSsn() - ethnicity() - firstName() - gender() - lastName() - middleName() - phoneNumbers().ifPresent { it.forEach { it?.validate() } } - preferredName() - residence().ifPresent { it.validate() } - ssn() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -597,22 +601,46 @@ private constructor( preferredName, residence, ssn, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): Individual = apply { + if (validated) { + return@apply + } + + id() + dob() + emails().ifPresent { it.forEach { it.validate() } } + encryptedSsn() + ethnicity() + firstName() + gender() + lastName() + middleName() + phoneNumbers().ifPresent { it.forEach { it?.validate() } } + preferredName() + residence().ifPresent { it.validate() } + ssn() + validated = true + } + class Email - @JsonCreator private constructor( - @JsonProperty("data") - @ExcludeMissing - private val data: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val data: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(data, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -639,21 +667,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Email = apply { - if (validated) { - return@apply - } - - data() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -726,7 +748,19 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Email = Email(data, type, additionalProperties.toImmutable()) + fun build(): Email = Email(data, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Email = apply { + if (validated) { + return@apply + } + + data() + type() + validated = true } class Type @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1094,18 +1128,19 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class PhoneNumber - @JsonCreator private constructor( - @JsonProperty("data") - @ExcludeMissing - private val data: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val data: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(data, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1132,21 +1167,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PhoneNumber = apply { - if (validated) { - return@apply - } - - data() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1222,7 +1251,19 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): PhoneNumber = PhoneNumber(data, type, additionalProperties.toImmutable()) + fun build(): PhoneNumber = PhoneNumber(data, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): PhoneNumber = apply { + if (validated) { + return@apply + } + + data() + type() + validated = true } class Type @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt index 9621d2e5..e0442180 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt @@ -11,26 +11,29 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -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 -@NoAutoDetect class IndividualBenefit -@JsonCreator private constructor( - @JsonProperty("body") @ExcludeMissing private val body: JsonField = JsonMissing.of(), - @JsonProperty("code") @ExcludeMissing private val code: JsonField = JsonMissing.of(), - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + 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). @@ -73,22 +76,15 @@ private constructor( @ExcludeMissing fun _individualId(): JsonField = individualId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): IndividualBenefit = apply { - if (validated) { - return@apply - } - - body().ifPresent { it.validate() } - code() - individualId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -172,32 +168,58 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): IndividualBenefit = - IndividualBenefit(body, code, individualId, additionalProperties.toImmutable()) + IndividualBenefit(body, code, individualId, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): IndividualBenefit = apply { + if (validated) { + return@apply + } + + body().ifPresent { it.validate() } + code() + individualId() + validated = true } - @NoAutoDetect class Body - @JsonCreator private constructor( - @JsonProperty("annual_maximum") - @ExcludeMissing - private val annualMaximum: JsonField = JsonMissing.of(), - @JsonProperty("catch_up") - @ExcludeMissing - private val catchUp: JsonField = JsonMissing.of(), - @JsonProperty("company_contribution") - @ExcludeMissing - private val companyContribution: JsonField = JsonMissing.of(), - @JsonProperty("employee_deduction") - @ExcludeMissing - private val employeeDeduction: JsonField = JsonMissing.of(), - @JsonProperty("hsa_contribution_limit") - @ExcludeMissing - private val hsaContributionLimit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val annualMaximum: JsonField, + private val catchUp: JsonField, + private val companyContribution: JsonField, + private val employeeDeduction: 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("employee_deduction") + @ExcludeMissing + employeeDeduction: JsonField = JsonMissing.of(), + @JsonProperty("hsa_contribution_limit") + @ExcludeMissing + hsaContributionLimit: JsonField = JsonMissing.of(), + ) : this( + annualMaximum, + catchUp, + companyContribution, + employeeDeduction, + hsaContributionLimit, + mutableMapOf(), + ) + /** * If the benefit supports annual maximum, the amount in cents for this individual. * @@ -286,24 +308,15 @@ private constructor( @ExcludeMissing fun _hsaContributionLimit(): JsonField = hsaContributionLimit + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - annualMaximum() - catchUp() - companyContribution().ifPresent { it.validate() } - employeeDeduction().ifPresent { it.validate() } - hsaContributionLimit() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -479,10 +492,25 @@ private constructor( companyContribution, employeeDeduction, hsaContributionLimit, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + annualMaximum() + catchUp() + companyContribution().ifPresent { it.validate() } + employeeDeduction().ifPresent { it.validate() } + hsaContributionLimit() + validated = true + } + /** Type for HSA contribution limit if the benefit is a HSA. */ class HsaContributionLimit @JsonCreator diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt index cd3f97b6..6c37ea7d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt @@ -10,27 +10,28 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects -@NoAutoDetect class IndividualEnrolledIdsResponse -@JsonCreator private constructor( - @JsonProperty("benefit_id") - @ExcludeMissing - private val benefitId: JsonField = JsonMissing.of(), - @JsonProperty("individual_ids") - @ExcludeMissing - private val individualIds: JsonField> = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val benefitId: JsonField, + private val individualIds: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("benefit_id") @ExcludeMissing benefitId: JsonField = JsonMissing.of(), + @JsonProperty("individual_ids") + @ExcludeMissing + individualIds: JsonField> = JsonMissing.of(), + ) : this(benefitId, individualIds, 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). @@ -59,21 +60,15 @@ private constructor( @ExcludeMissing fun _individualIds(): JsonField> = individualIds + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): IndividualEnrolledIdsResponse = apply { - if (validated) { - return@apply - } - - benefitId() - individualIds() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -178,10 +173,22 @@ private constructor( IndividualEnrolledIdsResponse( checkRequired("benefitId", benefitId), checkRequired("individualIds", individualIds).map { it.toImmutable() }, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): IndividualEnrolledIdsResponse = apply { + if (validated) { + return@apply + } + + benefitId() + individualIds() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt index 72c534d0..a9032b2a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt @@ -11,34 +11,42 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional -@NoAutoDetect class IndividualEvent -@JsonCreator private constructor( - @JsonProperty("account_id") - @ExcludeMissing - private val accountId: JsonField = JsonMissing.of(), - @JsonProperty("company_id") - @ExcludeMissing - private val companyId: JsonField = JsonMissing.of(), - @JsonProperty("connection_id") - @ExcludeMissing - private val connectionId: JsonField = JsonMissing.of(), - @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), - @JsonProperty("event_type") - @ExcludeMissing - private val eventType: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val accountId: JsonField, + private val companyId: JsonField, + private val connectionId: JsonField, + private val data: JsonField, + private val eventType: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("account_id") @ExcludeMissing accountId: JsonField = JsonMissing.of(), + @JsonProperty("company_id") @ExcludeMissing companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + connectionId: JsonField = JsonMissing.of(), + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + eventType: JsonField = JsonMissing.of(), + ) : this(accountId, companyId, connectionId, data, eventType, mutableMapOf()) + + fun toBaseWebhookEvent(): BaseWebhookEvent = + BaseWebhookEvent.builder() + .accountId(accountId) + .companyId(companyId) + .connectionId(connectionId) + .build() + /** * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. @@ -121,31 +129,15 @@ private constructor( */ @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBaseWebhookEvent(): BaseWebhookEvent = - BaseWebhookEvent.builder() - .accountId(accountId) - .companyId(companyId) - .connectionId(connectionId) - .build() - - private var validated: Boolean = false - - fun validate(): IndividualEvent = apply { - if (validated) { - return@apply - } - - accountId() - companyId() - connectionId() - data().ifPresent { it.validate() } - eventType() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -291,21 +283,38 @@ private constructor( connectionId, data, eventType, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): IndividualEvent = apply { + if (validated) { + return@apply + } + + accountId() + companyId() + connectionId() + data().ifPresent { it.validate() } + eventType() + validated = true + } + class Data - @JsonCreator private constructor( - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val individualId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("individual_id") + @ExcludeMissing + individualId: JsonField = JsonMissing.of() + ) : this(individualId, mutableMapOf()) + /** * The ID of the individual related to the event. * @@ -325,20 +334,15 @@ private constructor( @ExcludeMissing fun _individualId(): JsonField = individualId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Data = apply { - if (validated) { - return@apply - } - - individualId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -398,7 +402,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Data = Data(individualId, additionalProperties.toImmutable()) + fun build(): Data = Data(individualId, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Data = apply { + if (validated) { + return@apply + } + + individualId() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt index d087003a..98873c36 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt @@ -10,40 +10,39 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -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 -@NoAutoDetect class IndividualInDirectory -@JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("department") - @ExcludeMissing - private val department: JsonField = JsonMissing.of(), - @JsonProperty("first_name") - @ExcludeMissing - private val firstName: JsonField = JsonMissing.of(), - @JsonProperty("is_active") - @ExcludeMissing - private val isActive: JsonField = JsonMissing.of(), - @JsonProperty("last_name") - @ExcludeMissing - private val lastName: JsonField = JsonMissing.of(), - @JsonProperty("manager") - @ExcludeMissing - private val manager: JsonField = JsonMissing.of(), - @JsonProperty("middle_name") - @ExcludeMissing - private val middleName: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val department: JsonField, + private val firstName: JsonField, + private val isActive: JsonField, + private val lastName: JsonField, + private val manager: JsonField, + private val middleName: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("department") + @ExcludeMissing + department: JsonField = JsonMissing.of(), + @JsonProperty("first_name") @ExcludeMissing firstName: JsonField = JsonMissing.of(), + @JsonProperty("is_active") @ExcludeMissing isActive: JsonField = JsonMissing.of(), + @JsonProperty("last_name") @ExcludeMissing lastName: JsonField = JsonMissing.of(), + @JsonProperty("manager") @ExcludeMissing manager: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + middleName: JsonField = JsonMissing.of(), + ) : this(id, department, firstName, isActive, lastName, manager, middleName, mutableMapOf()) + /** * A stable Finch id (UUID v4) for an individual in the company. * @@ -152,26 +151,15 @@ private constructor( */ @JsonProperty("middle_name") @ExcludeMissing fun _middleName(): JsonField = middleName + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): IndividualInDirectory = apply { - if (validated) { - return@apply - } - - id() - department().ifPresent { it.validate() } - firstName() - isActive() - lastName() - manager().ifPresent { it.validate() } - middleName() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -344,22 +332,39 @@ private constructor( lastName, manager, middleName, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): IndividualInDirectory = apply { + if (validated) { + return@apply + } + + id() + department().ifPresent { it.validate() } + firstName() + isActive() + lastName() + manager().ifPresent { it.validate() } + middleName() + validated = true + } + /** The department object. */ - @NoAutoDetect class Department - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val name: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of() + ) : this(name, mutableMapOf()) + /** * The name of the department. * @@ -375,20 +380,15 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Department = apply { - if (validated) { - return@apply - } - - name() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -449,7 +449,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Department = Department(name, additionalProperties.toImmutable()) + fun build(): Department = Department(name, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Department = apply { + if (validated) { + return@apply + } + + name() + validated = true } override fun equals(other: Any?): Boolean { @@ -471,15 +482,17 @@ private constructor( } /** The manager object. */ - @NoAutoDetect class Manager - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of() + ) : this(id, mutableMapOf()) + /** * A stable Finch `id` (UUID v4) for an individual in the company. * @@ -495,20 +508,15 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Manager = apply { - if (validated) { - return@apply - } - - id() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -566,7 +574,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Manager = Manager(id, additionalProperties.toImmutable()) + fun build(): Manager = Manager(id, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Manager = apply { + if (validated) { + return@apply + } + + id() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt index ce7c48fb..f3f63c7c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt @@ -10,27 +10,28 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional -@NoAutoDetect class IndividualResponse -@JsonCreator private constructor( - @JsonProperty("body") - @ExcludeMissing - private val body: JsonField = JsonMissing.of(), - @JsonProperty("code") @ExcludeMissing private val code: JsonField = JsonMissing.of(), - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + 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). @@ -73,22 +74,15 @@ private constructor( @ExcludeMissing fun _individualId(): JsonField = individualId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): IndividualResponse = apply { - if (validated) { - return@apply - } - - body().ifPresent { it.validate() } - code() - individualId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -172,7 +166,20 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): IndividualResponse = - IndividualResponse(body, code, individualId, additionalProperties.toImmutable()) + IndividualResponse(body, code, individualId, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): IndividualResponse = apply { + if (validated) { + return@apply + } + + body().ifPresent { it.validate() } + code() + individualId() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt index c0530dc9..9c170392 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt @@ -11,55 +11,76 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown -import com.tryfinch.api.core.immutableEmptyMap 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 -@NoAutoDetect class IndividualUpdateResponse -@JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("dob") @ExcludeMissing private val dob: JsonField = JsonMissing.of(), - @JsonProperty("emails") - @ExcludeMissing - private val emails: JsonField> = JsonMissing.of(), - @JsonProperty("encrypted_ssn") - @ExcludeMissing - private val encryptedSsn: JsonField = JsonMissing.of(), - @JsonProperty("ethnicity") - @ExcludeMissing - private val ethnicity: JsonField = JsonMissing.of(), - @JsonProperty("first_name") - @ExcludeMissing - private val firstName: JsonField = JsonMissing.of(), - @JsonProperty("gender") - @ExcludeMissing - private val gender: JsonField = JsonMissing.of(), - @JsonProperty("last_name") - @ExcludeMissing - private val lastName: JsonField = JsonMissing.of(), - @JsonProperty("middle_name") - @ExcludeMissing - private val middleName: JsonField = JsonMissing.of(), - @JsonProperty("phone_numbers") - @ExcludeMissing - private val phoneNumbers: JsonField> = JsonMissing.of(), - @JsonProperty("preferred_name") - @ExcludeMissing - private val preferredName: JsonField = JsonMissing.of(), - @JsonProperty("residence") - @ExcludeMissing - private val residence: JsonField = JsonMissing.of(), - @JsonProperty("ssn") @ExcludeMissing private val ssn: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val dob: JsonField, + private val emails: JsonField>, + private val encryptedSsn: JsonField, + private val ethnicity: JsonField, + private val firstName: JsonField, + private val gender: JsonField, + private val lastName: JsonField, + private val middleName: JsonField, + private val phoneNumbers: JsonField>, + private val preferredName: JsonField, + private val residence: JsonField, + private val ssn: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dob") @ExcludeMissing dob: JsonField = JsonMissing.of(), + @JsonProperty("emails") @ExcludeMissing emails: JsonField> = JsonMissing.of(), + @JsonProperty("encrypted_ssn") + @ExcludeMissing + encryptedSsn: JsonField = JsonMissing.of(), + @JsonProperty("ethnicity") + @ExcludeMissing + ethnicity: JsonField = JsonMissing.of(), + @JsonProperty("first_name") @ExcludeMissing firstName: JsonField = JsonMissing.of(), + @JsonProperty("gender") @ExcludeMissing gender: JsonField = JsonMissing.of(), + @JsonProperty("last_name") @ExcludeMissing lastName: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + middleName: JsonField = JsonMissing.of(), + @JsonProperty("phone_numbers") + @ExcludeMissing + phoneNumbers: JsonField> = JsonMissing.of(), + @JsonProperty("preferred_name") + @ExcludeMissing + preferredName: JsonField = JsonMissing.of(), + @JsonProperty("residence") + @ExcludeMissing + residence: JsonField = JsonMissing.of(), + @JsonProperty("ssn") @ExcludeMissing ssn: JsonField = JsonMissing.of(), + ) : this( + id, + dob, + emails, + encryptedSsn, + ethnicity, + firstName, + gender, + lastName, + middleName, + phoneNumbers, + preferredName, + residence, + ssn, + mutableMapOf(), + ) + /** * A stable Finch `id` (UUID v4) for an individual in the company. * @@ -260,32 +281,15 @@ private constructor( */ @JsonProperty("ssn") @ExcludeMissing fun _ssn(): JsonField = ssn + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): IndividualUpdateResponse = apply { - if (validated) { - return@apply - } - - id() - dob() - emails().ifPresent { it.forEach { it.validate() } } - encryptedSsn() - ethnicity() - firstName() - gender() - lastName() - middleName() - phoneNumbers().ifPresent { it.forEach { it?.validate() } } - preferredName() - residence().ifPresent { it.validate() } - ssn() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -597,22 +601,46 @@ private constructor( preferredName, residence, ssn, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): IndividualUpdateResponse = apply { + if (validated) { + return@apply + } + + id() + dob() + emails().ifPresent { it.forEach { it.validate() } } + encryptedSsn() + ethnicity() + firstName() + gender() + lastName() + middleName() + phoneNumbers().ifPresent { it.forEach { it?.validate() } } + preferredName() + residence().ifPresent { it.validate() } + ssn() + validated = true + } + class Email - @JsonCreator private constructor( - @JsonProperty("data") - @ExcludeMissing - private val data: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val data: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(data, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -639,21 +667,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Email = apply { - if (validated) { - return@apply - } - - data() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -726,7 +748,19 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Email = Email(data, type, additionalProperties.toImmutable()) + fun build(): Email = Email(data, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Email = apply { + if (validated) { + return@apply + } + + data() + type() + validated = true } class Type @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1094,18 +1128,19 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class PhoneNumber - @JsonCreator private constructor( - @JsonProperty("data") - @ExcludeMissing - private val data: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val data: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(data, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1132,21 +1167,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PhoneNumber = apply { - if (validated) { - return@apply - } - - data() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1219,7 +1248,19 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): PhoneNumber = PhoneNumber(data, type, additionalProperties.toImmutable()) + fun build(): PhoneNumber = PhoneNumber(data, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): PhoneNumber = apply { + if (validated) { + return@apply + } + + data() + type() + validated = true } class Type @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt index 5365ac83..6b3f333c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt @@ -11,71 +11,96 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap 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 -@NoAutoDetect class Introspection -@JsonCreator private constructor( - @JsonProperty("account_id") - @ExcludeMissing - private val accountId: JsonField = JsonMissing.of(), - @JsonProperty("authentication_methods") - @ExcludeMissing - private val authenticationMethods: JsonField> = JsonMissing.of(), - @JsonProperty("client_id") - @ExcludeMissing - private val clientId: JsonField = JsonMissing.of(), - @JsonProperty("client_type") - @ExcludeMissing - private val clientType: JsonField = JsonMissing.of(), - @JsonProperty("company_id") - @ExcludeMissing - private val companyId: JsonField = JsonMissing.of(), - @JsonProperty("connection_id") - @ExcludeMissing - private val connectionId: JsonField = JsonMissing.of(), - @JsonProperty("connection_status") - @ExcludeMissing - private val connectionStatus: JsonField = JsonMissing.of(), - @JsonProperty("connection_type") - @ExcludeMissing - private val connectionType: JsonField = JsonMissing.of(), - @JsonProperty("customer_email") - @ExcludeMissing - private val customerEmail: JsonField = JsonMissing.of(), - @JsonProperty("customer_id") - @ExcludeMissing - private val customerId: JsonField = JsonMissing.of(), - @JsonProperty("customer_name") - @ExcludeMissing - private val customerName: JsonField = JsonMissing.of(), - @JsonProperty("manual") - @ExcludeMissing - private val manual: JsonField = JsonMissing.of(), - @JsonProperty("payroll_provider_id") - @ExcludeMissing - private val payrollProviderId: JsonField = JsonMissing.of(), - @JsonProperty("products") - @ExcludeMissing - private val products: JsonField> = JsonMissing.of(), - @JsonProperty("provider_id") - @ExcludeMissing - private val providerId: JsonField = JsonMissing.of(), - @JsonProperty("username") - @ExcludeMissing - private val username: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val accountId: JsonField, + private val authenticationMethods: JsonField>, + private val clientId: JsonField, + private val clientType: JsonField, + private val companyId: JsonField, + private val connectionId: JsonField, + private val connectionStatus: JsonField, + private val connectionType: JsonField, + private val customerEmail: JsonField, + private val customerId: JsonField, + private val customerName: JsonField, + private val manual: JsonField, + private val payrollProviderId: JsonField, + private val products: JsonField>, + private val providerId: JsonField, + private val username: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("account_id") @ExcludeMissing accountId: JsonField = JsonMissing.of(), + @JsonProperty("authentication_methods") + @ExcludeMissing + authenticationMethods: JsonField> = JsonMissing.of(), + @JsonProperty("client_id") @ExcludeMissing clientId: JsonField = JsonMissing.of(), + @JsonProperty("client_type") + @ExcludeMissing + clientType: JsonField = JsonMissing.of(), + @JsonProperty("company_id") @ExcludeMissing companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + connectionId: JsonField = JsonMissing.of(), + @JsonProperty("connection_status") + @ExcludeMissing + connectionStatus: JsonField = JsonMissing.of(), + @JsonProperty("connection_type") + @ExcludeMissing + connectionType: JsonField = JsonMissing.of(), + @JsonProperty("customer_email") + @ExcludeMissing + customerEmail: JsonField = JsonMissing.of(), + @JsonProperty("customer_id") + @ExcludeMissing + customerId: JsonField = JsonMissing.of(), + @JsonProperty("customer_name") + @ExcludeMissing + customerName: JsonField = JsonMissing.of(), + @JsonProperty("manual") @ExcludeMissing manual: JsonField = JsonMissing.of(), + @JsonProperty("payroll_provider_id") + @ExcludeMissing + payrollProviderId: JsonField = JsonMissing.of(), + @JsonProperty("products") + @ExcludeMissing + products: JsonField> = JsonMissing.of(), + @JsonProperty("provider_id") + @ExcludeMissing + providerId: JsonField = JsonMissing.of(), + @JsonProperty("username") @ExcludeMissing username: JsonField = JsonMissing.of(), + ) : this( + accountId, + authenticationMethods, + clientId, + clientType, + companyId, + connectionId, + connectionStatus, + connectionType, + customerEmail, + customerId, + customerName, + manual, + payrollProviderId, + products, + providerId, + username, + mutableMapOf(), + ) + /** * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of this * account ID. @@ -350,35 +375,15 @@ private constructor( */ @JsonProperty("username") @ExcludeMissing fun _username(): JsonField = username + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Introspection = apply { - if (validated) { - return@apply - } - - accountId() - authenticationMethods().forEach { it.validate() } - clientId() - clientType() - companyId() - connectionId() - connectionStatus().validate() - connectionType() - customerEmail() - customerId() - customerName() - manual() - payrollProviderId() - products() - providerId() - username() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -792,25 +797,55 @@ private constructor( checkRequired("products", products).map { it.toImmutable() }, checkRequired("providerId", providerId), checkRequired("username", username), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): Introspection = apply { + if (validated) { + return@apply + } + + accountId() + authenticationMethods().forEach { it.validate() } + clientId() + clientType() + companyId() + connectionId() + connectionStatus().validate() + connectionType() + customerEmail() + customerId() + customerName() + manual() + payrollProviderId() + products() + providerId() + username() + validated = true + } + class AuthenticationMethod - @JsonCreator private constructor( - @JsonProperty("connection_status") - @ExcludeMissing - private val connectionStatus: JsonField = JsonMissing.of(), - @JsonProperty("products") - @ExcludeMissing - private val products: JsonField> = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val connectionStatus: JsonField, + private val products: JsonField>, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("connection_status") + @ExcludeMissing + connectionStatus: JsonField = JsonMissing.of(), + @JsonProperty("products") + @ExcludeMissing + products: JsonField> = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(connectionStatus, products, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -861,22 +896,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): AuthenticationMethod = apply { - if (validated) { - return@apply - } - - connectionStatus().ifPresent { it.validate() } - products() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -983,24 +1011,40 @@ private constructor( connectionStatus, (products ?: JsonMissing.of()).map { it.toImmutable() }, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): AuthenticationMethod = apply { + if (validated) { + return@apply + } + + connectionStatus().ifPresent { it.validate() } + products() + type() + validated = true + } + class ConnectionStatus - @JsonCreator private constructor( - @JsonProperty("message") - @ExcludeMissing - private val message: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val message: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("message") + @ExcludeMissing + message: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + status: JsonField = JsonMissing.of(), + ) : this(message, status, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -1030,21 +1074,15 @@ private constructor( @ExcludeMissing fun _status(): JsonField = status + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): ConnectionStatus = apply { - if (validated) { - return@apply - } - - message() - status() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1118,7 +1156,19 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): ConnectionStatus = - ConnectionStatus(message, status, additionalProperties.toImmutable()) + ConnectionStatus(message, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): ConnectionStatus = apply { + if (validated) { + return@apply + } + + message() + status() + validated = true } override fun equals(other: Any?): Boolean { @@ -1382,20 +1432,21 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class ConnectionStatus - @JsonCreator private constructor( - @JsonProperty("message") - @ExcludeMissing - private val message: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val message: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("message") @ExcludeMissing message: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + status: JsonField = JsonMissing.of(), + ) : this(message, status, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1425,21 +1476,15 @@ private constructor( @ExcludeMissing fun _status(): JsonField = status + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): ConnectionStatus = apply { - if (validated) { - return@apply - } - - message() - status() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1510,7 +1555,19 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): ConnectionStatus = - ConnectionStatus(message, status, additionalProperties.toImmutable()) + ConnectionStatus(message, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): ConnectionStatus = apply { + if (validated) { + return@apply + } + + message() + status() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt index 5bbe923d..62c34d96 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt @@ -20,15 +20,13 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.getOrThrow import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap -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 @@ -61,6 +59,168 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): JobAutomatedCreateParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [JobAutomatedCreateParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [JobAutomatedCreateParams]. */ + class Builder internal constructor() { + + private var body: Body? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(jobAutomatedCreateParams: JobAutomatedCreateParams) = apply { + body = jobAutomatedCreateParams.body + additionalHeaders = jobAutomatedCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = jobAutomatedCreateParams.additionalQueryParams.toBuilder() + } + + fun body(body: Body?) = apply { this.body = body } + + /** Alias for calling [Builder.body] with `body.orElse(null)`. */ + fun body(body: Optional) = body(body.getOrNull()) + + /** Alias for calling [body] with `Body.ofDataSyncAll(dataSyncAll)`. */ + fun body(dataSyncAll: Body.DataSyncAll) = body(Body.ofDataSyncAll(dataSyncAll)) + + /** Alias for calling [body] with `Body.ofW4FormEmployeeSync(w4FormEmployeeSync)`. */ + fun body(w4FormEmployeeSync: Body.W4FormEmployeeSync) = + body(Body.ofW4FormEmployeeSync(w4FormEmployeeSync)) + + /** + * Alias for calling [body] with the following: + * ```java + * Body.W4FormEmployeeSync.builder() + * .type(JobAutomatedCreateParams.Body.W4FormEmployeeSync.Type.W4_FORM_EMPLOYEE_SYNC) + * .params(params) + * .build() + * ``` + */ + fun w4FormEmployeeSyncBody(params: Body.W4FormEmployeeSync.Params) = + body( + Body.W4FormEmployeeSync.builder() + .type( + JobAutomatedCreateParams.Body.W4FormEmployeeSync.Type.W4_FORM_EMPLOYEE_SYNC + ) + .params(params) + .build() + ) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [JobAutomatedCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): JobAutomatedCreateParams = + JobAutomatedCreateParams(body, additionalHeaders.build(), additionalQueryParams.build()) + } + @JvmSynthetic internal fun _body(): Optional = Optional.ofNullable(body) override fun _headers(): Headers = additionalHeaders @@ -211,17 +371,17 @@ private constructor( } } - @NoAutoDetect class DataSyncAll - @JsonCreator private constructor( - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of() + ) : this(type, mutableMapOf()) + /** * The type of job to start. * @@ -238,20 +398,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): DataSyncAll = apply { - if (validated) { - return@apply - } - - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -327,7 +482,18 @@ private constructor( * @throws IllegalStateException if any required field is unset. */ fun build(): DataSyncAll = - DataSyncAll(checkRequired("type", type), additionalProperties.toImmutable()) + DataSyncAll(checkRequired("type", type), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): DataSyncAll = apply { + if (validated) { + return@apply + } + + type() + validated = true } /** The type of job to start. */ @@ -446,20 +612,21 @@ private constructor( "DataSyncAll{type=$type, additionalProperties=$additionalProperties}" } - @NoAutoDetect class W4FormEmployeeSync - @JsonCreator private constructor( - @JsonProperty("params") - @ExcludeMissing - private val params: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val params: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("params") + @ExcludeMissing + params: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(params, type, 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 @@ -490,21 +657,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): W4FormEmployeeSync = apply { - if (validated) { - return@apply - } - - params().validate() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -598,21 +759,35 @@ private constructor( W4FormEmployeeSync( checkRequired("params", params), checkRequired("type", type), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): W4FormEmployeeSync = apply { + if (validated) { + return@apply + } + + params().validate() + type() + validated = true + } + class Params - @JsonCreator private constructor( - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val individualId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("individual_id") + @ExcludeMissing + individualId: JsonField = JsonMissing.of() + ) : this(individualId, mutableMapOf()) + /** * The unique ID of the individual for W-4 data sync. * @@ -632,20 +807,15 @@ private constructor( @ExcludeMissing fun _individualId(): JsonField = individualId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Params = apply { - if (validated) { - return@apply - } - - individualId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -726,10 +896,21 @@ private constructor( fun build(): Params = Params( checkRequired("individualId", individualId), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Params = apply { + if (validated) { + return@apply + } + + individualId() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -865,169 +1046,6 @@ private constructor( } } - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): JobAutomatedCreateParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [JobAutomatedCreateParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [JobAutomatedCreateParams]. */ - @NoAutoDetect - class Builder internal constructor() { - - private var body: Body? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(jobAutomatedCreateParams: JobAutomatedCreateParams) = apply { - body = jobAutomatedCreateParams.body - additionalHeaders = jobAutomatedCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = jobAutomatedCreateParams.additionalQueryParams.toBuilder() - } - - fun body(body: Body?) = apply { this.body = body } - - /** Alias for calling [Builder.body] with `body.orElse(null)`. */ - fun body(body: Optional) = body(body.getOrNull()) - - /** Alias for calling [body] with `Body.ofDataSyncAll(dataSyncAll)`. */ - fun body(dataSyncAll: Body.DataSyncAll) = body(Body.ofDataSyncAll(dataSyncAll)) - - /** Alias for calling [body] with `Body.ofW4FormEmployeeSync(w4FormEmployeeSync)`. */ - fun body(w4FormEmployeeSync: Body.W4FormEmployeeSync) = - body(Body.ofW4FormEmployeeSync(w4FormEmployeeSync)) - - /** - * Alias for calling [body] with the following: - * ```java - * Body.W4FormEmployeeSync.builder() - * .type(JobAutomatedCreateParams.Body.W4FormEmployeeSync.Type.W4_FORM_EMPLOYEE_SYNC) - * .params(params) - * .build() - * ``` - */ - fun w4FormEmployeeSyncBody(params: Body.W4FormEmployeeSync.Params) = - body( - Body.W4FormEmployeeSync.builder() - .type( - JobAutomatedCreateParams.Body.W4FormEmployeeSync.Type.W4_FORM_EMPLOYEE_SYNC - ) - .params(params) - .build() - ) - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [JobAutomatedCreateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): JobAutomatedCreateParams = - JobAutomatedCreateParams(body, additionalHeaders.build(), additionalQueryParams.build()) - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt index 26e0a437..bcd9259d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -33,17 +32,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - limit?.let { put("limit", it.toString()) } - offset?.let { put("offset", it.toString()) } - putAll(additionalQueryParams) - } - .build() - fun toBuilder() = Builder().from(this) companion object { @@ -55,7 +43,6 @@ private constructor( } /** A builder for [JobAutomatedListParams]. */ - @NoAutoDetect class Builder internal constructor() { private var limit: Long? = null @@ -209,6 +196,17 @@ private constructor( ) } + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + limit?.let { put("limit", it.toString()) } + offset?.let { put("offset", it.toString()) } + putAll(additionalQueryParams) + } + .build() + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParams.kt index 4d9c79eb..ac519b49 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedRetrieveParams.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers @@ -23,16 +22,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _pathParam(index: Int): String = - when (index) { - 0 -> jobId - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - fun toBuilder() = Builder().from(this) companion object { @@ -49,7 +38,6 @@ private constructor( } /** A builder for [JobAutomatedRetrieveParams]. */ - @NoAutoDetect class Builder internal constructor() { private var jobId: String? = null @@ -183,6 +171,16 @@ private constructor( ) } + fun _pathParam(index: Int): String = + when (index) { + 0 -> jobId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt index 2b4375ff..0bbf4e95 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt @@ -11,34 +11,42 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional -@NoAutoDetect class JobCompletionEvent -@JsonCreator private constructor( - @JsonProperty("account_id") - @ExcludeMissing - private val accountId: JsonField = JsonMissing.of(), - @JsonProperty("company_id") - @ExcludeMissing - private val companyId: JsonField = JsonMissing.of(), - @JsonProperty("connection_id") - @ExcludeMissing - private val connectionId: JsonField = JsonMissing.of(), - @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), - @JsonProperty("event_type") - @ExcludeMissing - private val eventType: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val accountId: JsonField, + private val companyId: JsonField, + private val connectionId: JsonField, + private val data: JsonField, + private val eventType: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("account_id") @ExcludeMissing accountId: JsonField = JsonMissing.of(), + @JsonProperty("company_id") @ExcludeMissing companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + connectionId: JsonField = JsonMissing.of(), + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + eventType: JsonField = JsonMissing.of(), + ) : this(accountId, companyId, connectionId, data, eventType, mutableMapOf()) + + fun toBaseWebhookEvent(): BaseWebhookEvent = + BaseWebhookEvent.builder() + .accountId(accountId) + .companyId(companyId) + .connectionId(connectionId) + .build() + /** * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. @@ -121,31 +129,15 @@ private constructor( */ @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBaseWebhookEvent(): BaseWebhookEvent = - BaseWebhookEvent.builder() - .accountId(accountId) - .companyId(companyId) - .connectionId(connectionId) - .build() - - private var validated: Boolean = false - - fun validate(): JobCompletionEvent = apply { - if (validated) { - return@apply - } - - accountId() - companyId() - connectionId() - data().ifPresent { it.validate() } - eventType() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -291,24 +283,38 @@ private constructor( connectionId, data, eventType, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): JobCompletionEvent = apply { + if (validated) { + return@apply + } + + accountId() + companyId() + connectionId() + data().ifPresent { it.validate() } + eventType() + validated = true + } + class Data - @JsonCreator private constructor( - @JsonProperty("job_id") - @ExcludeMissing - private val jobId: JsonField = JsonMissing.of(), - @JsonProperty("job_url") - @ExcludeMissing - private val jobUrl: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val jobId: JsonField, + private val jobUrl: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("job_id") @ExcludeMissing jobId: JsonField = JsonMissing.of(), + @JsonProperty("job_url") @ExcludeMissing jobUrl: JsonField = JsonMissing.of(), + ) : this(jobId, jobUrl, mutableMapOf()) + /** * The id of the job which has completed. * @@ -339,21 +345,15 @@ private constructor( */ @JsonProperty("job_url") @ExcludeMissing fun _jobUrl(): JsonField = jobUrl + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Data = apply { - if (validated) { - return@apply - } - - jobId() - jobUrl() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -445,10 +445,22 @@ private constructor( Data( checkRequired("jobId", jobId), checkRequired("jobUrl", jobUrl), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Data = apply { + if (validated) { + return@apply + } + + jobId() + jobUrl() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt index 74058d1f..2b00d8f4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt @@ -10,30 +10,32 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects -@NoAutoDetect class JobCreateResponse -@JsonCreator private constructor( - @JsonProperty("allowed_refreshes") - @ExcludeMissing - private val allowedRefreshes: JsonField = JsonMissing.of(), - @JsonProperty("job_id") @ExcludeMissing private val jobId: JsonField = JsonMissing.of(), - @JsonProperty("job_url") - @ExcludeMissing - private val jobUrl: JsonField = JsonMissing.of(), - @JsonProperty("remaining_refreshes") - @ExcludeMissing - private val remainingRefreshes: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val allowedRefreshes: JsonField, + private val jobId: JsonField, + private val jobUrl: JsonField, + private val remainingRefreshes: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("allowed_refreshes") + @ExcludeMissing + allowedRefreshes: JsonField = JsonMissing.of(), + @JsonProperty("job_id") @ExcludeMissing jobId: JsonField = JsonMissing.of(), + @JsonProperty("job_url") @ExcludeMissing jobUrl: JsonField = JsonMissing.of(), + @JsonProperty("remaining_refreshes") + @ExcludeMissing + remainingRefreshes: JsonField = JsonMissing.of(), + ) : this(allowedRefreshes, jobId, jobUrl, remainingRefreshes, mutableMapOf()) + /** * The number of allowed refreshes per hour (per hour, fixed window) * @@ -100,23 +102,15 @@ private constructor( @ExcludeMissing fun _remainingRefreshes(): JsonField = remainingRefreshes + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): JobCreateResponse = apply { - if (validated) { - return@apply - } - - allowedRefreshes() - jobId() - jobUrl() - remainingRefreshes() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -246,10 +240,24 @@ private constructor( checkRequired("jobId", jobId), checkRequired("jobUrl", jobUrl), checkRequired("remainingRefreshes", remainingRefreshes), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): JobCreateResponse = apply { + if (validated) { + return@apply + } + + allowedRefreshes() + jobId() + jobUrl() + remainingRefreshes() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobManualRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobManualRetrieveParams.kt index 127849fe..a1833b8c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobManualRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobManualRetrieveParams.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers @@ -26,16 +25,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _pathParam(index: Int): String = - when (index) { - 0 -> jobId - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - fun toBuilder() = Builder().from(this) companion object { @@ -52,7 +41,6 @@ private constructor( } /** A builder for [JobManualRetrieveParams]. */ - @NoAutoDetect class Builder internal constructor() { private var jobId: String? = null @@ -186,6 +174,16 @@ private constructor( ) } + fun _pathParam(index: Int): String = + when (index) { + 0 -> jobId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt index eb126368..567987ef 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt @@ -10,35 +10,39 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -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 -@NoAutoDetect class Location -@JsonCreator private constructor( - @JsonProperty("city") @ExcludeMissing private val city: JsonField = JsonMissing.of(), - @JsonProperty("country") - @ExcludeMissing - private val country: JsonField = JsonMissing.of(), - @JsonProperty("line1") @ExcludeMissing private val line1: JsonField = JsonMissing.of(), - @JsonProperty("line2") @ExcludeMissing private val line2: JsonField = JsonMissing.of(), - @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), - @JsonProperty("postal_code") - @ExcludeMissing - private val postalCode: JsonField = JsonMissing.of(), - @JsonProperty("source_id") - @ExcludeMissing - private val sourceId: JsonField = JsonMissing.of(), - @JsonProperty("state") @ExcludeMissing private val state: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val city: JsonField, + private val country: JsonField, + private val line1: JsonField, + private val line2: JsonField, + private val name: JsonField, + private val postalCode: JsonField, + private val sourceId: JsonField, + private val state: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("city") @ExcludeMissing city: JsonField = JsonMissing.of(), + @JsonProperty("country") @ExcludeMissing country: JsonField = JsonMissing.of(), + @JsonProperty("line1") @ExcludeMissing line1: JsonField = JsonMissing.of(), + @JsonProperty("line2") @ExcludeMissing line2: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("postal_code") + @ExcludeMissing + postalCode: JsonField = JsonMissing.of(), + @JsonProperty("source_id") @ExcludeMissing sourceId: JsonField = JsonMissing.of(), + @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), + ) : this(city, country, line1, line2, name, postalCode, sourceId, state, mutableMapOf()) + /** * City, district, suburb, town, or village. * @@ -155,27 +159,15 @@ private constructor( */ @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Location = apply { - if (validated) { - return@apply - } - - city() - country() - line1() - line2() - name() - postalCode() - sourceId() - state() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -356,10 +348,28 @@ private constructor( postalCode, sourceId, state, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Location = apply { + if (validated) { + return@apply + } + + city() + country() + line1() + line2() + name() + postalCode() + sourceId() + state() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt index 1835f8fa..a8e4898f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt @@ -11,30 +11,30 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap 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 -@NoAutoDetect class ManualAsyncJob -@JsonCreator private constructor( - @JsonProperty("body") - @ExcludeMissing - private val body: JsonField> = JsonMissing.of(), - @JsonProperty("job_id") @ExcludeMissing private val jobId: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val body: JsonField>, + private val jobId: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("body") @ExcludeMissing body: JsonField> = JsonMissing.of(), + @JsonProperty("job_id") @ExcludeMissing jobId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + ) : this(body, jobId, status, mutableMapOf()) + /** * Specific information about the job, such as individual statuses for batch jobs. * @@ -76,22 +76,15 @@ private constructor( */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): ManualAsyncJob = apply { - if (validated) { - return@apply - } - - body() - jobId() - status() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -213,10 +206,23 @@ private constructor( checkRequired("body", body).map { it.toImmutable() }, checkRequired("jobId", jobId), checkRequired("status", status), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): ManualAsyncJob = apply { + if (validated) { + return@apply + } + + body() + jobId() + status() + validated = true + } + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt index 30dc5fd7..d8be1fda 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt @@ -10,25 +10,25 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -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 -@NoAutoDetect class Money -@JsonCreator private constructor( - @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) + /** * Amount for money object (in cents) * @@ -57,21 +57,15 @@ private constructor( */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Money = apply { - if (validated) { - return@apply - } - - amount() - currency() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -150,7 +144,19 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Money = Money(amount, currency, additionalProperties.toImmutable()) + fun build(): Money = Money(amount, currency, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Money = apply { + if (validated) { + return@apply + } + + amount() + currency() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt index 9dbd43ed..f33ad738 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt @@ -10,32 +10,34 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional -@NoAutoDetect class OperationSupportMatrix -@JsonCreator private constructor( - @JsonProperty("create") - @ExcludeMissing - private val create: JsonField = JsonMissing.of(), - @JsonProperty("delete") - @ExcludeMissing - private val delete: JsonField = JsonMissing.of(), - @JsonProperty("read") - @ExcludeMissing - private val read: JsonField = JsonMissing.of(), - @JsonProperty("update") - @ExcludeMissing - private val update: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val create: JsonField, + private val delete: JsonField, + private val read: JsonField, + private val update: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("create") + @ExcludeMissing + create: JsonField = JsonMissing.of(), + @JsonProperty("delete") + @ExcludeMissing + delete: JsonField = JsonMissing.of(), + @JsonProperty("read") @ExcludeMissing read: JsonField = JsonMissing.of(), + @JsonProperty("update") + @ExcludeMissing + update: JsonField = JsonMissing.of(), + ) : this(create, delete, read, update, mutableMapOf()) + /** * - `supported`: This operation is supported by both the provider and Finch * - `not_supported_by_finch`: This operation is not supported by Finch but supported by the @@ -120,23 +122,15 @@ private constructor( */ @JsonProperty("update") @ExcludeMissing fun _update(): JsonField = update + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): OperationSupportMatrix = apply { - if (validated) { - return@apply - } - - create() - delete() - read() - update() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -269,7 +263,27 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): OperationSupportMatrix = - OperationSupportMatrix(create, delete, read, update, additionalProperties.toImmutable()) + OperationSupportMatrix( + create, + delete, + read, + update, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): OperationSupportMatrix = apply { + if (validated) { + return@apply + } + + create() + delete() + read() + update() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt index 2b67dfe7..e8ef2ff8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt @@ -10,22 +10,24 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional -@NoAutoDetect class Paging -@JsonCreator private constructor( - @JsonProperty("count") @ExcludeMissing private val count: JsonField = JsonMissing.of(), - @JsonProperty("offset") @ExcludeMissing private val offset: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val count: JsonField, + private val offset: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("count") @ExcludeMissing count: JsonField = JsonMissing.of(), + @JsonProperty("offset") @ExcludeMissing offset: JsonField = JsonMissing.of(), + ) : this(count, offset, mutableMapOf()) + /** * The total number of elements for the entire query (not just the given page) * @@ -56,21 +58,15 @@ private constructor( */ @JsonProperty("offset") @ExcludeMissing fun _offset(): JsonField = offset + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Paging = apply { - if (validated) { - return@apply - } - - count() - offset() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -140,7 +136,19 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Paging = Paging(count, offset, additionalProperties.toImmutable()) + fun build(): Paging = Paging(count, offset, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Paging = apply { + if (validated) { + return@apply + } + + count() + offset() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt index fae1a93b..64acbf4e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt @@ -11,26 +11,30 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown -import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional -@NoAutoDetect class PayGroupListResponse -@JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), - @JsonProperty("pay_frequencies") - @ExcludeMissing - private val payFrequencies: JsonField> = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val name: JsonField, + private val payFrequencies: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("pay_frequencies") + @ExcludeMissing + payFrequencies: JsonField> = JsonMissing.of(), + ) : this(id, name, payFrequencies, mutableMapOf()) + /** * Finch id (uuidv4) for the pay group * @@ -79,22 +83,15 @@ private constructor( @ExcludeMissing fun _payFrequencies(): JsonField> = payFrequencies + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PayGroupListResponse = apply { - if (validated) { - return@apply - } - - id() - name() - payFrequencies() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -198,10 +195,23 @@ private constructor( id, name, (payFrequencies ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): PayGroupListResponse = apply { + if (validated) { + return@apply + } + + id() + name() + payFrequencies() + validated = true + } + class PayFrequency @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt index 0ae35034..959124dc 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt @@ -11,29 +11,34 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects -@NoAutoDetect class PayGroupRetrieveResponse -@JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("individual_ids") - @ExcludeMissing - private val individualIds: JsonField> = JsonMissing.of(), - @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), - @JsonProperty("pay_frequencies") - @ExcludeMissing - private val payFrequencies: JsonField> = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val individualIds: JsonField>, + private val name: JsonField, + private val payFrequencies: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("individual_ids") + @ExcludeMissing + individualIds: JsonField> = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("pay_frequencies") + @ExcludeMissing + payFrequencies: JsonField> = JsonMissing.of(), + ) : this(id, individualIds, name, payFrequencies, mutableMapOf()) + /** * Finch id (uuidv4) for the pay group * @@ -96,23 +101,15 @@ private constructor( @ExcludeMissing fun _payFrequencies(): JsonField> = payFrequencies + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PayGroupRetrieveResponse = apply { - if (validated) { - return@apply - } - - id() - individualIds() - name() - payFrequencies() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -264,10 +261,24 @@ private constructor( checkRequired("individualIds", individualIds).map { it.toImmutable() }, checkRequired("name", name), checkRequired("payFrequencies", payFrequencies).map { it.toImmutable() }, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): PayGroupRetrieveResponse = apply { + if (validated) { + return@apply + } + + id() + individualIds() + name() + payFrequencies() + validated = true + } + class PayFrequency @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt index c98dcb83..6130a459 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt @@ -11,50 +11,67 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown -import com.tryfinch.api.core.immutableEmptyMap 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 -@NoAutoDetect class PayStatement -@JsonCreator private constructor( - @JsonProperty("earnings") - @ExcludeMissing - private val earnings: JsonField> = JsonMissing.of(), - @JsonProperty("employee_deductions") - @ExcludeMissing - private val employeeDeductions: JsonField> = JsonMissing.of(), - @JsonProperty("employer_contributions") - @ExcludeMissing - private val employerContributions: JsonField> = JsonMissing.of(), - @JsonProperty("gross_pay") - @ExcludeMissing - private val grossPay: JsonField = JsonMissing.of(), - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonProperty("net_pay") - @ExcludeMissing - private val netPay: JsonField = JsonMissing.of(), - @JsonProperty("payment_method") - @ExcludeMissing - private val paymentMethod: JsonField = JsonMissing.of(), - @JsonProperty("taxes") - @ExcludeMissing - private val taxes: JsonField> = JsonMissing.of(), - @JsonProperty("total_hours") - @ExcludeMissing - private val totalHours: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val earnings: JsonField>, + private val employeeDeductions: JsonField>, + private val employerContributions: JsonField>, + private val grossPay: JsonField, + private val individualId: JsonField, + private val netPay: JsonField, + private val paymentMethod: JsonField, + private val taxes: JsonField>, + private val totalHours: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("earnings") + @ExcludeMissing + earnings: JsonField> = JsonMissing.of(), + @JsonProperty("employee_deductions") + @ExcludeMissing + employeeDeductions: JsonField> = JsonMissing.of(), + @JsonProperty("employer_contributions") + @ExcludeMissing + employerContributions: JsonField> = JsonMissing.of(), + @JsonProperty("gross_pay") @ExcludeMissing grossPay: JsonField = JsonMissing.of(), + @JsonProperty("individual_id") + @ExcludeMissing + individualId: JsonField = JsonMissing.of(), + @JsonProperty("net_pay") @ExcludeMissing netPay: JsonField = JsonMissing.of(), + @JsonProperty("payment_method") + @ExcludeMissing + paymentMethod: JsonField = JsonMissing.of(), + @JsonProperty("taxes") @ExcludeMissing taxes: JsonField> = JsonMissing.of(), + @JsonProperty("total_hours") + @ExcludeMissing + totalHours: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this( + earnings, + employeeDeductions, + employerContributions, + grossPay, + individualId, + netPay, + paymentMethod, + taxes, + totalHours, + type, + mutableMapOf(), + ) + /** * The array of earnings objects associated with this pay statement * @@ -213,29 +230,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PayStatement = apply { - if (validated) { - return@apply - } - - earnings().ifPresent { it.forEach { it?.validate() } } - employeeDeductions().ifPresent { it.forEach { it?.validate() } } - employerContributions().ifPresent { it.forEach { it?.validate() } } - grossPay().ifPresent { it.validate() } - individualId() - netPay().ifPresent { it.validate() } - paymentMethod() - taxes().ifPresent { it.forEach { it?.validate() } } - totalHours() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -529,34 +532,55 @@ private constructor( (taxes ?: JsonMissing.of()).map { it.toImmutable() }, totalHours, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): PayStatement = apply { + if (validated) { + return@apply + } + + earnings().ifPresent { it.forEach { it?.validate() } } + employeeDeductions().ifPresent { it.forEach { it?.validate() } } + employerContributions().ifPresent { it.forEach { it?.validate() } } + grossPay().ifPresent { it.validate() } + individualId() + netPay().ifPresent { it.validate() } + paymentMethod() + taxes().ifPresent { it.forEach { it?.validate() } } + totalHours() + type() + validated = true + } + class Earning - @JsonCreator private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("attributes") - @ExcludeMissing - private val attributes: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("hours") - @ExcludeMissing - private val hours: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val amount: JsonField, + private val attributes: JsonField, + private val currency: JsonField, + private val hours: JsonField, + private val name: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + attributes: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("hours") @ExcludeMissing hours: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(amount, attributes, currency, hours, name, type, mutableMapOf()) + /** * The earnings amount in cents. * @@ -649,25 +673,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Earning = apply { - if (validated) { - return@apply - } - - amount() - attributes().ifPresent { it.validate() } - currency() - hours() - name() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -839,21 +853,39 @@ private constructor( hours, name, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): Earning = apply { + if (validated) { + return@apply + } + + amount() + attributes().ifPresent { it.validate() } + currency() + hours() + name() + type() + validated = true + } + class Attributes - @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val metadata: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -871,20 +903,15 @@ private constructor( @ExcludeMissing fun _metadata(): JsonField = metadata + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Attributes = apply { - if (validated) { - return@apply - } - - metadata().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -944,20 +971,33 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Attributes = Attributes(metadata, additionalProperties.toImmutable()) + fun build(): Attributes = Attributes(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Attributes = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true } - @NoAutoDetect class Metadata - @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val metadata: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + /** * The metadata to be attached to the entity by existing rules. It is a key-value * pairs where the values can be of any type (string, number, boolean, object, @@ -979,20 +1019,15 @@ private constructor( @ExcludeMissing fun _metadata(): JsonField = metadata + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Metadata = apply { - if (validated) { - return@apply - } - - metadata().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1059,7 +1094,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + fun build(): Metadata = Metadata(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true } /** @@ -1067,28 +1113,23 @@ private constructor( * pairs where the values can be of any type (string, number, boolean, object, * array, etc.). */ - @NoAutoDetect class InnerMetadata - @JsonCreator private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap() + private val additionalProperties: MutableMap ) { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): InnerMetadata = apply { - if (validated) { - return@apply - } + @JsonCreator private constructor() : this(mutableMapOf()) - validated = true + @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 { @@ -1139,7 +1180,17 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toImmutable()) + InnerMetadata(additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true } override fun equals(other: Any?): Boolean { @@ -1381,32 +1432,31 @@ private constructor( "Earning{amount=$amount, attributes=$attributes, currency=$currency, hours=$hours, name=$name, type=$type, additionalProperties=$additionalProperties}" } - @NoAutoDetect class EmployeeDeduction - @JsonCreator private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("attributes") - @ExcludeMissing - private val attributes: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("pre_tax") - @ExcludeMissing - private val preTax: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val amount: JsonField, + private val attributes: JsonField, + private val currency: JsonField, + private val name: JsonField, + private val preTax: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + attributes: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("pre_tax") @ExcludeMissing preTax: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(amount, attributes, currency, name, preTax, type, mutableMapOf()) + /** * The deduction amount in cents. * @@ -1498,25 +1548,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): EmployeeDeduction = apply { - if (validated) { - return@apply - } - - amount() - attributes().ifPresent { it.validate() } - currency() - name() - preTax() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1685,26 +1725,44 @@ private constructor( name, preTax, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect - class Attributes - @JsonCreator - private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + private var validated: Boolean = false - /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun metadata(): Optional = + fun validate(): EmployeeDeduction = apply { + if (validated) { + return@apply + } + + amount() + attributes().ifPresent { it.validate() } + currency() + name() + preTax() + type() + validated = true + } + + class Attributes + private constructor( + private val metadata: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) /** @@ -1717,20 +1775,15 @@ private constructor( @ExcludeMissing fun _metadata(): JsonField = metadata + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Attributes = apply { - if (validated) { - return@apply - } - - metadata().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1790,20 +1843,33 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Attributes = Attributes(metadata, additionalProperties.toImmutable()) + fun build(): Attributes = Attributes(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Attributes = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true } - @NoAutoDetect class Metadata - @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val metadata: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + /** * The metadata to be attached to the entity by existing rules. It is a key-value * pairs where the values can be of any type (string, number, boolean, object, @@ -1825,20 +1891,15 @@ private constructor( @ExcludeMissing fun _metadata(): JsonField = metadata + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Metadata = apply { - if (validated) { - return@apply - } - - metadata().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1905,7 +1966,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + fun build(): Metadata = Metadata(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true } /** @@ -1913,28 +1985,23 @@ private constructor( * pairs where the values can be of any type (string, number, boolean, object, * array, etc.). */ - @NoAutoDetect class InnerMetadata - @JsonCreator private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap() + private val additionalProperties: MutableMap ) { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): InnerMetadata = apply { - if (validated) { - return@apply - } + @JsonCreator private constructor() : this(mutableMapOf()) - validated = true + @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 { @@ -1985,7 +2052,17 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toImmutable()) + InnerMetadata(additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true } override fun equals(other: Any?): Boolean { @@ -2060,29 +2137,29 @@ private constructor( "EmployeeDeduction{amount=$amount, attributes=$attributes, currency=$currency, name=$name, preTax=$preTax, type=$type, additionalProperties=$additionalProperties}" } - @NoAutoDetect class EmployerContribution - @JsonCreator private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("attributes") - @ExcludeMissing - private val attributes: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val amount: JsonField, + private val attributes: JsonField, + private val currency: JsonField, + private val name: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + attributes: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(amount, attributes, currency, name, type, mutableMapOf()) + /** * The contribution amount in cents. * @@ -2159,24 +2236,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): EmployerContribution = apply { - if (validated) { - return@apply - } - - amount() - attributes().ifPresent { it.validate() } - currency() - name() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2320,21 +2388,38 @@ private constructor( currency, name, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): EmployerContribution = apply { + if (validated) { + return@apply + } + + amount() + attributes().ifPresent { it.validate() } + currency() + name() + type() + validated = true + } + class Attributes - @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val metadata: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -2352,20 +2437,15 @@ private constructor( @ExcludeMissing fun _metadata(): JsonField = metadata + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Attributes = apply { - if (validated) { - return@apply - } - - metadata().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2425,20 +2505,33 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Attributes = Attributes(metadata, additionalProperties.toImmutable()) + fun build(): Attributes = Attributes(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Attributes = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true } - @NoAutoDetect class Metadata - @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val metadata: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + /** * The metadata to be attached to the entity by existing rules. It is a key-value * pairs where the values can be of any type (string, number, boolean, object, @@ -2460,20 +2553,15 @@ private constructor( @ExcludeMissing fun _metadata(): JsonField = metadata + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Metadata = apply { - if (validated) { - return@apply - } - - metadata().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2540,7 +2628,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + fun build(): Metadata = Metadata(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true } /** @@ -2548,28 +2647,23 @@ private constructor( * pairs where the values can be of any type (string, number, boolean, object, * array, etc.). */ - @NoAutoDetect class InnerMetadata - @JsonCreator private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap() + private val additionalProperties: MutableMap ) { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JsonCreator private constructor() : this(mutableMapOf()) - private var validated: Boolean = false - - fun validate(): InnerMetadata = apply { - if (validated) { - return@apply - } - - validated = true + @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 { @@ -2620,7 +2714,17 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toImmutable()) + InnerMetadata(additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true } override fun equals(other: Any?): Boolean { @@ -2797,30 +2901,33 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class Tax - @JsonCreator private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("attributes") - @ExcludeMissing - private val attributes: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("employer") - @ExcludeMissing - private val employer: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val amount: JsonField, + private val attributes: JsonField, + private val currency: JsonField, + private val employer: JsonField, + private val name: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + attributes: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("employer") + @ExcludeMissing + employer: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(amount, attributes, currency, employer, name, type, mutableMapOf()) + /** * The tax amount in cents. * @@ -2912,25 +3019,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Tax = apply { - if (validated) { - return@apply - } - - amount() - attributes().ifPresent { it.validate() } - currency() - employer() - name() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3099,21 +3196,39 @@ private constructor( employer, name, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): Tax = apply { + if (validated) { + return@apply + } + + amount() + attributes().ifPresent { it.validate() } + currency() + employer() + name() + type() + validated = true + } + class Attributes - @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val metadata: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -3131,20 +3246,15 @@ private constructor( @ExcludeMissing fun _metadata(): JsonField = metadata + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Attributes = apply { - if (validated) { - return@apply - } - - metadata().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3204,20 +3314,33 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Attributes = Attributes(metadata, additionalProperties.toImmutable()) + fun build(): Attributes = Attributes(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Attributes = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true } - @NoAutoDetect class Metadata - @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val metadata: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + /** * The metadata to be attached to the entity by existing rules. It is a key-value * pairs where the values can be of any type (string, number, boolean, object, @@ -3239,20 +3362,15 @@ private constructor( @ExcludeMissing fun _metadata(): JsonField = metadata + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Metadata = apply { - if (validated) { - return@apply - } - - metadata().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3319,7 +3437,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + fun build(): Metadata = Metadata(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true } /** @@ -3327,28 +3456,23 @@ private constructor( * pairs where the values can be of any type (string, number, boolean, object, * array, etc.). */ - @NoAutoDetect class InnerMetadata - @JsonCreator private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap() + private val additionalProperties: MutableMap ) { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false + @JsonCreator private constructor() : this(mutableMapOf()) - fun validate(): InnerMetadata = apply { - if (validated) { - return@apply - } - - validated = true + @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 { @@ -3399,7 +3523,17 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toImmutable()) + InnerMetadata(additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt index 1c8b8296..30407494 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt @@ -11,34 +11,42 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional -@NoAutoDetect class PayStatementEvent -@JsonCreator private constructor( - @JsonProperty("account_id") - @ExcludeMissing - private val accountId: JsonField = JsonMissing.of(), - @JsonProperty("company_id") - @ExcludeMissing - private val companyId: JsonField = JsonMissing.of(), - @JsonProperty("connection_id") - @ExcludeMissing - private val connectionId: JsonField = JsonMissing.of(), - @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), - @JsonProperty("event_type") - @ExcludeMissing - private val eventType: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val accountId: JsonField, + private val companyId: JsonField, + private val connectionId: JsonField, + private val data: JsonField, + private val eventType: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("account_id") @ExcludeMissing accountId: JsonField = JsonMissing.of(), + @JsonProperty("company_id") @ExcludeMissing companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + connectionId: JsonField = JsonMissing.of(), + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + eventType: JsonField = JsonMissing.of(), + ) : this(accountId, companyId, connectionId, data, eventType, mutableMapOf()) + + fun toBaseWebhookEvent(): BaseWebhookEvent = + BaseWebhookEvent.builder() + .accountId(accountId) + .companyId(companyId) + .connectionId(connectionId) + .build() + /** * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. @@ -121,31 +129,15 @@ private constructor( */ @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBaseWebhookEvent(): BaseWebhookEvent = - BaseWebhookEvent.builder() - .accountId(accountId) - .companyId(companyId) - .connectionId(connectionId) - .build() - - private var validated: Boolean = false - - fun validate(): PayStatementEvent = apply { - if (validated) { - return@apply - } - - accountId() - companyId() - connectionId() - data().ifPresent { it.validate() } - eventType() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -291,24 +283,42 @@ private constructor( connectionId, data, eventType, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): PayStatementEvent = apply { + if (validated) { + return@apply + } + + accountId() + companyId() + connectionId() + data().ifPresent { it.validate() } + eventType() + validated = true + } + class Data - @JsonCreator private constructor( - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonProperty("payment_id") - @ExcludeMissing - private val paymentId: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val individualId: JsonField, + private val paymentId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("individual_id") + @ExcludeMissing + individualId: JsonField = JsonMissing.of(), + @JsonProperty("payment_id") + @ExcludeMissing + paymentId: JsonField = JsonMissing.of(), + ) : this(individualId, paymentId, mutableMapOf()) + /** * The ID of the individual associated with the pay statement. * @@ -343,21 +353,15 @@ private constructor( */ @JsonProperty("payment_id") @ExcludeMissing fun _paymentId(): JsonField = paymentId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Data = apply { - if (validated) { - return@apply - } - - individualId() - paymentId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -431,7 +435,19 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Data = Data(individualId, paymentId, additionalProperties.toImmutable()) + fun build(): Data = Data(individualId, paymentId, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Data = apply { + if (validated) { + return@apply + } + + individualId() + paymentId() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt index 1cccee9c..16256880 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt @@ -10,27 +10,28 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional -@NoAutoDetect class PayStatementResponse -@JsonCreator private constructor( - @JsonProperty("body") - @ExcludeMissing - private val body: JsonField = JsonMissing.of(), - @JsonProperty("code") @ExcludeMissing private val code: JsonField = JsonMissing.of(), - @JsonProperty("payment_id") - @ExcludeMissing - private val paymentId: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val body: JsonField, + private val code: JsonField, + private val paymentId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("body") + @ExcludeMissing + body: JsonField = JsonMissing.of(), + @JsonProperty("code") @ExcludeMissing code: JsonField = JsonMissing.of(), + @JsonProperty("payment_id") @ExcludeMissing paymentId: JsonField = JsonMissing.of(), + ) : this(body, code, paymentId, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -70,22 +71,15 @@ private constructor( */ @JsonProperty("payment_id") @ExcludeMissing fun _paymentId(): JsonField = paymentId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PayStatementResponse = apply { - if (validated) { - return@apply - } - - body().ifPresent { it.validate() } - code() - paymentId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -168,7 +162,20 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PayStatementResponse = - PayStatementResponse(body, code, paymentId, additionalProperties.toImmutable()) + PayStatementResponse(body, code, paymentId, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): PayStatementResponse = apply { + if (validated) { + return@apply + } + + body().ifPresent { it.validate() } + code() + paymentId() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt index 9c3e32c4..9703dfd1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt @@ -10,27 +10,28 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown -import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional -@NoAutoDetect class PayStatementResponseBody -@JsonCreator private constructor( - @JsonProperty("paging") - @ExcludeMissing - private val paging: JsonField = JsonMissing.of(), - @JsonProperty("pay_statements") - @ExcludeMissing - private val payStatements: JsonField> = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val paging: JsonField, + private val payStatements: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("paging") @ExcludeMissing paging: JsonField = JsonMissing.of(), + @JsonProperty("pay_statements") + @ExcludeMissing + payStatements: JsonField> = JsonMissing.of(), + ) : this(paging, payStatements, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -62,21 +63,15 @@ private constructor( @ExcludeMissing fun _payStatements(): JsonField> = payStatements + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PayStatementResponseBody = apply { - if (validated) { - return@apply - } - - paging().ifPresent { it.validate() } - payStatements().ifPresent { it.forEach { it.validate() } } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -165,10 +160,22 @@ private constructor( PayStatementResponseBody( paging, (payStatements ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): PayStatementResponseBody = apply { + if (validated) { + return@apply + } + + paging().ifPresent { it.validate() } + payStatements().ifPresent { it.forEach { it.validate() } } + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt index 7e49d866..1eb633a5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt @@ -11,56 +11,75 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown -import com.tryfinch.api.core.immutableEmptyMap 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 -@NoAutoDetect class Payment -@JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("company_debit") - @ExcludeMissing - private val companyDebit: JsonField = JsonMissing.of(), - @JsonProperty("debit_date") - @ExcludeMissing - private val debitDate: JsonField = JsonMissing.of(), - @JsonProperty("employee_taxes") - @ExcludeMissing - private val employeeTaxes: JsonField = JsonMissing.of(), - @JsonProperty("employer_taxes") - @ExcludeMissing - private val employerTaxes: JsonField = JsonMissing.of(), - @JsonProperty("gross_pay") - @ExcludeMissing - private val grossPay: JsonField = JsonMissing.of(), - @JsonProperty("individual_ids") - @ExcludeMissing - private val individualIds: JsonField> = JsonMissing.of(), - @JsonProperty("net_pay") - @ExcludeMissing - private val netPay: JsonField = JsonMissing.of(), - @JsonProperty("pay_date") - @ExcludeMissing - private val payDate: JsonField = JsonMissing.of(), - @JsonProperty("pay_frequencies") - @ExcludeMissing - private val payFrequencies: JsonField> = JsonMissing.of(), - @JsonProperty("pay_group_ids") - @ExcludeMissing - private val payGroupIds: JsonField> = JsonMissing.of(), - @JsonProperty("pay_period") - @ExcludeMissing - private val payPeriod: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val companyDebit: JsonField, + private val debitDate: JsonField, + private val employeeTaxes: JsonField, + private val employerTaxes: JsonField, + private val grossPay: JsonField, + private val individualIds: JsonField>, + private val netPay: JsonField, + private val payDate: JsonField, + private val payFrequencies: JsonField>, + private val payGroupIds: JsonField>, + private val payPeriod: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("company_debit") + @ExcludeMissing + companyDebit: JsonField = JsonMissing.of(), + @JsonProperty("debit_date") @ExcludeMissing debitDate: JsonField = JsonMissing.of(), + @JsonProperty("employee_taxes") + @ExcludeMissing + employeeTaxes: JsonField = JsonMissing.of(), + @JsonProperty("employer_taxes") + @ExcludeMissing + employerTaxes: JsonField = JsonMissing.of(), + @JsonProperty("gross_pay") @ExcludeMissing grossPay: JsonField = JsonMissing.of(), + @JsonProperty("individual_ids") + @ExcludeMissing + individualIds: JsonField> = JsonMissing.of(), + @JsonProperty("net_pay") @ExcludeMissing netPay: JsonField = JsonMissing.of(), + @JsonProperty("pay_date") @ExcludeMissing payDate: JsonField = JsonMissing.of(), + @JsonProperty("pay_frequencies") + @ExcludeMissing + payFrequencies: JsonField> = JsonMissing.of(), + @JsonProperty("pay_group_ids") + @ExcludeMissing + payGroupIds: JsonField> = JsonMissing.of(), + @JsonProperty("pay_period") + @ExcludeMissing + payPeriod: JsonField = JsonMissing.of(), + ) : this( + id, + companyDebit, + debitDate, + employeeTaxes, + employerTaxes, + grossPay, + individualIds, + netPay, + payDate, + payFrequencies, + payGroupIds, + payPeriod, + mutableMapOf(), + ) + /** * The unique id for the payment. * @@ -245,31 +264,15 @@ private constructor( */ @JsonProperty("pay_period") @ExcludeMissing fun _payPeriod(): JsonField = payPeriod + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Payment = apply { - if (validated) { - return@apply - } - - id() - companyDebit().ifPresent { it.validate() } - debitDate() - employeeTaxes().ifPresent { it.validate() } - employerTaxes().ifPresent { it.validate() } - grossPay().ifPresent { it.validate() } - individualIds() - netPay().ifPresent { it.validate() } - payDate() - payFrequencies() - payGroupIds() - payPeriod().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -571,10 +574,32 @@ private constructor( (payFrequencies ?: JsonMissing.of()).map { it.toImmutable() }, (payGroupIds ?: JsonMissing.of()).map { it.toImmutable() }, payPeriod, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Payment = apply { + if (validated) { + return@apply + } + + id() + companyDebit().ifPresent { it.validate() } + debitDate() + employeeTaxes().ifPresent { it.validate() } + employerTaxes().ifPresent { it.validate() } + grossPay().ifPresent { it.validate() } + individualIds() + netPay().ifPresent { it.validate() } + payDate() + payFrequencies() + payGroupIds() + payPeriod().ifPresent { it.validate() } + validated = true + } + class PayFrequency @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -718,20 +743,21 @@ private constructor( } /** The pay period object. */ - @NoAutoDetect class PayPeriod - @JsonCreator private constructor( - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val endDate: JsonField, + private val startDate: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + startDate: JsonField = JsonMissing.of(), + ) : this(endDate, startDate, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -758,21 +784,15 @@ private constructor( */ @JsonProperty("start_date") @ExcludeMissing fun _startDate(): JsonField = startDate + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PayPeriod = apply { - if (validated) { - return@apply - } - - endDate() - startDate() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -849,7 +869,19 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PayPeriod = - PayPeriod(endDate, startDate, additionalProperties.toImmutable()) + PayPeriod(endDate, startDate, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): PayPeriod = apply { + if (validated) { + return@apply + } + + endDate() + startDate() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt index 702ae468..86e5cffc 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt @@ -10,26 +10,24 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects -@NoAutoDetect class PaymentCreateResponse -@JsonCreator private constructor( - @JsonProperty("pay_date") - @ExcludeMissing - private val payDate: JsonField = JsonMissing.of(), - @JsonProperty("payment_id") - @ExcludeMissing - private val paymentId: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val payDate: JsonField, + private val paymentId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("pay_date") @ExcludeMissing payDate: JsonField = JsonMissing.of(), + @JsonProperty("payment_id") @ExcludeMissing paymentId: JsonField = JsonMissing.of(), + ) : this(payDate, paymentId, mutableMapOf()) + /** * The date of the payment. * @@ -60,21 +58,15 @@ private constructor( */ @JsonProperty("payment_id") @ExcludeMissing fun _paymentId(): JsonField = paymentId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PaymentCreateResponse = apply { - if (validated) { - return@apply - } - - payDate() - paymentId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -165,10 +157,22 @@ private constructor( PaymentCreateResponse( checkRequired("payDate", payDate), checkRequired("paymentId", paymentId), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): PaymentCreateResponse = apply { + if (validated) { + return@apply + } + + payDate() + paymentId() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt index 36e7b100..5c1774dc 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt @@ -11,36 +11,44 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional -@NoAutoDetect class PaymentEvent -@JsonCreator private constructor( - @JsonProperty("account_id") - @ExcludeMissing - private val accountId: JsonField = JsonMissing.of(), - @JsonProperty("company_id") - @ExcludeMissing - private val companyId: JsonField = JsonMissing.of(), - @JsonProperty("connection_id") - @ExcludeMissing - private val connectionId: JsonField = JsonMissing.of(), - @JsonProperty("data") - @ExcludeMissing - private val data: JsonField = JsonMissing.of(), - @JsonProperty("event_type") - @ExcludeMissing - private val eventType: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val accountId: JsonField, + private val companyId: JsonField, + private val connectionId: JsonField, + private val data: JsonField, + private val eventType: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("account_id") @ExcludeMissing accountId: JsonField = JsonMissing.of(), + @JsonProperty("company_id") @ExcludeMissing companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + connectionId: JsonField = JsonMissing.of(), + @JsonProperty("data") + @ExcludeMissing + data: JsonField = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + eventType: JsonField = JsonMissing.of(), + ) : this(accountId, companyId, connectionId, data, eventType, mutableMapOf()) + + fun toBaseWebhookEvent(): BaseWebhookEvent = + BaseWebhookEvent.builder() + .accountId(accountId) + .companyId(companyId) + .connectionId(connectionId) + .build() + /** * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. @@ -123,31 +131,15 @@ private constructor( */ @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBaseWebhookEvent(): BaseWebhookEvent = - BaseWebhookEvent.builder() - .accountId(accountId) - .companyId(companyId) - .connectionId(connectionId) - .build() - - private var validated: Boolean = false - - fun validate(): PaymentEvent = apply { - if (validated) { - return@apply - } - - accountId() - companyId() - connectionId() - data().ifPresent { it.validate() } - eventType() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -294,24 +286,40 @@ private constructor( connectionId, data, eventType, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): PaymentEvent = apply { + if (validated) { + return@apply + } + + accountId() + companyId() + connectionId() + data().ifPresent { it.validate() } + eventType() + validated = true + } + class PaymentIdentifiers - @JsonCreator private constructor( - @JsonProperty("pay_date") - @ExcludeMissing - private val payDate: JsonField = JsonMissing.of(), - @JsonProperty("payment_id") - @ExcludeMissing - private val paymentId: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val payDate: JsonField, + private val paymentId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("pay_date") @ExcludeMissing payDate: JsonField = JsonMissing.of(), + @JsonProperty("payment_id") + @ExcludeMissing + paymentId: JsonField = JsonMissing.of(), + ) : this(payDate, paymentId, mutableMapOf()) + /** * The date of the payment. * @@ -342,21 +350,15 @@ private constructor( */ @JsonProperty("payment_id") @ExcludeMissing fun _paymentId(): JsonField = paymentId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PaymentIdentifiers = apply { - if (validated) { - return@apply - } - - payDate() - paymentId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -448,10 +450,22 @@ private constructor( PaymentIdentifiers( checkRequired("payDate", payDate), checkRequired("paymentId", paymentId), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): PaymentIdentifiers = apply { + if (validated) { + return@apply + } + + payDate() + paymentId() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt index 3be90ee3..f31582e4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.payroll.PayGroupService +import java.util.Collections import java.util.Objects import java.util.Optional import java.util.stream.Stream @@ -69,24 +67,30 @@ private constructor( ) = PayrollPayGroupListPage(payGroupsService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("items") - private val items: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + 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.getNullable("items") ?: 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 = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -146,7 +150,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(items, additionalProperties.toImmutable()) + fun build(): Response = Response(items, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt index f9ea26b2..9ab3a4f1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.payroll.PayGroupServiceAsync +import java.util.Collections import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture @@ -71,24 +69,30 @@ private constructor( ) = PayrollPayGroupListPageAsync(payGroupsService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("items") - private val items: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + 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.getNullable("items") ?: 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 = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -149,7 +153,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(items, additionalProperties.toImmutable()) + fun build(): Response = Response(items, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt index f5bc60ed..327b9204 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -28,17 +27,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - individualId?.let { put("individual_id", it) } - payFrequencies?.forEach { put("pay_frequencies[]", it) } - putAll(additionalQueryParams) - } - .build() - fun toBuilder() = Builder().from(this) companion object { @@ -52,7 +40,6 @@ private constructor( } /** A builder for [PayrollPayGroupListParams]. */ - @NoAutoDetect class Builder internal constructor() { private var individualId: String? = null @@ -202,6 +189,17 @@ private constructor( ) } + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + individualId?.let { put("individual_id", it) } + payFrequencies?.forEach { put("pay_frequencies[]", it) } + putAll(additionalQueryParams) + } + .build() + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParams.kt index 32c9e3bd..129a9287 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupRetrieveParams.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers @@ -23,16 +22,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _pathParam(index: Int): String = - when (index) { - 0 -> payGroupId - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - fun toBuilder() = Builder().from(this) companion object { @@ -50,7 +39,6 @@ private constructor( } /** A builder for [PayrollPayGroupRetrieveParams]. */ - @NoAutoDetect class Builder internal constructor() { private var payGroupId: String? = null @@ -184,6 +172,16 @@ private constructor( ) } + fun _pathParam(index: Int): String = + when (index) { + 0 -> payGroupId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt index 0e3247b6..2b9a68b5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt @@ -11,45 +11,66 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap 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 -@NoAutoDetect class Provider -@JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("authentication_methods") - @ExcludeMissing - private val authenticationMethods: JsonField> = JsonMissing.of(), - @JsonProperty("beta") @ExcludeMissing private val beta: JsonField = JsonMissing.of(), - @JsonProperty("display_name") - @ExcludeMissing - private val displayName: JsonField = JsonMissing.of(), - @JsonProperty("icon") @ExcludeMissing private val icon: JsonField = JsonMissing.of(), - @JsonProperty("logo") @ExcludeMissing private val logo: JsonField = JsonMissing.of(), - @JsonProperty("manual") - @ExcludeMissing - private val manual: JsonField = JsonMissing.of(), - @JsonProperty("mfa_required") - @ExcludeMissing - private val mfaRequired: JsonField = JsonMissing.of(), - @JsonProperty("primary_color") - @ExcludeMissing - private val primaryColor: JsonField = JsonMissing.of(), - @JsonProperty("products") - @ExcludeMissing - private val products: JsonField> = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val authenticationMethods: JsonField>, + private val beta: JsonField, + private val displayName: JsonField, + private val icon: JsonField, + private val logo: JsonField, + private val manual: JsonField, + private val mfaRequired: JsonField, + private val primaryColor: JsonField, + private val products: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("authentication_methods") + @ExcludeMissing + authenticationMethods: JsonField> = JsonMissing.of(), + @JsonProperty("beta") @ExcludeMissing beta: JsonField = JsonMissing.of(), + @JsonProperty("display_name") + @ExcludeMissing + displayName: JsonField = JsonMissing.of(), + @JsonProperty("icon") @ExcludeMissing icon: JsonField = JsonMissing.of(), + @JsonProperty("logo") @ExcludeMissing logo: JsonField = JsonMissing.of(), + @JsonProperty("manual") @ExcludeMissing manual: JsonField = JsonMissing.of(), + @JsonProperty("mfa_required") + @ExcludeMissing + mfaRequired: JsonField = JsonMissing.of(), + @JsonProperty("primary_color") + @ExcludeMissing + primaryColor: JsonField = JsonMissing.of(), + @JsonProperty("products") + @ExcludeMissing + products: JsonField> = JsonMissing.of(), + ) : this( + id, + authenticationMethods, + beta, + displayName, + icon, + logo, + manual, + mfaRequired, + primaryColor, + products, + mutableMapOf(), + ) + /** * The id of the payroll provider used in Connect. * @@ -215,29 +236,15 @@ private constructor( */ @JsonProperty("products") @ExcludeMissing fun _products(): JsonField> = products + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Provider = apply { - if (validated) { - return@apply - } - - id() - authenticationMethods().ifPresent { it.forEach { it.validate() } } - beta() - displayName() - icon() - logo() - manual() - mfaRequired() - primaryColor() - products() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -464,25 +471,49 @@ private constructor( mfaRequired, primaryColor, (products ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): Provider = apply { + if (validated) { + return@apply + } + + id() + authenticationMethods().ifPresent { it.forEach { it.validate() } } + beta() + displayName() + icon() + logo() + manual() + mfaRequired() + primaryColor() + products() + validated = true + } + class AuthenticationMethod - @JsonCreator private constructor( - @JsonProperty("benefits_support") - @ExcludeMissing - private val benefitsSupport: JsonField = JsonMissing.of(), - @JsonProperty("supported_fields") - @ExcludeMissing - private val supportedFields: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val benefitsSupport: JsonField, + private val supportedFields: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("benefits_support") + @ExcludeMissing + benefitsSupport: JsonField = JsonMissing.of(), + @JsonProperty("supported_fields") + @ExcludeMissing + supportedFields: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(benefitsSupport, supportedFields, type, mutableMapOf()) + /** * Each benefit type and their supported features. If the benefit type is not supported, the * property will be null @@ -537,22 +568,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): AuthenticationMethod = apply { - if (validated) { - return@apply - } - - benefitsSupport().ifPresent { it.validate() } - supportedFields().ifPresent { it.validate() } - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -660,40 +684,70 @@ private constructor( benefitsSupport, supportedFields, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): AuthenticationMethod = apply { + if (validated) { + return@apply + } + + benefitsSupport().ifPresent { it.validate() } + supportedFields().ifPresent { it.validate() } + type() + validated = true + } + /** The supported data fields returned by our HR and payroll endpoints */ - @NoAutoDetect class SupportedFields - @JsonCreator private constructor( - @JsonProperty("company") - @ExcludeMissing - private val company: JsonField = JsonMissing.of(), - @JsonProperty("directory") - @ExcludeMissing - private val directory: JsonField = JsonMissing.of(), - @JsonProperty("employment") - @ExcludeMissing - private val employment: JsonField = JsonMissing.of(), - @JsonProperty("individual") - @ExcludeMissing - private val individual: JsonField = JsonMissing.of(), - @JsonProperty("pay_group") - @ExcludeMissing - private val payGroup: JsonField = JsonMissing.of(), - @JsonProperty("pay_statement") - @ExcludeMissing - private val payStatement: JsonField = JsonMissing.of(), - @JsonProperty("payment") - @ExcludeMissing - private val payment: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val company: JsonField, + private val directory: JsonField, + private val employment: JsonField, + private val individual: JsonField, + private val payGroup: JsonField, + private val payStatement: JsonField, + private val payment: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("company") + @ExcludeMissing + company: JsonField = JsonMissing.of(), + @JsonProperty("directory") + @ExcludeMissing + directory: JsonField = JsonMissing.of(), + @JsonProperty("employment") + @ExcludeMissing + employment: JsonField = JsonMissing.of(), + @JsonProperty("individual") + @ExcludeMissing + individual: JsonField = JsonMissing.of(), + @JsonProperty("pay_group") + @ExcludeMissing + payGroup: JsonField = JsonMissing.of(), + @JsonProperty("pay_statement") + @ExcludeMissing + payStatement: JsonField = JsonMissing.of(), + @JsonProperty("payment") + @ExcludeMissing + payment: JsonField = JsonMissing.of(), + ) : this( + company, + directory, + employment, + individual, + payGroup, + payStatement, + payment, + mutableMapOf(), + ) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -811,26 +865,15 @@ private constructor( @ExcludeMissing fun _payment(): JsonField = payment + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SupportedFields = apply { - if (validated) { - return@apply - } - - company().ifPresent { it.validate() } - directory().ifPresent { it.validate() } - employment().ifPresent { it.validate() } - individual().ifPresent { it.validate() } - payGroup().ifPresent { it.validate() } - payStatement().ifPresent { it.validate() } - payment().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -995,45 +1038,79 @@ private constructor( payGroup, payStatement, payment, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): SupportedFields = apply { + if (validated) { + return@apply + } + + company().ifPresent { it.validate() } + directory().ifPresent { it.validate() } + employment().ifPresent { it.validate() } + individual().ifPresent { it.validate() } + payGroup().ifPresent { it.validate() } + payStatement().ifPresent { it.validate() } + payment().ifPresent { it.validate() } + validated = true + } + class SupportedCompanyFields - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("accounts") - @ExcludeMissing - private val accounts: JsonField = JsonMissing.of(), - @JsonProperty("departments") - @ExcludeMissing - private val departments: JsonField = JsonMissing.of(), - @JsonProperty("ein") - @ExcludeMissing - private val ein: JsonField = JsonMissing.of(), - @JsonProperty("entity") - @ExcludeMissing - private val entity: JsonField = JsonMissing.of(), - @JsonProperty("legal_name") - @ExcludeMissing - private val legalName: JsonField = JsonMissing.of(), - @JsonProperty("locations") - @ExcludeMissing - private val locations: JsonField = JsonMissing.of(), - @JsonProperty("primary_email") - @ExcludeMissing - private val primaryEmail: JsonField = JsonMissing.of(), - @JsonProperty("primary_phone_number") - @ExcludeMissing - private val primaryPhoneNumber: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val accounts: JsonField, + private val departments: JsonField, + private val ein: JsonField, + private val entity: JsonField, + private val legalName: JsonField, + private val locations: JsonField, + private val primaryEmail: JsonField, + private val primaryPhoneNumber: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("accounts") + @ExcludeMissing + accounts: JsonField = JsonMissing.of(), + @JsonProperty("departments") + @ExcludeMissing + departments: JsonField = JsonMissing.of(), + @JsonProperty("ein") @ExcludeMissing ein: JsonField = JsonMissing.of(), + @JsonProperty("entity") + @ExcludeMissing + entity: JsonField = JsonMissing.of(), + @JsonProperty("legal_name") + @ExcludeMissing + legalName: JsonField = JsonMissing.of(), + @JsonProperty("locations") + @ExcludeMissing + locations: JsonField = JsonMissing.of(), + @JsonProperty("primary_email") + @ExcludeMissing + primaryEmail: JsonField = JsonMissing.of(), + @JsonProperty("primary_phone_number") + @ExcludeMissing + primaryPhoneNumber: JsonField = JsonMissing.of(), + ) : this( + id, + accounts, + departments, + ein, + entity, + legalName, + locations, + primaryEmail, + primaryPhoneNumber, + mutableMapOf(), + ) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -1176,28 +1253,15 @@ private constructor( @ExcludeMissing fun _primaryPhoneNumber(): JsonField = primaryPhoneNumber + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SupportedCompanyFields = apply { - if (validated) { - return@apply - } - - id() - accounts().ifPresent { it.validate() } - departments().ifPresent { it.validate() } - ein() - entity().ifPresent { it.validate() } - legalName() - locations().ifPresent { it.validate() } - primaryEmail() - primaryPhoneNumber() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1389,44 +1453,76 @@ private constructor( locations, primaryEmail, primaryPhoneNumber, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): SupportedCompanyFields = apply { + if (validated) { + return@apply + } + + id() + accounts().ifPresent { it.validate() } + departments().ifPresent { it.validate() } + ein() + entity().ifPresent { it.validate() } + legalName() + locations().ifPresent { it.validate() } + primaryEmail() + primaryPhoneNumber() + validated = true + } + class Accounts - @JsonCreator private constructor( - @JsonProperty("account_name") - @ExcludeMissing - private val accountName: JsonField = JsonMissing.of(), - @JsonProperty("account_number") - @ExcludeMissing - private val accountNumber: JsonField = JsonMissing.of(), - @JsonProperty("account_type") - @ExcludeMissing - private val accountType: JsonField = JsonMissing.of(), - @JsonProperty("institution_name") - @ExcludeMissing - private val institutionName: JsonField = JsonMissing.of(), - @JsonProperty("routing_number") - @ExcludeMissing - private val routingNumber: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val accountName: JsonField, + private val accountNumber: JsonField, + private val accountType: JsonField, + private val institutionName: JsonField, + private val routingNumber: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("account_name") + @ExcludeMissing + accountName: JsonField = JsonMissing.of(), + @JsonProperty("account_number") + @ExcludeMissing + accountNumber: JsonField = JsonMissing.of(), + @JsonProperty("account_type") + @ExcludeMissing + accountType: JsonField = JsonMissing.of(), + @JsonProperty("institution_name") + @ExcludeMissing + institutionName: JsonField = JsonMissing.of(), + @JsonProperty("routing_number") + @ExcludeMissing + routingNumber: JsonField = JsonMissing.of(), + ) : this( + accountName, + accountNumber, + accountType, + institutionName, + routingNumber, + mutableMapOf(), + ) + + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun accountName(): Optional = + Optional.ofNullable(accountName.getNullable("account_name")) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun accountName(): Optional = - Optional.ofNullable(accountName.getNullable("account_name")) - - /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ fun accountNumber(): Optional = Optional.ofNullable(accountNumber.getNullable("account_number")) @@ -1501,24 +1597,15 @@ private constructor( @ExcludeMissing fun _routingNumber(): JsonField = routingNumber + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Accounts = apply { - if (validated) { - return@apply - } - - accountName() - accountNumber() - accountType() - institutionName() - routingNumber() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1653,10 +1740,25 @@ private constructor( accountType, institutionName, routingNumber, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Accounts = apply { + if (validated) { + return@apply + } + + accountName() + accountNumber() + accountType() + institutionName() + routingNumber() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1675,20 +1777,23 @@ private constructor( "Accounts{accountName=$accountName, accountNumber=$accountNumber, accountType=$accountType, institutionName=$institutionName, routingNumber=$routingNumber, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Departments - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("parent") - @ExcludeMissing - private val parent: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val name: JsonField, + private val parent: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + @JsonProperty("parent") + @ExcludeMissing + parent: JsonField = JsonMissing.of(), + ) : this(name, parent, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -1720,21 +1825,15 @@ private constructor( @ExcludeMissing fun _parent(): JsonField = parent + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Departments = apply { - if (validated) { - return@apply - } - - name() - parent().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1811,21 +1910,34 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Departments = - Departments(name, parent, additionalProperties.toImmutable()) + Departments(name, parent, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Departments = apply { + if (validated) { + return@apply + } + + name() + parent().ifPresent { it.validate() } + validated = true } - @NoAutoDetect class Parent - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val name: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of() + ) : this(name, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -1841,20 +1953,15 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Parent = apply { - if (validated) { - return@apply - } - - name() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1918,7 +2025,18 @@ private constructor( * Further updates to this [Builder] will not mutate the returned * instance. */ - fun build(): Parent = Parent(name, additionalProperties.toImmutable()) + fun build(): Parent = Parent(name, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Parent = apply { + if (validated) { + return@apply + } + + name() + validated = true } override fun equals(other: Any?): Boolean { @@ -1957,20 +2075,23 @@ private constructor( "Departments{name=$name, parent=$parent, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Entity - @JsonCreator private constructor( - @JsonProperty("subtype") - @ExcludeMissing - private val subtype: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val subtype: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("subtype") + @ExcludeMissing + subtype: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(subtype, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -2002,21 +2123,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Entity = apply { - if (validated) { - return@apply - } - - subtype() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2091,7 +2206,19 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Entity = - Entity(subtype, type, additionalProperties.toImmutable()) + Entity(subtype, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Entity = apply { + if (validated) { + return@apply + } + + subtype() + type() + validated = true } override fun equals(other: Any?): Boolean { @@ -2112,32 +2239,39 @@ private constructor( "Entity{subtype=$subtype, type=$type, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Locations - @JsonCreator private constructor( - @JsonProperty("city") - @ExcludeMissing - private val city: JsonField = JsonMissing.of(), - @JsonProperty("country") - @ExcludeMissing - private val country: JsonField = JsonMissing.of(), - @JsonProperty("line1") - @ExcludeMissing - private val line1: JsonField = JsonMissing.of(), - @JsonProperty("line2") - @ExcludeMissing - private val line2: JsonField = JsonMissing.of(), - @JsonProperty("postal_code") - @ExcludeMissing - private val postalCode: JsonField = JsonMissing.of(), - @JsonProperty("state") - @ExcludeMissing - private val state: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val city: JsonField, + private val country: JsonField, + private val line1: JsonField, + private val line2: JsonField, + private val postalCode: JsonField, + private val state: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("city") + @ExcludeMissing + city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + country: JsonField = JsonMissing.of(), + @JsonProperty("line1") + @ExcludeMissing + line1: JsonField = JsonMissing.of(), + @JsonProperty("line2") + @ExcludeMissing + line2: JsonField = JsonMissing.of(), + @JsonProperty("postal_code") + @ExcludeMissing + postalCode: JsonField = JsonMissing.of(), + @JsonProperty("state") + @ExcludeMissing + state: JsonField = JsonMissing.of(), + ) : this(city, country, line1, line2, postalCode, state, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -2228,25 +2362,15 @@ private constructor( */ @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Locations = apply { - if (validated) { - return@apply - } - - city() - country() - line1() - line2() - postalCode() - state() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2384,10 +2508,26 @@ private constructor( line2, postalCode, state, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Locations = apply { + if (validated) { + return@apply + } + + city() + country() + line1() + line2() + postalCode() + state() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2424,20 +2564,23 @@ private constructor( "SupportedCompanyFields{id=$id, accounts=$accounts, departments=$departments, ein=$ein, entity=$entity, legalName=$legalName, locations=$locations, primaryEmail=$primaryEmail, primaryPhoneNumber=$primaryPhoneNumber, additionalProperties=$additionalProperties}" } - @NoAutoDetect class SupportedDirectoryFields - @JsonCreator private constructor( - @JsonProperty("individuals") - @ExcludeMissing - private val individuals: JsonField = JsonMissing.of(), - @JsonProperty("paging") - @ExcludeMissing - private val paging: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val individuals: JsonField, + private val paging: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("individuals") + @ExcludeMissing + individuals: JsonField = JsonMissing.of(), + @JsonProperty("paging") + @ExcludeMissing + paging: JsonField = JsonMissing.of(), + ) : this(individuals, paging, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -2469,21 +2612,15 @@ private constructor( */ @JsonProperty("paging") @ExcludeMissing fun _paging(): JsonField = paging + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SupportedDirectoryFields = apply { - if (validated) { - return@apply - } - - individuals().ifPresent { it.validate() } - paging().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2567,39 +2704,68 @@ private constructor( SupportedDirectoryFields( individuals, paging, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): SupportedDirectoryFields = apply { + if (validated) { + return@apply + } + + individuals().ifPresent { it.validate() } + paging().ifPresent { it.validate() } + validated = true + } + class Individuals - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("department") - @ExcludeMissing - private val department: JsonField = JsonMissing.of(), - @JsonProperty("first_name") - @ExcludeMissing - private val firstName: JsonField = JsonMissing.of(), - @JsonProperty("is_active") - @ExcludeMissing - private val isActive: JsonField = JsonMissing.of(), - @JsonProperty("last_name") - @ExcludeMissing - private val lastName: JsonField = JsonMissing.of(), - @JsonProperty("manager") - @ExcludeMissing - private val manager: JsonField = JsonMissing.of(), - @JsonProperty("middle_name") - @ExcludeMissing - private val middleName: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val department: JsonField, + private val firstName: JsonField, + private val isActive: JsonField, + private val lastName: JsonField, + private val manager: JsonField, + private val middleName: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") + @ExcludeMissing + id: JsonField = JsonMissing.of(), + @JsonProperty("department") + @ExcludeMissing + department: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + firstName: JsonField = JsonMissing.of(), + @JsonProperty("is_active") + @ExcludeMissing + isActive: JsonField = JsonMissing.of(), + @JsonProperty("last_name") + @ExcludeMissing + lastName: JsonField = JsonMissing.of(), + @JsonProperty("manager") + @ExcludeMissing + manager: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + middleName: JsonField = JsonMissing.of(), + ) : this( + id, + department, + firstName, + isActive, + lastName, + manager, + middleName, + mutableMapOf(), + ) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -2716,26 +2882,15 @@ private constructor( @ExcludeMissing fun _middleName(): JsonField = middleName + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Individuals = apply { - if (validated) { - return@apply - } - - id() - department() - firstName() - isActive() - lastName() - manager().ifPresent { it.validate() } - middleName() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2895,22 +3050,40 @@ private constructor( lastName, manager, middleName, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): Individuals = apply { + if (validated) { + return@apply + } + + id() + department() + firstName() + isActive() + lastName() + manager().ifPresent { it.validate() } + middleName() + validated = true + } + class Manager - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val id: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") + @ExcludeMissing + id: JsonField = JsonMissing.of() + ) : this(id, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -2925,20 +3098,15 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Manager = apply { - if (validated) { - return@apply - } - - id() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3002,7 +3170,18 @@ private constructor( * Further updates to this [Builder] will not mutate the returned * instance. */ - fun build(): Manager = Manager(id, additionalProperties.toImmutable()) + fun build(): Manager = Manager(id, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Manager = apply { + if (validated) { + return@apply + } + + id() + validated = true } override fun equals(other: Any?): Boolean { @@ -3041,20 +3220,23 @@ private constructor( "Individuals{id=$id, department=$department, firstName=$firstName, isActive=$isActive, lastName=$lastName, manager=$manager, middleName=$middleName, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Paging - @JsonCreator private constructor( - @JsonProperty("count") - @ExcludeMissing - private val count: JsonField = JsonMissing.of(), - @JsonProperty("offset") - @ExcludeMissing - private val offset: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val count: JsonField, + private val offset: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("count") + @ExcludeMissing + count: JsonField = JsonMissing.of(), + @JsonProperty("offset") + @ExcludeMissing + offset: JsonField = JsonMissing.of(), + ) : this(count, offset, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -3086,21 +3268,15 @@ private constructor( @ExcludeMissing fun _offset(): JsonField = offset + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Paging = apply { - if (validated) { - return@apply - } - - count() - offset() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3175,7 +3351,19 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Paging = - Paging(count, offset, additionalProperties.toImmutable()) + Paging(count, offset, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Paging = apply { + if (validated) { + return@apply + } + + count() + offset() + validated = true } override fun equals(other: Any?): Boolean { @@ -3214,65 +3402,100 @@ private constructor( "SupportedDirectoryFields{individuals=$individuals, paging=$paging, additionalProperties=$additionalProperties}" } - @NoAutoDetect class SupportedEmploymentFields - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("class_code") - @ExcludeMissing - private val classCode: JsonField = JsonMissing.of(), - @JsonProperty("custom_fields") - @ExcludeMissing - private val customFields: JsonField = JsonMissing.of(), - @JsonProperty("department") - @ExcludeMissing - private val department: JsonField = JsonMissing.of(), - @JsonProperty("employment") - @ExcludeMissing - private val employment: JsonField = JsonMissing.of(), - @JsonProperty("employment_status") - @ExcludeMissing - private val employmentStatus: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("first_name") - @ExcludeMissing - private val firstName: JsonField = JsonMissing.of(), - @JsonProperty("income") - @ExcludeMissing - private val income: JsonField = JsonMissing.of(), - @JsonProperty("income_history") - @ExcludeMissing - private val incomeHistory: JsonField = JsonMissing.of(), - @JsonProperty("is_active") - @ExcludeMissing - private val isActive: JsonField = JsonMissing.of(), - @JsonProperty("last_name") - @ExcludeMissing - private val lastName: JsonField = JsonMissing.of(), - @JsonProperty("location") - @ExcludeMissing - private val location: JsonField = JsonMissing.of(), - @JsonProperty("manager") - @ExcludeMissing - private val manager: JsonField = JsonMissing.of(), - @JsonProperty("middle_name") - @ExcludeMissing - private val middleName: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("title") - @ExcludeMissing - private val title: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val classCode: JsonField, + private val customFields: JsonField, + private val department: JsonField, + private val employment: JsonField, + private val employmentStatus: JsonField, + private val endDate: JsonField, + private val firstName: JsonField, + private val income: JsonField, + private val incomeHistory: JsonField, + private val isActive: JsonField, + private val lastName: JsonField, + private val location: JsonField, + private val manager: JsonField, + private val middleName: JsonField, + private val startDate: JsonField, + private val title: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("class_code") + @ExcludeMissing + classCode: JsonField = JsonMissing.of(), + @JsonProperty("custom_fields") + @ExcludeMissing + customFields: JsonField = JsonMissing.of(), + @JsonProperty("department") + @ExcludeMissing + department: JsonField = JsonMissing.of(), + @JsonProperty("employment") + @ExcludeMissing + employment: JsonField = JsonMissing.of(), + @JsonProperty("employment_status") + @ExcludeMissing + employmentStatus: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + endDate: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + firstName: JsonField = JsonMissing.of(), + @JsonProperty("income") + @ExcludeMissing + income: JsonField = JsonMissing.of(), + @JsonProperty("income_history") + @ExcludeMissing + incomeHistory: JsonField = JsonMissing.of(), + @JsonProperty("is_active") + @ExcludeMissing + isActive: JsonField = JsonMissing.of(), + @JsonProperty("last_name") + @ExcludeMissing + lastName: JsonField = JsonMissing.of(), + @JsonProperty("location") + @ExcludeMissing + location: JsonField = JsonMissing.of(), + @JsonProperty("manager") + @ExcludeMissing + manager: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + middleName: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + startDate: JsonField = JsonMissing.of(), + @JsonProperty("title") + @ExcludeMissing + title: JsonField = JsonMissing.of(), + ) : this( + id, + classCode, + customFields, + department, + employment, + employmentStatus, + endDate, + firstName, + income, + incomeHistory, + isActive, + lastName, + location, + manager, + middleName, + startDate, + title, + mutableMapOf(), + ) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -3552,36 +3775,15 @@ private constructor( */ @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SupportedEmploymentFields = apply { - if (validated) { - return@apply - } - - id() - classCode() - customFields() - department().ifPresent { it.validate() } - employment().ifPresent { it.validate() } - employmentStatus() - endDate() - firstName() - income().ifPresent { it.validate() } - incomeHistory() - isActive() - lastName() - location().ifPresent { it.validate() } - manager().ifPresent { it.validate() } - middleName() - startDate() - title() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3894,21 +4096,50 @@ private constructor( middleName, startDate, title, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): SupportedEmploymentFields = apply { + if (validated) { + return@apply + } + + id() + classCode() + customFields() + department().ifPresent { it.validate() } + employment().ifPresent { it.validate() } + employmentStatus() + endDate() + firstName() + income().ifPresent { it.validate() } + incomeHistory() + isActive() + lastName() + location().ifPresent { it.validate() } + manager().ifPresent { it.validate() } + middleName() + startDate() + title() + validated = true + } + class Department - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val name: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of() + ) : this(name, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -3923,20 +4154,15 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Department = apply { - if (validated) { - return@apply - } - - name() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -4000,7 +4226,18 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Department = - Department(name, additionalProperties.toImmutable()) + Department(name, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Department = apply { + if (validated) { + return@apply + } + + name() + validated = true } override fun equals(other: Any?): Boolean { @@ -4021,20 +4258,23 @@ private constructor( "Department{name=$name, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Employment - @JsonCreator private constructor( - @JsonProperty("subtype") - @ExcludeMissing - private val subtype: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val subtype: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("subtype") + @ExcludeMissing + subtype: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(subtype, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -4066,21 +4306,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Employment = apply { - if (validated) { - return@apply - } - - subtype() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -4157,7 +4391,19 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Employment = - Employment(subtype, type, additionalProperties.toImmutable()) + Employment(subtype, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Employment = apply { + if (validated) { + return@apply + } + + subtype() + type() + validated = true } override fun equals(other: Any?): Boolean { @@ -4178,23 +4424,27 @@ private constructor( "Employment{subtype=$subtype, type=$type, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Income - @JsonCreator private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("unit") - @ExcludeMissing - private val unit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val amount: JsonField, + private val currency: JsonField, + private val unit: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("unit") + @ExcludeMissing + unit: JsonField = JsonMissing.of(), + ) : this(amount, currency, unit, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -4243,22 +4493,15 @@ private constructor( */ @JsonProperty("unit") @ExcludeMissing fun _unit(): JsonField = unit + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Income = apply { - if (validated) { - return@apply - } - - amount() - currency() - unit() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -4348,7 +4591,20 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Income = - Income(amount, currency, unit, additionalProperties.toImmutable()) + Income(amount, currency, unit, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Income = apply { + if (validated) { + return@apply + } + + amount() + currency() + unit() + validated = true } override fun equals(other: Any?): Boolean { @@ -4369,32 +4625,39 @@ private constructor( "Income{amount=$amount, currency=$currency, unit=$unit, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Location - @JsonCreator private constructor( - @JsonProperty("city") - @ExcludeMissing - private val city: JsonField = JsonMissing.of(), - @JsonProperty("country") - @ExcludeMissing - private val country: JsonField = JsonMissing.of(), - @JsonProperty("line1") - @ExcludeMissing - private val line1: JsonField = JsonMissing.of(), - @JsonProperty("line2") - @ExcludeMissing - private val line2: JsonField = JsonMissing.of(), - @JsonProperty("postal_code") - @ExcludeMissing - private val postalCode: JsonField = JsonMissing.of(), - @JsonProperty("state") - @ExcludeMissing - private val state: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val city: JsonField, + private val country: JsonField, + private val line1: JsonField, + private val line2: JsonField, + private val postalCode: JsonField, + private val state: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("city") + @ExcludeMissing + city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + country: JsonField = JsonMissing.of(), + @JsonProperty("line1") + @ExcludeMissing + line1: JsonField = JsonMissing.of(), + @JsonProperty("line2") + @ExcludeMissing + line2: JsonField = JsonMissing.of(), + @JsonProperty("postal_code") + @ExcludeMissing + postalCode: JsonField = JsonMissing.of(), + @JsonProperty("state") + @ExcludeMissing + state: JsonField = JsonMissing.of(), + ) : this(city, country, line1, line2, postalCode, state, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -4485,25 +4748,15 @@ private constructor( */ @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Location = apply { - if (validated) { - return@apply - } - - city() - country() - line1() - line2() - postalCode() - state() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -4639,10 +4892,26 @@ private constructor( line2, postalCode, state, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Location = apply { + if (validated) { + return@apply + } + + city() + country() + line1() + line2() + postalCode() + state() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4661,17 +4930,19 @@ private constructor( "Location{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Manager - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") + @ExcludeMissing + id: JsonField = JsonMissing.of() + ) : this(id, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -4686,20 +4957,15 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Manager = apply { - if (validated) { - return@apply - } - - id() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -4760,7 +5026,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Manager = Manager(id, additionalProperties.toImmutable()) + fun build(): Manager = Manager(id, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Manager = apply { + if (validated) { + return@apply + } + + id() + validated = true } override fun equals(other: Any?): Boolean { @@ -4799,53 +5076,76 @@ private constructor( "SupportedEmploymentFields{id=$id, classCode=$classCode, customFields=$customFields, department=$department, employment=$employment, employmentStatus=$employmentStatus, endDate=$endDate, firstName=$firstName, income=$income, incomeHistory=$incomeHistory, isActive=$isActive, lastName=$lastName, location=$location, manager=$manager, middleName=$middleName, startDate=$startDate, title=$title, additionalProperties=$additionalProperties}" } - @NoAutoDetect class SupportedIndividualFields - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("dob") - @ExcludeMissing - private val dob: JsonField = JsonMissing.of(), - @JsonProperty("emails") - @ExcludeMissing - private val emails: JsonField = JsonMissing.of(), - @JsonProperty("encrypted_ssn") - @ExcludeMissing - private val encryptedSsn: JsonField = JsonMissing.of(), - @JsonProperty("ethnicity") - @ExcludeMissing - private val ethnicity: JsonField = JsonMissing.of(), - @JsonProperty("first_name") - @ExcludeMissing - private val firstName: JsonField = JsonMissing.of(), - @JsonProperty("gender") - @ExcludeMissing - private val gender: JsonField = JsonMissing.of(), - @JsonProperty("last_name") - @ExcludeMissing - private val lastName: JsonField = JsonMissing.of(), - @JsonProperty("middle_name") - @ExcludeMissing - private val middleName: JsonField = JsonMissing.of(), - @JsonProperty("phone_numbers") - @ExcludeMissing - private val phoneNumbers: JsonField = JsonMissing.of(), - @JsonProperty("preferred_name") - @ExcludeMissing - private val preferredName: JsonField = JsonMissing.of(), - @JsonProperty("residence") - @ExcludeMissing - private val residence: JsonField = JsonMissing.of(), - @JsonProperty("ssn") - @ExcludeMissing - private val ssn: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val dob: JsonField, + private val emails: JsonField, + private val encryptedSsn: JsonField, + private val ethnicity: JsonField, + private val firstName: JsonField, + private val gender: JsonField, + private val lastName: JsonField, + private val middleName: JsonField, + private val phoneNumbers: JsonField, + private val preferredName: JsonField, + private val residence: JsonField, + private val ssn: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dob") @ExcludeMissing dob: JsonField = JsonMissing.of(), + @JsonProperty("emails") + @ExcludeMissing + emails: JsonField = JsonMissing.of(), + @JsonProperty("encrypted_ssn") + @ExcludeMissing + encryptedSsn: JsonField = JsonMissing.of(), + @JsonProperty("ethnicity") + @ExcludeMissing + ethnicity: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + firstName: JsonField = JsonMissing.of(), + @JsonProperty("gender") + @ExcludeMissing + gender: JsonField = JsonMissing.of(), + @JsonProperty("last_name") + @ExcludeMissing + lastName: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + middleName: JsonField = JsonMissing.of(), + @JsonProperty("phone_numbers") + @ExcludeMissing + phoneNumbers: JsonField = JsonMissing.of(), + @JsonProperty("preferred_name") + @ExcludeMissing + preferredName: JsonField = JsonMissing.of(), + @JsonProperty("residence") + @ExcludeMissing + residence: JsonField = JsonMissing.of(), + @JsonProperty("ssn") @ExcludeMissing ssn: JsonField = JsonMissing.of(), + ) : this( + id, + dob, + emails, + encryptedSsn, + ethnicity, + firstName, + gender, + lastName, + middleName, + phoneNumbers, + preferredName, + residence, + ssn, + mutableMapOf(), + ) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -5049,32 +5349,15 @@ private constructor( */ @JsonProperty("ssn") @ExcludeMissing fun _ssn(): JsonField = ssn + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SupportedIndividualFields = apply { - if (validated) { - return@apply - } - - id() - dob() - emails().ifPresent { it.validate() } - encryptedSsn() - ethnicity() - firstName() - gender() - lastName() - middleName() - phoneNumbers().ifPresent { it.validate() } - preferredName() - residence().ifPresent { it.validate() } - ssn() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -5327,24 +5610,50 @@ private constructor( preferredName, residence, ssn, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): SupportedIndividualFields = apply { + if (validated) { + return@apply + } + + id() + dob() + emails().ifPresent { it.validate() } + encryptedSsn() + ethnicity() + firstName() + gender() + lastName() + middleName() + phoneNumbers().ifPresent { it.validate() } + preferredName() + residence().ifPresent { it.validate() } + ssn() + validated = true + } + class Emails - @JsonCreator private constructor( - @JsonProperty("data") - @ExcludeMissing - private val data: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val data: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("data") + @ExcludeMissing + data: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(data, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -5373,21 +5682,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Emails = apply { - if (validated) { - return@apply - } - - data() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -5461,7 +5764,20 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Emails = Emails(data, type, additionalProperties.toImmutable()) + fun build(): Emails = + Emails(data, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Emails = apply { + if (validated) { + return@apply + } + + data() + type() + validated = true } override fun equals(other: Any?): Boolean { @@ -5482,20 +5798,23 @@ private constructor( "Emails{data=$data, type=$type, additionalProperties=$additionalProperties}" } - @NoAutoDetect class PhoneNumbers - @JsonCreator private constructor( - @JsonProperty("data") - @ExcludeMissing - private val data: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val data: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("data") + @ExcludeMissing + data: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(data, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -5524,21 +5843,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PhoneNumbers = apply { - if (validated) { - return@apply - } - - data() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -5615,7 +5928,19 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PhoneNumbers = - PhoneNumbers(data, type, additionalProperties.toImmutable()) + PhoneNumbers(data, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): PhoneNumbers = apply { + if (validated) { + return@apply + } + + data() + type() + validated = true } override fun equals(other: Any?): Boolean { @@ -5636,32 +5961,39 @@ private constructor( "PhoneNumbers{data=$data, type=$type, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Residence - @JsonCreator private constructor( - @JsonProperty("city") - @ExcludeMissing - private val city: JsonField = JsonMissing.of(), - @JsonProperty("country") - @ExcludeMissing - private val country: JsonField = JsonMissing.of(), - @JsonProperty("line1") - @ExcludeMissing - private val line1: JsonField = JsonMissing.of(), - @JsonProperty("line2") - @ExcludeMissing - private val line2: JsonField = JsonMissing.of(), - @JsonProperty("postal_code") - @ExcludeMissing - private val postalCode: JsonField = JsonMissing.of(), - @JsonProperty("state") - @ExcludeMissing - private val state: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val city: JsonField, + private val country: JsonField, + private val line1: JsonField, + private val line2: JsonField, + private val postalCode: JsonField, + private val state: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("city") + @ExcludeMissing + city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + country: JsonField = JsonMissing.of(), + @JsonProperty("line1") + @ExcludeMissing + line1: JsonField = JsonMissing.of(), + @JsonProperty("line2") + @ExcludeMissing + line2: JsonField = JsonMissing.of(), + @JsonProperty("postal_code") + @ExcludeMissing + postalCode: JsonField = JsonMissing.of(), + @JsonProperty("state") + @ExcludeMissing + state: JsonField = JsonMissing.of(), + ) : this(city, country, line1, line2, postalCode, state, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -5752,25 +6084,15 @@ private constructor( */ @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Residence = apply { - if (validated) { - return@apply - } - - city() - country() - line1() - line2() - postalCode() - state() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -5908,10 +6230,26 @@ private constructor( line2, postalCode, state, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Residence = apply { + if (validated) { + return@apply + } + + city() + country() + line1() + line2() + postalCode() + state() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5948,26 +6286,29 @@ private constructor( "SupportedIndividualFields{id=$id, dob=$dob, emails=$emails, encryptedSsn=$encryptedSsn, ethnicity=$ethnicity, firstName=$firstName, gender=$gender, lastName=$lastName, middleName=$middleName, phoneNumbers=$phoneNumbers, preferredName=$preferredName, residence=$residence, ssn=$ssn, additionalProperties=$additionalProperties}" } - @NoAutoDetect class SupportedPayGroupFields - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("individual_ids") - @ExcludeMissing - private val individualIds: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("pay_frequencies") - @ExcludeMissing - private val payFrequencies: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val individualIds: JsonField, + private val name: JsonField, + private val payFrequencies: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("individual_ids") + @ExcludeMissing + individualIds: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + @JsonProperty("pay_frequencies") + @ExcludeMissing + payFrequencies: JsonField = JsonMissing.of(), + ) : this(id, individualIds, name, payFrequencies, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -6029,23 +6370,15 @@ private constructor( @ExcludeMissing fun _payFrequencies(): JsonField = payFrequencies + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SupportedPayGroupFields = apply { - if (validated) { - return@apply - } - - id() - individualIds() - name() - payFrequencies() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -6160,10 +6493,24 @@ private constructor( individualIds, name, payFrequencies, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): SupportedPayGroupFields = apply { + if (validated) { + return@apply + } + + id() + individualIds() + name() + payFrequencies() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6182,20 +6529,23 @@ private constructor( "SupportedPayGroupFields{id=$id, individualIds=$individualIds, name=$name, payFrequencies=$payFrequencies, additionalProperties=$additionalProperties}" } - @NoAutoDetect class SupportedPayStatementFields - @JsonCreator private constructor( - @JsonProperty("paging") - @ExcludeMissing - private val paging: JsonField = JsonMissing.of(), - @JsonProperty("pay_statements") - @ExcludeMissing - private val payStatements: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val paging: JsonField, + private val payStatements: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("paging") + @ExcludeMissing + paging: JsonField = JsonMissing.of(), + @JsonProperty("pay_statements") + @ExcludeMissing + payStatements: JsonField = JsonMissing.of(), + ) : this(paging, payStatements, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -6227,21 +6577,15 @@ private constructor( @ExcludeMissing fun _payStatements(): JsonField = payStatements + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SupportedPayStatementFields = apply { - if (validated) { - return@apply - } - - paging().ifPresent { it.validate() } - payStatements().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -6326,24 +6670,39 @@ private constructor( SupportedPayStatementFields( paging, payStatements, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): SupportedPayStatementFields = apply { + if (validated) { + return@apply + } + + paging().ifPresent { it.validate() } + payStatements().ifPresent { it.validate() } + validated = true + } + class Paging - @JsonCreator private constructor( - @JsonProperty("count") - @ExcludeMissing - private val count: JsonField = JsonMissing.of(), - @JsonProperty("offset") - @ExcludeMissing - private val offset: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val count: JsonField, + private val offset: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("count") + @ExcludeMissing + count: JsonField = JsonMissing.of(), + @JsonProperty("offset") + @ExcludeMissing + offset: JsonField = JsonMissing.of(), + ) : this(count, offset, 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 @@ -6376,21 +6735,15 @@ private constructor( @ExcludeMissing fun _offset(): JsonField = offset + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Paging = apply { - if (validated) { - return@apply - } - - count() - offset() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -6484,10 +6837,22 @@ private constructor( Paging( checkRequired("count", count), checkRequired("offset", offset), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Paging = apply { + if (validated) { + return@apply + } + + count() + offset() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6506,46 +6871,67 @@ private constructor( "Paging{count=$count, offset=$offset, additionalProperties=$additionalProperties}" } - @NoAutoDetect class PayStatements - @JsonCreator private constructor( - @JsonProperty("earnings") - @ExcludeMissing - private val earnings: JsonField = JsonMissing.of(), - @JsonProperty("employee_deductions") - @ExcludeMissing - private val employeeDeductions: JsonField = - JsonMissing.of(), - @JsonProperty("employer_contributions") - @ExcludeMissing - private val employerContributions: JsonField = - JsonMissing.of(), - @JsonProperty("gross_pay") - @ExcludeMissing - private val grossPay: JsonField = JsonMissing.of(), - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonProperty("net_pay") - @ExcludeMissing - private val netPay: JsonField = JsonMissing.of(), - @JsonProperty("payment_method") - @ExcludeMissing - private val paymentMethod: JsonField = JsonMissing.of(), - @JsonProperty("taxes") - @ExcludeMissing - private val taxes: JsonField = JsonMissing.of(), - @JsonProperty("total_hours") - @ExcludeMissing - private val totalHours: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val earnings: JsonField, + private val employeeDeductions: JsonField, + private val employerContributions: JsonField, + private val grossPay: JsonField, + private val individualId: JsonField, + private val netPay: JsonField, + private val paymentMethod: JsonField, + private val taxes: JsonField, + private val totalHours: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("earnings") + @ExcludeMissing + earnings: JsonField = JsonMissing.of(), + @JsonProperty("employee_deductions") + @ExcludeMissing + employeeDeductions: JsonField = JsonMissing.of(), + @JsonProperty("employer_contributions") + @ExcludeMissing + employerContributions: JsonField = JsonMissing.of(), + @JsonProperty("gross_pay") + @ExcludeMissing + grossPay: JsonField = JsonMissing.of(), + @JsonProperty("individual_id") + @ExcludeMissing + individualId: JsonField = JsonMissing.of(), + @JsonProperty("net_pay") + @ExcludeMissing + netPay: JsonField = JsonMissing.of(), + @JsonProperty("payment_method") + @ExcludeMissing + paymentMethod: JsonField = JsonMissing.of(), + @JsonProperty("taxes") + @ExcludeMissing + taxes: JsonField = JsonMissing.of(), + @JsonProperty("total_hours") + @ExcludeMissing + totalHours: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this( + earnings, + employeeDeductions, + employerContributions, + grossPay, + individualId, + netPay, + paymentMethod, + taxes, + totalHours, + type, + mutableMapOf(), + ) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -6713,29 +7099,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PayStatements = apply { - if (validated) { - return@apply - } - - earnings().ifPresent { it.validate() } - employeeDeductions().ifPresent { it.validate() } - employerContributions().ifPresent { it.validate() } - grossPay() - individualId() - netPay() - paymentMethod() - taxes().ifPresent { it.validate() } - totalHours() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -6949,31 +7321,55 @@ private constructor( taxes, totalHours, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): PayStatements = apply { + if (validated) { + return@apply + } + + earnings().ifPresent { it.validate() } + employeeDeductions().ifPresent { it.validate() } + employerContributions().ifPresent { it.validate() } + grossPay() + individualId() + netPay() + paymentMethod() + taxes().ifPresent { it.validate() } + totalHours() + type() + validated = true + } + class Earnings - @JsonCreator private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val amount: JsonField, + private val currency: JsonField, + private val name: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(amount, currency, name, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -7038,23 +7434,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Earnings = apply { - if (validated) { - return@apply - } - - amount() - currency() - name() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -7165,10 +7553,24 @@ private constructor( currency, name, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Earnings = apply { + if (validated) { + return@apply + } + + amount() + currency() + name() + type() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -7182,35 +7584,40 @@ private constructor( /* spotless:on */ override fun hashCode(): Int = hashCode - - override fun toString() = - "Earnings{amount=$amount, currency=$currency, name=$name, type=$type, additionalProperties=$additionalProperties}" - } - - @NoAutoDetect - class EmployeeDeductions - @JsonCreator - private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("pre_tax") - @ExcludeMissing - private val preTax: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + + override fun toString() = + "Earnings{amount=$amount, currency=$currency, name=$name, type=$type, additionalProperties=$additionalProperties}" + } + + class EmployeeDeductions + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val name: JsonField, + private val preTax: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + @JsonProperty("pre_tax") + @ExcludeMissing + preTax: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(amount, currency, name, preTax, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -7292,24 +7699,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): EmployeeDeductions = apply { - if (validated) { - return@apply - } - - amount() - currency() - name() - preTax() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -7436,10 +7834,25 @@ private constructor( name, preTax, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): EmployeeDeductions = apply { + if (validated) { + return@apply + } + + amount() + currency() + name() + preTax() + type() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -7458,24 +7871,27 @@ private constructor( "EmployeeDeductions{amount=$amount, currency=$currency, name=$name, preTax=$preTax, type=$type, additionalProperties=$additionalProperties}" } - @NoAutoDetect class EmployerContributions - @JsonCreator private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val amount: JsonField, + private val currency: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + ) : this(amount, currency, name, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -7525,22 +7941,15 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): EmployerContributions = apply { - if (validated) { - return@apply - } - - amount() - currency() - name() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -7640,10 +8049,23 @@ private constructor( amount, currency, name, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): EmployerContributions = apply { + if (validated) { + return@apply + } + + amount() + currency() + name() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -7662,30 +8084,35 @@ private constructor( "EmployerContributions{amount=$amount, currency=$currency, name=$name, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Taxes - @JsonCreator private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("employer") - @ExcludeMissing - private val employer: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap(), + private val amount: JsonField, + private val currency: JsonField, + private val employer: JsonField, + private val name: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("employer") + @ExcludeMissing + employer: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(amount, currency, employer, name, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -7767,24 +8194,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Taxes = apply { - if (validated) { - return@apply - } - - amount() - currency() - employer() - name() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -7911,10 +8329,25 @@ private constructor( employer, name, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Taxes = apply { + if (validated) { + return@apply + } + + amount() + currency() + employer() + name() + type() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -7969,50 +8402,75 @@ private constructor( "SupportedPayStatementFields{paging=$paging, payStatements=$payStatements, additionalProperties=$additionalProperties}" } - @NoAutoDetect class SupportedPaymentFields - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("company_debit") - @ExcludeMissing - private val companyDebit: JsonField = JsonMissing.of(), - @JsonProperty("debit_date") - @ExcludeMissing - private val debitDate: JsonField = JsonMissing.of(), - @JsonProperty("employee_taxes") - @ExcludeMissing - private val employeeTaxes: JsonField = JsonMissing.of(), - @JsonProperty("employer_taxes") - @ExcludeMissing - private val employerTaxes: JsonField = JsonMissing.of(), - @JsonProperty("gross_pay") - @ExcludeMissing - private val grossPay: JsonField = JsonMissing.of(), - @JsonProperty("individual_ids") - @ExcludeMissing - private val individualIds: JsonField = JsonMissing.of(), - @JsonProperty("net_pay") - @ExcludeMissing - private val netPay: JsonField = JsonMissing.of(), - @JsonProperty("pay_date") - @ExcludeMissing - private val payDate: JsonField = JsonMissing.of(), - @JsonProperty("pay_frequencies") - @ExcludeMissing - private val payFrequencies: JsonField = JsonMissing.of(), - @JsonProperty("pay_group_ids") - @ExcludeMissing - private val payGroupIds: JsonField = JsonMissing.of(), - @JsonProperty("pay_period") - @ExcludeMissing - private val payPeriod: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val companyDebit: JsonField, + private val debitDate: JsonField, + private val employeeTaxes: JsonField, + private val employerTaxes: JsonField, + private val grossPay: JsonField, + private val individualIds: JsonField, + private val netPay: JsonField, + private val payDate: JsonField, + private val payFrequencies: JsonField, + private val payGroupIds: JsonField, + private val payPeriod: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("company_debit") + @ExcludeMissing + companyDebit: JsonField = JsonMissing.of(), + @JsonProperty("debit_date") + @ExcludeMissing + debitDate: JsonField = JsonMissing.of(), + @JsonProperty("employee_taxes") + @ExcludeMissing + employeeTaxes: JsonField = JsonMissing.of(), + @JsonProperty("employer_taxes") + @ExcludeMissing + employerTaxes: JsonField = JsonMissing.of(), + @JsonProperty("gross_pay") + @ExcludeMissing + grossPay: JsonField = JsonMissing.of(), + @JsonProperty("individual_ids") + @ExcludeMissing + individualIds: JsonField = JsonMissing.of(), + @JsonProperty("net_pay") + @ExcludeMissing + netPay: JsonField = JsonMissing.of(), + @JsonProperty("pay_date") + @ExcludeMissing + payDate: JsonField = JsonMissing.of(), + @JsonProperty("pay_frequencies") + @ExcludeMissing + payFrequencies: JsonField = JsonMissing.of(), + @JsonProperty("pay_group_ids") + @ExcludeMissing + payGroupIds: JsonField = JsonMissing.of(), + @JsonProperty("pay_period") + @ExcludeMissing + payPeriod: JsonField = JsonMissing.of(), + ) : this( + id, + companyDebit, + debitDate, + employeeTaxes, + employerTaxes, + grossPay, + individualIds, + netPay, + payDate, + payFrequencies, + payGroupIds, + payPeriod, + mutableMapOf(), + ) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -8210,31 +8668,15 @@ private constructor( @ExcludeMissing fun _payPeriod(): JsonField = payPeriod + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SupportedPaymentFields = apply { - if (validated) { - return@apply - } - - id() - companyDebit() - debitDate() - employeeTaxes() - employerTaxes() - grossPay() - individualIds() - netPay() - payDate() - payFrequencies() - payGroupIds() - payPeriod().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -8476,24 +8918,49 @@ private constructor( payFrequencies, payGroupIds, payPeriod, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): SupportedPaymentFields = apply { + if (validated) { + return@apply + } + + id() + companyDebit() + debitDate() + employeeTaxes() + employerTaxes() + grossPay() + individualIds() + netPay() + payDate() + payFrequencies() + payGroupIds() + payPeriod().ifPresent { it.validate() } + validated = true + } + class PayPeriod - @JsonCreator private constructor( - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val endDate: JsonField, + private val startDate: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("end_date") + @ExcludeMissing + endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + startDate: JsonField = JsonMissing.of(), + ) : this(endDate, startDate, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -8528,21 +8995,15 @@ private constructor( @ExcludeMissing fun _startDate(): JsonField = startDate + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PayPeriod = apply { - if (validated) { - return@apply - } - - endDate() - startDate() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -8621,7 +9082,19 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PayPeriod = - PayPeriod(endDate, startDate, additionalProperties.toImmutable()) + PayPeriod(endDate, startDate, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): PayPeriod = apply { + if (validated) { + return@apply + } + + endDate() + startDate() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt index a24d76c7..8a2001ef 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.ProviderService +import java.util.Collections import java.util.Objects import java.util.Optional import java.util.stream.Stream @@ -66,23 +64,30 @@ private constructor( ProviderListPage(providersService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("items") private val items: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + 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.getNullable("items") ?: 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 = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -140,7 +145,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(items, additionalProperties.toImmutable()) + fun build(): Response = Response(items, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt index ad126c86..881b0e59 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt @@ -10,10 +10,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.ProviderServiceAsync +import java.util.Collections import java.util.Objects import java.util.Optional import java.util.concurrent.CompletableFuture @@ -71,23 +69,30 @@ private constructor( ) = ProviderListPageAsync(providersService, params, response) } - @NoAutoDetect - class Response - @JsonCreator - constructor( - @JsonProperty("items") private val items: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + 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.getNullable("items") ?: 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 = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) private var validated: Boolean = false @@ -147,7 +152,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Response = Response(items, additionalProperties.toImmutable()) + fun build(): Response = Response(items, additionalProperties.toMutableMap()) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListParams.kt index 39527df9..dbf39fca 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListParams.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -19,10 +18,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - fun toBuilder() = Builder().from(this) companion object { @@ -34,7 +29,6 @@ private constructor( } /** A builder for [ProviderListParams]. */ - @NoAutoDetect class Builder internal constructor() { private var additionalHeaders: Headers.Builder = Headers.builder() @@ -153,6 +147,10 @@ private constructor( ProviderListParams(additionalHeaders.build(), additionalQueryParams.build()) } + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt index aac36e23..3d87bd25 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt @@ -10,14 +10,12 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap -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 @@ -101,6 +99,233 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [RequestForwardingForwardParams]. + * + * The following fields are required: + * ```java + * .method() + * .route() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RequestForwardingForwardParams]. */ + class Builder internal constructor() { + + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(requestForwardingForwardParams: RequestForwardingForwardParams) = apply { + body = requestForwardingForwardParams.body.toBuilder() + additionalHeaders = requestForwardingForwardParams.additionalHeaders.toBuilder() + additionalQueryParams = requestForwardingForwardParams.additionalQueryParams.toBuilder() + } + + /** + * The HTTP method for the forwarded request. Valid values include: `GET` , `POST` , `PUT` , + * `DELETE` , and `PATCH`. + */ + fun method(method: String) = apply { body.method(method) } + + /** + * Sets [Builder.method] to an arbitrary JSON value. + * + * You should usually call [Builder.method] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun method(method: JsonField) = apply { body.method(method) } + + /** + * The URL route path for the forwarded request. This value must begin with a forward-slash + * ( / ) and may only contain alphanumeric characters, hyphens, and underscores. + */ + fun route(route: String) = apply { body.route(route) } + + /** + * Sets [Builder.route] to an arbitrary JSON value. + * + * You should usually call [Builder.route] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun route(route: JsonField) = apply { body.route(route) } + + /** + * The body for the forwarded request. This value must be specified as either a string or a + * valid JSON object. + */ + fun data(data: String?) = apply { body.data(data) } + + /** Alias for calling [Builder.data] with `data.orElse(null)`. */ + fun data(data: Optional) = data(data.getOrNull()) + + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun data(data: JsonField) = apply { body.data(data) } + + /** + * The HTTP headers to include on the forwarded request. This value must be specified as an + * object of key-value pairs. Example: `{"Content-Type": "application/xml", "X-API-Version": + * "v1" }` + */ + fun headers(headers: JsonValue) = apply { body.headers(headers) } + + /** + * The query parameters for the forwarded request. This value must be specified as a valid + * JSON object rather than a query string. + */ + fun params(params: JsonValue) = apply { body.params(params) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [RequestForwardingForwardParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .method() + * .route() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RequestForwardingForwardParams = + RequestForwardingForwardParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -108,25 +333,25 @@ private constructor( override fun _queryParams(): QueryParams = additionalQueryParams /** Forward Request Body */ - @NoAutoDetect class Body - @JsonCreator private constructor( - @JsonProperty("method") - @ExcludeMissing - private val method: JsonField = JsonMissing.of(), - @JsonProperty("route") - @ExcludeMissing - private val route: JsonField = JsonMissing.of(), - @JsonProperty("data") - @ExcludeMissing - private val data: JsonField = JsonMissing.of(), - @JsonProperty("headers") @ExcludeMissing private val headers: JsonValue = JsonMissing.of(), - @JsonProperty("params") @ExcludeMissing private val params: JsonValue = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val method: JsonField, + private val route: JsonField, + private val data: JsonField, + private val headers: JsonValue, + private val params: JsonValue, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("method") @ExcludeMissing method: JsonField = JsonMissing.of(), + @JsonProperty("route") @ExcludeMissing route: JsonField = JsonMissing.of(), + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("headers") @ExcludeMissing headers: JsonValue = JsonMissing.of(), + @JsonProperty("params") @ExcludeMissing params: JsonValue = JsonMissing.of(), + ) : this(method, route, data, headers, params, mutableMapOf()) + /** * The HTTP method for the forwarded request. Valid values include: `GET` , `POST` , `PUT` , * `DELETE` , and `PATCH`. @@ -188,22 +413,15 @@ private constructor( */ @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - method() - route() - data() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -342,10 +560,23 @@ private constructor( data, headers, params, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + method() + route() + data() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -364,234 +595,6 @@ private constructor( "Body{method=$method, route=$route, data=$data, headers=$headers, params=$params, additionalProperties=$additionalProperties}" } - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [RequestForwardingForwardParams]. - * - * The following fields are required: - * ```java - * .method() - * .route() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [RequestForwardingForwardParams]. */ - @NoAutoDetect - class Builder internal constructor() { - - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(requestForwardingForwardParams: RequestForwardingForwardParams) = apply { - body = requestForwardingForwardParams.body.toBuilder() - additionalHeaders = requestForwardingForwardParams.additionalHeaders.toBuilder() - additionalQueryParams = requestForwardingForwardParams.additionalQueryParams.toBuilder() - } - - /** - * The HTTP method for the forwarded request. Valid values include: `GET` , `POST` , `PUT` , - * `DELETE` , and `PATCH`. - */ - fun method(method: String) = apply { body.method(method) } - - /** - * Sets [Builder.method] to an arbitrary JSON value. - * - * You should usually call [Builder.method] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun method(method: JsonField) = apply { body.method(method) } - - /** - * The URL route path for the forwarded request. This value must begin with a forward-slash - * ( / ) and may only contain alphanumeric characters, hyphens, and underscores. - */ - fun route(route: String) = apply { body.route(route) } - - /** - * Sets [Builder.route] to an arbitrary JSON value. - * - * You should usually call [Builder.route] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun route(route: JsonField) = apply { body.route(route) } - - /** - * The body for the forwarded request. This value must be specified as either a string or a - * valid JSON object. - */ - fun data(data: String?) = apply { body.data(data) } - - /** Alias for calling [Builder.data] with `data.orElse(null)`. */ - fun data(data: Optional) = data(data.getOrNull()) - - /** - * Sets [Builder.data] to an arbitrary JSON value. - * - * You should usually call [Builder.data] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun data(data: JsonField) = apply { body.data(data) } - - /** - * The HTTP headers to include on the forwarded request. This value must be specified as an - * object of key-value pairs. Example: `{"Content-Type": "application/xml", "X-API-Version": - * "v1" }` - */ - fun headers(headers: JsonValue) = apply { body.headers(headers) } - - /** - * The query parameters for the forwarded request. This value must be specified as a valid - * JSON object rather than a query string. - */ - fun params(params: JsonValue) = apply { body.params(params) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [RequestForwardingForwardParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .method() - * .route() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): RequestForwardingForwardParams = - RequestForwardingForwardParams( - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt index 01f7f07a..4b07f919 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt @@ -10,30 +10,30 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -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 -@NoAutoDetect class RequestForwardingForwardResponse -@JsonCreator private constructor( - @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), - @JsonProperty("headers") @ExcludeMissing private val headers: JsonValue = JsonMissing.of(), - @JsonProperty("request") - @ExcludeMissing - private val request: JsonField = JsonMissing.of(), - @JsonProperty("statusCode") - @ExcludeMissing - private val statusCode: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val data: JsonField, + private val headers: JsonValue, + private val request: JsonField, + private val statusCode: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("headers") @ExcludeMissing headers: JsonValue = JsonMissing.of(), + @JsonProperty("request") @ExcludeMissing request: JsonField = JsonMissing.of(), + @JsonProperty("statusCode") @ExcludeMissing statusCode: JsonField = JsonMissing.of(), + ) : this(data, headers, request, statusCode, mutableMapOf()) + /** * A string representation of the HTTP response body of the forwarded request’s response * received from the underlying integration’s API. This field may be null in the case where the @@ -88,22 +88,15 @@ private constructor( */ @JsonProperty("statusCode") @ExcludeMissing fun _statusCode(): JsonField = statusCode + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): RequestForwardingForwardResponse = apply { - if (validated) { - return@apply - } - - data() - request().validate() - statusCode() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -236,32 +229,45 @@ private constructor( checkRequired("headers", headers), checkRequired("request", request), checkRequired("statusCode", statusCode), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): RequestForwardingForwardResponse = apply { + if (validated) { + return@apply + } + + data() + request().validate() + statusCode() + validated = true + } + /** * An object containing details of your original forwarded request, for your ease of reference. */ - @NoAutoDetect class Request - @JsonCreator private constructor( - @JsonProperty("data") - @ExcludeMissing - private val data: JsonField = JsonMissing.of(), - @JsonProperty("headers") @ExcludeMissing private val headers: JsonValue = JsonMissing.of(), - @JsonProperty("method") - @ExcludeMissing - private val method: JsonField = JsonMissing.of(), - @JsonProperty("params") @ExcludeMissing private val params: JsonValue = JsonMissing.of(), - @JsonProperty("route") - @ExcludeMissing - private val route: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val data: JsonField, + private val headers: JsonValue, + private val method: JsonField, + private val params: JsonValue, + private val route: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("headers") @ExcludeMissing headers: JsonValue = JsonMissing.of(), + @JsonProperty("method") @ExcludeMissing method: JsonField = JsonMissing.of(), + @JsonProperty("params") @ExcludeMissing params: JsonValue = JsonMissing.of(), + @JsonProperty("route") @ExcludeMissing route: JsonField = JsonMissing.of(), + ) : this(data, headers, method, params, route, mutableMapOf()) + /** * The body that was specified for the forwarded request. If a value was not specified in * the original request, this value will be returned as null ; otherwise, this value will @@ -322,22 +328,15 @@ private constructor( */ @JsonProperty("route") @ExcludeMissing fun _route(): JsonField = route + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Request = apply { - if (validated) { - return@apply - } - - data() - method() - route() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -478,10 +477,23 @@ private constructor( checkRequired("method", method), checkRequired("params", params), checkRequired("route", route), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Request = apply { + if (validated) { + return@apply + } + + data() + method() + route() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt index 7d47258a..b1147a4a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt @@ -11,15 +11,14 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap 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 @@ -157,845 +156,880 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): CompanyWithoutId = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams + fun toBuilder() = Builder().from(this) - @NoAutoDetect - class CompanyWithoutId - @JsonCreator - private constructor( - @JsonProperty("accounts") - @ExcludeMissing - private val accounts: JsonField> = JsonMissing.of(), - @JsonProperty("departments") - @ExcludeMissing - private val departments: JsonField> = JsonMissing.of(), - @JsonProperty("ein") @ExcludeMissing private val ein: JsonField = JsonMissing.of(), - @JsonProperty("entity") - @ExcludeMissing - private val entity: JsonField = JsonMissing.of(), - @JsonProperty("legal_name") - @ExcludeMissing - private val legalName: JsonField = JsonMissing.of(), - @JsonProperty("locations") - @ExcludeMissing - private val locations: JsonField> = JsonMissing.of(), - @JsonProperty("primary_email") - @ExcludeMissing - private val primaryEmail: JsonField = JsonMissing.of(), - @JsonProperty("primary_phone_number") - @ExcludeMissing - private val primaryPhoneNumber: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + companion object { /** - * An array of bank account objects associated with the payroll/HRIS system. + * Returns a mutable builder for constructing an instance of [SandboxCompanyUpdateParams]. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * The following fields are required: + * ```java + * .accounts() + * .departments() + * .ein() + * .entity() + * .legalName() + * .locations() + * .primaryEmail() + * .primaryPhoneNumber() + * ``` */ - fun accounts(): Optional> = - Optional.ofNullable(accounts.getNullable("accounts")) + @JvmStatic fun builder() = Builder() + } - /** - * The array of company departments. - * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun departments(): Optional> = - Optional.ofNullable(departments.getNullable("departments")) + /** A builder for [SandboxCompanyUpdateParams]. */ + class Builder internal constructor() { - /** - * The employer identification number. - * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun ein(): Optional = Optional.ofNullable(ein.getNullable("ein")) + private var body: CompanyWithoutId.Builder = CompanyWithoutId.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(sandboxCompanyUpdateParams: SandboxCompanyUpdateParams) = apply { + body = sandboxCompanyUpdateParams.body.toBuilder() + additionalHeaders = sandboxCompanyUpdateParams.additionalHeaders.toBuilder() + additionalQueryParams = sandboxCompanyUpdateParams.additionalQueryParams.toBuilder() + } + + /** An array of bank account objects associated with the payroll/HRIS system. */ + fun accounts(accounts: List?) = apply { body.accounts(accounts) } + + /** Alias for calling [Builder.accounts] with `accounts.orElse(null)`. */ + fun accounts(accounts: Optional>) = accounts(accounts.getOrNull()) /** - * The entity type object. + * Sets [Builder.accounts] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.accounts] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun entity(): Optional = Optional.ofNullable(entity.getNullable("entity")) + fun accounts(accounts: JsonField>) = apply { body.accounts(accounts) } /** - * The legal name of the company. + * Adds a single [Account] to [accounts]. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws IllegalStateException if the field was previously set to a non-list. */ - fun legalName(): Optional = Optional.ofNullable(legalName.getNullable("legal_name")) + fun addAccount(account: Account) = apply { body.addAccount(account) } - /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun locations(): Optional> = - Optional.ofNullable(locations.getNullable("locations")) + /** The array of company departments. */ + fun departments(departments: List?) = apply { body.departments(departments) } + + /** Alias for calling [Builder.departments] with `departments.orElse(null)`. */ + fun departments(departments: Optional>) = + departments(departments.getOrNull()) /** - * The email of the main administrator on the account. + * Sets [Builder.departments] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.departments] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun primaryEmail(): Optional = - Optional.ofNullable(primaryEmail.getNullable("primary_email")) + fun departments(departments: JsonField>) = apply { + body.departments(departments) + } /** - * The phone number of the main administrator on the account. Format: `XXXXXXXXXX` + * Adds a single [Department] to [departments]. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws IllegalStateException if the field was previously set to a non-list. */ - fun primaryPhoneNumber(): Optional = - Optional.ofNullable(primaryPhoneNumber.getNullable("primary_phone_number")) + fun addDepartment(department: Department) = apply { body.addDepartment(department) } + + /** The employer identification number. */ + fun ein(ein: String?) = apply { body.ein(ein) } + + /** Alias for calling [Builder.ein] with `ein.orElse(null)`. */ + fun ein(ein: Optional) = ein(ein.getOrNull()) /** - * Returns the raw JSON value of [accounts]. + * Sets [Builder.ein] to an arbitrary JSON value. * - * Unlike [accounts], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.ein] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - @JsonProperty("accounts") - @ExcludeMissing - fun _accounts(): JsonField> = accounts + fun ein(ein: JsonField) = apply { body.ein(ein) } + + /** The entity type object. */ + fun entity(entity: Entity?) = apply { body.entity(entity) } + + /** Alias for calling [Builder.entity] with `entity.orElse(null)`. */ + fun entity(entity: Optional) = entity(entity.getOrNull()) /** - * Returns the raw JSON value of [departments]. + * Sets [Builder.entity] to an arbitrary JSON value. * - * Unlike [departments], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.entity] with a well-typed [Entity] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - @JsonProperty("departments") - @ExcludeMissing - fun _departments(): JsonField> = departments + fun entity(entity: JsonField) = apply { body.entity(entity) } + + /** The legal name of the company. */ + fun legalName(legalName: String?) = apply { body.legalName(legalName) } + + /** Alias for calling [Builder.legalName] with `legalName.orElse(null)`. */ + fun legalName(legalName: Optional) = legalName(legalName.getOrNull()) /** - * Returns the raw JSON value of [ein]. + * Sets [Builder.legalName] to an arbitrary JSON value. * - * Unlike [ein], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.legalName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - @JsonProperty("ein") @ExcludeMissing fun _ein(): JsonField = ein + fun legalName(legalName: JsonField) = apply { body.legalName(legalName) } + + fun locations(locations: List?) = apply { body.locations(locations) } + + /** Alias for calling [Builder.locations] with `locations.orElse(null)`. */ + fun locations(locations: Optional>) = locations(locations.getOrNull()) /** - * Returns the raw JSON value of [entity]. + * Sets [Builder.locations] to an arbitrary JSON value. * - * Unlike [entity], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.locations] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - @JsonProperty("entity") @ExcludeMissing fun _entity(): JsonField = entity + fun locations(locations: JsonField>) = apply { body.locations(locations) } /** - * Returns the raw JSON value of [legalName]. + * Adds a single [Location] to [locations]. * - * Unlike [legalName], this method doesn't throw if the JSON field has an unexpected type. + * @throws IllegalStateException if the field was previously set to a non-list. */ - @JsonProperty("legal_name") @ExcludeMissing fun _legalName(): JsonField = legalName + fun addLocation(location: Location) = apply { body.addLocation(location) } + + /** The email of the main administrator on the account. */ + fun primaryEmail(primaryEmail: String?) = apply { body.primaryEmail(primaryEmail) } + + /** Alias for calling [Builder.primaryEmail] with `primaryEmail.orElse(null)`. */ + fun primaryEmail(primaryEmail: Optional) = primaryEmail(primaryEmail.getOrNull()) /** - * Returns the raw JSON value of [locations]. + * Sets [Builder.primaryEmail] to an arbitrary JSON value. * - * Unlike [locations], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.primaryEmail] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - @JsonProperty("locations") - @ExcludeMissing - fun _locations(): JsonField> = locations + fun primaryEmail(primaryEmail: JsonField) = apply { + body.primaryEmail(primaryEmail) + } + + /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + fun primaryPhoneNumber(primaryPhoneNumber: String?) = apply { + body.primaryPhoneNumber(primaryPhoneNumber) + } /** - * Returns the raw JSON value of [primaryEmail]. - * - * Unlike [primaryEmail], this method doesn't throw if the JSON field has an unexpected - * type. + * Alias for calling [Builder.primaryPhoneNumber] with `primaryPhoneNumber.orElse(null)`. */ - @JsonProperty("primary_email") - @ExcludeMissing - fun _primaryEmail(): JsonField = primaryEmail + fun primaryPhoneNumber(primaryPhoneNumber: Optional) = + primaryPhoneNumber(primaryPhoneNumber.getOrNull()) /** - * Returns the raw JSON value of [primaryPhoneNumber]. + * Sets [Builder.primaryPhoneNumber] to an arbitrary JSON value. * - * Unlike [primaryPhoneNumber], this method doesn't throw if the JSON field has an - * unexpected type. + * You should usually call [Builder.primaryPhoneNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - @JsonProperty("primary_phone_number") - @ExcludeMissing - fun _primaryPhoneNumber(): JsonField = primaryPhoneNumber + fun primaryPhoneNumber(primaryPhoneNumber: JsonField) = apply { + body.primaryPhoneNumber(primaryPhoneNumber) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } - private var validated: Boolean = false + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } - fun validate(): CompanyWithoutId = apply { - if (validated) { - return@apply + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) } - accounts().ifPresent { it.forEach { it.validate() } } - departments().ifPresent { it.forEach { it?.validate() } } - ein() - entity().ifPresent { it.validate() } - legalName() - locations().ifPresent { it.forEach { it?.validate() } } - primaryEmail() - primaryPhoneNumber() - validated = true + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) } - fun toBuilder() = Builder().from(this) + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - companion object { + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - /** - * Returns a mutable builder for constructing an instance of [CompanyWithoutId]. - * - * The following fields are required: - * ```java - * .accounts() - * .departments() - * .ein() - * .entity() - * .legalName() - * .locations() - * .primaryEmail() - * .primaryPhoneNumber() - * ``` - */ - @JvmStatic fun builder() = Builder() + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - /** A builder for [CompanyWithoutId]. */ - class Builder internal constructor() { + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } - private var accounts: JsonField>? = null - private var departments: JsonField>? = null - private var ein: JsonField? = null - private var entity: JsonField? = null - private var legalName: JsonField? = null - private var locations: JsonField>? = null - private var primaryEmail: JsonField? = null - private var primaryPhoneNumber: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } - @JvmSynthetic - internal fun from(companyWithoutId: CompanyWithoutId) = apply { - accounts = companyWithoutId.accounts.map { it.toMutableList() } - departments = companyWithoutId.departments.map { it.toMutableList() } - ein = companyWithoutId.ein - entity = companyWithoutId.entity - legalName = companyWithoutId.legalName - locations = companyWithoutId.locations.map { it.toMutableList() } - primaryEmail = companyWithoutId.primaryEmail - primaryPhoneNumber = companyWithoutId.primaryPhoneNumber - additionalProperties = companyWithoutId.additionalProperties.toMutableMap() - } + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } - /** An array of bank account objects associated with the payroll/HRIS system. */ - fun accounts(accounts: List?) = accounts(JsonField.ofNullable(accounts)) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } - /** Alias for calling [Builder.accounts] with `accounts.orElse(null)`. */ - fun accounts(accounts: Optional>) = accounts(accounts.getOrNull()) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } - /** - * Sets [Builder.accounts] to an arbitrary JSON value. - * - * You should usually call [Builder.accounts] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun accounts(accounts: JsonField>) = apply { - this.accounts = accounts.map { it.toMutableList() } - } + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } - /** - * Adds a single [Account] to [accounts]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addAccount(account: Account) = apply { - accounts = - (accounts ?: JsonField.of(mutableListOf())).also { - checkKnown("accounts", it).add(account) - } - } + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } - /** The array of company departments. */ - fun departments(departments: List?) = - departments(JsonField.ofNullable(departments)) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - /** Alias for calling [Builder.departments] with `departments.orElse(null)`. */ - fun departments(departments: Optional>) = - departments(departments.getOrNull()) + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } - /** - * Sets [Builder.departments] to an arbitrary JSON value. - * - * You should usually call [Builder.departments] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun departments(departments: JsonField>) = apply { - this.departments = departments.map { it.toMutableList() } - } + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } - /** - * Adds a single [Department] to [departments]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addDepartment(department: Department) = apply { - departments = - (departments ?: JsonField.of(mutableListOf())).also { - checkKnown("departments", it).add(department) - } - } + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } - /** The employer identification number. */ - fun ein(ein: String?) = ein(JsonField.ofNullable(ein)) + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } - /** Alias for calling [Builder.ein] with `ein.orElse(null)`. */ - fun ein(ein: Optional) = ein(ein.getOrNull()) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } - /** - * Sets [Builder.ein] to an arbitrary JSON value. - * - * You should usually call [Builder.ein] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun ein(ein: JsonField) = apply { this.ein = ein } + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } - /** The entity type object. */ - fun entity(entity: Entity?) = entity(JsonField.ofNullable(entity)) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } - /** Alias for calling [Builder.entity] with `entity.orElse(null)`. */ - fun entity(entity: Optional) = entity(entity.getOrNull()) + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } - /** - * Sets [Builder.entity] to an arbitrary JSON value. - * - * You should usually call [Builder.entity] with a well-typed [Entity] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun entity(entity: JsonField) = apply { this.entity = entity } + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } - /** The legal name of the company. */ - fun legalName(legalName: String?) = legalName(JsonField.ofNullable(legalName)) + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } - /** Alias for calling [Builder.legalName] with `legalName.orElse(null)`. */ - fun legalName(legalName: Optional) = legalName(legalName.getOrNull()) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } - /** - * Sets [Builder.legalName] to an arbitrary JSON value. - * - * You should usually call [Builder.legalName] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun legalName(legalName: JsonField) = apply { this.legalName = legalName } + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - fun locations(locations: List?) = locations(JsonField.ofNullable(locations)) + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } - /** Alias for calling [Builder.locations] with `locations.orElse(null)`. */ - fun locations(locations: Optional>) = locations(locations.getOrNull()) + /** + * Returns an immutable instance of [SandboxCompanyUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accounts() + * .departments() + * .ein() + * .entity() + * .legalName() + * .locations() + * .primaryEmail() + * .primaryPhoneNumber() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SandboxCompanyUpdateParams = + SandboxCompanyUpdateParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } - /** - * Sets [Builder.locations] to an arbitrary JSON value. - * - * You should usually call [Builder.locations] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun locations(locations: JsonField>) = apply { - this.locations = locations.map { it.toMutableList() } - } + @JvmSynthetic internal fun _body(): CompanyWithoutId = body - /** - * Adds a single [Location] to [locations]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addLocation(location: Location) = apply { - locations = - (locations ?: JsonField.of(mutableListOf())).also { - checkKnown("locations", it).add(location) - } - } - - /** The email of the main administrator on the account. */ - fun primaryEmail(primaryEmail: String?) = - primaryEmail(JsonField.ofNullable(primaryEmail)) - - /** Alias for calling [Builder.primaryEmail] with `primaryEmail.orElse(null)`. */ - fun primaryEmail(primaryEmail: Optional) = - primaryEmail(primaryEmail.getOrNull()) - - /** - * Sets [Builder.primaryEmail] to an arbitrary JSON value. - * - * You should usually call [Builder.primaryEmail] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun primaryEmail(primaryEmail: JsonField) = apply { - this.primaryEmail = primaryEmail - } - - /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ - fun primaryPhoneNumber(primaryPhoneNumber: String?) = - primaryPhoneNumber(JsonField.ofNullable(primaryPhoneNumber)) - - /** - * Alias for calling [Builder.primaryPhoneNumber] with - * `primaryPhoneNumber.orElse(null)`. - */ - fun primaryPhoneNumber(primaryPhoneNumber: Optional) = - primaryPhoneNumber(primaryPhoneNumber.getOrNull()) - - /** - * Sets [Builder.primaryPhoneNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.primaryPhoneNumber] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun primaryPhoneNumber(primaryPhoneNumber: JsonField) = apply { - this.primaryPhoneNumber = primaryPhoneNumber - } - - 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 [CompanyWithoutId]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .accounts() - * .departments() - * .ein() - * .entity() - * .legalName() - * .locations() - * .primaryEmail() - * .primaryPhoneNumber() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CompanyWithoutId = - CompanyWithoutId( - checkRequired("accounts", accounts).map { it.toImmutable() }, - checkRequired("departments", departments).map { it.toImmutable() }, - checkRequired("ein", ein), - checkRequired("entity", entity), - checkRequired("legalName", legalName), - checkRequired("locations", locations).map { it.toImmutable() }, - checkRequired("primaryEmail", primaryEmail), - checkRequired("primaryPhoneNumber", primaryPhoneNumber), - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is CompanyWithoutId && accounts == other.accounts && departments == other.departments && ein == other.ein && entity == other.entity && legalName == other.legalName && locations == other.locations && primaryEmail == other.primaryEmail && primaryPhoneNumber == other.primaryPhoneNumber && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(accounts, departments, ein, entity, legalName, locations, primaryEmail, primaryPhoneNumber, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode + override fun _headers(): Headers = additionalHeaders - override fun toString() = - "CompanyWithoutId{accounts=$accounts, departments=$departments, ein=$ein, entity=$entity, legalName=$legalName, locations=$locations, primaryEmail=$primaryEmail, primaryPhoneNumber=$primaryPhoneNumber, additionalProperties=$additionalProperties}" - } + override fun _queryParams(): QueryParams = additionalQueryParams - fun toBuilder() = Builder().from(this) + class CompanyWithoutId + private constructor( + private val accounts: JsonField>, + private val departments: JsonField>, + private val ein: JsonField, + private val entity: JsonField, + private val legalName: JsonField, + private val locations: JsonField>, + private val primaryEmail: JsonField, + private val primaryPhoneNumber: JsonField, + private val additionalProperties: MutableMap, + ) { - companion object { + @JsonCreator + private constructor( + @JsonProperty("accounts") + @ExcludeMissing + accounts: JsonField> = JsonMissing.of(), + @JsonProperty("departments") + @ExcludeMissing + departments: JsonField> = JsonMissing.of(), + @JsonProperty("ein") @ExcludeMissing ein: JsonField = JsonMissing.of(), + @JsonProperty("entity") @ExcludeMissing entity: JsonField = JsonMissing.of(), + @JsonProperty("legal_name") + @ExcludeMissing + legalName: JsonField = JsonMissing.of(), + @JsonProperty("locations") + @ExcludeMissing + locations: JsonField> = JsonMissing.of(), + @JsonProperty("primary_email") + @ExcludeMissing + primaryEmail: JsonField = JsonMissing.of(), + @JsonProperty("primary_phone_number") + @ExcludeMissing + primaryPhoneNumber: JsonField = JsonMissing.of(), + ) : this( + accounts, + departments, + ein, + entity, + legalName, + locations, + primaryEmail, + primaryPhoneNumber, + mutableMapOf(), + ) /** - * Returns a mutable builder for constructing an instance of [SandboxCompanyUpdateParams]. + * An array of bank account objects associated with the payroll/HRIS system. * - * The following fields are required: - * ```java - * .accounts() - * .departments() - * .ein() - * .entity() - * .legalName() - * .locations() - * .primaryEmail() - * .primaryPhoneNumber() - * ``` + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SandboxCompanyUpdateParams]. */ - @NoAutoDetect - class Builder internal constructor() { - - private var body: CompanyWithoutId.Builder = CompanyWithoutId.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(sandboxCompanyUpdateParams: SandboxCompanyUpdateParams) = apply { - body = sandboxCompanyUpdateParams.body.toBuilder() - additionalHeaders = sandboxCompanyUpdateParams.additionalHeaders.toBuilder() - additionalQueryParams = sandboxCompanyUpdateParams.additionalQueryParams.toBuilder() - } - - /** An array of bank account objects associated with the payroll/HRIS system. */ - fun accounts(accounts: List?) = apply { body.accounts(accounts) } - - /** Alias for calling [Builder.accounts] with `accounts.orElse(null)`. */ - fun accounts(accounts: Optional>) = accounts(accounts.getOrNull()) + fun accounts(): Optional> = + Optional.ofNullable(accounts.getNullable("accounts")) /** - * Sets [Builder.accounts] to an arbitrary JSON value. + * The array of company departments. * - * You should usually call [Builder.accounts] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun accounts(accounts: JsonField>) = apply { body.accounts(accounts) } + fun departments(): Optional> = + Optional.ofNullable(departments.getNullable("departments")) /** - * Adds a single [Account] to [accounts]. + * The employer identification number. * - * @throws IllegalStateException if the field was previously set to a non-list. + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun addAccount(account: Account) = apply { body.addAccount(account) } - - /** The array of company departments. */ - fun departments(departments: List?) = apply { body.departments(departments) } - - /** Alias for calling [Builder.departments] with `departments.orElse(null)`. */ - fun departments(departments: Optional>) = - departments(departments.getOrNull()) + fun ein(): Optional = Optional.ofNullable(ein.getNullable("ein")) /** - * Sets [Builder.departments] to an arbitrary JSON value. + * The entity type object. * - * You should usually call [Builder.departments] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun departments(departments: JsonField>) = apply { - body.departments(departments) - } + fun entity(): Optional = Optional.ofNullable(entity.getNullable("entity")) /** - * Adds a single [Department] to [departments]. + * The legal name of the company. * - * @throws IllegalStateException if the field was previously set to a non-list. + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun addDepartment(department: Department) = apply { body.addDepartment(department) } - - /** The employer identification number. */ - fun ein(ein: String?) = apply { body.ein(ein) } + fun legalName(): Optional = Optional.ofNullable(legalName.getNullable("legal_name")) - /** Alias for calling [Builder.ein] with `ein.orElse(null)`. */ - fun ein(ein: Optional) = ein(ein.getOrNull()) + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun locations(): Optional> = + Optional.ofNullable(locations.getNullable("locations")) /** - * Sets [Builder.ein] to an arbitrary JSON value. + * The email of the main administrator on the account. * - * You should usually call [Builder.ein] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun ein(ein: JsonField) = apply { body.ein(ein) } - - /** The entity type object. */ - fun entity(entity: Entity?) = apply { body.entity(entity) } - - /** Alias for calling [Builder.entity] with `entity.orElse(null)`. */ - fun entity(entity: Optional) = entity(entity.getOrNull()) + fun primaryEmail(): Optional = + Optional.ofNullable(primaryEmail.getNullable("primary_email")) /** - * Sets [Builder.entity] to an arbitrary JSON value. + * The phone number of the main administrator on the account. Format: `XXXXXXXXXX` * - * You should usually call [Builder.entity] with a well-typed [Entity] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun entity(entity: JsonField) = apply { body.entity(entity) } - - /** The legal name of the company. */ - fun legalName(legalName: String?) = apply { body.legalName(legalName) } - - /** Alias for calling [Builder.legalName] with `legalName.orElse(null)`. */ - fun legalName(legalName: Optional) = legalName(legalName.getOrNull()) + fun primaryPhoneNumber(): Optional = + Optional.ofNullable(primaryPhoneNumber.getNullable("primary_phone_number")) /** - * Sets [Builder.legalName] to an arbitrary JSON value. + * Returns the raw JSON value of [accounts]. * - * You should usually call [Builder.legalName] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * Unlike [accounts], this method doesn't throw if the JSON field has an unexpected type. */ - fun legalName(legalName: JsonField) = apply { body.legalName(legalName) } - - fun locations(locations: List?) = apply { body.locations(locations) } - - /** Alias for calling [Builder.locations] with `locations.orElse(null)`. */ - fun locations(locations: Optional>) = locations(locations.getOrNull()) + @JsonProperty("accounts") + @ExcludeMissing + fun _accounts(): JsonField> = accounts /** - * Sets [Builder.locations] to an arbitrary JSON value. + * Returns the raw JSON value of [departments]. * - * You should usually call [Builder.locations] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * Unlike [departments], this method doesn't throw if the JSON field has an unexpected type. */ - fun locations(locations: JsonField>) = apply { body.locations(locations) } + @JsonProperty("departments") + @ExcludeMissing + fun _departments(): JsonField> = departments /** - * Adds a single [Location] to [locations]. + * Returns the raw JSON value of [ein]. * - * @throws IllegalStateException if the field was previously set to a non-list. + * Unlike [ein], this method doesn't throw if the JSON field has an unexpected type. */ - fun addLocation(location: Location) = apply { body.addLocation(location) } - - /** The email of the main administrator on the account. */ - fun primaryEmail(primaryEmail: String?) = apply { body.primaryEmail(primaryEmail) } + @JsonProperty("ein") @ExcludeMissing fun _ein(): JsonField = ein - /** Alias for calling [Builder.primaryEmail] with `primaryEmail.orElse(null)`. */ - fun primaryEmail(primaryEmail: Optional) = primaryEmail(primaryEmail.getOrNull()) + /** + * Returns the raw JSON value of [entity]. + * + * Unlike [entity], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("entity") @ExcludeMissing fun _entity(): JsonField = entity /** - * Sets [Builder.primaryEmail] to an arbitrary JSON value. + * Returns the raw JSON value of [legalName]. * - * You should usually call [Builder.primaryEmail] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * Unlike [legalName], this method doesn't throw if the JSON field has an unexpected type. */ - fun primaryEmail(primaryEmail: JsonField) = apply { - body.primaryEmail(primaryEmail) - } + @JsonProperty("legal_name") @ExcludeMissing fun _legalName(): JsonField = legalName - /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ - fun primaryPhoneNumber(primaryPhoneNumber: String?) = apply { - body.primaryPhoneNumber(primaryPhoneNumber) - } + /** + * Returns the raw JSON value of [locations]. + * + * Unlike [locations], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("locations") + @ExcludeMissing + fun _locations(): JsonField> = locations /** - * Alias for calling [Builder.primaryPhoneNumber] with `primaryPhoneNumber.orElse(null)`. + * Returns the raw JSON value of [primaryEmail]. + * + * Unlike [primaryEmail], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun primaryPhoneNumber(primaryPhoneNumber: Optional) = - primaryPhoneNumber(primaryPhoneNumber.getOrNull()) + @JsonProperty("primary_email") + @ExcludeMissing + fun _primaryEmail(): JsonField = primaryEmail /** - * Sets [Builder.primaryPhoneNumber] to an arbitrary JSON value. + * Returns the raw JSON value of [primaryPhoneNumber]. * - * You should usually call [Builder.primaryPhoneNumber] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * Unlike [primaryPhoneNumber], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun primaryPhoneNumber(primaryPhoneNumber: JsonField) = apply { - body.primaryPhoneNumber(primaryPhoneNumber) - } + @JsonProperty("primary_phone_number") + @ExcludeMissing + fun _primaryPhoneNumber(): JsonField = primaryPhoneNumber - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(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 [CompanyWithoutId]. + * + * The following fields are required: + * ```java + * .accounts() + * .departments() + * .ein() + * .entity() + * .legalName() + * .locations() + * .primaryEmail() + * .primaryPhoneNumber() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) + /** A builder for [CompanyWithoutId]. */ + class Builder internal constructor() { + + private var accounts: JsonField>? = null + private var departments: JsonField>? = null + private var ein: JsonField? = null + private var entity: JsonField? = null + private var legalName: JsonField? = null + private var locations: JsonField>? = null + private var primaryEmail: JsonField? = null + private var primaryPhoneNumber: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(companyWithoutId: CompanyWithoutId) = apply { + accounts = companyWithoutId.accounts.map { it.toMutableList() } + departments = companyWithoutId.departments.map { it.toMutableList() } + ein = companyWithoutId.ein + entity = companyWithoutId.entity + legalName = companyWithoutId.legalName + locations = companyWithoutId.locations.map { it.toMutableList() } + primaryEmail = companyWithoutId.primaryEmail + primaryPhoneNumber = companyWithoutId.primaryPhoneNumber + additionalProperties = companyWithoutId.additionalProperties.toMutableMap() } - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + /** An array of bank account objects associated with the payroll/HRIS system. */ + fun accounts(accounts: List?) = accounts(JsonField.ofNullable(accounts)) - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } + /** Alias for calling [Builder.accounts] with `accounts.orElse(null)`. */ + fun accounts(accounts: Optional>) = accounts(accounts.getOrNull()) - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } + /** + * Sets [Builder.accounts] to an arbitrary JSON value. + * + * You should usually call [Builder.accounts] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun accounts(accounts: JsonField>) = apply { + this.accounts = accounts.map { it.toMutableList() } + } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } + /** + * Adds a single [Account] to [accounts]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addAccount(account: Account) = apply { + accounts = + (accounts ?: JsonField.of(mutableListOf())).also { + checkKnown("accounts", it).add(account) + } + } - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } + /** The array of company departments. */ + fun departments(departments: List?) = + departments(JsonField.ofNullable(departments)) - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } + /** Alias for calling [Builder.departments] with `departments.orElse(null)`. */ + fun departments(departments: Optional>) = + departments(departments.getOrNull()) - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + /** + * Sets [Builder.departments] to an arbitrary JSON value. + * + * You should usually call [Builder.departments] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun departments(departments: JsonField>) = apply { + this.departments = departments.map { it.toMutableList() } + } - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + /** + * Adds a single [Department] to [departments]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addDepartment(department: Department) = apply { + departments = + (departments ?: JsonField.of(mutableListOf())).also { + checkKnown("departments", it).add(department) + } + } - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } + /** The employer identification number. */ + fun ein(ein: String?) = ein(JsonField.ofNullable(ein)) - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } + /** Alias for calling [Builder.ein] with `ein.orElse(null)`. */ + fun ein(ein: Optional) = ein(ein.getOrNull()) - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + /** + * Sets [Builder.ein] to an arbitrary JSON value. + * + * You should usually call [Builder.ein] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun ein(ein: JsonField) = apply { this.ein = ein } - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + /** The entity type object. */ + fun entity(entity: Entity?) = entity(JsonField.ofNullable(entity)) - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + /** Alias for calling [Builder.entity] with `entity.orElse(null)`. */ + fun entity(entity: Optional) = entity(entity.getOrNull()) - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } + /** + * Sets [Builder.entity] to an arbitrary JSON value. + * + * You should usually call [Builder.entity] with a well-typed [Entity] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun entity(entity: JsonField) = apply { this.entity = entity } - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + /** The legal name of the company. */ + fun legalName(legalName: String?) = legalName(JsonField.ofNullable(legalName)) - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + /** Alias for calling [Builder.legalName] with `legalName.orElse(null)`. */ + fun legalName(legalName: Optional) = legalName(legalName.getOrNull()) + + /** + * Sets [Builder.legalName] to an arbitrary JSON value. + * + * You should usually call [Builder.legalName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun legalName(legalName: JsonField) = apply { this.legalName = legalName } + + fun locations(locations: List?) = locations(JsonField.ofNullable(locations)) + + /** Alias for calling [Builder.locations] with `locations.orElse(null)`. */ + fun locations(locations: Optional>) = locations(locations.getOrNull()) + + /** + * Sets [Builder.locations] to an arbitrary JSON value. + * + * You should usually call [Builder.locations] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun locations(locations: JsonField>) = apply { + this.locations = locations.map { it.toMutableList() } + } + + /** + * Adds a single [Location] to [locations]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addLocation(location: Location) = apply { + locations = + (locations ?: JsonField.of(mutableListOf())).also { + checkKnown("locations", it).add(location) + } + } + + /** The email of the main administrator on the account. */ + fun primaryEmail(primaryEmail: String?) = + primaryEmail(JsonField.ofNullable(primaryEmail)) + + /** Alias for calling [Builder.primaryEmail] with `primaryEmail.orElse(null)`. */ + fun primaryEmail(primaryEmail: Optional) = + primaryEmail(primaryEmail.getOrNull()) + + /** + * Sets [Builder.primaryEmail] to an arbitrary JSON value. + * + * You should usually call [Builder.primaryEmail] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun primaryEmail(primaryEmail: JsonField) = apply { + this.primaryEmail = primaryEmail + } + + /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + fun primaryPhoneNumber(primaryPhoneNumber: String?) = + primaryPhoneNumber(JsonField.ofNullable(primaryPhoneNumber)) + + /** + * Alias for calling [Builder.primaryPhoneNumber] with + * `primaryPhoneNumber.orElse(null)`. + */ + fun primaryPhoneNumber(primaryPhoneNumber: Optional) = + primaryPhoneNumber(primaryPhoneNumber.getOrNull()) + + /** + * Sets [Builder.primaryPhoneNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.primaryPhoneNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun primaryPhoneNumber(primaryPhoneNumber: JsonField) = apply { + this.primaryPhoneNumber = primaryPhoneNumber + } + + 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 putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) + /** + * Returns an immutable instance of [CompanyWithoutId]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accounts() + * .departments() + * .ein() + * .entity() + * .legalName() + * .locations() + * .primaryEmail() + * .primaryPhoneNumber() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CompanyWithoutId = + CompanyWithoutId( + checkRequired("accounts", accounts).map { it.toImmutable() }, + checkRequired("departments", departments).map { it.toImmutable() }, + checkRequired("ein", ein), + checkRequired("entity", entity), + checkRequired("legalName", legalName), + checkRequired("locations", locations).map { it.toImmutable() }, + checkRequired("primaryEmail", primaryEmail), + checkRequired("primaryPhoneNumber", primaryPhoneNumber), + additionalProperties.toMutableMap(), + ) } - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } + private var validated: Boolean = false - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) + fun validate(): CompanyWithoutId = apply { + if (validated) { + return@apply } - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) + accounts().ifPresent { it.forEach { it.validate() } } + departments().ifPresent { it.forEach { it?.validate() } } + ein() + entity().ifPresent { it.validate() } + legalName() + locations().ifPresent { it.forEach { it?.validate() } } + primaryEmail() + primaryPhoneNumber() + validated = true } - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) + return /* spotless:off */ other is CompanyWithoutId && accounts == other.accounts && departments == other.departments && ein == other.ein && entity == other.entity && legalName == other.legalName && locations == other.locations && primaryEmail == other.primaryEmail && primaryPhoneNumber == other.primaryPhoneNumber && additionalProperties == other.additionalProperties /* spotless:on */ } - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(accounts, departments, ein, entity, legalName, locations, primaryEmail, primaryPhoneNumber, additionalProperties) } + /* spotless:on */ - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } + override fun hashCode(): Int = hashCode - /** - * Returns an immutable instance of [SandboxCompanyUpdateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .accounts() - * .departments() - * .ein() - * .entity() - * .legalName() - * .locations() - * .primaryEmail() - * .primaryPhoneNumber() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): SandboxCompanyUpdateParams = - SandboxCompanyUpdateParams( - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) + override fun toString() = + "CompanyWithoutId{accounts=$accounts, departments=$departments, ein=$ein, entity=$entity, legalName=$legalName, locations=$locations, primaryEmail=$primaryEmail, primaryPhoneNumber=$primaryPhoneNumber, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Account - @JsonCreator private constructor( - @JsonProperty("account_name") - @ExcludeMissing - private val accountName: JsonField = JsonMissing.of(), - @JsonProperty("account_number") - @ExcludeMissing - private val accountNumber: JsonField = JsonMissing.of(), - @JsonProperty("account_type") - @ExcludeMissing - private val accountType: JsonField = JsonMissing.of(), - @JsonProperty("institution_name") - @ExcludeMissing - private val institutionName: JsonField = JsonMissing.of(), - @JsonProperty("routing_number") - @ExcludeMissing - private val routingNumber: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val accountName: JsonField, + private val accountNumber: JsonField, + private val accountType: JsonField, + private val institutionName: JsonField, + private val routingNumber: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("account_name") + @ExcludeMissing + accountName: JsonField = JsonMissing.of(), + @JsonProperty("account_number") + @ExcludeMissing + accountNumber: JsonField = JsonMissing.of(), + @JsonProperty("account_type") + @ExcludeMissing + accountType: JsonField = JsonMissing.of(), + @JsonProperty("institution_name") + @ExcludeMissing + institutionName: JsonField = JsonMissing.of(), + @JsonProperty("routing_number") + @ExcludeMissing + routingNumber: JsonField = JsonMissing.of(), + ) : this( + accountName, + accountNumber, + accountType, + institutionName, + routingNumber, + mutableMapOf(), + ) + /** * The name of the bank associated in the payroll/HRIS system. * @@ -1089,24 +1123,15 @@ private constructor( @ExcludeMissing fun _routingNumber(): JsonField = routingNumber + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Account = apply { - if (validated) { - return@apply - } - - accountName() - accountNumber() - accountType() - institutionName() - routingNumber() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1263,10 +1288,25 @@ private constructor( accountType, institutionName, routingNumber, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Account = apply { + if (validated) { + return@apply + } + + accountName() + accountNumber() + accountType() + institutionName() + routingNumber() + validated = true + } + /** The type of bank account. */ class AccountType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1390,20 +1430,19 @@ private constructor( "Account{accountName=$accountName, accountNumber=$accountNumber, accountType=$accountType, institutionName=$institutionName, routingNumber=$routingNumber, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Department - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("parent") - @ExcludeMissing - private val parent: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val name: JsonField, + private val parent: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("parent") @ExcludeMissing parent: JsonField = JsonMissing.of(), + ) : this(name, parent, mutableMapOf()) + /** * The department name. * @@ -1434,21 +1473,15 @@ private constructor( */ @JsonProperty("parent") @ExcludeMissing fun _parent(): JsonField = parent + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Department = apply { - if (validated) { - return@apply - } - - name() - parent().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1526,21 +1559,33 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Department = Department(name, parent, additionalProperties.toImmutable()) + fun build(): Department = Department(name, parent, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Department = apply { + if (validated) { + return@apply + } + + name() + parent().ifPresent { it.validate() } + validated = true } /** The parent department, if present. */ - @NoAutoDetect class Parent - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val name: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of() + ) : this(name, mutableMapOf()) + /** * The parent department's name. * @@ -1556,20 +1601,15 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Parent = apply { - if (validated) { - return@apply - } - - name() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1633,7 +1673,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Parent = Parent(name, additionalProperties.toImmutable()) + fun build(): Parent = Parent(name, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Parent = apply { + if (validated) { + return@apply + } + + name() + validated = true } override fun equals(other: Any?): Boolean { @@ -1673,18 +1724,19 @@ private constructor( } /** The entity type object. */ - @NoAutoDetect class Entity - @JsonCreator private constructor( - @JsonProperty("subtype") - @ExcludeMissing - private val subtype: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val subtype: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("subtype") @ExcludeMissing subtype: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(subtype, type, mutableMapOf()) + /** * The tax payer subtype of the company. * @@ -1715,21 +1767,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Entity = apply { - if (validated) { - return@apply - } - - subtype() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1807,7 +1853,19 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Entity = Entity(subtype, type, additionalProperties.toImmutable()) + fun build(): Entity = Entity(subtype, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Entity = apply { + if (validated) { + return@apply + } + + subtype() + type() + validated = true } /** The tax payer subtype of the company. */ diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt index 10d2b3f3..5c93064f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt @@ -11,15 +11,14 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional @@ -95,32 +94,269 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [SandboxConnectionAccountCreateParams]. + * + * The following fields are required: + * ```java + * .companyId() + * .providerId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SandboxConnectionAccountCreateParams]. */ + class Builder internal constructor() { + + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from( + sandboxConnectionAccountCreateParams: SandboxConnectionAccountCreateParams + ) = apply { + body = sandboxConnectionAccountCreateParams.body.toBuilder() + additionalHeaders = sandboxConnectionAccountCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = + sandboxConnectionAccountCreateParams.additionalQueryParams.toBuilder() + } + + fun companyId(companyId: String) = apply { body.companyId(companyId) } + + /** + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun companyId(companyId: JsonField) = apply { body.companyId(companyId) } + + /** The provider associated with the `access_token` */ + fun providerId(providerId: String) = apply { body.providerId(providerId) } + + /** + * Sets [Builder.providerId] to an arbitrary JSON value. + * + * You should usually call [Builder.providerId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun providerId(providerId: JsonField) = apply { body.providerId(providerId) } + + fun authenticationType(authenticationType: AuthenticationType) = apply { + body.authenticationType(authenticationType) + } + + /** + * Sets [Builder.authenticationType] to an arbitrary JSON value. + * + * You should usually call [Builder.authenticationType] with a well-typed + * [AuthenticationType] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun authenticationType(authenticationType: JsonField) = apply { + body.authenticationType(authenticationType) + } + + /** + * Optional, defaults to Organization products (`company`, `directory`, `employment`, + * `individual`) + */ + fun products(products: List) = apply { body.products(products) } + + /** + * Sets [Builder.products] to an arbitrary JSON value. + * + * You should usually call [Builder.products] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun products(products: JsonField>) = apply { body.products(products) } + + /** + * Adds a single [String] to [products]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addProduct(product: String) = apply { body.addProduct(product) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [SandboxConnectionAccountCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .companyId() + * .providerId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SandboxConnectionAccountCreateParams = + SandboxConnectionAccountCreateParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams - @NoAutoDetect class Body - @JsonCreator private constructor( - @JsonProperty("company_id") - @ExcludeMissing - private val companyId: JsonField = JsonMissing.of(), - @JsonProperty("provider_id") - @ExcludeMissing - private val providerId: JsonField = JsonMissing.of(), - @JsonProperty("authentication_type") - @ExcludeMissing - private val authenticationType: JsonField = JsonMissing.of(), - @JsonProperty("products") - @ExcludeMissing - private val products: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val companyId: JsonField, + private val providerId: JsonField, + private val authenticationType: JsonField, + private val products: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("company_id") + @ExcludeMissing + companyId: JsonField = JsonMissing.of(), + @JsonProperty("provider_id") + @ExcludeMissing + providerId: JsonField = JsonMissing.of(), + @JsonProperty("authentication_type") + @ExcludeMissing + authenticationType: JsonField = JsonMissing.of(), + @JsonProperty("products") + @ExcludeMissing + products: JsonField> = JsonMissing.of(), + ) : this(companyId, providerId, authenticationType, products, 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). @@ -187,23 +423,15 @@ private constructor( @ExcludeMissing fun _products(): JsonField> = products + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - companyId() - providerId() - authenticationType() - products() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -343,10 +571,24 @@ private constructor( checkRequired("providerId", providerId), authenticationType, (products ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + companyId() + providerId() + authenticationType() + products() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -365,239 +607,6 @@ private constructor( "Body{companyId=$companyId, providerId=$providerId, authenticationType=$authenticationType, products=$products, additionalProperties=$additionalProperties}" } - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [SandboxConnectionAccountCreateParams]. - * - * The following fields are required: - * ```java - * .companyId() - * .providerId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SandboxConnectionAccountCreateParams]. */ - @NoAutoDetect - class Builder internal constructor() { - - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from( - sandboxConnectionAccountCreateParams: SandboxConnectionAccountCreateParams - ) = apply { - body = sandboxConnectionAccountCreateParams.body.toBuilder() - additionalHeaders = sandboxConnectionAccountCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = - sandboxConnectionAccountCreateParams.additionalQueryParams.toBuilder() - } - - fun companyId(companyId: String) = apply { body.companyId(companyId) } - - /** - * Sets [Builder.companyId] to an arbitrary JSON value. - * - * You should usually call [Builder.companyId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun companyId(companyId: JsonField) = apply { body.companyId(companyId) } - - /** The provider associated with the `access_token` */ - fun providerId(providerId: String) = apply { body.providerId(providerId) } - - /** - * Sets [Builder.providerId] to an arbitrary JSON value. - * - * You should usually call [Builder.providerId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun providerId(providerId: JsonField) = apply { body.providerId(providerId) } - - fun authenticationType(authenticationType: AuthenticationType) = apply { - body.authenticationType(authenticationType) - } - - /** - * Sets [Builder.authenticationType] to an arbitrary JSON value. - * - * You should usually call [Builder.authenticationType] with a well-typed - * [AuthenticationType] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun authenticationType(authenticationType: JsonField) = apply { - body.authenticationType(authenticationType) - } - - /** - * Optional, defaults to Organization products (`company`, `directory`, `employment`, - * `individual`) - */ - fun products(products: List) = apply { body.products(products) } - - /** - * Sets [Builder.products] to an arbitrary JSON value. - * - * You should usually call [Builder.products] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun products(products: JsonField>) = apply { body.products(products) } - - /** - * Adds a single [String] to [products]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addProduct(product: String) = apply { body.addProduct(product) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [SandboxConnectionAccountCreateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .companyId() - * .providerId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): SandboxConnectionAccountCreateParams = - SandboxConnectionAccountCreateParams( - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - class AuthenticationType @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt index fbf2e699..209ef17f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt @@ -10,13 +10,11 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional @@ -51,134 +49,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - @NoAutoDetect - class Body - @JsonCreator - private constructor( - @JsonProperty("connection_status") - @ExcludeMissing - private val connectionStatus: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun connectionStatus(): Optional = - Optional.ofNullable(connectionStatus.getNullable("connection_status")) - - /** - * Returns the raw JSON value of [connectionStatus]. - * - * Unlike [connectionStatus], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("connection_status") - @ExcludeMissing - fun _connectionStatus(): JsonField = connectionStatus - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - connectionStatus() - validated = true - } - - 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 connectionStatus: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - connectionStatus = body.connectionStatus - additionalProperties = body.additionalProperties.toMutableMap() - } - - fun connectionStatus(connectionStatus: ConnectionStatusType) = - connectionStatus(JsonField.of(connectionStatus)) - - /** - * Sets [Builder.connectionStatus] to an arbitrary JSON value. - * - * You should usually call [Builder.connectionStatus] with a well-typed - * [ConnectionStatusType] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun connectionStatus(connectionStatus: JsonField) = apply { - this.connectionStatus = connectionStatus - } - - 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(connectionStatus, additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Body && connectionStatus == other.connectionStatus && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(connectionStatus, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{connectionStatus=$connectionStatus, additionalProperties=$additionalProperties}" - } - fun toBuilder() = Builder().from(this) companion object { @@ -193,7 +63,6 @@ private constructor( } /** A builder for [SandboxConnectionAccountUpdateParams]. */ - @NoAutoDetect class Builder internal constructor() { private var body: Body.Builder = Body.builder() @@ -355,6 +224,142 @@ private constructor( ) } + @JvmSynthetic internal fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + private constructor( + private val connectionStatus: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("connection_status") + @ExcludeMissing + connectionStatus: JsonField = JsonMissing.of() + ) : this(connectionStatus, mutableMapOf()) + + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun connectionStatus(): Optional = + Optional.ofNullable(connectionStatus.getNullable("connection_status")) + + /** + * Returns the raw JSON value of [connectionStatus]. + * + * Unlike [connectionStatus], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("connection_status") + @ExcludeMissing + fun _connectionStatus(): JsonField = connectionStatus + + @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 connectionStatus: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + connectionStatus = body.connectionStatus + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun connectionStatus(connectionStatus: ConnectionStatusType) = + connectionStatus(JsonField.of(connectionStatus)) + + /** + * Sets [Builder.connectionStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.connectionStatus] with a well-typed + * [ConnectionStatusType] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun connectionStatus(connectionStatus: JsonField) = apply { + this.connectionStatus = connectionStatus + } + + 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(connectionStatus, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + connectionStatus() + validated = true + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Body && connectionStatus == other.connectionStatus && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(connectionStatus, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{connectionStatus=$connectionStatus, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt index 9334c115..5860e41a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt @@ -11,15 +11,14 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional @@ -96,32 +95,265 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [SandboxConnectionCreateParams]. + * + * The following fields are required: + * ```java + * .providerId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SandboxConnectionCreateParams]. */ + class Builder internal constructor() { + + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(sandboxConnectionCreateParams: SandboxConnectionCreateParams) = apply { + body = sandboxConnectionCreateParams.body.toBuilder() + additionalHeaders = sandboxConnectionCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = sandboxConnectionCreateParams.additionalQueryParams.toBuilder() + } + + /** The provider associated with the connection */ + fun providerId(providerId: String) = apply { body.providerId(providerId) } + + /** + * Sets [Builder.providerId] to an arbitrary JSON value. + * + * You should usually call [Builder.providerId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun providerId(providerId: JsonField) = apply { body.providerId(providerId) } + + fun authenticationType(authenticationType: AuthenticationType) = apply { + body.authenticationType(authenticationType) + } + + /** + * Sets [Builder.authenticationType] to an arbitrary JSON value. + * + * You should usually call [Builder.authenticationType] with a well-typed + * [AuthenticationType] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun authenticationType(authenticationType: JsonField) = apply { + body.authenticationType(authenticationType) + } + + /** + * Optional: the size of the employer to be created with this connection. Defaults to 20. + * Note that if this is higher than 100, historical payroll data will not be generated, and + * instead only one pay period will be created. + */ + fun employeeSize(employeeSize: Long) = apply { body.employeeSize(employeeSize) } + + /** + * Sets [Builder.employeeSize] to an arbitrary JSON value. + * + * You should usually call [Builder.employeeSize] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun employeeSize(employeeSize: JsonField) = apply { body.employeeSize(employeeSize) } + + fun products(products: List) = apply { body.products(products) } + + /** + * Sets [Builder.products] to an arbitrary JSON value. + * + * You should usually call [Builder.products] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun products(products: JsonField>) = apply { body.products(products) } + + /** + * Adds a single [String] to [products]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addProduct(product: String) = apply { body.addProduct(product) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [SandboxConnectionCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .providerId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SandboxConnectionCreateParams = + SandboxConnectionCreateParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams - @NoAutoDetect class Body - @JsonCreator private constructor( - @JsonProperty("provider_id") - @ExcludeMissing - private val providerId: JsonField = JsonMissing.of(), - @JsonProperty("authentication_type") - @ExcludeMissing - private val authenticationType: JsonField = JsonMissing.of(), - @JsonProperty("employee_size") - @ExcludeMissing - private val employeeSize: JsonField = JsonMissing.of(), - @JsonProperty("products") - @ExcludeMissing - private val products: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val providerId: JsonField, + private val authenticationType: JsonField, + private val employeeSize: JsonField, + private val products: JsonField>, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("provider_id") + @ExcludeMissing + providerId: JsonField = JsonMissing.of(), + @JsonProperty("authentication_type") + @ExcludeMissing + authenticationType: JsonField = JsonMissing.of(), + @JsonProperty("employee_size") + @ExcludeMissing + employeeSize: JsonField = JsonMissing.of(), + @JsonProperty("products") + @ExcludeMissing + products: JsonField> = JsonMissing.of(), + ) : this(providerId, authenticationType, employeeSize, products, mutableMapOf()) + /** * The provider associated with the connection * @@ -193,23 +425,15 @@ private constructor( @ExcludeMissing fun _products(): JsonField> = products + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - providerId() - authenticationType() - employeeSize() - products() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -350,10 +574,24 @@ private constructor( authenticationType, employeeSize, (products ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + providerId() + authenticationType() + employeeSize() + products() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -372,235 +610,6 @@ private constructor( "Body{providerId=$providerId, authenticationType=$authenticationType, employeeSize=$employeeSize, products=$products, additionalProperties=$additionalProperties}" } - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [SandboxConnectionCreateParams]. - * - * The following fields are required: - * ```java - * .providerId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SandboxConnectionCreateParams]. */ - @NoAutoDetect - class Builder internal constructor() { - - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(sandboxConnectionCreateParams: SandboxConnectionCreateParams) = apply { - body = sandboxConnectionCreateParams.body.toBuilder() - additionalHeaders = sandboxConnectionCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = sandboxConnectionCreateParams.additionalQueryParams.toBuilder() - } - - /** The provider associated with the connection */ - fun providerId(providerId: String) = apply { body.providerId(providerId) } - - /** - * Sets [Builder.providerId] to an arbitrary JSON value. - * - * You should usually call [Builder.providerId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun providerId(providerId: JsonField) = apply { body.providerId(providerId) } - - fun authenticationType(authenticationType: AuthenticationType) = apply { - body.authenticationType(authenticationType) - } - - /** - * Sets [Builder.authenticationType] to an arbitrary JSON value. - * - * You should usually call [Builder.authenticationType] with a well-typed - * [AuthenticationType] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun authenticationType(authenticationType: JsonField) = apply { - body.authenticationType(authenticationType) - } - - /** - * Optional: the size of the employer to be created with this connection. Defaults to 20. - * Note that if this is higher than 100, historical payroll data will not be generated, and - * instead only one pay period will be created. - */ - fun employeeSize(employeeSize: Long) = apply { body.employeeSize(employeeSize) } - - /** - * Sets [Builder.employeeSize] to an arbitrary JSON value. - * - * You should usually call [Builder.employeeSize] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun employeeSize(employeeSize: JsonField) = apply { body.employeeSize(employeeSize) } - - fun products(products: List) = apply { body.products(products) } - - /** - * Sets [Builder.products] to an arbitrary JSON value. - * - * You should usually call [Builder.products] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun products(products: JsonField>) = apply { body.products(products) } - - /** - * Adds a single [String] to [products]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addProduct(product: String) = apply { body.addProduct(product) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [SandboxConnectionCreateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .providerId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): SandboxConnectionCreateParams = - SandboxConnectionCreateParams( - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - class AuthenticationType @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt index ab1ca75a..16d2620c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt @@ -11,14 +11,13 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap 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 @@ -41,6 +40,161 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): SandboxDirectoryCreateParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of [SandboxDirectoryCreateParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SandboxDirectoryCreateParams]. */ + class Builder internal constructor() { + + private var body: MutableList? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(sandboxDirectoryCreateParams: SandboxDirectoryCreateParams) = apply { + body = sandboxDirectoryCreateParams.body?.toMutableList() + additionalHeaders = sandboxDirectoryCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = sandboxDirectoryCreateParams.additionalQueryParams.toBuilder() + } + + /** + * Array of individuals to create. Takes all combined fields from `/individual` and + * `/employment` endpoints. All fields are optional. + */ + fun body(body: List?) = apply { this.body = body?.toMutableList() } + + /** Alias for calling [Builder.body] with `body.orElse(null)`. */ + fun body(body: Optional>) = body(body.getOrNull()) + + /** + * Adds a single [IndividualOrEmployment] to [Builder.body]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBody(body: IndividualOrEmployment) = apply { + this.body = (this.body ?: mutableListOf()).apply { add(body) } + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [SandboxDirectoryCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): SandboxDirectoryCreateParams = + SandboxDirectoryCreateParams( + body?.toImmutable(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + @JvmSynthetic internal fun _body(): Optional> = Optional.ofNullable(body) @@ -48,87 +202,48 @@ private constructor( override fun _queryParams(): QueryParams = additionalQueryParams - @NoAutoDetect class IndividualOrEmployment @JsonCreator private constructor( - @JsonProperty("class_code") - @ExcludeMissing - private val classCode: JsonField = JsonMissing.of(), + @JsonProperty("class_code") @ExcludeMissing private val classCode: JsonField, @JsonProperty("custom_fields") @ExcludeMissing - private val customFields: JsonField> = JsonMissing.of(), - @JsonProperty("department") - @ExcludeMissing - private val department: JsonField = JsonMissing.of(), - @JsonProperty("dob") @ExcludeMissing private val dob: JsonField = JsonMissing.of(), - @JsonProperty("emails") - @ExcludeMissing - private val emails: JsonField> = JsonMissing.of(), - @JsonProperty("employment") - @ExcludeMissing - private val employment: JsonField = JsonMissing.of(), + private val customFields: JsonField>, + @JsonProperty("department") @ExcludeMissing private val department: JsonField, + @JsonProperty("dob") @ExcludeMissing private val dob: JsonField, + @JsonProperty("emails") @ExcludeMissing private val emails: JsonField>, + @JsonProperty("employment") @ExcludeMissing private val employment: JsonField, @JsonProperty("employment_status") @ExcludeMissing - private val employmentStatus: JsonField = JsonMissing.of(), - @JsonProperty("encrypted_ssn") - @ExcludeMissing - private val encryptedSsn: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("ethnicity") - @ExcludeMissing - private val ethnicity: JsonField = JsonMissing.of(), - @JsonProperty("first_name") - @ExcludeMissing - private val firstName: JsonField = JsonMissing.of(), - @JsonProperty("gender") - @ExcludeMissing - private val gender: JsonField = JsonMissing.of(), - @JsonProperty("income") - @ExcludeMissing - private val income: JsonField = JsonMissing.of(), + private val employmentStatus: JsonField, + @JsonProperty("encrypted_ssn") @ExcludeMissing private val encryptedSsn: JsonField, + @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField, + @JsonProperty("ethnicity") @ExcludeMissing private val ethnicity: JsonField, + @JsonProperty("first_name") @ExcludeMissing private val firstName: JsonField, + @JsonProperty("gender") @ExcludeMissing private val gender: JsonField, + @JsonProperty("income") @ExcludeMissing private val income: JsonField, @JsonProperty("income_history") @ExcludeMissing - private val incomeHistory: JsonField> = JsonMissing.of(), - @JsonProperty("is_active") - @ExcludeMissing - private val isActive: JsonField = JsonMissing.of(), - @JsonProperty("last_name") - @ExcludeMissing - private val lastName: JsonField = JsonMissing.of(), + private val incomeHistory: JsonField>, + @JsonProperty("is_active") @ExcludeMissing private val isActive: JsonField, + @JsonProperty("last_name") @ExcludeMissing private val lastName: JsonField, @JsonProperty("latest_rehire_date") @ExcludeMissing - private val latestRehireDate: JsonField = JsonMissing.of(), - @JsonProperty("location") - @ExcludeMissing - private val location: JsonField = JsonMissing.of(), - @JsonProperty("manager") - @ExcludeMissing - private val manager: JsonField = JsonMissing.of(), - @JsonProperty("middle_name") - @ExcludeMissing - private val middleName: JsonField = JsonMissing.of(), + private val latestRehireDate: JsonField, + @JsonProperty("location") @ExcludeMissing private val location: JsonField, + @JsonProperty("manager") @ExcludeMissing private val manager: JsonField, + @JsonProperty("middle_name") @ExcludeMissing private val middleName: JsonField, @JsonProperty("phone_numbers") @ExcludeMissing - private val phoneNumbers: JsonField> = JsonMissing.of(), + private val phoneNumbers: JsonField>, @JsonProperty("preferred_name") @ExcludeMissing - private val preferredName: JsonField = JsonMissing.of(), - @JsonProperty("residence") - @ExcludeMissing - private val residence: JsonField = JsonMissing.of(), - @JsonProperty("source_id") - @ExcludeMissing - private val sourceId: JsonField = JsonMissing.of(), - @JsonProperty("ssn") @ExcludeMissing private val ssn: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("title") - @ExcludeMissing - private val title: JsonField = JsonMissing.of(), + private val preferredName: JsonField, + @JsonProperty("residence") @ExcludeMissing private val residence: JsonField, + @JsonProperty("source_id") @ExcludeMissing private val sourceId: JsonField, + @JsonProperty("ssn") @ExcludeMissing private val ssn: JsonField, + @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField, + @JsonProperty("title") @ExcludeMissing private val title: JsonField, ) { /** @@ -568,43 +683,6 @@ private constructor( */ @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title - private var validated: Boolean = false - - fun validate(): IndividualOrEmployment = apply { - if (validated) { - return@apply - } - - classCode() - customFields().ifPresent { it.forEach { it.validate() } } - department().ifPresent { it.validate() } - dob() - emails().ifPresent { it.forEach { it.validate() } } - employment().ifPresent { it.validate() } - employmentStatus() - encryptedSsn() - endDate() - ethnicity() - firstName() - gender() - income().ifPresent { it.validate() } - incomeHistory().ifPresent { it.forEach { it?.validate() } } - isActive() - lastName() - latestRehireDate() - location().ifPresent { it.validate() } - manager().ifPresent { it.validate() } - middleName() - phoneNumbers().ifPresent { it.forEach { it?.validate() } } - preferredName() - residence().ifPresent { it.validate() } - sourceId() - ssn() - startDate() - title() - validated = true - } - fun toBuilder() = Builder().from(this) companion object { @@ -1212,18 +1290,56 @@ private constructor( ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): IndividualOrEmployment = apply { + if (validated) { + return@apply + } + + classCode() + customFields().ifPresent { it.forEach { it.validate() } } + department().ifPresent { it.validate() } + dob() + emails().ifPresent { it.forEach { it.validate() } } + employment().ifPresent { it.validate() } + employmentStatus() + encryptedSsn() + endDate() + ethnicity() + firstName() + gender() + income().ifPresent { it.validate() } + incomeHistory().ifPresent { it.forEach { it?.validate() } } + isActive() + lastName() + latestRehireDate() + location().ifPresent { it.validate() } + manager().ifPresent { it.validate() } + middleName() + phoneNumbers().ifPresent { it.forEach { it?.validate() } } + preferredName() + residence().ifPresent { it.validate() } + sourceId() + ssn() + startDate() + title() + validated = true + } + class CustomField - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("value") @ExcludeMissing private val value: JsonValue = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val name: JsonField, + private val value: JsonValue, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonValue = JsonMissing.of(), + ) : this(name, value, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -1239,20 +1355,15 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): CustomField = apply { - if (validated) { - return@apply - } - - name() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1320,7 +1431,18 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): CustomField = - CustomField(name, value, additionalProperties.toImmutable()) + CustomField(name, value, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): CustomField = apply { + if (validated) { + return@apply + } + + name() + validated = true } override fun equals(other: Any?): Boolean { @@ -1342,17 +1464,17 @@ private constructor( } /** The department object. */ - @NoAutoDetect class Department - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val name: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of() + ) : this(name, mutableMapOf()) + /** * The name of the department associated with the individual. * @@ -1368,20 +1490,15 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Department = apply { - if (validated) { - return@apply - } - - name() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1445,7 +1562,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Department = Department(name, additionalProperties.toImmutable()) + fun build(): Department = Department(name, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Department = apply { + if (validated) { + return@apply + } + + name() + validated = true } override fun equals(other: Any?): Boolean { @@ -1466,20 +1594,19 @@ private constructor( "Department{name=$name, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Email - @JsonCreator private constructor( - @JsonProperty("data") - @ExcludeMissing - private val data: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val data: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(data, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -1506,21 +1633,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Email = apply { - if (validated) { - return@apply - } - - data() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1591,12 +1712,24 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - /** - * Returns an immutable instance of [Email]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Email = Email(data, type, additionalProperties.toImmutable()) + /** + * Returns an immutable instance of [Email]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Email = Email(data, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Email = apply { + if (validated) { + return@apply + } + + data() + type() + validated = true } class Type @JsonCreator private constructor(private val value: JsonField) : @@ -1721,20 +1854,21 @@ private constructor( } /** The employment object. */ - @NoAutoDetect class Employment - @JsonCreator private constructor( - @JsonProperty("subtype") - @ExcludeMissing - private val subtype: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val subtype: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("subtype") + @ExcludeMissing + subtype: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(subtype, type, mutableMapOf()) + /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, * `intern`, `temp`, `seasonal` and `individual_contractor`. @@ -1766,21 +1900,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Employment = apply { - if (validated) { - return@apply - } - - subtype() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1865,7 +1993,19 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Employment = - Employment(subtype, type, additionalProperties.toImmutable()) + Employment(subtype, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Employment = apply { + if (validated) { + return@apply + } + + subtype() + type() + validated = true } /** @@ -2518,17 +2658,17 @@ private constructor( } /** The manager object representing the manager of the individual within the org. */ - @NoAutoDetect class Manager - @JsonCreator private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of() + ) : this(id, mutableMapOf()) + /** * A stable Finch `id` (UUID v4) for an individual in the company. * @@ -2544,20 +2684,15 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Manager = apply { - if (validated) { - return@apply - } - - id() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2618,7 +2753,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Manager = Manager(id, additionalProperties.toImmutable()) + fun build(): Manager = Manager(id, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Manager = apply { + if (validated) { + return@apply + } + + id() + validated = true } override fun equals(other: Any?): Boolean { @@ -2638,20 +2784,19 @@ private constructor( override fun toString() = "Manager{id=$id, additionalProperties=$additionalProperties}" } - @NoAutoDetect class PhoneNumber - @JsonCreator private constructor( - @JsonProperty("data") - @ExcludeMissing - private val data: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val data: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(data, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -2678,21 +2823,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PhoneNumber = apply { - if (validated) { - return@apply - } - - data() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2769,7 +2908,19 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PhoneNumber = - PhoneNumber(data, type, additionalProperties.toImmutable()) + PhoneNumber(data, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): PhoneNumber = apply { + if (validated) { + return@apply + } + + data() + type() + validated = true } class Type @JsonCreator private constructor(private val value: JsonField) : @@ -2911,162 +3062,6 @@ private constructor( "IndividualOrEmployment{classCode=$classCode, customFields=$customFields, department=$department, dob=$dob, emails=$emails, employment=$employment, employmentStatus=$employmentStatus, encryptedSsn=$encryptedSsn, endDate=$endDate, ethnicity=$ethnicity, firstName=$firstName, gender=$gender, income=$income, incomeHistory=$incomeHistory, isActive=$isActive, lastName=$lastName, latestRehireDate=$latestRehireDate, location=$location, manager=$manager, middleName=$middleName, phoneNumbers=$phoneNumbers, preferredName=$preferredName, residence=$residence, sourceId=$sourceId, ssn=$ssn, startDate=$startDate, title=$title}" } - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): SandboxDirectoryCreateParams = builder().build() - - /** - * Returns a mutable builder for constructing an instance of [SandboxDirectoryCreateParams]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SandboxDirectoryCreateParams]. */ - @NoAutoDetect - class Builder internal constructor() { - - private var body: MutableList? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(sandboxDirectoryCreateParams: SandboxDirectoryCreateParams) = apply { - body = sandboxDirectoryCreateParams.body?.toMutableList() - additionalHeaders = sandboxDirectoryCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = sandboxDirectoryCreateParams.additionalQueryParams.toBuilder() - } - - /** - * Array of individuals to create. Takes all combined fields from `/individual` and - * `/employment` endpoints. All fields are optional. - */ - fun body(body: List?) = apply { this.body = body?.toMutableList() } - - /** Alias for calling [Builder.body] with `body.orElse(null)`. */ - fun body(body: Optional>) = body(body.getOrNull()) - - /** - * Adds a single [IndividualOrEmployment] to [Builder.body]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addBody(body: IndividualOrEmployment) = apply { - this.body = (this.body ?: mutableListOf()).apply { add(body) } - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [SandboxDirectoryCreateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): SandboxDirectoryCreateParams = - SandboxDirectoryCreateParams( - body?.toImmutable(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt index 9a95da3a..23ee8da9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt @@ -11,15 +11,14 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap 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 @@ -308,1329 +307,1366 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): EmploymentWithoutId = body + fun toBuilder() = Builder().from(this) - fun _pathParam(index: Int): String = - when (index) { - 0 -> individualId - else -> "" + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [SandboxEmploymentUpdateParams]. + * + * The following fields are required: + * ```java + * .individualId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SandboxEmploymentUpdateParams]. */ + class Builder internal constructor() { + + private var individualId: String? = null + private var body: EmploymentWithoutId.Builder = EmploymentWithoutId.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(sandboxEmploymentUpdateParams: SandboxEmploymentUpdateParams) = apply { + individualId = sandboxEmploymentUpdateParams.individualId + body = sandboxEmploymentUpdateParams.body.toBuilder() + additionalHeaders = sandboxEmploymentUpdateParams.additionalHeaders.toBuilder() + additionalQueryParams = sandboxEmploymentUpdateParams.additionalQueryParams.toBuilder() } - override fun _headers(): Headers = additionalHeaders + fun individualId(individualId: String) = apply { this.individualId = individualId } - override fun _queryParams(): QueryParams = additionalQueryParams + /** Worker's compensation classification code for this employee */ + fun classCode(classCode: String?) = apply { body.classCode(classCode) } - @NoAutoDetect - class EmploymentWithoutId - @JsonCreator - private constructor( - @JsonProperty("class_code") - @ExcludeMissing - private val classCode: JsonField = JsonMissing.of(), - @JsonProperty("custom_fields") - @ExcludeMissing - private val customFields: JsonField> = JsonMissing.of(), - @JsonProperty("department") - @ExcludeMissing - private val department: JsonField = JsonMissing.of(), - @JsonProperty("employment") - @ExcludeMissing - private val employment: JsonField = JsonMissing.of(), - @JsonProperty("employment_status") - @ExcludeMissing - private val employmentStatus: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("first_name") - @ExcludeMissing - private val firstName: JsonField = JsonMissing.of(), - @JsonProperty("income") - @ExcludeMissing - private val income: JsonField = JsonMissing.of(), - @JsonProperty("income_history") - @ExcludeMissing - private val incomeHistory: JsonField> = JsonMissing.of(), - @JsonProperty("is_active") - @ExcludeMissing - private val isActive: JsonField = JsonMissing.of(), - @JsonProperty("last_name") - @ExcludeMissing - private val lastName: JsonField = JsonMissing.of(), - @JsonProperty("latest_rehire_date") - @ExcludeMissing - private val latestRehireDate: JsonField = JsonMissing.of(), - @JsonProperty("location") - @ExcludeMissing - private val location: JsonField = JsonMissing.of(), - @JsonProperty("manager") - @ExcludeMissing - private val manager: JsonField = JsonMissing.of(), - @JsonProperty("middle_name") - @ExcludeMissing - private val middleName: JsonField = JsonMissing.of(), - @JsonProperty("source_id") - @ExcludeMissing - private val sourceId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("title") - @ExcludeMissing - private val title: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** Alias for calling [Builder.classCode] with `classCode.orElse(null)`. */ + fun classCode(classCode: Optional) = classCode(classCode.getOrNull()) /** - * Worker's compensation classification code for this employee + * Sets [Builder.classCode] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.classCode] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun classCode(): Optional = Optional.ofNullable(classCode.getNullable("class_code")) + fun classCode(classCode: JsonField) = apply { body.classCode(classCode) } /** * Custom fields for the individual. These are fields which are defined by the employer in * the system. Custom fields are not currently supported for assisted connections. - * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). */ - fun customFields(): Optional> = - Optional.ofNullable(customFields.getNullable("custom_fields")) + fun customFields(customFields: List) = apply { + body.customFields(customFields) + } /** - * The department object. + * Sets [Builder.customFields] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.customFields] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun department(): Optional = - Optional.ofNullable(department.getNullable("department")) + fun customFields(customFields: JsonField>) = apply { + body.customFields(customFields) + } /** - * The employment object. + * Adds a single [CustomField] to [customFields]. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws IllegalStateException if the field was previously set to a non-list. */ - fun employment(): Optional = - Optional.ofNullable(employment.getNullable("employment")) + fun addCustomField(customField: CustomField) = apply { body.addCustomField(customField) } - /** - * The detailed employment status of the individual. - * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun employmentStatus(): Optional = - Optional.ofNullable(employmentStatus.getNullable("employment_status")) + /** The department object. */ + fun department(department: Department?) = apply { body.department(department) } - /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** Alias for calling [Builder.department] with `department.orElse(null)`. */ + fun department(department: Optional) = department(department.getOrNull()) /** - * The legal first name of the individual. + * Sets [Builder.department] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.department] with a well-typed [Department] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) + fun department(department: JsonField) = apply { body.department(department) } + + /** The employment object. */ + fun employment(employment: Employment?) = apply { body.employment(employment) } + + /** Alias for calling [Builder.employment] with `employment.orElse(null)`. */ + fun employment(employment: Optional) = employment(employment.getOrNull()) /** - * The employee's income as reported by the provider. This may not always be annualized - * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what - * information the provider returns. + * Sets [Builder.employment] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.employment] with a well-typed [Employment] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun income(): Optional = Optional.ofNullable(income.getNullable("income")) + fun employment(employment: JsonField) = apply { body.employment(employment) } + + /** The detailed employment status of the individual. */ + fun employmentStatus(employmentStatus: EmploymentStatus?) = apply { + body.employmentStatus(employmentStatus) + } + + /** Alias for calling [Builder.employmentStatus] with `employmentStatus.orElse(null)`. */ + fun employmentStatus(employmentStatus: Optional) = + employmentStatus(employmentStatus.getOrNull()) /** - * The array of income history. + * Sets [Builder.employmentStatus] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.employmentStatus] with a well-typed [EmploymentStatus] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun incomeHistory(): Optional> = - Optional.ofNullable(incomeHistory.getNullable("income_history")) + fun employmentStatus(employmentStatus: JsonField) = apply { + body.employmentStatus(employmentStatus) + } + + fun endDate(endDate: String?) = apply { body.endDate(endDate) } + + /** Alias for calling [Builder.endDate] with `endDate.orElse(null)`. */ + fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) /** - * `true` if the individual an an active employee or contractor at the company. + * Sets [Builder.endDate] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.endDate] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) + fun endDate(endDate: JsonField) = apply { body.endDate(endDate) } + + /** The legal first name of the individual. */ + fun firstName(firstName: String?) = apply { body.firstName(firstName) } + + /** Alias for calling [Builder.firstName] with `firstName.orElse(null)`. */ + fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) /** - * The legal last name of the individual. + * Sets [Builder.firstName] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.firstName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + fun firstName(firstName: JsonField) = apply { body.firstName(firstName) } /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * The employee's income as reported by the provider. This may not always be annualized + * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what + * information the provider returns. */ - fun latestRehireDate(): Optional = - Optional.ofNullable(latestRehireDate.getNullable("latest_rehire_date")) + fun income(income: Income?) = apply { body.income(income) } + + /** Alias for calling [Builder.income] with `income.orElse(null)`. */ + fun income(income: Optional) = income(income.getOrNull()) /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * Sets [Builder.income] to an arbitrary JSON value. + * + * You should usually call [Builder.income] with a well-typed [Income] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun location(): Optional = Optional.ofNullable(location.getNullable("location")) + fun income(income: JsonField) = apply { body.income(income) } + + /** The array of income history. */ + fun incomeHistory(incomeHistory: List?) = apply { + body.incomeHistory(incomeHistory) + } + + /** Alias for calling [Builder.incomeHistory] with `incomeHistory.orElse(null)`. */ + fun incomeHistory(incomeHistory: Optional>) = + incomeHistory(incomeHistory.getOrNull()) /** - * The manager object representing the manager of the individual within the org. + * Sets [Builder.incomeHistory] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.incomeHistory] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) + fun incomeHistory(incomeHistory: JsonField>) = apply { + body.incomeHistory(incomeHistory) + } /** - * The legal middle name of the individual. + * Adds a single [Income] to [Builder.incomeHistory]. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws IllegalStateException if the field was previously set to a non-list. */ - fun middleName(): Optional = - Optional.ofNullable(middleName.getNullable("middle_name")) + fun addIncomeHistory(incomeHistory: Income) = apply { body.addIncomeHistory(incomeHistory) } + + /** `true` if the individual an an active employee or contractor at the company. */ + fun isActive(isActive: Boolean?) = apply { body.isActive(isActive) } /** - * The source system's unique employment identifier for this individual + * Alias for [Builder.isActive]. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * This unboxed primitive overload exists for backwards compatibility. */ - fun sourceId(): Optional = Optional.ofNullable(sourceId.getNullable("source_id")) + fun isActive(isActive: Boolean) = isActive(isActive as Boolean?) - /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) + /** Alias for calling [Builder.isActive] with `isActive.orElse(null)`. */ + fun isActive(isActive: Optional) = isActive(isActive.getOrNull()) /** - * The current title of the individual. + * Sets [Builder.isActive] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.isActive] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun title(): Optional = Optional.ofNullable(title.getNullable("title")) + fun isActive(isActive: JsonField) = apply { body.isActive(isActive) } - /** - * Returns the raw JSON value of [classCode]. - * - * Unlike [classCode], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("class_code") @ExcludeMissing fun _classCode(): JsonField = classCode + /** The legal last name of the individual. */ + fun lastName(lastName: String?) = apply { body.lastName(lastName) } - /** - * Returns the raw JSON value of [customFields]. - * - * Unlike [customFields], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("custom_fields") - @ExcludeMissing - fun _customFields(): JsonField> = customFields + /** Alias for calling [Builder.lastName] with `lastName.orElse(null)`. */ + fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) /** - * Returns the raw JSON value of [department]. + * Sets [Builder.lastName] to an arbitrary JSON value. * - * Unlike [department], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.lastName] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - @JsonProperty("department") - @ExcludeMissing - fun _department(): JsonField = department + fun lastName(lastName: JsonField) = apply { body.lastName(lastName) } - /** - * Returns the raw JSON value of [employment]. - * - * Unlike [employment], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("employment") - @ExcludeMissing - fun _employment(): JsonField = employment + fun latestRehireDate(latestRehireDate: String?) = apply { + body.latestRehireDate(latestRehireDate) + } - /** - * Returns the raw JSON value of [employmentStatus]. - * - * Unlike [employmentStatus], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employment_status") - @ExcludeMissing - fun _employmentStatus(): JsonField = employmentStatus + /** Alias for calling [Builder.latestRehireDate] with `latestRehireDate.orElse(null)`. */ + fun latestRehireDate(latestRehireDate: Optional) = + latestRehireDate(latestRehireDate.getOrNull()) /** - * Returns the raw JSON value of [endDate]. + * Sets [Builder.latestRehireDate] to an arbitrary JSON value. * - * Unlike [endDate], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.latestRehireDate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate(): JsonField = endDate + fun latestRehireDate(latestRehireDate: JsonField) = apply { + body.latestRehireDate(latestRehireDate) + } - /** - * Returns the raw JSON value of [firstName]. - * - * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName + fun location(location: Location?) = apply { body.location(location) } - /** - * Returns the raw JSON value of [income]. - * - * Unlike [income], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("income") @ExcludeMissing fun _income(): JsonField = income + /** Alias for calling [Builder.location] with `location.orElse(null)`. */ + fun location(location: Optional) = location(location.getOrNull()) /** - * Returns the raw JSON value of [incomeHistory]. + * Sets [Builder.location] to an arbitrary JSON value. * - * Unlike [incomeHistory], this method doesn't throw if the JSON field has an unexpected - * type. + * You should usually call [Builder.location] with a well-typed [Location] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - @JsonProperty("income_history") - @ExcludeMissing - fun _incomeHistory(): JsonField> = incomeHistory + fun location(location: JsonField) = apply { body.location(location) } - /** - * Returns the raw JSON value of [isActive]. - * - * Unlike [isActive], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("is_active") @ExcludeMissing fun _isActive(): JsonField = isActive + /** The manager object representing the manager of the individual within the org. */ + fun manager(manager: Manager?) = apply { body.manager(manager) } - /** - * Returns the raw JSON value of [lastName]. - * - * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName + /** Alias for calling [Builder.manager] with `manager.orElse(null)`. */ + fun manager(manager: Optional) = manager(manager.getOrNull()) /** - * Returns the raw JSON value of [latestRehireDate]. + * Sets [Builder.manager] to an arbitrary JSON value. * - * Unlike [latestRehireDate], this method doesn't throw if the JSON field has an unexpected - * type. + * You should usually call [Builder.manager] with a well-typed [Manager] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - @JsonProperty("latest_rehire_date") - @ExcludeMissing - fun _latestRehireDate(): JsonField = latestRehireDate + fun manager(manager: JsonField) = apply { body.manager(manager) } - /** - * Returns the raw JSON value of [location]. - * - * Unlike [location], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("location") @ExcludeMissing fun _location(): JsonField = location + /** The legal middle name of the individual. */ + fun middleName(middleName: String?) = apply { body.middleName(middleName) } - /** - * Returns the raw JSON value of [manager]. - * - * Unlike [manager], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("manager") @ExcludeMissing fun _manager(): JsonField = manager + /** Alias for calling [Builder.middleName] with `middleName.orElse(null)`. */ + fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) /** - * Returns the raw JSON value of [middleName]. + * Sets [Builder.middleName] to an arbitrary JSON value. * - * Unlike [middleName], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.middleName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - @JsonProperty("middle_name") - @ExcludeMissing - fun _middleName(): JsonField = middleName + fun middleName(middleName: JsonField) = apply { body.middleName(middleName) } + + /** The source system's unique employment identifier for this individual */ + fun sourceId(sourceId: String) = apply { body.sourceId(sourceId) } /** - * Returns the raw JSON value of [sourceId]. + * Sets [Builder.sourceId] to an arbitrary JSON value. * - * Unlike [sourceId], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.sourceId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - @JsonProperty("source_id") @ExcludeMissing fun _sourceId(): JsonField = sourceId + fun sourceId(sourceId: JsonField) = apply { body.sourceId(sourceId) } + + fun startDate(startDate: String?) = apply { body.startDate(startDate) } + + /** Alias for calling [Builder.startDate] with `startDate.orElse(null)`. */ + fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) /** - * Returns the raw JSON value of [startDate]. + * Sets [Builder.startDate] to an arbitrary JSON value. * - * Unlike [startDate], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.startDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate(): JsonField = startDate + fun startDate(startDate: JsonField) = apply { body.startDate(startDate) } + + /** The current title of the individual. */ + fun title(title: String?) = apply { body.title(title) } + + /** Alias for calling [Builder.title] with `title.orElse(null)`. */ + fun title(title: Optional) = title(title.getOrNull()) /** - * Returns the raw JSON value of [title]. + * Sets [Builder.title] to an arbitrary JSON value. * - * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.title] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title + fun title(title: JsonField) = apply { body.title(title) } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } - private var validated: Boolean = false + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } - fun validate(): EmploymentWithoutId = apply { - if (validated) { - return@apply + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) } - classCode() - customFields().ifPresent { it.forEach { it.validate() } } - department().ifPresent { it.validate() } - employment().ifPresent { it.validate() } - employmentStatus() - endDate() - firstName() - income().ifPresent { it.validate() } - incomeHistory().ifPresent { it.forEach { it?.validate() } } - isActive() - lastName() - latestRehireDate() - location().ifPresent { it.validate() } - manager().ifPresent { it.validate() } - middleName() - sourceId() - startDate() - title() - validated = true + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) } - fun toBuilder() = Builder().from(this) + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - companion object { + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - /** Returns a mutable builder for constructing an instance of [EmploymentWithoutId]. */ - @JvmStatic fun builder() = Builder() + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - /** A builder for [EmploymentWithoutId]. */ - class Builder internal constructor() { + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } - private var classCode: JsonField = JsonMissing.of() - private var customFields: JsonField>? = null - private var department: JsonField = JsonMissing.of() - private var employment: JsonField = JsonMissing.of() - private var employmentStatus: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var firstName: JsonField = JsonMissing.of() - private var income: JsonField = JsonMissing.of() - private var incomeHistory: JsonField>? = null - private var isActive: JsonField = JsonMissing.of() - private var lastName: JsonField = JsonMissing.of() - private var latestRehireDate: JsonField = JsonMissing.of() - private var location: JsonField = JsonMissing.of() - private var manager: JsonField = JsonMissing.of() - private var middleName: JsonField = JsonMissing.of() - private var sourceId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var title: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } - @JvmSynthetic - internal fun from(employmentWithoutId: EmploymentWithoutId) = apply { - classCode = employmentWithoutId.classCode - customFields = employmentWithoutId.customFields.map { it.toMutableList() } - department = employmentWithoutId.department - employment = employmentWithoutId.employment - employmentStatus = employmentWithoutId.employmentStatus - endDate = employmentWithoutId.endDate - firstName = employmentWithoutId.firstName - income = employmentWithoutId.income - incomeHistory = employmentWithoutId.incomeHistory.map { it.toMutableList() } - isActive = employmentWithoutId.isActive - lastName = employmentWithoutId.lastName - latestRehireDate = employmentWithoutId.latestRehireDate - location = employmentWithoutId.location - manager = employmentWithoutId.manager - middleName = employmentWithoutId.middleName - sourceId = employmentWithoutId.sourceId - startDate = employmentWithoutId.startDate - title = employmentWithoutId.title - additionalProperties = employmentWithoutId.additionalProperties.toMutableMap() - } + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } - /** Worker's compensation classification code for this employee */ - fun classCode(classCode: String?) = classCode(JsonField.ofNullable(classCode)) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } - /** Alias for calling [Builder.classCode] with `classCode.orElse(null)`. */ - fun classCode(classCode: Optional) = classCode(classCode.getOrNull()) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } - /** - * Sets [Builder.classCode] to an arbitrary JSON value. - * - * You should usually call [Builder.classCode] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun classCode(classCode: JsonField) = apply { this.classCode = classCode } + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } - /** - * Custom fields for the individual. These are fields which are defined by the employer - * in the system. Custom fields are not currently supported for assisted connections. - */ - fun customFields(customFields: List) = - customFields(JsonField.of(customFields)) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } - /** - * Sets [Builder.customFields] to an arbitrary JSON value. - * - * You should usually call [Builder.customFields] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun customFields(customFields: JsonField>) = apply { - this.customFields = customFields.map { it.toMutableList() } - } + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - /** - * Adds a single [CustomField] to [customFields]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addCustomField(customField: CustomField) = apply { - customFields = - (customFields ?: JsonField.of(mutableListOf())).also { - checkKnown("customFields", it).add(customField) - } - } + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } - /** The department object. */ - fun department(department: Department?) = department(JsonField.ofNullable(department)) + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } - /** Alias for calling [Builder.department] with `department.orElse(null)`. */ - fun department(department: Optional) = department(department.getOrNull()) + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } - /** - * Sets [Builder.department] to an arbitrary JSON value. - * - * You should usually call [Builder.department] with a well-typed [Department] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun department(department: JsonField) = apply { - this.department = department - } + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } - /** The employment object. */ - fun employment(employment: Employment?) = employment(JsonField.ofNullable(employment)) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } - /** Alias for calling [Builder.employment] with `employment.orElse(null)`. */ - fun employment(employment: Optional) = employment(employment.getOrNull()) + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } - /** - * Sets [Builder.employment] to an arbitrary JSON value. - * - * You should usually call [Builder.employment] with a well-typed [Employment] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun employment(employment: JsonField) = apply { - this.employment = employment + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) } - /** The detailed employment status of the individual. */ - fun employmentStatus(employmentStatus: EmploymentStatus?) = - employmentStatus(JsonField.ofNullable(employmentStatus)) + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } - /** - * Alias for calling [Builder.employmentStatus] with `employmentStatus.orElse(null)`. - */ - fun employmentStatus(employmentStatus: Optional) = - employmentStatus(employmentStatus.getOrNull()) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } - /** - * Sets [Builder.employmentStatus] to an arbitrary JSON value. - * - * You should usually call [Builder.employmentStatus] with a well-typed - * [EmploymentStatus] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun employmentStatus(employmentStatus: JsonField) = apply { - this.employmentStatus = employmentStatus + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) } - fun endDate(endDate: String?) = endDate(JsonField.ofNullable(endDate)) + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - /** Alias for calling [Builder.endDate] with `endDate.orElse(null)`. */ - fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } - /** - * Sets [Builder.endDate] to an arbitrary JSON value. - * - * You should usually call [Builder.endDate] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** + * Returns an immutable instance of [SandboxEmploymentUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .individualId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SandboxEmploymentUpdateParams = + SandboxEmploymentUpdateParams( + checkRequired("individualId", individualId), + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } - /** The legal first name of the individual. */ - fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) + @JvmSynthetic internal fun _body(): EmploymentWithoutId = body - /** Alias for calling [Builder.firstName] with `firstName.orElse(null)`. */ - fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) + fun _pathParam(index: Int): String = + when (index) { + 0 -> individualId + else -> "" + } - /** - * Sets [Builder.firstName] to an arbitrary JSON value. - * - * You should usually call [Builder.firstName] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun firstName(firstName: JsonField) = apply { this.firstName = firstName } + override fun _headers(): Headers = additionalHeaders - /** - * The employee's income as reported by the provider. This may not always be annualized - * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what - * information the provider returns. - */ - fun income(income: Income?) = income(JsonField.ofNullable(income)) + override fun _queryParams(): QueryParams = additionalQueryParams - /** Alias for calling [Builder.income] with `income.orElse(null)`. */ - fun income(income: Optional) = income(income.getOrNull()) + class EmploymentWithoutId + private constructor( + private val classCode: JsonField, + private val customFields: JsonField>, + private val department: JsonField, + private val employment: JsonField, + private val employmentStatus: JsonField, + private val endDate: JsonField, + private val firstName: JsonField, + private val income: JsonField, + private val incomeHistory: JsonField>, + private val isActive: JsonField, + private val lastName: JsonField, + private val latestRehireDate: JsonField, + private val location: JsonField, + private val manager: JsonField, + private val middleName: JsonField, + private val sourceId: JsonField, + private val startDate: JsonField, + private val title: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * Sets [Builder.income] to an arbitrary JSON value. - * - * You should usually call [Builder.income] with a well-typed [Income] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun income(income: JsonField) = apply { this.income = income } + @JsonCreator + private constructor( + @JsonProperty("class_code") + @ExcludeMissing + classCode: JsonField = JsonMissing.of(), + @JsonProperty("custom_fields") + @ExcludeMissing + customFields: JsonField> = JsonMissing.of(), + @JsonProperty("department") + @ExcludeMissing + department: JsonField = JsonMissing.of(), + @JsonProperty("employment") + @ExcludeMissing + employment: JsonField = JsonMissing.of(), + @JsonProperty("employment_status") + @ExcludeMissing + employmentStatus: JsonField = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + firstName: JsonField = JsonMissing.of(), + @JsonProperty("income") @ExcludeMissing income: JsonField = JsonMissing.of(), + @JsonProperty("income_history") + @ExcludeMissing + incomeHistory: JsonField> = JsonMissing.of(), + @JsonProperty("is_active") + @ExcludeMissing + isActive: JsonField = JsonMissing.of(), + @JsonProperty("last_name") + @ExcludeMissing + lastName: JsonField = JsonMissing.of(), + @JsonProperty("latest_rehire_date") + @ExcludeMissing + latestRehireDate: JsonField = JsonMissing.of(), + @JsonProperty("location") + @ExcludeMissing + location: JsonField = JsonMissing.of(), + @JsonProperty("manager") @ExcludeMissing manager: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + middleName: JsonField = JsonMissing.of(), + @JsonProperty("source_id") + @ExcludeMissing + sourceId: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + startDate: JsonField = JsonMissing.of(), + @JsonProperty("title") @ExcludeMissing title: JsonField = JsonMissing.of(), + ) : this( + classCode, + customFields, + department, + employment, + employmentStatus, + endDate, + firstName, + income, + incomeHistory, + isActive, + lastName, + latestRehireDate, + location, + manager, + middleName, + sourceId, + startDate, + title, + mutableMapOf(), + ) - /** The array of income history. */ - fun incomeHistory(incomeHistory: List?) = - incomeHistory(JsonField.ofNullable(incomeHistory)) + /** + * Worker's compensation classification code for this employee + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun classCode(): Optional = Optional.ofNullable(classCode.getNullable("class_code")) - /** Alias for calling [Builder.incomeHistory] with `incomeHistory.orElse(null)`. */ - fun incomeHistory(incomeHistory: Optional>) = - incomeHistory(incomeHistory.getOrNull()) - - /** - * Sets [Builder.incomeHistory] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeHistory] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun incomeHistory(incomeHistory: JsonField>) = apply { - this.incomeHistory = incomeHistory.map { it.toMutableList() } - } - - /** - * Adds a single [Income] to [Builder.incomeHistory]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addIncomeHistory(incomeHistory: Income) = apply { - this.incomeHistory = - (this.incomeHistory ?: JsonField.of(mutableListOf())).also { - checkKnown("incomeHistory", it).add(incomeHistory) - } - } - - /** `true` if the individual an an active employee or contractor at the company. */ - fun isActive(isActive: Boolean?) = isActive(JsonField.ofNullable(isActive)) - - /** - * Alias for [Builder.isActive]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun isActive(isActive: Boolean) = isActive(isActive as Boolean?) - - /** Alias for calling [Builder.isActive] with `isActive.orElse(null)`. */ - fun isActive(isActive: Optional) = isActive(isActive.getOrNull()) - - /** - * Sets [Builder.isActive] to an arbitrary JSON value. - * - * You should usually call [Builder.isActive] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun isActive(isActive: JsonField) = apply { this.isActive = isActive } - - /** The legal last name of the individual. */ - fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) - - /** Alias for calling [Builder.lastName] with `lastName.orElse(null)`. */ - fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) - - /** - * Sets [Builder.lastName] to an arbitrary JSON value. - * - * You should usually call [Builder.lastName] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun lastName(lastName: JsonField) = apply { this.lastName = lastName } - - fun latestRehireDate(latestRehireDate: String?) = - latestRehireDate(JsonField.ofNullable(latestRehireDate)) - - /** - * Alias for calling [Builder.latestRehireDate] with `latestRehireDate.orElse(null)`. - */ - fun latestRehireDate(latestRehireDate: Optional) = - latestRehireDate(latestRehireDate.getOrNull()) - - /** - * Sets [Builder.latestRehireDate] to an arbitrary JSON value. - * - * You should usually call [Builder.latestRehireDate] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun latestRehireDate(latestRehireDate: JsonField) = apply { - this.latestRehireDate = latestRehireDate - } - - fun location(location: Location?) = location(JsonField.ofNullable(location)) - - /** Alias for calling [Builder.location] with `location.orElse(null)`. */ - fun location(location: Optional) = location(location.getOrNull()) - - /** - * Sets [Builder.location] to an arbitrary JSON value. - * - * You should usually call [Builder.location] with a well-typed [Location] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun location(location: JsonField) = apply { this.location = location } - - /** The manager object representing the manager of the individual within the org. */ - fun manager(manager: Manager?) = manager(JsonField.ofNullable(manager)) - - /** Alias for calling [Builder.manager] with `manager.orElse(null)`. */ - fun manager(manager: Optional) = manager(manager.getOrNull()) - - /** - * Sets [Builder.manager] to an arbitrary JSON value. - * - * You should usually call [Builder.manager] with a well-typed [Manager] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun manager(manager: JsonField) = apply { this.manager = manager } - - /** The legal middle name of the individual. */ - fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) - - /** Alias for calling [Builder.middleName] with `middleName.orElse(null)`. */ - fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) - - /** - * Sets [Builder.middleName] to an arbitrary JSON value. - * - * You should usually call [Builder.middleName] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun middleName(middleName: JsonField) = apply { this.middleName = middleName } - - /** The source system's unique employment identifier for this individual */ - fun sourceId(sourceId: String) = sourceId(JsonField.of(sourceId)) - - /** - * Sets [Builder.sourceId] to an arbitrary JSON value. - * - * You should usually call [Builder.sourceId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun sourceId(sourceId: JsonField) = apply { this.sourceId = sourceId } - - fun startDate(startDate: String?) = startDate(JsonField.ofNullable(startDate)) - - /** Alias for calling [Builder.startDate] with `startDate.orElse(null)`. */ - fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) - - /** - * Sets [Builder.startDate] to an arbitrary JSON value. - * - * You should usually call [Builder.startDate] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - - /** The current title of the individual. */ - fun title(title: String?) = title(JsonField.ofNullable(title)) - - /** Alias for calling [Builder.title] with `title.orElse(null)`. */ - fun title(title: Optional) = title(title.getOrNull()) - - /** - * Sets [Builder.title] to an arbitrary JSON value. - * - * You should usually call [Builder.title] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun title(title: JsonField) = apply { this.title = title } - - 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 [EmploymentWithoutId]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): EmploymentWithoutId = - EmploymentWithoutId( - classCode, - (customFields ?: JsonMissing.of()).map { it.toImmutable() }, - department, - employment, - employmentStatus, - endDate, - firstName, - income, - (incomeHistory ?: JsonMissing.of()).map { it.toImmutable() }, - isActive, - lastName, - latestRehireDate, - location, - manager, - middleName, - sourceId, - startDate, - title, - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Custom fields for the individual. These are fields which are defined by the employer in + * the system. Custom fields are not currently supported for assisted connections. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun customFields(): Optional> = + Optional.ofNullable(customFields.getNullable("custom_fields")) - return /* spotless:off */ other is EmploymentWithoutId && classCode == other.classCode && customFields == other.customFields && department == other.department && employment == other.employment && employmentStatus == other.employmentStatus && endDate == other.endDate && firstName == other.firstName && income == other.income && incomeHistory == other.incomeHistory && isActive == other.isActive && lastName == other.lastName && latestRehireDate == other.latestRehireDate && location == other.location && manager == other.manager && middleName == other.middleName && sourceId == other.sourceId && startDate == other.startDate && title == other.title && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * The department object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun department(): Optional = + Optional.ofNullable(department.getNullable("department")) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(classCode, customFields, department, employment, employmentStatus, endDate, firstName, income, incomeHistory, isActive, lastName, latestRehireDate, location, manager, middleName, sourceId, startDate, title, additionalProperties) } - /* spotless:on */ + /** + * The employment object. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun employment(): Optional = + Optional.ofNullable(employment.getNullable("employment")) - override fun hashCode(): Int = hashCode + /** + * The detailed employment status of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun employmentStatus(): Optional = + Optional.ofNullable(employmentStatus.getNullable("employment_status")) - override fun toString() = - "EmploymentWithoutId{classCode=$classCode, customFields=$customFields, department=$department, employment=$employment, employmentStatus=$employmentStatus, endDate=$endDate, firstName=$firstName, income=$income, incomeHistory=$incomeHistory, isActive=$isActive, lastName=$lastName, latestRehireDate=$latestRehireDate, location=$location, manager=$manager, middleName=$middleName, sourceId=$sourceId, startDate=$startDate, title=$title, additionalProperties=$additionalProperties}" - } + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun toBuilder() = Builder().from(this) + /** + * The legal first name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) - companion object { + /** + * The employee's income as reported by the provider. This may not always be annualized + * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what + * information the provider returns. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun income(): Optional = Optional.ofNullable(income.getNullable("income")) /** - * Returns a mutable builder for constructing an instance of - * [SandboxEmploymentUpdateParams]. + * The array of income history. * - * The following fields are required: - * ```java - * .individualId() - * ``` + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - @JvmStatic fun builder() = Builder() - } + fun incomeHistory(): Optional> = + Optional.ofNullable(incomeHistory.getNullable("income_history")) - /** A builder for [SandboxEmploymentUpdateParams]. */ - @NoAutoDetect - class Builder internal constructor() { + /** + * `true` if the individual an an active employee or contractor at the company. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) - private var individualId: String? = null - private var body: EmploymentWithoutId.Builder = EmploymentWithoutId.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + /** + * The legal last name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) - @JvmSynthetic - internal fun from(sandboxEmploymentUpdateParams: SandboxEmploymentUpdateParams) = apply { - individualId = sandboxEmploymentUpdateParams.individualId - body = sandboxEmploymentUpdateParams.body.toBuilder() - additionalHeaders = sandboxEmploymentUpdateParams.additionalHeaders.toBuilder() - additionalQueryParams = sandboxEmploymentUpdateParams.additionalQueryParams.toBuilder() - } + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun latestRehireDate(): Optional = + Optional.ofNullable(latestRehireDate.getNullable("latest_rehire_date")) - fun individualId(individualId: String) = apply { this.individualId = individualId } + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun location(): Optional = Optional.ofNullable(location.getNullable("location")) - /** Worker's compensation classification code for this employee */ - fun classCode(classCode: String?) = apply { body.classCode(classCode) } + /** + * The manager object representing the manager of the individual within the org. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) - /** Alias for calling [Builder.classCode] with `classCode.orElse(null)`. */ - fun classCode(classCode: Optional) = classCode(classCode.getOrNull()) + /** + * The legal middle name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun middleName(): Optional = + Optional.ofNullable(middleName.getNullable("middle_name")) /** - * Sets [Builder.classCode] to an arbitrary JSON value. + * The source system's unique employment identifier for this individual * - * You should usually call [Builder.classCode] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun classCode(classCode: JsonField) = apply { body.classCode(classCode) } + fun sourceId(): Optional = Optional.ofNullable(sourceId.getNullable("source_id")) /** - * Custom fields for the individual. These are fields which are defined by the employer in - * the system. Custom fields are not currently supported for assisted connections. + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun customFields(customFields: List) = apply { - body.customFields(customFields) - } + fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) /** - * Sets [Builder.customFields] to an arbitrary JSON value. + * The current title of the individual. * - * You should usually call [Builder.customFields] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun customFields(customFields: JsonField>) = apply { - body.customFields(customFields) - } + fun title(): Optional = Optional.ofNullable(title.getNullable("title")) /** - * Adds a single [CustomField] to [customFields]. + * Returns the raw JSON value of [classCode]. * - * @throws IllegalStateException if the field was previously set to a non-list. + * Unlike [classCode], this method doesn't throw if the JSON field has an unexpected type. */ - fun addCustomField(customField: CustomField) = apply { body.addCustomField(customField) } - - /** The department object. */ - fun department(department: Department?) = apply { body.department(department) } - - /** Alias for calling [Builder.department] with `department.orElse(null)`. */ - fun department(department: Optional) = department(department.getOrNull()) + @JsonProperty("class_code") @ExcludeMissing fun _classCode(): JsonField = classCode /** - * Sets [Builder.department] to an arbitrary JSON value. + * Returns the raw JSON value of [customFields]. * - * You should usually call [Builder.department] with a well-typed [Department] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * Unlike [customFields], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun department(department: JsonField) = apply { body.department(department) } - - /** The employment object. */ - fun employment(employment: Employment?) = apply { body.employment(employment) } - - /** Alias for calling [Builder.employment] with `employment.orElse(null)`. */ - fun employment(employment: Optional) = employment(employment.getOrNull()) + @JsonProperty("custom_fields") + @ExcludeMissing + fun _customFields(): JsonField> = customFields /** - * Sets [Builder.employment] to an arbitrary JSON value. + * Returns the raw JSON value of [department]. * - * You should usually call [Builder.employment] with a well-typed [Employment] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * Unlike [department], this method doesn't throw if the JSON field has an unexpected type. */ - fun employment(employment: JsonField) = apply { body.employment(employment) } - - /** The detailed employment status of the individual. */ - fun employmentStatus(employmentStatus: EmploymentStatus?) = apply { - body.employmentStatus(employmentStatus) - } - - /** Alias for calling [Builder.employmentStatus] with `employmentStatus.orElse(null)`. */ - fun employmentStatus(employmentStatus: Optional) = - employmentStatus(employmentStatus.getOrNull()) + @JsonProperty("department") + @ExcludeMissing + fun _department(): JsonField = department /** - * Sets [Builder.employmentStatus] to an arbitrary JSON value. + * Returns the raw JSON value of [employment]. * - * You should usually call [Builder.employmentStatus] with a well-typed [EmploymentStatus] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * Unlike [employment], this method doesn't throw if the JSON field has an unexpected type. */ - fun employmentStatus(employmentStatus: JsonField) = apply { - body.employmentStatus(employmentStatus) - } - - fun endDate(endDate: String?) = apply { body.endDate(endDate) } - - /** Alias for calling [Builder.endDate] with `endDate.orElse(null)`. */ - fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) + @JsonProperty("employment") + @ExcludeMissing + fun _employment(): JsonField = employment /** - * Sets [Builder.endDate] to an arbitrary JSON value. + * Returns the raw JSON value of [employmentStatus]. * - * You should usually call [Builder.endDate] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * Unlike [employmentStatus], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun endDate(endDate: JsonField) = apply { body.endDate(endDate) } + @JsonProperty("employment_status") + @ExcludeMissing + fun _employmentStatus(): JsonField = employmentStatus - /** The legal first name of the individual. */ - fun firstName(firstName: String?) = apply { body.firstName(firstName) } + /** + * Returns the raw JSON value of [endDate]. + * + * Unlike [endDate], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate(): JsonField = endDate - /** Alias for calling [Builder.firstName] with `firstName.orElse(null)`. */ - fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) + /** + * Returns the raw JSON value of [firstName]. + * + * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName /** - * Sets [Builder.firstName] to an arbitrary JSON value. + * Returns the raw JSON value of [income]. * - * You should usually call [Builder.firstName] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * Unlike [income], this method doesn't throw if the JSON field has an unexpected type. */ - fun firstName(firstName: JsonField) = apply { body.firstName(firstName) } + @JsonProperty("income") @ExcludeMissing fun _income(): JsonField = income /** - * The employee's income as reported by the provider. This may not always be annualized - * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what - * information the provider returns. + * Returns the raw JSON value of [incomeHistory]. + * + * Unlike [incomeHistory], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun income(income: Income?) = apply { body.income(income) } + @JsonProperty("income_history") + @ExcludeMissing + fun _incomeHistory(): JsonField> = incomeHistory - /** Alias for calling [Builder.income] with `income.orElse(null)`. */ - fun income(income: Optional) = income(income.getOrNull()) + /** + * Returns the raw JSON value of [isActive]. + * + * Unlike [isActive], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("is_active") @ExcludeMissing fun _isActive(): JsonField = isActive /** - * Sets [Builder.income] to an arbitrary JSON value. + * Returns the raw JSON value of [lastName]. * - * You should usually call [Builder.income] with a well-typed [Income] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected type. */ - fun income(income: JsonField) = apply { body.income(income) } + @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName - /** The array of income history. */ - fun incomeHistory(incomeHistory: List?) = apply { - body.incomeHistory(incomeHistory) - } + /** + * Returns the raw JSON value of [latestRehireDate]. + * + * Unlike [latestRehireDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("latest_rehire_date") + @ExcludeMissing + fun _latestRehireDate(): JsonField = latestRehireDate - /** Alias for calling [Builder.incomeHistory] with `incomeHistory.orElse(null)`. */ - fun incomeHistory(incomeHistory: Optional>) = - incomeHistory(incomeHistory.getOrNull()) + /** + * Returns the raw JSON value of [location]. + * + * Unlike [location], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("location") @ExcludeMissing fun _location(): JsonField = location /** - * Sets [Builder.incomeHistory] to an arbitrary JSON value. + * Returns the raw JSON value of [manager]. * - * You should usually call [Builder.incomeHistory] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * Unlike [manager], this method doesn't throw if the JSON field has an unexpected type. */ - fun incomeHistory(incomeHistory: JsonField>) = apply { - body.incomeHistory(incomeHistory) - } + @JsonProperty("manager") @ExcludeMissing fun _manager(): JsonField = manager /** - * Adds a single [Income] to [Builder.incomeHistory]. + * Returns the raw JSON value of [middleName]. * - * @throws IllegalStateException if the field was previously set to a non-list. + * Unlike [middleName], this method doesn't throw if the JSON field has an unexpected type. */ - fun addIncomeHistory(incomeHistory: Income) = apply { body.addIncomeHistory(incomeHistory) } - - /** `true` if the individual an an active employee or contractor at the company. */ - fun isActive(isActive: Boolean?) = apply { body.isActive(isActive) } + @JsonProperty("middle_name") + @ExcludeMissing + fun _middleName(): JsonField = middleName /** - * Alias for [Builder.isActive]. + * Returns the raw JSON value of [sourceId]. * - * This unboxed primitive overload exists for backwards compatibility. + * Unlike [sourceId], this method doesn't throw if the JSON field has an unexpected type. */ - fun isActive(isActive: Boolean) = isActive(isActive as Boolean?) - - /** Alias for calling [Builder.isActive] with `isActive.orElse(null)`. */ - fun isActive(isActive: Optional) = isActive(isActive.getOrNull()) + @JsonProperty("source_id") @ExcludeMissing fun _sourceId(): JsonField = sourceId /** - * Sets [Builder.isActive] to an arbitrary JSON value. + * Returns the raw JSON value of [startDate]. * - * You should usually call [Builder.isActive] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * Unlike [startDate], this method doesn't throw if the JSON field has an unexpected type. */ - fun isActive(isActive: JsonField) = apply { body.isActive(isActive) } - - /** The legal last name of the individual. */ - fun lastName(lastName: String?) = apply { body.lastName(lastName) } - - /** Alias for calling [Builder.lastName] with `lastName.orElse(null)`. */ - fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) + @JsonProperty("start_date") @ExcludeMissing fun _startDate(): JsonField = startDate /** - * Sets [Builder.lastName] to an arbitrary JSON value. + * Returns the raw JSON value of [title]. * - * You should usually call [Builder.lastName] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. */ - fun lastName(lastName: JsonField) = apply { body.lastName(lastName) } + @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title - fun latestRehireDate(latestRehireDate: String?) = apply { - body.latestRehireDate(latestRehireDate) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } - /** Alias for calling [Builder.latestRehireDate] with `latestRehireDate.orElse(null)`. */ - fun latestRehireDate(latestRehireDate: Optional) = - latestRehireDate(latestRehireDate.getOrNull()) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * Sets [Builder.latestRehireDate] to an arbitrary JSON value. - * - * You should usually call [Builder.latestRehireDate] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun latestRehireDate(latestRehireDate: JsonField) = apply { - body.latestRehireDate(latestRehireDate) + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [EmploymentWithoutId]. */ + @JvmStatic fun builder() = Builder() } - fun location(location: Location?) = apply { body.location(location) } + /** A builder for [EmploymentWithoutId]. */ + class Builder internal constructor() { + + private var classCode: JsonField = JsonMissing.of() + private var customFields: JsonField>? = null + private var department: JsonField = JsonMissing.of() + private var employment: JsonField = JsonMissing.of() + private var employmentStatus: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var firstName: JsonField = JsonMissing.of() + private var income: JsonField = JsonMissing.of() + private var incomeHistory: JsonField>? = null + private var isActive: JsonField = JsonMissing.of() + private var lastName: JsonField = JsonMissing.of() + private var latestRehireDate: JsonField = JsonMissing.of() + private var location: JsonField = JsonMissing.of() + private var manager: JsonField = JsonMissing.of() + private var middleName: JsonField = JsonMissing.of() + private var sourceId: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var title: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(employmentWithoutId: EmploymentWithoutId) = apply { + classCode = employmentWithoutId.classCode + customFields = employmentWithoutId.customFields.map { it.toMutableList() } + department = employmentWithoutId.department + employment = employmentWithoutId.employment + employmentStatus = employmentWithoutId.employmentStatus + endDate = employmentWithoutId.endDate + firstName = employmentWithoutId.firstName + income = employmentWithoutId.income + incomeHistory = employmentWithoutId.incomeHistory.map { it.toMutableList() } + isActive = employmentWithoutId.isActive + lastName = employmentWithoutId.lastName + latestRehireDate = employmentWithoutId.latestRehireDate + location = employmentWithoutId.location + manager = employmentWithoutId.manager + middleName = employmentWithoutId.middleName + sourceId = employmentWithoutId.sourceId + startDate = employmentWithoutId.startDate + title = employmentWithoutId.title + additionalProperties = employmentWithoutId.additionalProperties.toMutableMap() + } + + /** Worker's compensation classification code for this employee */ + fun classCode(classCode: String?) = classCode(JsonField.ofNullable(classCode)) + + /** Alias for calling [Builder.classCode] with `classCode.orElse(null)`. */ + fun classCode(classCode: Optional) = classCode(classCode.getOrNull()) + + /** + * Sets [Builder.classCode] to an arbitrary JSON value. + * + * You should usually call [Builder.classCode] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun classCode(classCode: JsonField) = apply { this.classCode = classCode } + + /** + * Custom fields for the individual. These are fields which are defined by the employer + * in the system. Custom fields are not currently supported for assisted connections. + */ + fun customFields(customFields: List) = + customFields(JsonField.of(customFields)) + + /** + * Sets [Builder.customFields] to an arbitrary JSON value. + * + * You should usually call [Builder.customFields] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun customFields(customFields: JsonField>) = apply { + this.customFields = customFields.map { it.toMutableList() } + } + + /** + * Adds a single [CustomField] to [customFields]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addCustomField(customField: CustomField) = apply { + customFields = + (customFields ?: JsonField.of(mutableListOf())).also { + checkKnown("customFields", it).add(customField) + } + } + + /** The department object. */ + fun department(department: Department?) = department(JsonField.ofNullable(department)) + + /** Alias for calling [Builder.department] with `department.orElse(null)`. */ + fun department(department: Optional) = department(department.getOrNull()) + + /** + * Sets [Builder.department] to an arbitrary JSON value. + * + * You should usually call [Builder.department] with a well-typed [Department] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun department(department: JsonField) = apply { + this.department = department + } + + /** The employment object. */ + fun employment(employment: Employment?) = employment(JsonField.ofNullable(employment)) + + /** Alias for calling [Builder.employment] with `employment.orElse(null)`. */ + fun employment(employment: Optional) = employment(employment.getOrNull()) + + /** + * Sets [Builder.employment] to an arbitrary JSON value. + * + * You should usually call [Builder.employment] with a well-typed [Employment] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun employment(employment: JsonField) = apply { + this.employment = employment + } + + /** The detailed employment status of the individual. */ + fun employmentStatus(employmentStatus: EmploymentStatus?) = + employmentStatus(JsonField.ofNullable(employmentStatus)) + + /** + * Alias for calling [Builder.employmentStatus] with `employmentStatus.orElse(null)`. + */ + fun employmentStatus(employmentStatus: Optional) = + employmentStatus(employmentStatus.getOrNull()) + + /** + * Sets [Builder.employmentStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.employmentStatus] with a well-typed + * [EmploymentStatus] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun employmentStatus(employmentStatus: JsonField) = apply { + this.employmentStatus = employmentStatus + } + + fun endDate(endDate: String?) = endDate(JsonField.ofNullable(endDate)) + + /** Alias for calling [Builder.endDate] with `endDate.orElse(null)`. */ + fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) + + /** + * Sets [Builder.endDate] to an arbitrary JSON value. + * + * You should usually call [Builder.endDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The legal first name of the individual. */ + fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) + + /** Alias for calling [Builder.firstName] with `firstName.orElse(null)`. */ + fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) + + /** + * Sets [Builder.firstName] to an arbitrary JSON value. + * + * You should usually call [Builder.firstName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun firstName(firstName: JsonField) = apply { this.firstName = firstName } + + /** + * The employee's income as reported by the provider. This may not always be annualized + * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what + * information the provider returns. + */ + fun income(income: Income?) = income(JsonField.ofNullable(income)) + + /** Alias for calling [Builder.income] with `income.orElse(null)`. */ + fun income(income: Optional) = income(income.getOrNull()) - /** Alias for calling [Builder.location] with `location.orElse(null)`. */ - fun location(location: Optional) = location(location.getOrNull()) + /** + * Sets [Builder.income] to an arbitrary JSON value. + * + * You should usually call [Builder.income] with a well-typed [Income] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun income(income: JsonField) = apply { this.income = income } - /** - * Sets [Builder.location] to an arbitrary JSON value. - * - * You should usually call [Builder.location] with a well-typed [Location] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun location(location: JsonField) = apply { body.location(location) } + /** The array of income history. */ + fun incomeHistory(incomeHistory: List?) = + incomeHistory(JsonField.ofNullable(incomeHistory)) - /** The manager object representing the manager of the individual within the org. */ - fun manager(manager: Manager?) = apply { body.manager(manager) } + /** Alias for calling [Builder.incomeHistory] with `incomeHistory.orElse(null)`. */ + fun incomeHistory(incomeHistory: Optional>) = + incomeHistory(incomeHistory.getOrNull()) - /** Alias for calling [Builder.manager] with `manager.orElse(null)`. */ - fun manager(manager: Optional) = manager(manager.getOrNull()) + /** + * Sets [Builder.incomeHistory] to an arbitrary JSON value. + * + * You should usually call [Builder.incomeHistory] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun incomeHistory(incomeHistory: JsonField>) = apply { + this.incomeHistory = incomeHistory.map { it.toMutableList() } + } - /** - * Sets [Builder.manager] to an arbitrary JSON value. - * - * You should usually call [Builder.manager] with a well-typed [Manager] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun manager(manager: JsonField) = apply { body.manager(manager) } + /** + * Adds a single [Income] to [Builder.incomeHistory]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addIncomeHistory(incomeHistory: Income) = apply { + this.incomeHistory = + (this.incomeHistory ?: JsonField.of(mutableListOf())).also { + checkKnown("incomeHistory", it).add(incomeHistory) + } + } - /** The legal middle name of the individual. */ - fun middleName(middleName: String?) = apply { body.middleName(middleName) } + /** `true` if the individual an an active employee or contractor at the company. */ + fun isActive(isActive: Boolean?) = isActive(JsonField.ofNullable(isActive)) - /** Alias for calling [Builder.middleName] with `middleName.orElse(null)`. */ - fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) + /** + * Alias for [Builder.isActive]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun isActive(isActive: Boolean) = isActive(isActive as Boolean?) - /** - * Sets [Builder.middleName] to an arbitrary JSON value. - * - * You should usually call [Builder.middleName] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun middleName(middleName: JsonField) = apply { body.middleName(middleName) } + /** Alias for calling [Builder.isActive] with `isActive.orElse(null)`. */ + fun isActive(isActive: Optional) = isActive(isActive.getOrNull()) - /** The source system's unique employment identifier for this individual */ - fun sourceId(sourceId: String) = apply { body.sourceId(sourceId) } + /** + * Sets [Builder.isActive] to an arbitrary JSON value. + * + * You should usually call [Builder.isActive] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun isActive(isActive: JsonField) = apply { this.isActive = isActive } - /** - * Sets [Builder.sourceId] to an arbitrary JSON value. - * - * You should usually call [Builder.sourceId] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun sourceId(sourceId: JsonField) = apply { body.sourceId(sourceId) } + /** The legal last name of the individual. */ + fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) - fun startDate(startDate: String?) = apply { body.startDate(startDate) } + /** Alias for calling [Builder.lastName] with `lastName.orElse(null)`. */ + fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) - /** Alias for calling [Builder.startDate] with `startDate.orElse(null)`. */ - fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) + /** + * Sets [Builder.lastName] to an arbitrary JSON value. + * + * You should usually call [Builder.lastName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun lastName(lastName: JsonField) = apply { this.lastName = lastName } - /** - * Sets [Builder.startDate] to an arbitrary JSON value. - * - * You should usually call [Builder.startDate] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun startDate(startDate: JsonField) = apply { body.startDate(startDate) } + fun latestRehireDate(latestRehireDate: String?) = + latestRehireDate(JsonField.ofNullable(latestRehireDate)) - /** The current title of the individual. */ - fun title(title: String?) = apply { body.title(title) } + /** + * Alias for calling [Builder.latestRehireDate] with `latestRehireDate.orElse(null)`. + */ + fun latestRehireDate(latestRehireDate: Optional) = + latestRehireDate(latestRehireDate.getOrNull()) - /** Alias for calling [Builder.title] with `title.orElse(null)`. */ - fun title(title: Optional) = title(title.getOrNull()) + /** + * Sets [Builder.latestRehireDate] to an arbitrary JSON value. + * + * You should usually call [Builder.latestRehireDate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun latestRehireDate(latestRehireDate: JsonField) = apply { + this.latestRehireDate = latestRehireDate + } - /** - * Sets [Builder.title] to an arbitrary JSON value. - * - * You should usually call [Builder.title] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun title(title: JsonField) = apply { body.title(title) } + fun location(location: Location?) = location(JsonField.ofNullable(location)) - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } + /** Alias for calling [Builder.location] with `location.orElse(null)`. */ + fun location(location: Optional) = location(location.getOrNull()) - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } + /** + * Sets [Builder.location] to an arbitrary JSON value. + * + * You should usually call [Builder.location] with a well-typed [Location] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun location(location: JsonField) = apply { this.location = location } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } + /** The manager object representing the manager of the individual within the org. */ + fun manager(manager: Manager?) = manager(JsonField.ofNullable(manager)) - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + /** Alias for calling [Builder.manager] with `manager.orElse(null)`. */ + fun manager(manager: Optional) = manager(manager.getOrNull()) - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } + /** + * Sets [Builder.manager] to an arbitrary JSON value. + * + * You should usually call [Builder.manager] with a well-typed [Manager] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun manager(manager: JsonField) = apply { this.manager = manager } - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } + /** The legal middle name of the individual. */ + fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } + /** Alias for calling [Builder.middleName] with `middleName.orElse(null)`. */ + fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } + /** + * Sets [Builder.middleName] to an arbitrary JSON value. + * + * You should usually call [Builder.middleName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun middleName(middleName: JsonField) = apply { this.middleName = middleName } - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } + /** The source system's unique employment identifier for this individual */ + fun sourceId(sourceId: String) = sourceId(JsonField.of(sourceId)) - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + /** + * Sets [Builder.sourceId] to an arbitrary JSON value. + * + * You should usually call [Builder.sourceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun sourceId(sourceId: JsonField) = apply { this.sourceId = sourceId } - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + fun startDate(startDate: String?) = startDate(JsonField.ofNullable(startDate)) - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } + /** Alias for calling [Builder.startDate] with `startDate.orElse(null)`. */ + fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } + /** + * Sets [Builder.startDate] to an arbitrary JSON value. + * + * You should usually call [Builder.startDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + /** The current title of the individual. */ + fun title(title: String?) = title(JsonField.ofNullable(title)) + + /** Alias for calling [Builder.title] with `title.orElse(null)`. */ + fun title(title: Optional) = title(title.getOrNull()) - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun title(title: JsonField) = apply { this.title = title } - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) + /** + * Returns an immutable instance of [EmploymentWithoutId]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): EmploymentWithoutId = + EmploymentWithoutId( + classCode, + (customFields ?: JsonMissing.of()).map { it.toImmutable() }, + department, + employment, + employmentStatus, + endDate, + firstName, + income, + (incomeHistory ?: JsonMissing.of()).map { it.toImmutable() }, + isActive, + lastName, + latestRehireDate, + location, + manager, + middleName, + sourceId, + startDate, + title, + additionalProperties.toMutableMap(), + ) } - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } + private var validated: Boolean = false - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) + fun validate(): EmploymentWithoutId = apply { + if (validated) { + return@apply } - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) + classCode() + customFields().ifPresent { it.forEach { it.validate() } } + department().ifPresent { it.validate() } + employment().ifPresent { it.validate() } + employmentStatus() + endDate() + firstName() + income().ifPresent { it.validate() } + incomeHistory().ifPresent { it.forEach { it?.validate() } } + isActive() + lastName() + latestRehireDate() + location().ifPresent { it.validate() } + manager().ifPresent { it.validate() } + middleName() + sourceId() + startDate() + title() + validated = true } - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) + return /* spotless:off */ other is EmploymentWithoutId && classCode == other.classCode && customFields == other.customFields && department == other.department && employment == other.employment && employmentStatus == other.employmentStatus && endDate == other.endDate && firstName == other.firstName && income == other.income && incomeHistory == other.incomeHistory && isActive == other.isActive && lastName == other.lastName && latestRehireDate == other.latestRehireDate && location == other.location && manager == other.manager && middleName == other.middleName && sourceId == other.sourceId && startDate == other.startDate && title == other.title && additionalProperties == other.additionalProperties /* spotless:on */ } - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(classCode, customFields, department, employment, employmentStatus, endDate, firstName, income, incomeHistory, isActive, lastName, latestRehireDate, location, manager, middleName, sourceId, startDate, title, additionalProperties) } + /* spotless:on */ - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } + override fun hashCode(): Int = hashCode - /** - * Returns an immutable instance of [SandboxEmploymentUpdateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .individualId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): SandboxEmploymentUpdateParams = - SandboxEmploymentUpdateParams( - checkRequired("individualId", individualId), - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) + override fun toString() = + "EmploymentWithoutId{classCode=$classCode, customFields=$customFields, department=$department, employment=$employment, employmentStatus=$employmentStatus, endDate=$endDate, firstName=$firstName, income=$income, incomeHistory=$incomeHistory, isActive=$isActive, lastName=$lastName, latestRehireDate=$latestRehireDate, location=$location, manager=$manager, middleName=$middleName, sourceId=$sourceId, startDate=$startDate, title=$title, additionalProperties=$additionalProperties}" } - @NoAutoDetect class CustomField - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("value") @ExcludeMissing private val value: JsonValue = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val name: JsonField, + private val value: JsonValue, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonValue = JsonMissing.of(), + ) : this(name, value, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1646,20 +1682,15 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): CustomField = apply { - if (validated) { - return@apply - } - - name() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1723,7 +1754,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): CustomField = CustomField(name, value, additionalProperties.toImmutable()) + fun build(): CustomField = CustomField(name, value, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): CustomField = apply { + if (validated) { + return@apply + } + + name() + validated = true } override fun equals(other: Any?): Boolean { @@ -1745,17 +1787,17 @@ private constructor( } /** The department object. */ - @NoAutoDetect class Department - @JsonCreator private constructor( - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val name: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of() + ) : this(name, mutableMapOf()) + /** * The name of the department associated with the individual. * @@ -1771,20 +1813,15 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Department = apply { - if (validated) { - return@apply - } - - name() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1845,7 +1882,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Department = Department(name, additionalProperties.toImmutable()) + fun build(): Department = Department(name, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Department = apply { + if (validated) { + return@apply + } + + name() + validated = true } override fun equals(other: Any?): Boolean { @@ -1867,18 +1915,19 @@ private constructor( } /** The employment object. */ - @NoAutoDetect class Employment - @JsonCreator private constructor( - @JsonProperty("subtype") - @ExcludeMissing - private val subtype: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val subtype: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("subtype") @ExcludeMissing subtype: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(subtype, type, mutableMapOf()) + /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, * `intern`, `temp`, `seasonal` and `individual_contractor`. @@ -1910,21 +1959,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Employment = apply { - if (validated) { - return@apply - } - - subtype() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2005,7 +2048,19 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Employment = Employment(subtype, type, additionalProperties.toImmutable()) + fun build(): Employment = Employment(subtype, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Employment = apply { + if (validated) { + return@apply + } + + subtype() + type() + validated = true } /** @@ -2391,15 +2446,17 @@ private constructor( } /** The manager object representing the manager of the individual within the org. */ - @NoAutoDetect class Manager - @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val id: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of() + ) : this(id, mutableMapOf()) + /** * A stable Finch `id` (UUID v4) for an individual in the company. * @@ -2415,20 +2472,15 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Manager = apply { - if (validated) { - return@apply - } - - id() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2486,7 +2538,18 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Manager = Manager(id, additionalProperties.toImmutable()) + fun build(): Manager = Manager(id, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Manager = apply { + if (validated) { + return@apply + } + + id() + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt index 1325a93c..0fa3520e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt @@ -11,15 +11,14 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap 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 @@ -217,992 +216,1023 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): IndividualWithoutId = body + fun toBuilder() = Builder().from(this) - fun _pathParam(index: Int): String = - when (index) { - 0 -> individualId - else -> "" + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [SandboxIndividualUpdateParams]. + * + * The following fields are required: + * ```java + * .individualId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SandboxIndividualUpdateParams]. */ + class Builder internal constructor() { + + private var individualId: String? = null + private var body: IndividualWithoutId.Builder = IndividualWithoutId.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(sandboxIndividualUpdateParams: SandboxIndividualUpdateParams) = apply { + individualId = sandboxIndividualUpdateParams.individualId + body = sandboxIndividualUpdateParams.body.toBuilder() + additionalHeaders = sandboxIndividualUpdateParams.additionalHeaders.toBuilder() + additionalQueryParams = sandboxIndividualUpdateParams.additionalQueryParams.toBuilder() } - override fun _headers(): Headers = additionalHeaders + fun individualId(individualId: String) = apply { this.individualId = individualId } - override fun _queryParams(): QueryParams = additionalQueryParams + fun dob(dob: String?) = apply { body.dob(dob) } - @NoAutoDetect - class IndividualWithoutId - @JsonCreator - private constructor( - @JsonProperty("dob") @ExcludeMissing private val dob: JsonField = JsonMissing.of(), - @JsonProperty("emails") - @ExcludeMissing - private val emails: JsonField> = JsonMissing.of(), - @JsonProperty("encrypted_ssn") - @ExcludeMissing - private val encryptedSsn: JsonField = JsonMissing.of(), - @JsonProperty("ethnicity") - @ExcludeMissing - private val ethnicity: JsonField = JsonMissing.of(), - @JsonProperty("first_name") - @ExcludeMissing - private val firstName: JsonField = JsonMissing.of(), - @JsonProperty("gender") - @ExcludeMissing - private val gender: JsonField = JsonMissing.of(), - @JsonProperty("last_name") - @ExcludeMissing - private val lastName: JsonField = JsonMissing.of(), - @JsonProperty("middle_name") - @ExcludeMissing - private val middleName: JsonField = JsonMissing.of(), - @JsonProperty("phone_numbers") - @ExcludeMissing - private val phoneNumbers: JsonField> = JsonMissing.of(), - @JsonProperty("preferred_name") - @ExcludeMissing - private val preferredName: JsonField = JsonMissing.of(), - @JsonProperty("residence") - @ExcludeMissing - private val residence: JsonField = JsonMissing.of(), - @JsonProperty("ssn") @ExcludeMissing private val ssn: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** Alias for calling [Builder.dob] with `dob.orElse(null)`. */ + fun dob(dob: Optional) = dob(dob.getOrNull()) /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * Sets [Builder.dob] to an arbitrary JSON value. + * + * You should usually call [Builder.dob] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) + fun dob(dob: JsonField) = apply { body.dob(dob) } + + fun emails(emails: List?) = apply { body.emails(emails) } + + /** Alias for calling [Builder.emails] with `emails.orElse(null)`. */ + fun emails(emails: Optional>) = emails(emails.getOrNull()) /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * Sets [Builder.emails] to an arbitrary JSON value. + * + * You should usually call [Builder.emails] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun emails(): Optional> = Optional.ofNullable(emails.getNullable("emails")) + fun emails(emails: JsonField>) = apply { body.emails(emails) } + + /** + * Adds a single [Email] to [emails]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addEmail(email: Email) = apply { body.addEmail(email) } /** * Social Security Number of the individual in **encrypted** format. This field is only * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set * in the body. - * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). */ - fun encryptedSsn(): Optional = - Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) + fun encryptedSsn(encryptedSsn: String?) = apply { body.encryptedSsn(encryptedSsn) } + + /** Alias for calling [Builder.encryptedSsn] with `encryptedSsn.orElse(null)`. */ + fun encryptedSsn(encryptedSsn: Optional) = encryptedSsn(encryptedSsn.getOrNull()) /** - * The EEOC-defined ethnicity of the individual. + * Sets [Builder.encryptedSsn] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.encryptedSsn] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun ethnicity(): Optional = - Optional.ofNullable(ethnicity.getNullable("ethnicity")) + fun encryptedSsn(encryptedSsn: JsonField) = apply { + body.encryptedSsn(encryptedSsn) + } + + /** The EEOC-defined ethnicity of the individual. */ + fun ethnicity(ethnicity: Ethnicity?) = apply { body.ethnicity(ethnicity) } + + /** Alias for calling [Builder.ethnicity] with `ethnicity.orElse(null)`. */ + fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.getOrNull()) /** - * The legal first name of the individual. + * Sets [Builder.ethnicity] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.ethnicity] with a well-typed [Ethnicity] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) + fun ethnicity(ethnicity: JsonField) = apply { body.ethnicity(ethnicity) } + + /** The legal first name of the individual. */ + fun firstName(firstName: String?) = apply { body.firstName(firstName) } + + /** Alias for calling [Builder.firstName] with `firstName.orElse(null)`. */ + fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) /** - * The gender of the individual. + * Sets [Builder.firstName] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.firstName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun gender(): Optional = Optional.ofNullable(gender.getNullable("gender")) + fun firstName(firstName: JsonField) = apply { body.firstName(firstName) } + + /** The gender of the individual. */ + fun gender(gender: Gender?) = apply { body.gender(gender) } + + /** Alias for calling [Builder.gender] with `gender.orElse(null)`. */ + fun gender(gender: Optional) = gender(gender.getOrNull()) /** - * The legal last name of the individual. + * Sets [Builder.gender] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.gender] with a well-typed [Gender] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + fun gender(gender: JsonField) = apply { body.gender(gender) } + + /** The legal last name of the individual. */ + fun lastName(lastName: String?) = apply { body.lastName(lastName) } + + /** Alias for calling [Builder.lastName] with `lastName.orElse(null)`. */ + fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) /** - * The legal middle name of the individual. + * Sets [Builder.lastName] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.lastName] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun middleName(): Optional = - Optional.ofNullable(middleName.getNullable("middle_name")) + fun lastName(lastName: JsonField) = apply { body.lastName(lastName) } - /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun phoneNumbers(): Optional> = - Optional.ofNullable(phoneNumbers.getNullable("phone_numbers")) + /** The legal middle name of the individual. */ + fun middleName(middleName: String?) = apply { body.middleName(middleName) } + + /** Alias for calling [Builder.middleName] with `middleName.orElse(null)`. */ + fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) /** - * The preferred name of the individual. + * Sets [Builder.middleName] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.middleName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun preferredName(): Optional = - Optional.ofNullable(preferredName.getNullable("preferred_name")) + fun middleName(middleName: JsonField) = apply { body.middleName(middleName) } - /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun residence(): Optional = - Optional.ofNullable(residence.getNullable("residence")) + fun phoneNumbers(phoneNumbers: List?) = apply { + body.phoneNumbers(phoneNumbers) + } + + /** Alias for calling [Builder.phoneNumbers] with `phoneNumbers.orElse(null)`. */ + fun phoneNumbers(phoneNumbers: Optional>) = + phoneNumbers(phoneNumbers.getOrNull()) /** - * Social Security Number of the individual. This field is only available with the `ssn` - * scope enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + * Sets [Builder.phoneNumbers] to an arbitrary JSON value. * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * You should usually call [Builder.phoneNumbers] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) + fun phoneNumbers(phoneNumbers: JsonField>) = apply { + body.phoneNumbers(phoneNumbers) + } /** - * Returns the raw JSON value of [dob]. + * Adds a single [PhoneNumber] to [phoneNumbers]. * - * Unlike [dob], this method doesn't throw if the JSON field has an unexpected type. + * @throws IllegalStateException if the field was previously set to a non-list. */ - @JsonProperty("dob") @ExcludeMissing fun _dob(): JsonField = dob + fun addPhoneNumber(phoneNumber: PhoneNumber) = apply { body.addPhoneNumber(phoneNumber) } + + /** The preferred name of the individual. */ + fun preferredName(preferredName: String?) = apply { body.preferredName(preferredName) } + + /** Alias for calling [Builder.preferredName] with `preferredName.orElse(null)`. */ + fun preferredName(preferredName: Optional) = + preferredName(preferredName.getOrNull()) /** - * Returns the raw JSON value of [emails]. + * Sets [Builder.preferredName] to an arbitrary JSON value. * - * Unlike [emails], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.preferredName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - @JsonProperty("emails") @ExcludeMissing fun _emails(): JsonField> = emails + fun preferredName(preferredName: JsonField) = apply { + body.preferredName(preferredName) + } + + fun residence(residence: Location?) = apply { body.residence(residence) } + + /** Alias for calling [Builder.residence] with `residence.orElse(null)`. */ + fun residence(residence: Optional) = residence(residence.getOrNull()) /** - * Returns the raw JSON value of [encryptedSsn]. + * Sets [Builder.residence] to an arbitrary JSON value. * - * Unlike [encryptedSsn], this method doesn't throw if the JSON field has an unexpected - * type. + * You should usually call [Builder.residence] with a well-typed [Location] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - @JsonProperty("encrypted_ssn") - @ExcludeMissing - fun _encryptedSsn(): JsonField = encryptedSsn + fun residence(residence: JsonField) = apply { body.residence(residence) } /** - * Returns the raw JSON value of [ethnicity]. - * - * Unlike [ethnicity], this method doesn't throw if the JSON field has an unexpected type. + * Social Security Number of the individual. This field is only available with the `ssn` + * scope enabled and the `options: { include: ['ssn'] }` param set in the body. + * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). */ - @JsonProperty("ethnicity") - @ExcludeMissing - fun _ethnicity(): JsonField = ethnicity + fun ssn(ssn: String?) = apply { body.ssn(ssn) } - /** - * Returns the raw JSON value of [firstName]. - * - * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName + /** Alias for calling [Builder.ssn] with `ssn.orElse(null)`. */ + fun ssn(ssn: Optional) = ssn(ssn.getOrNull()) /** - * Returns the raw JSON value of [gender]. + * Sets [Builder.ssn] to an arbitrary JSON value. * - * Unlike [gender], this method doesn't throw if the JSON field has an unexpected type. + * You should usually call [Builder.ssn] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - @JsonProperty("gender") @ExcludeMissing fun _gender(): JsonField = gender + fun ssn(ssn: JsonField) = apply { body.ssn(ssn) } - /** - * Returns the raw JSON value of [lastName]. - * - * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } - /** - * Returns the raw JSON value of [middleName]. - * - * Unlike [middleName], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("middle_name") - @ExcludeMissing - fun _middleName(): JsonField = middleName + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } - /** - * Returns the raw JSON value of [phoneNumbers]. - * - * Unlike [phoneNumbers], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("phone_numbers") - @ExcludeMissing - fun _phoneNumbers(): JsonField> = phoneNumbers + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } - /** - * Returns the raw JSON value of [preferredName]. - * - * Unlike [preferredName], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("preferred_name") - @ExcludeMissing - fun _preferredName(): JsonField = preferredName + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - /** - * Returns the raw JSON value of [residence]. - * - * Unlike [residence], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("residence") @ExcludeMissing fun _residence(): JsonField = residence + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } - /** - * Returns the raw JSON value of [ssn]. - * - * Unlike [ssn], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("ssn") @ExcludeMissing fun _ssn(): JsonField = ssn + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - private var validated: Boolean = false + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } - fun validate(): IndividualWithoutId = apply { - if (validated) { - return@apply - } + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } - dob() - emails().ifPresent { it.forEach { it.validate() } } - encryptedSsn() - ethnicity() - firstName() - gender() - lastName() - middleName() - phoneNumbers().ifPresent { it.forEach { it?.validate() } } - preferredName() - residence().ifPresent { it.validate() } - ssn() - validated = true + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) } - fun toBuilder() = Builder().from(this) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } - companion object { + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } - /** Returns a mutable builder for constructing an instance of [IndividualWithoutId]. */ - @JvmStatic fun builder() = Builder() + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) } - /** A builder for [IndividualWithoutId]. */ - class Builder internal constructor() { + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } - private var dob: JsonField = JsonMissing.of() - private var emails: JsonField>? = null - private var encryptedSsn: JsonField = JsonMissing.of() - private var ethnicity: JsonField = JsonMissing.of() - private var firstName: JsonField = JsonMissing.of() - private var gender: JsonField = JsonMissing.of() - private var lastName: JsonField = JsonMissing.of() - private var middleName: JsonField = JsonMissing.of() - private var phoneNumbers: JsonField>? = null - private var preferredName: JsonField = JsonMissing.of() - private var residence: JsonField = JsonMissing.of() - private var ssn: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } - @JvmSynthetic - internal fun from(individualWithoutId: IndividualWithoutId) = apply { - dob = individualWithoutId.dob - emails = individualWithoutId.emails.map { it.toMutableList() } - encryptedSsn = individualWithoutId.encryptedSsn - ethnicity = individualWithoutId.ethnicity - firstName = individualWithoutId.firstName - gender = individualWithoutId.gender - lastName = individualWithoutId.lastName - middleName = individualWithoutId.middleName - phoneNumbers = individualWithoutId.phoneNumbers.map { it.toMutableList() } - preferredName = individualWithoutId.preferredName - residence = individualWithoutId.residence - ssn = individualWithoutId.ssn - additionalProperties = individualWithoutId.additionalProperties.toMutableMap() - } + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - fun dob(dob: String?) = dob(JsonField.ofNullable(dob)) + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } - /** Alias for calling [Builder.dob] with `dob.orElse(null)`. */ - fun dob(dob: Optional) = dob(dob.getOrNull()) + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } - /** - * Sets [Builder.dob] to an arbitrary JSON value. - * - * You should usually call [Builder.dob] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun dob(dob: JsonField) = apply { this.dob = dob } + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } - fun emails(emails: List?) = emails(JsonField.ofNullable(emails)) + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } - /** Alias for calling [Builder.emails] with `emails.orElse(null)`. */ - fun emails(emails: Optional>) = emails(emails.getOrNull()) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } - /** - * Sets [Builder.emails] to an arbitrary JSON value. - * - * You should usually call [Builder.emails] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun emails(emails: JsonField>) = apply { - this.emails = emails.map { it.toMutableList() } - } + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } - /** - * Adds a single [Email] to [emails]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addEmail(email: Email) = apply { - emails = - (emails ?: JsonField.of(mutableListOf())).also { - checkKnown("emails", it).add(email) - } + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) } - /** - * Social Security Number of the individual in **encrypted** format. This field is only - * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param - * set in the body. - */ - fun encryptedSsn(encryptedSsn: String?) = - encryptedSsn(JsonField.ofNullable(encryptedSsn)) + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } - /** Alias for calling [Builder.encryptedSsn] with `encryptedSsn.orElse(null)`. */ - fun encryptedSsn(encryptedSsn: Optional) = - encryptedSsn(encryptedSsn.getOrNull()) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } - /** - * Sets [Builder.encryptedSsn] to an arbitrary JSON value. - * - * You should usually call [Builder.encryptedSsn] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun encryptedSsn(encryptedSsn: JsonField) = apply { - this.encryptedSsn = encryptedSsn + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) } - /** The EEOC-defined ethnicity of the individual. */ - fun ethnicity(ethnicity: Ethnicity?) = ethnicity(JsonField.ofNullable(ethnicity)) - - /** Alias for calling [Builder.ethnicity] with `ethnicity.orElse(null)`. */ - fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.getOrNull()) - - /** - * Sets [Builder.ethnicity] to an arbitrary JSON value. - * - * You should usually call [Builder.ethnicity] with a well-typed [Ethnicity] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun ethnicity(ethnicity: JsonField) = apply { this.ethnicity = ethnicity } - - /** The legal first name of the individual. */ - fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) - - /** Alias for calling [Builder.firstName] with `firstName.orElse(null)`. */ - fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) - - /** - * Sets [Builder.firstName] to an arbitrary JSON value. - * - * You should usually call [Builder.firstName] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun firstName(firstName: JsonField) = apply { this.firstName = firstName } - - /** The gender of the individual. */ - fun gender(gender: Gender?) = gender(JsonField.ofNullable(gender)) - - /** Alias for calling [Builder.gender] with `gender.orElse(null)`. */ - fun gender(gender: Optional) = gender(gender.getOrNull()) - - /** - * Sets [Builder.gender] to an arbitrary JSON value. - * - * You should usually call [Builder.gender] with a well-typed [Gender] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun gender(gender: JsonField) = apply { this.gender = gender } - - /** The legal last name of the individual. */ - fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) - - /** Alias for calling [Builder.lastName] with `lastName.orElse(null)`. */ - fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) - - /** - * Sets [Builder.lastName] to an arbitrary JSON value. - * - * You should usually call [Builder.lastName] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun lastName(lastName: JsonField) = apply { this.lastName = lastName } - - /** The legal middle name of the individual. */ - fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) - - /** Alias for calling [Builder.middleName] with `middleName.orElse(null)`. */ - fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) - - /** - * Sets [Builder.middleName] to an arbitrary JSON value. - * - * You should usually call [Builder.middleName] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun middleName(middleName: JsonField) = apply { this.middleName = middleName } - - fun phoneNumbers(phoneNumbers: List?) = - phoneNumbers(JsonField.ofNullable(phoneNumbers)) - - /** Alias for calling [Builder.phoneNumbers] with `phoneNumbers.orElse(null)`. */ - fun phoneNumbers(phoneNumbers: Optional>) = - phoneNumbers(phoneNumbers.getOrNull()) - - /** - * Sets [Builder.phoneNumbers] to an arbitrary JSON value. - * - * You should usually call [Builder.phoneNumbers] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun phoneNumbers(phoneNumbers: JsonField>) = apply { - this.phoneNumbers = phoneNumbers.map { it.toMutableList() } - } - - /** - * Adds a single [PhoneNumber] to [phoneNumbers]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addPhoneNumber(phoneNumber: PhoneNumber) = apply { - phoneNumbers = - (phoneNumbers ?: JsonField.of(mutableListOf())).also { - checkKnown("phoneNumbers", it).add(phoneNumber) - } - } - - /** The preferred name of the individual. */ - fun preferredName(preferredName: String?) = - preferredName(JsonField.ofNullable(preferredName)) - - /** Alias for calling [Builder.preferredName] with `preferredName.orElse(null)`. */ - fun preferredName(preferredName: Optional) = - preferredName(preferredName.getOrNull()) - - /** - * Sets [Builder.preferredName] to an arbitrary JSON value. - * - * You should usually call [Builder.preferredName] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun preferredName(preferredName: JsonField) = apply { - this.preferredName = preferredName - } - - fun residence(residence: Location?) = residence(JsonField.ofNullable(residence)) - - /** Alias for calling [Builder.residence] with `residence.orElse(null)`. */ - fun residence(residence: Optional) = residence(residence.getOrNull()) + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - /** - * Sets [Builder.residence] to an arbitrary JSON value. - * - * You should usually call [Builder.residence] with a well-typed [Location] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun residence(residence: JsonField) = apply { this.residence = residence } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } - /** - * Social Security Number of the individual. This field is only available with the `ssn` - * scope enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). - */ - fun ssn(ssn: String?) = ssn(JsonField.ofNullable(ssn)) + /** + * Returns an immutable instance of [SandboxIndividualUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .individualId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SandboxIndividualUpdateParams = + SandboxIndividualUpdateParams( + checkRequired("individualId", individualId), + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } - /** Alias for calling [Builder.ssn] with `ssn.orElse(null)`. */ - fun ssn(ssn: Optional) = ssn(ssn.getOrNull()) + @JvmSynthetic internal fun _body(): IndividualWithoutId = body - /** - * Sets [Builder.ssn] to an arbitrary JSON value. - * - * You should usually call [Builder.ssn] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun ssn(ssn: JsonField) = apply { this.ssn = ssn } + fun _pathParam(index: Int): String = + when (index) { + 0 -> individualId + else -> "" + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun _headers(): Headers = additionalHeaders - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + override fun _queryParams(): QueryParams = additionalQueryParams - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + class IndividualWithoutId + private constructor( + private val dob: JsonField, + private val emails: JsonField>, + private val encryptedSsn: JsonField, + private val ethnicity: JsonField, + private val firstName: JsonField, + private val gender: JsonField, + private val lastName: JsonField, + private val middleName: JsonField, + private val phoneNumbers: JsonField>, + private val preferredName: JsonField, + private val residence: JsonField, + private val ssn: JsonField, + private val additionalProperties: MutableMap, + ) { - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + @JsonCreator + private constructor( + @JsonProperty("dob") @ExcludeMissing dob: JsonField = JsonMissing.of(), + @JsonProperty("emails") + @ExcludeMissing + emails: JsonField> = JsonMissing.of(), + @JsonProperty("encrypted_ssn") + @ExcludeMissing + encryptedSsn: JsonField = JsonMissing.of(), + @JsonProperty("ethnicity") + @ExcludeMissing + ethnicity: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + firstName: JsonField = JsonMissing.of(), + @JsonProperty("gender") @ExcludeMissing gender: JsonField = JsonMissing.of(), + @JsonProperty("last_name") + @ExcludeMissing + lastName: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + middleName: JsonField = JsonMissing.of(), + @JsonProperty("phone_numbers") + @ExcludeMissing + phoneNumbers: JsonField> = JsonMissing.of(), + @JsonProperty("preferred_name") + @ExcludeMissing + preferredName: JsonField = JsonMissing.of(), + @JsonProperty("residence") + @ExcludeMissing + residence: JsonField = JsonMissing.of(), + @JsonProperty("ssn") @ExcludeMissing ssn: JsonField = JsonMissing.of(), + ) : this( + dob, + emails, + encryptedSsn, + ethnicity, + firstName, + gender, + lastName, + middleName, + phoneNumbers, + preferredName, + residence, + ssn, + mutableMapOf(), + ) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) - /** - * Returns an immutable instance of [IndividualWithoutId]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): IndividualWithoutId = - IndividualWithoutId( - dob, - (emails ?: JsonMissing.of()).map { it.toImmutable() }, - encryptedSsn, - ethnicity, - firstName, - gender, - lastName, - middleName, - (phoneNumbers ?: JsonMissing.of()).map { it.toImmutable() }, - preferredName, - residence, - ssn, - additionalProperties.toImmutable(), - ) - } + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun emails(): Optional> = Optional.ofNullable(emails.getNullable("emails")) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Social Security Number of the individual in **encrypted** format. This field is only + * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set + * in the body. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun encryptedSsn(): Optional = + Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) - return /* spotless:off */ other is IndividualWithoutId && dob == other.dob && emails == other.emails && encryptedSsn == other.encryptedSsn && ethnicity == other.ethnicity && firstName == other.firstName && gender == other.gender && lastName == other.lastName && middleName == other.middleName && phoneNumbers == other.phoneNumbers && preferredName == other.preferredName && residence == other.residence && ssn == other.ssn && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * The EEOC-defined ethnicity of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ethnicity(): Optional = + Optional.ofNullable(ethnicity.getNullable("ethnicity")) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(dob, emails, encryptedSsn, ethnicity, firstName, gender, lastName, middleName, phoneNumbers, preferredName, residence, ssn, additionalProperties) } - /* spotless:on */ + /** + * The legal first name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) - override fun hashCode(): Int = hashCode + /** + * The gender of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun gender(): Optional = Optional.ofNullable(gender.getNullable("gender")) - override fun toString() = - "IndividualWithoutId{dob=$dob, emails=$emails, encryptedSsn=$encryptedSsn, ethnicity=$ethnicity, firstName=$firstName, gender=$gender, lastName=$lastName, middleName=$middleName, phoneNumbers=$phoneNumbers, preferredName=$preferredName, residence=$residence, ssn=$ssn, additionalProperties=$additionalProperties}" - } + /** + * The legal last name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) - fun toBuilder() = Builder().from(this) + /** + * The legal middle name of the individual. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun middleName(): Optional = + Optional.ofNullable(middleName.getNullable("middle_name")) - companion object { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun phoneNumbers(): Optional> = + Optional.ofNullable(phoneNumbers.getNullable("phone_numbers")) /** - * Returns a mutable builder for constructing an instance of - * [SandboxIndividualUpdateParams]. + * The preferred name of the individual. * - * The following fields are required: - * ```java - * .individualId() - * ``` + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - @JvmStatic fun builder() = Builder() - } + fun preferredName(): Optional = + Optional.ofNullable(preferredName.getNullable("preferred_name")) - /** A builder for [SandboxIndividualUpdateParams]. */ - @NoAutoDetect - class Builder internal constructor() { + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun residence(): Optional = + Optional.ofNullable(residence.getNullable("residence")) - private var individualId: String? = null - private var body: IndividualWithoutId.Builder = IndividualWithoutId.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + /** + * Social Security Number of the individual. This field is only available with the `ssn` + * scope enabled and the `options: { include: ['ssn'] }` param set in the body. + * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) - @JvmSynthetic - internal fun from(sandboxIndividualUpdateParams: SandboxIndividualUpdateParams) = apply { - individualId = sandboxIndividualUpdateParams.individualId - body = sandboxIndividualUpdateParams.body.toBuilder() - additionalHeaders = sandboxIndividualUpdateParams.additionalHeaders.toBuilder() - additionalQueryParams = sandboxIndividualUpdateParams.additionalQueryParams.toBuilder() - } + /** + * Returns the raw JSON value of [dob]. + * + * Unlike [dob], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dob") @ExcludeMissing fun _dob(): JsonField = dob - fun individualId(individualId: String) = apply { this.individualId = individualId } + /** + * Returns the raw JSON value of [emails]. + * + * Unlike [emails], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("emails") @ExcludeMissing fun _emails(): JsonField> = emails - fun dob(dob: String?) = apply { body.dob(dob) } + /** + * Returns the raw JSON value of [encryptedSsn]. + * + * Unlike [encryptedSsn], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("encrypted_ssn") + @ExcludeMissing + fun _encryptedSsn(): JsonField = encryptedSsn - /** Alias for calling [Builder.dob] with `dob.orElse(null)`. */ - fun dob(dob: Optional) = dob(dob.getOrNull()) + /** + * Returns the raw JSON value of [ethnicity]. + * + * Unlike [ethnicity], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ethnicity") + @ExcludeMissing + fun _ethnicity(): JsonField = ethnicity /** - * Sets [Builder.dob] to an arbitrary JSON value. + * Returns the raw JSON value of [firstName]. * - * You should usually call [Builder.dob] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected type. */ - fun dob(dob: JsonField) = apply { body.dob(dob) } + @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName - fun emails(emails: List?) = apply { body.emails(emails) } + /** + * Returns the raw JSON value of [gender]. + * + * Unlike [gender], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("gender") @ExcludeMissing fun _gender(): JsonField = gender - /** Alias for calling [Builder.emails] with `emails.orElse(null)`. */ - fun emails(emails: Optional>) = emails(emails.getOrNull()) + /** + * Returns the raw JSON value of [lastName]. + * + * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName /** - * Sets [Builder.emails] to an arbitrary JSON value. + * Returns the raw JSON value of [middleName]. * - * You should usually call [Builder.emails] with a well-typed `List` value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * Unlike [middleName], this method doesn't throw if the JSON field has an unexpected type. */ - fun emails(emails: JsonField>) = apply { body.emails(emails) } + @JsonProperty("middle_name") + @ExcludeMissing + fun _middleName(): JsonField = middleName /** - * Adds a single [Email] to [emails]. + * Returns the raw JSON value of [phoneNumbers]. * - * @throws IllegalStateException if the field was previously set to a non-list. + * Unlike [phoneNumbers], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun addEmail(email: Email) = apply { body.addEmail(email) } + @JsonProperty("phone_numbers") + @ExcludeMissing + fun _phoneNumbers(): JsonField> = phoneNumbers /** - * Social Security Number of the individual in **encrypted** format. This field is only - * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set - * in the body. + * Returns the raw JSON value of [preferredName]. + * + * Unlike [preferredName], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun encryptedSsn(encryptedSsn: String?) = apply { body.encryptedSsn(encryptedSsn) } + @JsonProperty("preferred_name") + @ExcludeMissing + fun _preferredName(): JsonField = preferredName - /** Alias for calling [Builder.encryptedSsn] with `encryptedSsn.orElse(null)`. */ - fun encryptedSsn(encryptedSsn: Optional) = encryptedSsn(encryptedSsn.getOrNull()) + /** + * Returns the raw JSON value of [residence]. + * + * Unlike [residence], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("residence") @ExcludeMissing fun _residence(): JsonField = residence /** - * Sets [Builder.encryptedSsn] to an arbitrary JSON value. + * Returns the raw JSON value of [ssn]. * - * You should usually call [Builder.encryptedSsn] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * Unlike [ssn], this method doesn't throw if the JSON field has an unexpected type. */ - fun encryptedSsn(encryptedSsn: JsonField) = apply { - body.encryptedSsn(encryptedSsn) + @JsonProperty("ssn") @ExcludeMissing fun _ssn(): JsonField = ssn + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } - /** The EEOC-defined ethnicity of the individual. */ - fun ethnicity(ethnicity: Ethnicity?) = apply { body.ethnicity(ethnicity) } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** Alias for calling [Builder.ethnicity] with `ethnicity.orElse(null)`. */ - fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.getOrNull()) + fun toBuilder() = Builder().from(this) - /** - * Sets [Builder.ethnicity] to an arbitrary JSON value. - * - * You should usually call [Builder.ethnicity] with a well-typed [Ethnicity] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun ethnicity(ethnicity: JsonField) = apply { body.ethnicity(ethnicity) } + companion object { - /** The legal first name of the individual. */ - fun firstName(firstName: String?) = apply { body.firstName(firstName) } + /** Returns a mutable builder for constructing an instance of [IndividualWithoutId]. */ + @JvmStatic fun builder() = Builder() + } - /** Alias for calling [Builder.firstName] with `firstName.orElse(null)`. */ - fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) + /** A builder for [IndividualWithoutId]. */ + class Builder internal constructor() { - /** - * Sets [Builder.firstName] to an arbitrary JSON value. - * - * You should usually call [Builder.firstName] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun firstName(firstName: JsonField) = apply { body.firstName(firstName) } + private var dob: JsonField = JsonMissing.of() + private var emails: JsonField>? = null + private var encryptedSsn: JsonField = JsonMissing.of() + private var ethnicity: JsonField = JsonMissing.of() + private var firstName: JsonField = JsonMissing.of() + private var gender: JsonField = JsonMissing.of() + private var lastName: JsonField = JsonMissing.of() + private var middleName: JsonField = JsonMissing.of() + private var phoneNumbers: JsonField>? = null + private var preferredName: JsonField = JsonMissing.of() + private var residence: JsonField = JsonMissing.of() + private var ssn: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(individualWithoutId: IndividualWithoutId) = apply { + dob = individualWithoutId.dob + emails = individualWithoutId.emails.map { it.toMutableList() } + encryptedSsn = individualWithoutId.encryptedSsn + ethnicity = individualWithoutId.ethnicity + firstName = individualWithoutId.firstName + gender = individualWithoutId.gender + lastName = individualWithoutId.lastName + middleName = individualWithoutId.middleName + phoneNumbers = individualWithoutId.phoneNumbers.map { it.toMutableList() } + preferredName = individualWithoutId.preferredName + residence = individualWithoutId.residence + ssn = individualWithoutId.ssn + additionalProperties = individualWithoutId.additionalProperties.toMutableMap() + } - /** The gender of the individual. */ - fun gender(gender: Gender?) = apply { body.gender(gender) } + fun dob(dob: String?) = dob(JsonField.ofNullable(dob)) - /** Alias for calling [Builder.gender] with `gender.orElse(null)`. */ - fun gender(gender: Optional) = gender(gender.getOrNull()) + /** Alias for calling [Builder.dob] with `dob.orElse(null)`. */ + fun dob(dob: Optional) = dob(dob.getOrNull()) - /** - * Sets [Builder.gender] to an arbitrary JSON value. - * - * You should usually call [Builder.gender] with a well-typed [Gender] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun gender(gender: JsonField) = apply { body.gender(gender) } + /** + * Sets [Builder.dob] to an arbitrary JSON value. + * + * You should usually call [Builder.dob] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun dob(dob: JsonField) = apply { this.dob = dob } - /** The legal last name of the individual. */ - fun lastName(lastName: String?) = apply { body.lastName(lastName) } + fun emails(emails: List?) = emails(JsonField.ofNullable(emails)) - /** Alias for calling [Builder.lastName] with `lastName.orElse(null)`. */ - fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) + /** Alias for calling [Builder.emails] with `emails.orElse(null)`. */ + fun emails(emails: Optional>) = emails(emails.getOrNull()) - /** - * Sets [Builder.lastName] to an arbitrary JSON value. - * - * You should usually call [Builder.lastName] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun lastName(lastName: JsonField) = apply { body.lastName(lastName) } + /** + * Sets [Builder.emails] to an arbitrary JSON value. + * + * You should usually call [Builder.emails] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun emails(emails: JsonField>) = apply { + this.emails = emails.map { it.toMutableList() } + } - /** The legal middle name of the individual. */ - fun middleName(middleName: String?) = apply { body.middleName(middleName) } + /** + * Adds a single [Email] to [emails]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addEmail(email: Email) = apply { + emails = + (emails ?: JsonField.of(mutableListOf())).also { + checkKnown("emails", it).add(email) + } + } - /** Alias for calling [Builder.middleName] with `middleName.orElse(null)`. */ - fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) + /** + * Social Security Number of the individual in **encrypted** format. This field is only + * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param + * set in the body. + */ + fun encryptedSsn(encryptedSsn: String?) = + encryptedSsn(JsonField.ofNullable(encryptedSsn)) - /** - * Sets [Builder.middleName] to an arbitrary JSON value. - * - * You should usually call [Builder.middleName] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun middleName(middleName: JsonField) = apply { body.middleName(middleName) } + /** Alias for calling [Builder.encryptedSsn] with `encryptedSsn.orElse(null)`. */ + fun encryptedSsn(encryptedSsn: Optional) = + encryptedSsn(encryptedSsn.getOrNull()) - fun phoneNumbers(phoneNumbers: List?) = apply { - body.phoneNumbers(phoneNumbers) - } + /** + * Sets [Builder.encryptedSsn] to an arbitrary JSON value. + * + * You should usually call [Builder.encryptedSsn] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun encryptedSsn(encryptedSsn: JsonField) = apply { + this.encryptedSsn = encryptedSsn + } - /** Alias for calling [Builder.phoneNumbers] with `phoneNumbers.orElse(null)`. */ - fun phoneNumbers(phoneNumbers: Optional>) = - phoneNumbers(phoneNumbers.getOrNull()) + /** The EEOC-defined ethnicity of the individual. */ + fun ethnicity(ethnicity: Ethnicity?) = ethnicity(JsonField.ofNullable(ethnicity)) - /** - * Sets [Builder.phoneNumbers] to an arbitrary JSON value. - * - * You should usually call [Builder.phoneNumbers] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun phoneNumbers(phoneNumbers: JsonField>) = apply { - body.phoneNumbers(phoneNumbers) - } + /** Alias for calling [Builder.ethnicity] with `ethnicity.orElse(null)`. */ + fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.getOrNull()) - /** - * Adds a single [PhoneNumber] to [phoneNumbers]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addPhoneNumber(phoneNumber: PhoneNumber) = apply { body.addPhoneNumber(phoneNumber) } + /** + * Sets [Builder.ethnicity] to an arbitrary JSON value. + * + * You should usually call [Builder.ethnicity] with a well-typed [Ethnicity] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun ethnicity(ethnicity: JsonField) = apply { this.ethnicity = ethnicity } - /** The preferred name of the individual. */ - fun preferredName(preferredName: String?) = apply { body.preferredName(preferredName) } + /** The legal first name of the individual. */ + fun firstName(firstName: String?) = firstName(JsonField.ofNullable(firstName)) - /** Alias for calling [Builder.preferredName] with `preferredName.orElse(null)`. */ - fun preferredName(preferredName: Optional) = - preferredName(preferredName.getOrNull()) + /** Alias for calling [Builder.firstName] with `firstName.orElse(null)`. */ + fun firstName(firstName: Optional) = firstName(firstName.getOrNull()) - /** - * Sets [Builder.preferredName] to an arbitrary JSON value. - * - * You should usually call [Builder.preferredName] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun preferredName(preferredName: JsonField) = apply { - body.preferredName(preferredName) - } + /** + * Sets [Builder.firstName] to an arbitrary JSON value. + * + * You should usually call [Builder.firstName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun firstName(firstName: JsonField) = apply { this.firstName = firstName } - fun residence(residence: Location?) = apply { body.residence(residence) } + /** The gender of the individual. */ + fun gender(gender: Gender?) = gender(JsonField.ofNullable(gender)) - /** Alias for calling [Builder.residence] with `residence.orElse(null)`. */ - fun residence(residence: Optional) = residence(residence.getOrNull()) + /** Alias for calling [Builder.gender] with `gender.orElse(null)`. */ + fun gender(gender: Optional) = gender(gender.getOrNull()) - /** - * Sets [Builder.residence] to an arbitrary JSON value. - * - * You should usually call [Builder.residence] with a well-typed [Location] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun residence(residence: JsonField) = apply { body.residence(residence) } + /** + * Sets [Builder.gender] to an arbitrary JSON value. + * + * You should usually call [Builder.gender] with a well-typed [Gender] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun gender(gender: JsonField) = apply { this.gender = gender } - /** - * Social Security Number of the individual. This field is only available with the `ssn` - * scope enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). - */ - fun ssn(ssn: String?) = apply { body.ssn(ssn) } + /** The legal last name of the individual. */ + fun lastName(lastName: String?) = lastName(JsonField.ofNullable(lastName)) - /** Alias for calling [Builder.ssn] with `ssn.orElse(null)`. */ - fun ssn(ssn: Optional) = ssn(ssn.getOrNull()) + /** Alias for calling [Builder.lastName] with `lastName.orElse(null)`. */ + fun lastName(lastName: Optional) = lastName(lastName.getOrNull()) - /** - * Sets [Builder.ssn] to an arbitrary JSON value. - * - * You should usually call [Builder.ssn] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun ssn(ssn: JsonField) = apply { body.ssn(ssn) } + /** + * Sets [Builder.lastName] to an arbitrary JSON value. + * + * You should usually call [Builder.lastName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun lastName(lastName: JsonField) = apply { this.lastName = lastName } - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } + /** The legal middle name of the individual. */ + fun middleName(middleName: String?) = middleName(JsonField.ofNullable(middleName)) - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } + /** Alias for calling [Builder.middleName] with `middleName.orElse(null)`. */ + fun middleName(middleName: Optional) = middleName(middleName.getOrNull()) - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } + /** + * Sets [Builder.middleName] to an arbitrary JSON value. + * + * You should usually call [Builder.middleName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun middleName(middleName: JsonField) = apply { this.middleName = middleName } - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + fun phoneNumbers(phoneNumbers: List?) = + phoneNumbers(JsonField.ofNullable(phoneNumbers)) - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } + /** Alias for calling [Builder.phoneNumbers] with `phoneNumbers.orElse(null)`. */ + fun phoneNumbers(phoneNumbers: Optional>) = + phoneNumbers(phoneNumbers.getOrNull()) - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } + /** + * Sets [Builder.phoneNumbers] to an arbitrary JSON value. + * + * You should usually call [Builder.phoneNumbers] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun phoneNumbers(phoneNumbers: JsonField>) = apply { + this.phoneNumbers = phoneNumbers.map { it.toMutableList() } + } + + /** + * Adds a single [PhoneNumber] to [phoneNumbers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addPhoneNumber(phoneNumber: PhoneNumber) = apply { + phoneNumbers = + (phoneNumbers ?: JsonField.of(mutableListOf())).also { + checkKnown("phoneNumbers", it).add(phoneNumber) + } + } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } + /** The preferred name of the individual. */ + fun preferredName(preferredName: String?) = + preferredName(JsonField.ofNullable(preferredName)) - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } + /** Alias for calling [Builder.preferredName] with `preferredName.orElse(null)`. */ + fun preferredName(preferredName: Optional) = + preferredName(preferredName.getOrNull()) - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } + /** + * Sets [Builder.preferredName] to an arbitrary JSON value. + * + * You should usually call [Builder.preferredName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun preferredName(preferredName: JsonField) = apply { + this.preferredName = preferredName + } - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + fun residence(residence: Location?) = residence(JsonField.ofNullable(residence)) - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + /** Alias for calling [Builder.residence] with `residence.orElse(null)`. */ + fun residence(residence: Optional) = residence(residence.getOrNull()) - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } + /** + * Sets [Builder.residence] to an arbitrary JSON value. + * + * You should usually call [Builder.residence] with a well-typed [Location] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun residence(residence: JsonField) = apply { this.residence = residence } - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } + /** + * Social Security Number of the individual. This field is only available with the `ssn` + * scope enabled and the `options: { include: ['ssn'] }` param set in the body. + * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + */ + fun ssn(ssn: String?) = ssn(JsonField.ofNullable(ssn)) - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + /** Alias for calling [Builder.ssn] with `ssn.orElse(null)`. */ + fun ssn(ssn: Optional) = ssn(ssn.getOrNull()) - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + /** + * Sets [Builder.ssn] to an arbitrary JSON value. + * + * You should usually call [Builder.ssn] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun ssn(ssn: JsonField) = apply { this.ssn = ssn } - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) + /** + * Returns an immutable instance of [IndividualWithoutId]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): IndividualWithoutId = + IndividualWithoutId( + dob, + (emails ?: JsonMissing.of()).map { it.toImmutable() }, + encryptedSsn, + ethnicity, + firstName, + gender, + lastName, + middleName, + (phoneNumbers ?: JsonMissing.of()).map { it.toImmutable() }, + preferredName, + residence, + ssn, + additionalProperties.toMutableMap(), + ) } - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } + private var validated: Boolean = false - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) + fun validate(): IndividualWithoutId = apply { + if (validated) { + return@apply } - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) + dob() + emails().ifPresent { it.forEach { it.validate() } } + encryptedSsn() + ethnicity() + firstName() + gender() + lastName() + middleName() + phoneNumbers().ifPresent { it.forEach { it?.validate() } } + preferredName() + residence().ifPresent { it.validate() } + ssn() + validated = true } - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) + return /* spotless:off */ other is IndividualWithoutId && dob == other.dob && emails == other.emails && encryptedSsn == other.encryptedSsn && ethnicity == other.ethnicity && firstName == other.firstName && gender == other.gender && lastName == other.lastName && middleName == other.middleName && phoneNumbers == other.phoneNumbers && preferredName == other.preferredName && residence == other.residence && ssn == other.ssn && additionalProperties == other.additionalProperties /* spotless:on */ } - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(dob, emails, encryptedSsn, ethnicity, firstName, gender, lastName, middleName, phoneNumbers, preferredName, residence, ssn, additionalProperties) } + /* spotless:on */ - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } + override fun hashCode(): Int = hashCode - /** - * Returns an immutable instance of [SandboxIndividualUpdateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .individualId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): SandboxIndividualUpdateParams = - SandboxIndividualUpdateParams( - checkRequired("individualId", individualId), - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) + override fun toString() = + "IndividualWithoutId{dob=$dob, emails=$emails, encryptedSsn=$encryptedSsn, ethnicity=$ethnicity, firstName=$firstName, gender=$gender, lastName=$lastName, middleName=$middleName, phoneNumbers=$phoneNumbers, preferredName=$preferredName, residence=$residence, ssn=$ssn, additionalProperties=$additionalProperties}" } - @NoAutoDetect class Email - @JsonCreator private constructor( - @JsonProperty("data") - @ExcludeMissing - private val data: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val data: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(data, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1229,21 +1259,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Email = apply { - if (validated) { - return@apply - } - - data() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1316,7 +1340,19 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Email = Email(data, type, additionalProperties.toImmutable()) + fun build(): Email = Email(data, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Email = apply { + if (validated) { + return@apply + } + + data() + type() + validated = true } class Type @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1684,18 +1720,19 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class PhoneNumber - @JsonCreator private constructor( - @JsonProperty("data") - @ExcludeMissing - private val data: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val data: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(data, type, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1722,21 +1759,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PhoneNumber = apply { - if (validated) { - return@apply - } - - data() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1809,7 +1840,19 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): PhoneNumber = PhoneNumber(data, type, additionalProperties.toImmutable()) + fun build(): PhoneNumber = PhoneNumber(data, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): PhoneNumber = apply { + if (validated) { + return@apply + } + + data() + type() + validated = true } class Type @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt index f7baec68..64c5787f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt @@ -11,24 +11,26 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects -@NoAutoDetect class SandboxJobConfiguration -@JsonCreator private constructor( - @JsonProperty("completion_status") - @ExcludeMissing - private val completionStatus: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val completionStatus: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("completion_status") + @ExcludeMissing + completionStatus: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(completionStatus, type, 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). @@ -58,21 +60,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SandboxJobConfiguration = apply { - if (validated) { - return@apply - } - - completionStatus() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -164,10 +160,22 @@ private constructor( SandboxJobConfiguration( checkRequired("completionStatus", completionStatus), checkRequired("type", type), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): SandboxJobConfiguration = apply { + if (validated) { + return@apply + } + + completionStatus() + type() + validated = true + } + class CompletionStatus @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt index 8172c944..85e0f79d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.models -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -19,10 +18,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - fun toBuilder() = Builder().from(this) companion object { @@ -37,7 +32,6 @@ private constructor( } /** A builder for [SandboxJobConfigurationRetrieveParams]. */ - @NoAutoDetect class Builder internal constructor() { private var additionalHeaders: Headers.Builder = Headers.builder() @@ -162,6 +156,10 @@ private constructor( ) } + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt index d2459c5d..c8b6d6f4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt @@ -3,7 +3,6 @@ package com.tryfinch.api.models import com.tryfinch.api.core.JsonValue -import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers @@ -27,12 +26,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): SandboxJobConfiguration = sandboxJobConfiguration - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - fun toBuilder() = Builder().from(this) companion object { @@ -50,7 +43,6 @@ private constructor( } /** A builder for [SandboxJobConfigurationUpdateParams]. */ - @NoAutoDetect class Builder internal constructor() { private var sandboxJobConfiguration: SandboxJobConfiguration? = null @@ -189,6 +181,12 @@ private constructor( ) } + @JvmSynthetic internal fun _body(): SandboxJobConfiguration = sandboxJobConfiguration + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt index fbbe2b64..1c6e5dd1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt @@ -11,14 +11,12 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects /** Enqueue a new sandbox job */ @@ -50,142 +48,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - @NoAutoDetect - class Body - @JsonCreator - private constructor( - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** - * The type of job to start. Currently the only supported type is `data_sync_all` - * - * @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 type(): Type = type.getRequired("type") - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - type() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Body]. - * - * The following fields are required: - * ```java - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var type: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - type = body.type - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** The type of job to start. Currently the only supported type is `data_sync_all` */ - fun type(type: Type) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [Type] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun type(type: JsonField) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body(checkRequired("type", type), additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Body && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = "Body{type=$type, additionalProperties=$additionalProperties}" - } - fun toBuilder() = Builder().from(this) companion object { @@ -202,7 +64,6 @@ private constructor( } /** A builder for [SandboxJobCreateParams]. */ - @NoAutoDetect class Builder internal constructor() { private var body: Body.Builder = Body.builder() @@ -364,6 +225,150 @@ private constructor( ) } + @JvmSynthetic internal fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + private constructor( + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of() + ) : this(type, mutableMapOf()) + + /** + * The type of job to start. Currently the only supported type is `data_sync_all` + * + * @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 type(): Type = type.getRequired("type") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + type = body.type + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The type of job to start. Currently the only supported type is `data_sync_all` */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body(checkRequired("type", type), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + type() + validated = true + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Body && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(type, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Body{type=$type, additionalProperties=$additionalProperties}" + } + /** The type of job to start. Currently the only supported type is `data_sync_all` */ class Type @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt index 8302efd2..7363244b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt @@ -11,14 +11,13 @@ 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.NoAutoDetect import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import com.tryfinch.api.core.immutableEmptyMap 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 @@ -76,216 +75,6 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - /** - * Fields to configure the payment. Takes all fields from the `/payment` endpoint. All fields - * are optional. - */ - @NoAutoDetect - class Body - @JsonCreator - private constructor( - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("pay_statements") - @ExcludeMissing - private val payStatements: JsonField> = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - - /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun payStatements(): Optional> = - Optional.ofNullable(payStatements.getNullable("pay_statements")) - - /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) - - /** - * Returns the raw JSON value of [endDate]. - * - * Unlike [endDate], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate(): JsonField = endDate - - /** - * Returns the raw JSON value of [payStatements]. - * - * Unlike [payStatements], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("pay_statements") - @ExcludeMissing - fun _payStatements(): JsonField> = payStatements - - /** - * Returns the raw JSON value of [startDate]. - * - * Unlike [startDate], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate(): JsonField = startDate - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - endDate() - payStatements().ifPresent { it.forEach { it.validate() } } - startDate() - validated = true - } - - 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 endDate: JsonField = JsonMissing.of() - private var payStatements: JsonField>? = null - private var startDate: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - endDate = body.endDate - payStatements = body.payStatements.map { it.toMutableList() } - startDate = body.startDate - additionalProperties = body.additionalProperties.toMutableMap() - } - - fun endDate(endDate: String) = endDate(JsonField.of(endDate)) - - /** - * Sets [Builder.endDate] to an arbitrary JSON value. - * - * You should usually call [Builder.endDate] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun payStatements(payStatements: List) = - payStatements(JsonField.of(payStatements)) - - /** - * Sets [Builder.payStatements] to an arbitrary JSON value. - * - * You should usually call [Builder.payStatements] with a well-typed - * `List` value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun payStatements(payStatements: JsonField>) = apply { - this.payStatements = payStatements.map { it.toMutableList() } - } - - /** - * Adds a single [PayStatement] to [payStatements]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addPayStatement(payStatement: PayStatement) = apply { - payStatements = - (payStatements ?: JsonField.of(mutableListOf())).also { - checkKnown("payStatements", it).add(payStatement) - } - } - - fun startDate(startDate: String) = startDate(JsonField.of(startDate)) - - /** - * Sets [Builder.startDate] to an arbitrary JSON value. - * - * You should usually call [Builder.startDate] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - - 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( - endDate, - (payStatements ?: JsonMissing.of()).map { it.toImmutable() }, - startDate, - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Body && endDate == other.endDate && payStatements == other.payStatements && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(endDate, payStatements, startDate, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{endDate=$endDate, payStatements=$payStatements, startDate=$startDate, additionalProperties=$additionalProperties}" - } - fun toBuilder() = Builder().from(this) companion object { @@ -299,7 +88,6 @@ private constructor( } /** A builder for [SandboxPaymentCreateParams]. */ - @NoAutoDetect class Builder internal constructor() { private var body: Body.Builder = Body.builder() @@ -411,120 +199,356 @@ private constructor( additionalHeaders.replace(name, values) } - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [SandboxPaymentCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): SandboxPaymentCreateParams = + SandboxPaymentCreateParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + @JvmSynthetic internal fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + /** + * Fields to configure the payment. Takes all fields from the `/payment` endpoint. All fields + * are optional. + */ + class Body + private constructor( + private val endDate: JsonField, + private val payStatements: JsonField>, + private val startDate: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("end_date") @ExcludeMissing endDate: JsonField = JsonMissing.of(), + @JsonProperty("pay_statements") + @ExcludeMissing + payStatements: JsonField> = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + startDate: JsonField = JsonMissing.of(), + ) : this(endDate, payStatements, startDate, mutableMapOf()) + + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun payStatements(): Optional> = + Optional.ofNullable(payStatements.getNullable("pay_statements")) + + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) + + /** + * Returns the raw JSON value of [endDate]. + * + * Unlike [endDate], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate(): JsonField = endDate + + /** + * Returns the raw JSON value of [payStatements]. + * + * Unlike [payStatements], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("pay_statements") + @ExcludeMissing + fun _payStatements(): JsonField> = payStatements + + /** + * Returns the raw JSON value of [startDate]. + * + * Unlike [startDate], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate(): JsonField = startDate + + @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 endDate: JsonField = JsonMissing.of() + private var payStatements: JsonField>? = null + private var startDate: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + endDate = body.endDate + payStatements = body.payStatements.map { it.toMutableList() } + startDate = body.startDate + additionalProperties = body.additionalProperties.toMutableMap() + } + + fun endDate(endDate: String) = endDate(JsonField.of(endDate)) + + /** + * Sets [Builder.endDate] to an arbitrary JSON value. + * + * You should usually call [Builder.endDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + fun payStatements(payStatements: List) = + payStatements(JsonField.of(payStatements)) + + /** + * Sets [Builder.payStatements] to an arbitrary JSON value. + * + * You should usually call [Builder.payStatements] with a well-typed + * `List` value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun payStatements(payStatements: JsonField>) = apply { + this.payStatements = payStatements.map { it.toMutableList() } + } + + /** + * Adds a single [PayStatement] to [payStatements]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addPayStatement(payStatement: PayStatement) = apply { + payStatements = + (payStatements ?: JsonField.of(mutableListOf())).also { + checkKnown("payStatements", it).add(payStatement) + } + } + + fun startDate(startDate: String) = startDate(JsonField.of(startDate)) - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + /** + * Sets [Builder.startDate] to an arbitrary JSON value. + * + * You should usually call [Builder.startDate] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Body = + Body( + endDate, + (payStatements ?: JsonMissing.of()).map { it.toImmutable() }, + startDate, + additionalProperties.toMutableMap(), + ) } - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } + private var validated: Boolean = false - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) + fun validate(): Body = apply { + if (validated) { + return@apply } - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) + endDate() + payStatements().ifPresent { it.forEach { it.validate() } } + startDate() + validated = true } - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) + return /* spotless:off */ other is Body && endDate == other.endDate && payStatements == other.payStatements && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(endDate, payStatements, startDate, additionalProperties) } + /* spotless:on */ - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } + override fun hashCode(): Int = hashCode - /** - * Returns an immutable instance of [SandboxPaymentCreateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): SandboxPaymentCreateParams = - SandboxPaymentCreateParams( - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) + override fun toString() = + "Body{endDate=$endDate, payStatements=$payStatements, startDate=$startDate, additionalProperties=$additionalProperties}" } - @NoAutoDetect class PayStatement - @JsonCreator private constructor( - @JsonProperty("earnings") - @ExcludeMissing - private val earnings: JsonField> = JsonMissing.of(), - @JsonProperty("employee_deductions") - @ExcludeMissing - private val employeeDeductions: JsonField> = JsonMissing.of(), - @JsonProperty("employer_contributions") - @ExcludeMissing - private val employerContributions: JsonField> = - JsonMissing.of(), - @JsonProperty("gross_pay") - @ExcludeMissing - private val grossPay: JsonField = JsonMissing.of(), - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonProperty("net_pay") - @ExcludeMissing - private val netPay: JsonField = JsonMissing.of(), - @JsonProperty("payment_method") - @ExcludeMissing - private val paymentMethod: JsonField = JsonMissing.of(), - @JsonProperty("taxes") - @ExcludeMissing - private val taxes: JsonField> = JsonMissing.of(), - @JsonProperty("total_hours") - @ExcludeMissing - private val totalHours: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val earnings: JsonField>, + private val employeeDeductions: JsonField>, + private val employerContributions: JsonField>, + private val grossPay: JsonField, + private val individualId: JsonField, + private val netPay: JsonField, + private val paymentMethod: JsonField, + private val taxes: JsonField>, + private val totalHours: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("earnings") + @ExcludeMissing + earnings: JsonField> = JsonMissing.of(), + @JsonProperty("employee_deductions") + @ExcludeMissing + employeeDeductions: JsonField> = JsonMissing.of(), + @JsonProperty("employer_contributions") + @ExcludeMissing + employerContributions: JsonField> = JsonMissing.of(), + @JsonProperty("gross_pay") + @ExcludeMissing + grossPay: JsonField = JsonMissing.of(), + @JsonProperty("individual_id") + @ExcludeMissing + individualId: JsonField = JsonMissing.of(), + @JsonProperty("net_pay") @ExcludeMissing netPay: JsonField = JsonMissing.of(), + @JsonProperty("payment_method") + @ExcludeMissing + paymentMethod: JsonField = JsonMissing.of(), + @JsonProperty("taxes") @ExcludeMissing taxes: JsonField> = JsonMissing.of(), + @JsonProperty("total_hours") + @ExcludeMissing + totalHours: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this( + earnings, + employeeDeductions, + employerContributions, + grossPay, + individualId, + netPay, + paymentMethod, + taxes, + totalHours, + type, + mutableMapOf(), + ) + /** * The array of earnings objects associated with this pay statement * @@ -691,29 +715,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): PayStatement = apply { - if (validated) { - return@apply - } - - earnings().ifPresent { it.forEach { it?.validate() } } - employeeDeductions().ifPresent { it.forEach { it?.validate() } } - employerContributions().ifPresent { it.forEach { it?.validate() } } - grossPay().ifPresent { it.validate() } - individualId() - netPay().ifPresent { it.validate() } - paymentMethod() - taxes().ifPresent { it.forEach { it?.validate() } } - totalHours() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1017,36 +1027,55 @@ private constructor( (taxes ?: JsonMissing.of()).map { it.toImmutable() }, totalHours, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): PayStatement = apply { + if (validated) { + return@apply + } + + earnings().ifPresent { it.forEach { it?.validate() } } + employeeDeductions().ifPresent { it.forEach { it?.validate() } } + employerContributions().ifPresent { it.forEach { it?.validate() } } + grossPay().ifPresent { it.validate() } + individualId() + netPay().ifPresent { it.validate() } + paymentMethod() + taxes().ifPresent { it.forEach { it?.validate() } } + totalHours() + type() + validated = true + } + class Earning - @JsonCreator private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("attributes") - @ExcludeMissing - private val attributes: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("hours") - @ExcludeMissing - private val hours: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val amount: JsonField, + private val attributes: JsonField, + private val currency: JsonField, + private val hours: JsonField, + private val name: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + attributes: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("hours") @ExcludeMissing hours: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(amount, attributes, currency, hours, name, type, mutableMapOf()) + /** * The earnings amount in cents. * @@ -1141,25 +1170,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Earning = apply { - if (validated) { - return@apply - } - - amount() - attributes().ifPresent { it.validate() } - currency() - hours() - name() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1336,21 +1355,39 @@ private constructor( hours, name, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): Earning = apply { + if (validated) { + return@apply + } + + amount() + attributes().ifPresent { it.validate() } + currency() + hours() + name() + type() + validated = true + } + class Attributes - @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val metadata: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -1368,21 +1405,16 @@ private constructor( @ExcludeMissing fun _metadata(): JsonField = metadata - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Attributes = apply { - if (validated) { - return@apply - } - - metadata().ifPresent { it.validate() } - validated = true + @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 { @@ -1442,20 +1474,33 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Attributes = - Attributes(metadata, additionalProperties.toImmutable()) + Attributes(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Attributes = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true } - @NoAutoDetect class Metadata - @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val metadata: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + /** * The metadata to be attached to the entity by existing rules. It is a * key-value pairs where the values can be of any type (string, number, boolean, @@ -1477,20 +1522,15 @@ private constructor( @ExcludeMissing fun _metadata(): JsonField = metadata + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Metadata = apply { - if (validated) { - return@apply - } - - metadata().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -1559,7 +1599,18 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Metadata = - Metadata(metadata, additionalProperties.toImmutable()) + Metadata(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true } /** @@ -1567,29 +1618,23 @@ private constructor( * key-value pairs where the values can be of any type (string, number, boolean, * object, array, etc.). */ - @NoAutoDetect class InnerMetadata - @JsonCreator private constructor( - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap() + private val additionalProperties: MutableMap ) { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): InnerMetadata = apply { - if (validated) { - return@apply - } + @JsonCreator private constructor() : this(mutableMapOf()) - validated = true + @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 { @@ -1642,7 +1687,17 @@ private constructor( * instance. */ fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toImmutable()) + InnerMetadata(additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true } override fun equals(other: Any?): Boolean { @@ -1887,32 +1942,35 @@ private constructor( "Earning{amount=$amount, attributes=$attributes, currency=$currency, hours=$hours, name=$name, type=$type, additionalProperties=$additionalProperties}" } - @NoAutoDetect class EmployeeDeduction - @JsonCreator private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("attributes") - @ExcludeMissing - private val attributes: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("pre_tax") - @ExcludeMissing - private val preTax: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val amount: JsonField, + private val attributes: JsonField, + private val currency: JsonField, + private val name: JsonField, + private val preTax: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + attributes: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("pre_tax") + @ExcludeMissing + preTax: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(amount, attributes, currency, name, preTax, type, mutableMapOf()) + /** * The deduction amount in cents. * @@ -2006,25 +2064,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): EmployeeDeduction = apply { - if (validated) { - return@apply - } - - amount() - attributes().ifPresent { it.validate() } - currency() - name() - preTax() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2200,21 +2248,39 @@ private constructor( name, preTax, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): EmployeeDeduction = apply { + if (validated) { + return@apply + } + + amount() + attributes().ifPresent { it.validate() } + currency() + name() + preTax() + type() + validated = true + } + class Attributes - @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val metadata: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -2232,20 +2298,15 @@ private constructor( @ExcludeMissing fun _metadata(): JsonField = metadata + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Attributes = apply { - if (validated) { - return@apply - } - - metadata().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2306,20 +2367,33 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Attributes = - Attributes(metadata, additionalProperties.toImmutable()) + Attributes(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Attributes = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true } - @NoAutoDetect class Metadata - @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val metadata: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + /** * The metadata to be attached to the entity by existing rules. It is a * key-value pairs where the values can be of any type (string, number, boolean, @@ -2341,20 +2415,15 @@ private constructor( @ExcludeMissing fun _metadata(): JsonField = metadata + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Metadata = apply { - if (validated) { - return@apply - } - - metadata().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2423,7 +2492,18 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Metadata = - Metadata(metadata, additionalProperties.toImmutable()) + Metadata(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true } /** @@ -2431,29 +2511,23 @@ private constructor( * key-value pairs where the values can be of any type (string, number, boolean, * object, array, etc.). */ - @NoAutoDetect class InnerMetadata - @JsonCreator private constructor( - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap() + private val additionalProperties: MutableMap ) { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): InnerMetadata = apply { - if (validated) { - return@apply - } + @JsonCreator private constructor() : this(mutableMapOf()) - validated = true + @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 { @@ -2506,7 +2580,17 @@ private constructor( * instance. */ fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toImmutable()) + InnerMetadata(additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true } override fun equals(other: Any?): Boolean { @@ -2581,29 +2665,31 @@ private constructor( "EmployeeDeduction{amount=$amount, attributes=$attributes, currency=$currency, name=$name, preTax=$preTax, type=$type, additionalProperties=$additionalProperties}" } - @NoAutoDetect class EmployerContribution - @JsonCreator private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("attributes") - @ExcludeMissing - private val attributes: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val amount: JsonField, + private val attributes: JsonField, + private val currency: JsonField, + private val name: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + attributes: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(amount, attributes, currency, name, type, mutableMapOf()) + /** * The contribution amount in cents. * @@ -2682,24 +2768,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): EmployerContribution = apply { - if (validated) { - return@apply - } - - amount() - attributes().ifPresent { it.validate() } - currency() - name() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2850,21 +2927,38 @@ private constructor( currency, name, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): EmployerContribution = apply { + if (validated) { + return@apply + } + + amount() + attributes().ifPresent { it.validate() } + currency() + name() + type() + validated = true + } + class Attributes - @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val metadata: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -2882,20 +2976,15 @@ private constructor( @ExcludeMissing fun _metadata(): JsonField = metadata + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Attributes = apply { - if (validated) { - return@apply - } - - metadata().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -2956,20 +3045,33 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Attributes = - Attributes(metadata, additionalProperties.toImmutable()) + Attributes(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Attributes = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true } - @NoAutoDetect class Metadata - @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val metadata: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + /** * The metadata to be attached to the entity by existing rules. It is a * key-value pairs where the values can be of any type (string, number, boolean, @@ -2991,20 +3093,15 @@ private constructor( @ExcludeMissing fun _metadata(): JsonField = metadata + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Metadata = apply { - if (validated) { - return@apply - } - - metadata().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3073,7 +3170,18 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Metadata = - Metadata(metadata, additionalProperties.toImmutable()) + Metadata(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true } /** @@ -3081,29 +3189,23 @@ private constructor( * key-value pairs where the values can be of any type (string, number, boolean, * object, array, etc.). */ - @NoAutoDetect class InnerMetadata - @JsonCreator private constructor( - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap() + private val additionalProperties: MutableMap ) { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): InnerMetadata = apply { - if (validated) { - return@apply - } + @JsonCreator private constructor() : this(mutableMapOf()) - validated = true + @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 { @@ -3156,7 +3258,17 @@ private constructor( * instance. */ fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toImmutable()) + InnerMetadata(additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true } override fun equals(other: Any?): Boolean { @@ -3336,32 +3448,33 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect class Tax - @JsonCreator private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("attributes") - @ExcludeMissing - private val attributes: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("employer") - @ExcludeMissing - private val employer: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val amount: JsonField, + private val attributes: JsonField, + private val currency: JsonField, + private val employer: JsonField, + private val name: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + attributes: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("employer") + @ExcludeMissing + employer: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(amount, attributes, currency, employer, name, type, mutableMapOf()) + /** * The tax amount in cents. * @@ -3457,25 +3570,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Tax = apply { - if (validated) { - return@apply - } - - amount() - attributes().ifPresent { it.validate() } - currency() - employer() - name() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3649,21 +3752,39 @@ private constructor( employer, name, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } - @NoAutoDetect + private var validated: Boolean = false + + fun validate(): Tax = apply { + if (validated) { + return@apply + } + + amount() + attributes().ifPresent { it.validate() } + currency() + employer() + name() + type() + validated = true + } + class Attributes - @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val metadata: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -3681,20 +3802,15 @@ private constructor( @ExcludeMissing fun _metadata(): JsonField = metadata + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Attributes = apply { - if (validated) { - return@apply - } - - metadata().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3755,20 +3871,33 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Attributes = - Attributes(metadata, additionalProperties.toImmutable()) + Attributes(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Attributes = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true } - @NoAutoDetect class Metadata - @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val metadata: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + /** * The metadata to be attached to the entity by existing rules. It is a * key-value pairs where the values can be of any type (string, number, boolean, @@ -3790,20 +3919,15 @@ private constructor( @ExcludeMissing fun _metadata(): JsonField = metadata + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Metadata = apply { - if (validated) { - return@apply - } - - metadata().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -3872,7 +3996,18 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Metadata = - Metadata(metadata, additionalProperties.toImmutable()) + Metadata(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true } /** @@ -3880,29 +4015,23 @@ private constructor( * key-value pairs where the values can be of any type (string, number, boolean, * object, array, etc.). */ - @NoAutoDetect class InnerMetadata - @JsonCreator private constructor( - @JsonAnySetter - private val additionalProperties: Map = - immutableEmptyMap() + private val additionalProperties: MutableMap ) { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): InnerMetadata = apply { - if (validated) { - return@apply - } + @JsonCreator private constructor() : this(mutableMapOf()) - validated = true + @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 { @@ -3955,7 +4084,17 @@ private constructor( * instance. */ fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toImmutable()) + InnerMetadata(additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt index d80dd9ce..79a726d4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt @@ -10,26 +10,26 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects -@NoAutoDetect class SessionNewResponse -@JsonCreator private constructor( - @JsonProperty("connect_url") - @ExcludeMissing - private val connectUrl: JsonField = JsonMissing.of(), - @JsonProperty("session_id") - @ExcludeMissing - private val sessionId: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val connectUrl: JsonField, + private val sessionId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("connect_url") + @ExcludeMissing + connectUrl: JsonField = JsonMissing.of(), + @JsonProperty("session_id") @ExcludeMissing sessionId: JsonField = JsonMissing.of(), + ) : this(connectUrl, sessionId, mutableMapOf()) + /** * The Connect URL to redirect the user to for authentication * @@ -60,21 +60,15 @@ private constructor( */ @JsonProperty("session_id") @ExcludeMissing fun _sessionId(): JsonField = sessionId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SessionNewResponse = apply { - if (validated) { - return@apply - } - - connectUrl() - sessionId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -166,10 +160,22 @@ private constructor( SessionNewResponse( checkRequired("connectUrl", connectUrl), checkRequired("sessionId", sessionId), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): SessionNewResponse = apply { + if (validated) { + return@apply + } + + connectUrl() + sessionId() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt index 7326657d..4d21d31f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt @@ -10,26 +10,26 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects -@NoAutoDetect class SessionReauthenticateResponse -@JsonCreator private constructor( - @JsonProperty("connect_url") - @ExcludeMissing - private val connectUrl: JsonField = JsonMissing.of(), - @JsonProperty("session_id") - @ExcludeMissing - private val sessionId: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val connectUrl: JsonField, + private val sessionId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("connect_url") + @ExcludeMissing + connectUrl: JsonField = JsonMissing.of(), + @JsonProperty("session_id") @ExcludeMissing sessionId: JsonField = JsonMissing.of(), + ) : this(connectUrl, sessionId, mutableMapOf()) + /** * The Connect URL to redirect the user to for reauthentication * @@ -60,21 +60,15 @@ private constructor( */ @JsonProperty("session_id") @ExcludeMissing fun _sessionId(): JsonField = sessionId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SessionReauthenticateResponse = apply { - if (validated) { - return@apply - } - - connectUrl() - sessionId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -167,10 +161,22 @@ private constructor( SessionReauthenticateResponse( checkRequired("connectUrl", connectUrl), checkRequired("sessionId", sessionId), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): SessionReauthenticateResponse = apply { + if (validated) { + return@apply + } + + connectUrl() + sessionId() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt index 9b34ff89..831e93bb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt @@ -10,26 +10,28 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional -@NoAutoDetect class SupportPerBenefitType -@JsonCreator private constructor( - @JsonProperty("company_benefits") - @ExcludeMissing - private val companyBenefits: JsonField = JsonMissing.of(), - @JsonProperty("individual_benefits") - @ExcludeMissing - private val individualBenefits: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val companyBenefits: JsonField, + private val individualBenefits: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("company_benefits") + @ExcludeMissing + companyBenefits: JsonField = JsonMissing.of(), + @JsonProperty("individual_benefits") + @ExcludeMissing + individualBenefits: JsonField = JsonMissing.of(), + ) : this(companyBenefits, individualBenefits, mutableMapOf()) + /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -63,21 +65,15 @@ private constructor( @ExcludeMissing fun _individualBenefits(): JsonField = individualBenefits + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SupportPerBenefitType = apply { - if (validated) { - return@apply - } - - companyBenefits().ifPresent { it.validate() } - individualBenefits().ifPresent { it.validate() } - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -157,10 +153,22 @@ private constructor( SupportPerBenefitType( companyBenefits, individualBenefits, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): SupportPerBenefitType = apply { + if (validated) { + return@apply + } + + companyBenefits().ifPresent { it.validate() } + individualBenefits().ifPresent { it.validate() } + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt index c34a31ee..43f2206e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt @@ -11,46 +11,61 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkKnown -import com.tryfinch.api.core.immutableEmptyMap 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 -@NoAutoDetect class SupportedBenefit -@JsonCreator private constructor( - @JsonProperty("annual_maximum") - @ExcludeMissing - private val annualMaximum: JsonField = JsonMissing.of(), - @JsonProperty("catch_up") - @ExcludeMissing - private val catchUp: JsonField = JsonMissing.of(), - @JsonProperty("company_contribution") - @ExcludeMissing - private val companyContribution: JsonField> = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("employee_deduction") - @ExcludeMissing - private val employeeDeduction: JsonField> = JsonMissing.of(), - @JsonProperty("frequencies") - @ExcludeMissing - private val frequencies: JsonField> = JsonMissing.of(), - @JsonProperty("hsa_contribution_limit") - @ExcludeMissing - private val hsaContributionLimit: JsonField> = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - private val type: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + 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 type: 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(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this( + annualMaximum, + catchUp, + companyContribution, + description, + employeeDeduction, + frequencies, + hsaContributionLimit, + type, + mutableMapOf(), + ) + /** * Whether the provider supports an annual maximum for this benefit. * @@ -190,27 +205,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SupportedBenefit = apply { - if (validated) { - return@apply - } - - annualMaximum() - catchUp() - companyContribution() - description() - employeeDeduction() - frequencies() - hsaContributionLimit() - type() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -491,10 +494,28 @@ private constructor( (frequencies ?: JsonMissing.of()).map { it.toImmutable() }, (hsaContributionLimit ?: JsonMissing.of()).map { it.toImmutable() }, type, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): SupportedBenefit = apply { + if (validated) { + return@apply + } + + annualMaximum() + catchUp() + companyContribution() + description() + employeeDeduction() + frequencies() + hsaContributionLimit() + type() + validated = true + } + class CompanyContribution @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt index 089c7ef2..e779fdd9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt @@ -10,26 +10,29 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -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 -@NoAutoDetect class UnenrolledIndividual -@JsonCreator private constructor( - @JsonProperty("body") @ExcludeMissing private val body: JsonField = JsonMissing.of(), - @JsonProperty("code") @ExcludeMissing private val code: JsonField = JsonMissing.of(), - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + 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). @@ -74,22 +77,15 @@ private constructor( @ExcludeMissing fun _individualId(): JsonField = individualId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): UnenrolledIndividual = apply { - if (validated) { - return@apply - } - - body().ifPresent { it.validate() } - code() - individualId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -174,26 +170,39 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): UnenrolledIndividual = - UnenrolledIndividual(body, code, individualId, additionalProperties.toImmutable()) + UnenrolledIndividual(body, code, individualId, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): UnenrolledIndividual = apply { + if (validated) { + return@apply + } + + body().ifPresent { it.validate() } + code() + individualId() + validated = true } - @NoAutoDetect class Body - @JsonCreator private constructor( - @JsonProperty("finch_code") - @ExcludeMissing - private val finchCode: JsonField = JsonMissing.of(), - @JsonProperty("message") - @ExcludeMissing - private val message: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + 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. * @@ -239,22 +248,15 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - finchCode() - message() - name() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -349,7 +351,20 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Body = Body(finchCode, message, name, additionalProperties.toImmutable()) + 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 } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt index a85c5e93..edaba045 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt @@ -10,23 +10,22 @@ 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.NoAutoDetect import com.tryfinch.api.core.checkRequired -import com.tryfinch.api.core.immutableEmptyMap -import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections import java.util.Objects -@NoAutoDetect class UpdateCompanyBenefitResponse -@JsonCreator private constructor( - @JsonProperty("benefit_id") - @ExcludeMissing - private val benefitId: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val benefitId: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("benefit_id") @ExcludeMissing benefitId: JsonField = JsonMissing.of() + ) : this(benefitId, 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). @@ -40,20 +39,15 @@ private constructor( */ @JsonProperty("benefit_id") @ExcludeMissing fun _benefitId(): JsonField = benefitId + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): UpdateCompanyBenefitResponse = apply { - if (validated) { - return@apply - } - - benefitId() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -127,10 +121,21 @@ private constructor( fun build(): UpdateCompanyBenefitResponse = UpdateCompanyBenefitResponse( checkRequired("benefitId", benefitId), - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): UpdateCompanyBenefitResponse = apply { + if (validated) { + return@apply + } + + benefitId() + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt index fc5fda1f..d3c1fd4c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt @@ -11,10 +11,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -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 @@ -23,16 +21,21 @@ import kotlin.jvm.optionals.getOrNull * A 2005 version of the W-4 tax form containing information on an individual's filing status, * dependents, and withholding details. */ -@NoAutoDetect class W42005 -@JsonCreator private constructor( - @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonProperty("year") @ExcludeMissing private val year: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val data: JsonField, + private val type: JsonField, + private val year: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("year") @ExcludeMissing year: JsonField = JsonMissing.of(), + ) : this(data, type, year, mutableMapOf()) + /** * Detailed information specific to the 2005 W4 form. * @@ -78,22 +81,15 @@ private constructor( */ @JsonProperty("year") @ExcludeMissing fun _year(): JsonField = year + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): W42005 = apply { - if (validated) { - return@apply - } - - data().ifPresent { it.validate() } - type() - year() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -186,33 +182,59 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): W42005 = W42005(data, type, year, additionalProperties.toImmutable()) + fun build(): W42005 = W42005(data, type, year, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): W42005 = apply { + if (validated) { + return@apply + } + + data().ifPresent { it.validate() } + type() + year() + validated = true } /** Detailed information specific to the 2005 W4 form. */ - @NoAutoDetect class Data - @JsonCreator private constructor( - @JsonProperty("additional_withholding") - @ExcludeMissing - private val additionalWithholding: JsonField = JsonMissing.of(), - @JsonProperty("exemption") - @ExcludeMissing - private val exemption: JsonField = JsonMissing.of(), - @JsonProperty("filing_status") - @ExcludeMissing - private val filingStatus: JsonField = JsonMissing.of(), - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonProperty("total_number_of_allowances") - @ExcludeMissing - private val totalNumberOfAllowances: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalWithholding: JsonField, + private val exemption: JsonField, + private val filingStatus: JsonField, + private val individualId: JsonField, + private val totalNumberOfAllowances: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("additional_withholding") + @ExcludeMissing + additionalWithholding: JsonField = JsonMissing.of(), + @JsonProperty("exemption") + @ExcludeMissing + exemption: JsonField = JsonMissing.of(), + @JsonProperty("filing_status") + @ExcludeMissing + filingStatus: JsonField = JsonMissing.of(), + @JsonProperty("individual_id") + @ExcludeMissing + individualId: JsonField = JsonMissing.of(), + @JsonProperty("total_number_of_allowances") + @ExcludeMissing + totalNumberOfAllowances: JsonField = JsonMissing.of(), + ) : this( + additionalWithholding, + exemption, + filingStatus, + individualId, + totalNumberOfAllowances, + mutableMapOf(), + ) + /** * Additional withholding amount (in cents). * @@ -307,24 +329,15 @@ private constructor( @ExcludeMissing fun _totalNumberOfAllowances(): JsonField = totalNumberOfAllowances + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Data = apply { - if (validated) { - return@apply - } - - additionalWithholding() - exemption() - filingStatus() - individualId() - totalNumberOfAllowances() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -485,10 +498,25 @@ private constructor( filingStatus, individualId, totalNumberOfAllowances, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Data = apply { + if (validated) { + return@apply + } + + additionalWithholding() + exemption() + filingStatus() + individualId() + totalNumberOfAllowances() + validated = true + } + /** Indicates exemption status from federal tax withholding. */ class Exemption @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt index 77bb284e..fb2340c2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt @@ -11,10 +11,8 @@ 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.NoAutoDetect -import com.tryfinch.api.core.immutableEmptyMap -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 @@ -23,16 +21,21 @@ import kotlin.jvm.optionals.getOrNull * A 2020 version of the W-4 tax form containing information on an individual's filing status, * dependents, and withholding details. */ -@NoAutoDetect class W42020 -@JsonCreator private constructor( - @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonProperty("year") @ExcludeMissing private val year: JsonField = JsonMissing.of(), - @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), + private val data: JsonField, + private val type: JsonField, + private val year: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("year") @ExcludeMissing year: JsonField = JsonMissing.of(), + ) : this(data, type, year, mutableMapOf()) + /** * Detailed information specific to the 2020 W4 form. * @@ -78,22 +81,15 @@ private constructor( */ @JsonProperty("year") @ExcludeMissing fun _year(): JsonField = year + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): W42020 = apply { - if (validated) { - return@apply - } - - data().ifPresent { it.validate() } - type() - year() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -186,42 +182,74 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): W42020 = W42020(data, type, year, additionalProperties.toImmutable()) + fun build(): W42020 = W42020(data, type, year, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): W42020 = apply { + if (validated) { + return@apply + } + + data().ifPresent { it.validate() } + type() + year() + validated = true } /** Detailed information specific to the 2020 W4 form. */ - @NoAutoDetect class Data - @JsonCreator private constructor( - @JsonProperty("amount_for_other_dependents") - @ExcludeMissing - private val amountForOtherDependents: JsonField = JsonMissing.of(), - @JsonProperty("amount_for_qualifying_children_under_17") - @ExcludeMissing - private val amountForQualifyingChildrenUnder17: JsonField = JsonMissing.of(), - @JsonProperty("deductions") - @ExcludeMissing - private val deductions: JsonField = JsonMissing.of(), - @JsonProperty("extra_withholding") - @ExcludeMissing - private val extraWithholding: JsonField = JsonMissing.of(), - @JsonProperty("filing_status") - @ExcludeMissing - private val filingStatus: JsonField = JsonMissing.of(), - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonProperty("other_income") - @ExcludeMissing - private val otherIncome: JsonField = JsonMissing.of(), - @JsonProperty("total_claim_dependent_and_other_credits") - @ExcludeMissing - private val totalClaimDependentAndOtherCredits: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val amountForOtherDependents: JsonField, + private val amountForQualifyingChildrenUnder17: JsonField, + private val deductions: JsonField, + private val extraWithholding: JsonField, + private val filingStatus: JsonField, + private val individualId: JsonField, + private val otherIncome: JsonField, + private val totalClaimDependentAndOtherCredits: JsonField, + private val additionalProperties: MutableMap, ) { + @JsonCreator + private constructor( + @JsonProperty("amount_for_other_dependents") + @ExcludeMissing + amountForOtherDependents: JsonField = JsonMissing.of(), + @JsonProperty("amount_for_qualifying_children_under_17") + @ExcludeMissing + amountForQualifyingChildrenUnder17: JsonField = JsonMissing.of(), + @JsonProperty("deductions") + @ExcludeMissing + deductions: JsonField = JsonMissing.of(), + @JsonProperty("extra_withholding") + @ExcludeMissing + extraWithholding: JsonField = JsonMissing.of(), + @JsonProperty("filing_status") + @ExcludeMissing + filingStatus: JsonField = JsonMissing.of(), + @JsonProperty("individual_id") + @ExcludeMissing + individualId: JsonField = JsonMissing.of(), + @JsonProperty("other_income") + @ExcludeMissing + otherIncome: JsonField = JsonMissing.of(), + @JsonProperty("total_claim_dependent_and_other_credits") + @ExcludeMissing + totalClaimDependentAndOtherCredits: JsonField = JsonMissing.of(), + ) : this( + amountForOtherDependents, + amountForQualifyingChildrenUnder17, + deductions, + extraWithholding, + filingStatus, + individualId, + otherIncome, + totalClaimDependentAndOtherCredits, + mutableMapOf(), + ) + /** * Amount claimed for dependents other than qualifying children under 17 (in cents). * @@ -379,27 +407,15 @@ private constructor( fun _totalClaimDependentAndOtherCredits(): JsonField = totalClaimDependentAndOtherCredits + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Data = apply { - if (validated) { - return@apply - } - - amountForOtherDependents() - amountForQualifyingChildrenUnder17() - deductions() - extraWithholding() - filingStatus() - individualId() - otherIncome() - totalClaimDependentAndOtherCredits() - validated = true - } + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -675,10 +691,28 @@ private constructor( individualId, otherIncome, totalClaimDependentAndOtherCredits, - additionalProperties.toImmutable(), + additionalProperties.toMutableMap(), ) } + private var validated: Boolean = false + + fun validate(): Data = apply { + if (validated) { + return@apply + } + + amountForOtherDependents() + amountForQualifyingChildrenUnder17() + deductions() + extraWithholding() + filingStatus() + individualId() + otherIncome() + totalClaimDependentAndOtherCredits() + validated = true + } + /** The individual's filing status for tax purposes. */ class FilingStatus @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/SerializerTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/SerializerTest.kt index 159fc882..974c40f9 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/SerializerTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/SerializerTest.kt @@ -11,7 +11,6 @@ import org.junit.jupiter.api.Test internal class SerializerTest { @JsonDeserialize(builder = ClassWithBooleanFieldPrefixedWithIs.Builder::class) - @NoAutoDetect class ClassWithBooleanFieldPrefixedWithIs private constructor( private val isActive: JsonField, @@ -60,7 +59,6 @@ internal class SerializerTest { fun builder() = Builder() } - @NoAutoDetect class Builder internal constructor() { private var isActive: JsonField = JsonMissing.of() From 5849824f4a7704255935cd6e13c1761427b8ca62 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 25 Mar 2025 16:26:40 +0000 Subject: [PATCH 41/65] feat(api): api update (#513) --- .stats.yml | 2 +- .../src/main/kotlin/com/tryfinch/api/models/W42005.kt | 7 ++++++- .../test/kotlin/com/tryfinch/api/models/CompanyTest.kt | 8 ++++---- .../tryfinch/api/models/CompanyUpdateResponseTest.kt | 4 ++-- .../api/models/SandboxCompanyUpdateParamsTest.kt | 10 +++++----- .../services/async/sandbox/CompanyServiceAsyncTest.kt | 2 +- .../services/blocking/sandbox/CompanyServiceTest.kt | 2 +- 7 files changed, 20 insertions(+), 15 deletions(-) diff --git a/.stats.yml b/.stats.yml index 42d351e3..2762eb75 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-f1779210fbedfc6099076412405288b489f727cbb0b3a85e7b7c12fabb37ef47.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-69819ddc6d03624ee8d880317fca03afab50a0a843218f1d9f14616e8a003dad.yml diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt index d3c1fd4c..a1aaa30f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt @@ -410,7 +410,12 @@ private constructor( fun exemption(exemption: JsonField) = apply { this.exemption = exemption } /** The individual's filing status for tax purposes. */ - fun filingStatus(filingStatus: FilingStatus) = filingStatus(JsonField.of(filingStatus)) + fun filingStatus(filingStatus: FilingStatus?) = + filingStatus(JsonField.ofNullable(filingStatus)) + + /** Alias for calling [Builder.filingStatus] with `filingStatus.orElse(null)`. */ + fun filingStatus(filingStatus: Optional) = + filingStatus(filingStatus.getOrNull()) /** * Sets [Builder.filingStatus] to an arbitrary JSON value. diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt index b6f8b419..49ca5786 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt @@ -12,7 +12,7 @@ internal class CompanyTest { fun create() { val company = Company.builder() - .id("id") + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addAccount( Company.Account.builder() .accountName("account_name") @@ -48,11 +48,11 @@ internal class CompanyTest { .state("state") .build() ) - .primaryEmail("primary_email") + .primaryEmail("dev@stainless.com") .primaryPhoneNumber("primary_phone_number") .build() - assertThat(company.id()).isEqualTo("id") + assertThat(company.id()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(company.accounts().getOrNull()) .containsExactly( Company.Account.builder() @@ -92,7 +92,7 @@ internal class CompanyTest { .state("state") .build() ) - assertThat(company.primaryEmail()).contains("primary_email") + assertThat(company.primaryEmail()).contains("dev@stainless.com") assertThat(company.primaryPhoneNumber()).contains("primary_phone_number") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt index a50c0da3..3956a3d5 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt @@ -49,7 +49,7 @@ internal class CompanyUpdateResponseTest { .state("state") .build() ) - .primaryEmail("primary_email") + .primaryEmail("dev@stainless.com") .primaryPhoneNumber("primary_phone_number") .build() @@ -92,7 +92,7 @@ internal class CompanyUpdateResponseTest { .state("state") .build() ) - assertThat(companyUpdateResponse.primaryEmail()).contains("primary_email") + assertThat(companyUpdateResponse.primaryEmail()).contains("dev@stainless.com") assertThat(companyUpdateResponse.primaryPhoneNumber()).contains("primary_phone_number") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt index f14348ef..149dc4c6 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt @@ -48,7 +48,7 @@ internal class SandboxCompanyUpdateParamsTest { .state("state") .build() ) - .primaryEmail("primary_email") + .primaryEmail("dev@stainless.com") .primaryPhoneNumber("primary_phone_number") .build() } @@ -96,7 +96,7 @@ internal class SandboxCompanyUpdateParamsTest { .state("state") .build() ) - .primaryEmail("primary_email") + .primaryEmail("dev@stainless.com") .primaryPhoneNumber("primary_phone_number") .build() @@ -143,7 +143,7 @@ internal class SandboxCompanyUpdateParamsTest { .state("state") .build() ) - assertThat(body.primaryEmail()).contains("primary_email") + assertThat(body.primaryEmail()).contains("dev@stainless.com") assertThat(body.primaryPhoneNumber()).contains("primary_phone_number") } @@ -157,7 +157,7 @@ internal class SandboxCompanyUpdateParamsTest { .entity(SandboxCompanyUpdateParams.Entity.builder().build()) .legalName("legal_name") .addLocation(Location.builder().build()) - .primaryEmail("primary_email") + .primaryEmail("dev@stainless.com") .primaryPhoneNumber("primary_phone_number") .build() @@ -171,7 +171,7 @@ internal class SandboxCompanyUpdateParamsTest { assertThat(body.entity()).contains(SandboxCompanyUpdateParams.Entity.builder().build()) assertThat(body.legalName()).contains("legal_name") assertThat(body.locations().getOrNull()).containsExactly(Location.builder().build()) - assertThat(body.primaryEmail()).contains("primary_email") + assertThat(body.primaryEmail()).contains("dev@stainless.com") assertThat(body.primaryPhoneNumber()).contains("primary_phone_number") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncTest.kt index dd90399f..644fb0d1 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncTest.kt @@ -63,7 +63,7 @@ internal class CompanyServiceAsyncTest { .state("state") .build() ) - .primaryEmail("primary_email") + .primaryEmail("dev@stainless.com") .primaryPhoneNumber("primary_phone_number") .build() ) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceTest.kt index a70db440..092485b9 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceTest.kt @@ -63,7 +63,7 @@ internal class CompanyServiceTest { .state("state") .build() ) - .primaryEmail("primary_email") + .primaryEmail("dev@stainless.com") .primaryPhoneNumber("primary_phone_number") .build() ) From de913e6b48d8d78712fe34885a06c359446f9388 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Mar 2025 17:32:34 +0000 Subject: [PATCH 42/65] codegen metadata --- .stats.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.stats.yml b/.stats.yml index 2762eb75..3eedfc68 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,4 @@ configured_endpoints: 40 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-69819ddc6d03624ee8d880317fca03afab50a0a843218f1d9f14616e8a003dad.yml +openapi_spec_hash: aaaf1428c428b79ff61b7cd02c7eee5c +config_hash: 8303e755d3e16cf28542d5f0aec83851 From 8d03e6dd61fa910bcd9788a58ad4cbd0141356ac Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Mar 2025 22:46:20 +0000 Subject: [PATCH 43/65] chore(internal): delete unused methods and annotations (#514) fix(client): map deserialization bug --- .../api/models/AccountDisconnectParams.kt | 21 ++---- .../com/tryfinch/api/models/CompanyEvent.kt | 19 +++--- .../com/tryfinch/api/models/PayStatement.kt | 64 ++++++------------- .../api/models/SandboxPaymentCreateParams.kt | 64 ++++++------------- 4 files changed, 53 insertions(+), 115 deletions(-) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt index fc89011d..c1c81b71 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt @@ -2,14 +2,11 @@ package com.tryfinch.api.models -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.Params import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams -import java.util.Collections +import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional @@ -18,23 +15,15 @@ class AccountDisconnectParams private constructor( private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: MutableMap, + private val additionalBodyProperties: Map, ) : Params { + fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JsonAnySetter - private fun putAdditionalBodyProperty(key: String, value: JsonValue) { - additionalBodyProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalBodyProperties(): Map = - Collections.unmodifiableMap(additionalBodyProperties) - fun toBuilder() = Builder().from(this) companion object { @@ -189,7 +178,7 @@ private constructor( AccountDisconnectParams( additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toMutableMap(), + additionalBodyProperties.toImmutable(), ) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt index f916b070..de42d69b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt @@ -12,6 +12,7 @@ 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.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects @@ -307,19 +308,15 @@ private constructor( } class Data - private constructor(private val additionalProperties: MutableMap) { - - @JsonCreator private constructor() : this(mutableMapOf()) - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun _additionalProperties(): Map = additionalProperties fun toBuilder() = Builder().from(this) @@ -363,7 +360,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Data = Data(additionalProperties.toMutableMap()) + fun build(): Data = Data(additionalProperties.toImmutable()) } private var validated: Boolean = false diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt index 6130a459..45ffe3fc 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt @@ -1114,21 +1114,15 @@ private constructor( * array, etc.). */ class InnerMetadata + @JsonCreator private constructor( - private val additionalProperties: MutableMap + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map ) { - @JsonCreator private constructor() : this(mutableMapOf()) - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun _additionalProperties(): Map = additionalProperties fun toBuilder() = Builder().from(this) @@ -1180,7 +1174,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toMutableMap()) + InnerMetadata(additionalProperties.toImmutable()) } private var validated: Boolean = false @@ -1986,21 +1980,15 @@ private constructor( * array, etc.). */ class InnerMetadata + @JsonCreator private constructor( - private val additionalProperties: MutableMap + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map ) { - @JsonCreator private constructor() : this(mutableMapOf()) - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun _additionalProperties(): Map = additionalProperties fun toBuilder() = Builder().from(this) @@ -2052,7 +2040,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toMutableMap()) + InnerMetadata(additionalProperties.toImmutable()) } private var validated: Boolean = false @@ -2648,21 +2636,15 @@ private constructor( * array, etc.). */ class InnerMetadata + @JsonCreator private constructor( - private val additionalProperties: MutableMap + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map ) { - @JsonCreator private constructor() : this(mutableMapOf()) - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun _additionalProperties(): Map = additionalProperties fun toBuilder() = Builder().from(this) @@ -2714,7 +2696,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toMutableMap()) + InnerMetadata(additionalProperties.toImmutable()) } private var validated: Boolean = false @@ -3457,21 +3439,15 @@ private constructor( * array, etc.). */ class InnerMetadata + @JsonCreator private constructor( - private val additionalProperties: MutableMap + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map ) { - @JsonCreator private constructor() : this(mutableMapOf()) - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun _additionalProperties(): Map = additionalProperties fun toBuilder() = Builder().from(this) @@ -3523,7 +3499,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toMutableMap()) + InnerMetadata(additionalProperties.toImmutable()) } private var validated: Boolean = false diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt index 7363244b..9817ef9e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt @@ -1619,21 +1619,15 @@ private constructor( * object, array, etc.). */ class InnerMetadata + @JsonCreator private constructor( - private val additionalProperties: MutableMap + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map ) { - @JsonCreator private constructor() : this(mutableMapOf()) - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun _additionalProperties(): Map = additionalProperties fun toBuilder() = Builder().from(this) @@ -1687,7 +1681,7 @@ private constructor( * instance. */ fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toMutableMap()) + InnerMetadata(additionalProperties.toImmutable()) } private var validated: Boolean = false @@ -2512,21 +2506,15 @@ private constructor( * object, array, etc.). */ class InnerMetadata + @JsonCreator private constructor( - private val additionalProperties: MutableMap + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map ) { - @JsonCreator private constructor() : this(mutableMapOf()) - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun _additionalProperties(): Map = additionalProperties fun toBuilder() = Builder().from(this) @@ -2580,7 +2568,7 @@ private constructor( * instance. */ fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toMutableMap()) + InnerMetadata(additionalProperties.toImmutable()) } private var validated: Boolean = false @@ -3190,21 +3178,15 @@ private constructor( * object, array, etc.). */ class InnerMetadata + @JsonCreator private constructor( - private val additionalProperties: MutableMap + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map ) { - @JsonCreator private constructor() : this(mutableMapOf()) - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun _additionalProperties(): Map = additionalProperties fun toBuilder() = Builder().from(this) @@ -3258,7 +3240,7 @@ private constructor( * instance. */ fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toMutableMap()) + InnerMetadata(additionalProperties.toImmutable()) } private var validated: Boolean = false @@ -4016,21 +3998,15 @@ private constructor( * object, array, etc.). */ class InnerMetadata + @JsonCreator private constructor( - private val additionalProperties: MutableMap + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map ) { - @JsonCreator private constructor() : this(mutableMapOf()) - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun _additionalProperties(): Map = additionalProperties fun toBuilder() = Builder().from(this) @@ -4084,7 +4060,7 @@ private constructor( * instance. */ fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toMutableMap()) + InnerMetadata(additionalProperties.toImmutable()) } private var validated: Boolean = false From dffd823f5649b18ca44e06d5f0f8bcb68ba43879 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Mar 2025 16:57:38 +0000 Subject: [PATCH 44/65] feat(api): api update (#515) --- .stats.yml | 4 ++-- .../com/tryfinch/api/models/IndividualUpdateResponse.kt | 5 ++++- .../com/tryfinch/api/models/SandboxDirectoryCreateParams.kt | 5 ++++- .../com/tryfinch/api/models/SandboxIndividualUpdateParams.kt | 5 ++++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3eedfc68..e5e8a093 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-69819ddc6d03624ee8d880317fca03afab50a0a843218f1d9f14616e8a003dad.yml -openapi_spec_hash: aaaf1428c428b79ff61b7cd02c7eee5c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-63d6857158c2634529b468b53df0b9c02f42d6f9783399939a38986e3137a86f.yml +openapi_spec_hash: 2c3aea6ae3e0a3dd7ac65c25b8fdc24d config_hash: 8303e755d3e16cf28542d5f0aec83851 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt index 9c170392..dbaa72c2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt @@ -1199,7 +1199,10 @@ private constructor( additionalProperties = phoneNumber.additionalProperties.toMutableMap() } - fun data(data: String) = data(JsonField.of(data)) + fun data(data: String?) = data(JsonField.ofNullable(data)) + + /** Alias for calling [Builder.data] with `data.orElse(null)`. */ + fun data(data: Optional) = data(data.getOrNull()) /** * Sets [Builder.data] to an arbitrary JSON value. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt index 16d2620c..793f2100 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt @@ -2855,7 +2855,10 @@ private constructor( additionalProperties = phoneNumber.additionalProperties.toMutableMap() } - fun data(data: String) = data(JsonField.of(data)) + fun data(data: String?) = data(JsonField.ofNullable(data)) + + /** Alias for calling [Builder.data] with `data.orElse(null)`. */ + fun data(data: Optional) = data(data.getOrNull()) /** * Sets [Builder.data] to an arbitrary JSON value. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt index 0fa3520e..ef523b2d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt @@ -1791,7 +1791,10 @@ private constructor( additionalProperties = phoneNumber.additionalProperties.toMutableMap() } - fun data(data: String) = data(JsonField.of(data)) + fun data(data: String?) = data(JsonField.ofNullable(data)) + + /** Alias for calling [Builder.data] with `data.orElse(null)`. */ + fun data(data: Optional) = data(data.getOrNull()) /** * Sets [Builder.data] to an arbitrary JSON value. From e988e9da5f57c5d201021842312fd60ae4c41ae1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 28 Mar 2025 13:24:12 +0000 Subject: [PATCH 45/65] fix(client): don't call `validate()` during deserialization if we don't have to (#516) --- .../com/tryfinch/api/core/BaseDeserializer.kt | 8 ++++++++ .../api/models/DocumentRetreiveResponse.kt | 16 ++++++++-------- .../api/models/JobAutomatedCreateParams.kt | 17 +++++++++-------- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/BaseDeserializer.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/BaseDeserializer.kt index c850405c..b0de5889 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/BaseDeserializer.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/BaseDeserializer.kt @@ -11,6 +11,7 @@ import com.fasterxml.jackson.databind.JsonMappingException import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.deser.ContextualDeserializer import com.fasterxml.jackson.databind.deser.std.StdDeserializer +import com.tryfinch.api.errors.FinchInvalidDataException import kotlin.reflect.KClass abstract class BaseDeserializer(type: KClass) : @@ -29,6 +30,13 @@ abstract class BaseDeserializer(type: KClass) : protected abstract fun ObjectCodec.deserialize(node: JsonNode): T + protected fun ObjectCodec.deserialize(node: JsonNode, type: TypeReference): T = + try { + readValue(treeAsTokens(node), type) + } catch (e: Exception) { + throw FinchInvalidDataException("Error deserializing", e) + } + protected fun ObjectCodec.tryDeserialize( node: JsonNode, type: TypeReference, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentRetreiveResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentRetreiveResponse.kt index 4fa2026a..25647646 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentRetreiveResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentRetreiveResponse.kt @@ -165,16 +165,16 @@ private constructor( when (type) { "w4_2020" -> { - tryDeserialize(node, jacksonTypeRef()) { it.validate() } - ?.let { - return DocumentRetreiveResponse(w42020 = it, _json = json) - } + return DocumentRetreiveResponse( + w42020 = deserialize(node, jacksonTypeRef()), + _json = json, + ) } "w4_2005" -> { - tryDeserialize(node, jacksonTypeRef()) { it.validate() } - ?.let { - return DocumentRetreiveResponse(w42005 = it, _json = json) - } + return DocumentRetreiveResponse( + w42005 = deserialize(node, jacksonTypeRef()), + _json = json, + ) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt index 62c34d96..9bf31100 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt @@ -337,16 +337,17 @@ private constructor( when (type) { "data_sync_all" -> { - tryDeserialize(node, jacksonTypeRef()) { it.validate() } - ?.let { - return Body(dataSyncAll = it, _json = json) - } + return Body( + dataSyncAll = deserialize(node, jacksonTypeRef()), + _json = json, + ) } "w4_form_employee_sync" -> { - tryDeserialize(node, jacksonTypeRef()) { it.validate() } - ?.let { - return Body(w4FormEmployeeSync = it, _json = json) - } + return Body( + w4FormEmployeeSync = + deserialize(node, jacksonTypeRef()), + _json = json, + ) } } From 01230422dedfd1f4432fc84e4ed517eaf31319a9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 31 Mar 2025 16:54:22 +0000 Subject: [PATCH 46/65] feat(api): api update (#517) --- .stats.yml | 4 +- .../com/tryfinch/api/models/Introspection.kt | 57 +++++++++++++++++-- .../tryfinch/api/models/IntrospectionTest.kt | 3 + 3 files changed, 57 insertions(+), 7 deletions(-) diff --git a/.stats.yml b/.stats.yml index e5e8a093..f68ad445 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-63d6857158c2634529b468b53df0b9c02f42d6f9783399939a38986e3137a86f.yml -openapi_spec_hash: 2c3aea6ae3e0a3dd7ac65c25b8fdc24d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-3224f142ed1542ed2535c155e8eb23b7ea10470c12448d60c3ce584126073a93.yml +openapi_spec_hash: 6c4b213ed5e4f7d1b369e04e4bfb5164 config_hash: 8303e755d3e16cf28542d5f0aec83851 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt index 6b3f333c..4276cda9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt @@ -15,6 +15,7 @@ import com.tryfinch.api.core.checkKnown import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException +import java.time.OffsetDateTime import java.util.Collections import java.util.Objects import java.util.Optional @@ -1434,6 +1435,7 @@ private constructor( class ConnectionStatus private constructor( + private val lastSuccessfulSync: JsonField, private val message: JsonField, private val status: JsonField, private val additionalProperties: MutableMap, @@ -1441,11 +1443,23 @@ private constructor( @JsonCreator private constructor( + @JsonProperty("last_successful_sync") + @ExcludeMissing + lastSuccessfulSync: JsonField = JsonMissing.of(), @JsonProperty("message") @ExcludeMissing message: JsonField = JsonMissing.of(), @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), - ) : this(message, status, mutableMapOf()) + ) : this(lastSuccessfulSync, message, status, mutableMapOf()) + + /** + * The datetime when the connection was last successfully synced. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun lastSuccessfulSync(): Optional = + Optional.ofNullable(lastSuccessfulSync.getNullable("last_successful_sync")) /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the @@ -1460,6 +1474,16 @@ private constructor( fun status(): Optional = Optional.ofNullable(status.getNullable("status")) + /** + * Returns the raw JSON value of [lastSuccessfulSync]. + * + * Unlike [lastSuccessfulSync], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("last_successful_sync") + @ExcludeMissing + fun _lastSuccessfulSync(): JsonField = lastSuccessfulSync + /** * Returns the raw JSON value of [message]. * @@ -1497,17 +1521,34 @@ private constructor( /** A builder for [ConnectionStatus]. */ class Builder internal constructor() { + private var lastSuccessfulSync: JsonField = JsonMissing.of() private var message: JsonField = JsonMissing.of() private var status: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(connectionStatus: ConnectionStatus) = apply { + lastSuccessfulSync = connectionStatus.lastSuccessfulSync message = connectionStatus.message status = connectionStatus.status additionalProperties = connectionStatus.additionalProperties.toMutableMap() } + /** The datetime when the connection was last successfully synced. */ + fun lastSuccessfulSync(lastSuccessfulSync: OffsetDateTime) = + lastSuccessfulSync(JsonField.of(lastSuccessfulSync)) + + /** + * Sets [Builder.lastSuccessfulSync] to an arbitrary JSON value. + * + * You should usually call [Builder.lastSuccessfulSync] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun lastSuccessfulSync(lastSuccessfulSync: JsonField) = apply { + this.lastSuccessfulSync = lastSuccessfulSync + } + fun message(message: String) = message(JsonField.of(message)) /** @@ -1555,7 +1596,12 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): ConnectionStatus = - ConnectionStatus(message, status, additionalProperties.toMutableMap()) + ConnectionStatus( + lastSuccessfulSync, + message, + status, + additionalProperties.toMutableMap(), + ) } private var validated: Boolean = false @@ -1565,6 +1611,7 @@ private constructor( return@apply } + lastSuccessfulSync() message() status() validated = true @@ -1575,17 +1622,17 @@ private constructor( return true } - return /* spotless:off */ other is ConnectionStatus && message == other.message && status == other.status && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ConnectionStatus && lastSuccessfulSync == other.lastSuccessfulSync && message == other.message && status == other.status && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(message, status, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(lastSuccessfulSync, message, status, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ConnectionStatus{message=$message, status=$status, additionalProperties=$additionalProperties}" + "ConnectionStatus{lastSuccessfulSync=$lastSuccessfulSync, message=$message, status=$status, additionalProperties=$additionalProperties}" } /** diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IntrospectionTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IntrospectionTest.kt index 565c16f8..1fe645aa 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IntrospectionTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IntrospectionTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -30,6 +31,7 @@ internal class IntrospectionTest { .connectionId("connection_id") .connectionStatus( Introspection.ConnectionStatus.builder() + .lastSuccessfulSync(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .message("message") .status(ConnectionStatusType.PENDING) .build() @@ -66,6 +68,7 @@ internal class IntrospectionTest { assertThat(introspection.connectionStatus()) .isEqualTo( Introspection.ConnectionStatus.builder() + .lastSuccessfulSync(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .message("message") .status(ConnectionStatusType.PENDING) .build() From 0bd7dd5974c4d30f0adc02b6af1f4f227d2c743e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 31 Mar 2025 19:56:41 +0000 Subject: [PATCH 47/65] fix(client): limit json deserialization coercion (#518) --- finch-java-core/build.gradle.kts | 1 + .../com/tryfinch/api/core/ObjectMappers.kt | 57 +++++++++++ .../tryfinch/api/core/ObjectMappersTest.kt | 81 ++++++++++++++++ .../tryfinch/api/core/http/SerializerTest.kt | 97 ------------------- 4 files changed, 139 insertions(+), 97 deletions(-) create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/core/ObjectMappersTest.kt delete mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/SerializerTest.kt diff --git a/finch-java-core/build.gradle.kts b/finch-java-core/build.gradle.kts index f7ecabd4..cc2d57aa 100644 --- a/finch-java-core/build.gradle.kts +++ b/finch-java-core/build.gradle.kts @@ -34,6 +34,7 @@ dependencies { testImplementation("org.assertj:assertj-core:3.25.3") testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.3") testImplementation("org.junit.jupiter:junit-jupiter-params:5.9.3") + testImplementation("org.junit-pioneer:junit-pioneer:1.9.1") testImplementation("org.mockito:mockito-core:5.14.2") testImplementation("org.mockito:mockito-junit-jupiter:5.14.2") testImplementation("org.mockito.kotlin:mockito-kotlin:4.1.0") diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt index 15a04cbb..6054a8c1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt @@ -8,8 +8,11 @@ import com.fasterxml.jackson.databind.DeserializationFeature import com.fasterxml.jackson.databind.MapperFeature import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.cfg.CoercionAction +import com.fasterxml.jackson.databind.cfg.CoercionInputShape import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.databind.module.SimpleModule +import com.fasterxml.jackson.databind.type.LogicalType import com.fasterxml.jackson.datatype.jdk8.Jdk8Module import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule import com.fasterxml.jackson.module.kotlin.kotlinModule @@ -21,6 +24,60 @@ fun jsonMapper(): JsonMapper = .addModule(Jdk8Module()) .addModule(JavaTimeModule()) .addModule(SimpleModule().addSerializer(InputStreamJsonSerializer)) + .withCoercionConfig(LogicalType.Boolean) { + it.setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.Integer) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.Float) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.Textual) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.Array) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.Collection) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.Map) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Object, CoercionAction.Fail) + } + .withCoercionConfig(LogicalType.POJO) { + it.setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) + .setCoercion(CoercionInputShape.String, CoercionAction.Fail) + .setCoercion(CoercionInputShape.Array, CoercionAction.Fail) + } .serializationInclusion(JsonInclude.Include.NON_ABSENT) .disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE) .disable(SerializationFeature.FLUSH_AFTER_WRITE_VALUE) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/core/ObjectMappersTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/ObjectMappersTest.kt new file mode 100644 index 00000000..a2ccffc2 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/ObjectMappersTest.kt @@ -0,0 +1,81 @@ +package com.tryfinch.api.core + +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.databind.exc.MismatchedInputException +import kotlin.reflect.KClass +import org.assertj.core.api.Assertions.assertThat +import org.assertj.core.api.Assertions.catchThrowable +import org.junit.jupiter.api.Test +import org.junitpioneer.jupiter.cartesian.CartesianTest + +internal class ObjectMappersTest { + + internal class ClassWithBooleanFieldPrefixedWithIs(private val isActive: JsonField) { + + @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive + } + + @Test + fun write_whenFieldPrefixedWithIs_keepsPrefix() { + val value = ClassWithBooleanFieldPrefixedWithIs(JsonField.of(true)) + + val json = jsonMapper().writeValueAsString(value) + + assertThat(json).isEqualTo("{\"is_active\":true}") + } + + internal class Class(@get:JsonProperty("field") @JsonProperty("field") val field: String) + + enum class ShapeTestCase(val value: Any, val kClass: KClass<*>) { + STRING("Hello World!", String::class), + BOOLEAN(true, Boolean::class), + FLOAT(3.14F, Float::class), + DOUBLE(3.14, Double::class), + INTEGER(42, Int::class), + LONG(42L, Long::class), + MAP(mapOf("property" to "value"), Map::class), + CLASS(Class("Hello World!"), Class::class), + LIST(listOf(1, 2, 3), List::class); + + companion object { + val VALID_CONVERSIONS = + listOf( + FLOAT to DOUBLE, + FLOAT to INTEGER, + FLOAT to LONG, + DOUBLE to FLOAT, + DOUBLE to INTEGER, + DOUBLE to LONG, + INTEGER to FLOAT, + INTEGER to DOUBLE, + INTEGER to LONG, + LONG to FLOAT, + LONG to DOUBLE, + LONG to INTEGER, + CLASS to MAP, + // These aren't actually valid, but coercion configs don't work for String until + // v2.14.0: https://github.com/FasterXML/jackson-databind/issues/3240 + // We currently test on v2.13.4. + BOOLEAN to STRING, + FLOAT to STRING, + DOUBLE to STRING, + INTEGER to STRING, + LONG to STRING, + ) + } + } + + @CartesianTest + fun read(@CartesianTest.Enum shape1: ShapeTestCase, @CartesianTest.Enum shape2: ShapeTestCase) { + val jsonMapper = jsonMapper() + val json = jsonMapper.writeValueAsString(shape1.value) + + val e = catchThrowable { jsonMapper.readValue(json, shape2.kClass.java) } + + if (shape1 == shape2 || shape1 to shape2 in ShapeTestCase.VALID_CONVERSIONS) { + assertThat(e).isNull() + } else { + assertThat(e).isInstanceOf(MismatchedInputException::class.java) + } + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/SerializerTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/SerializerTest.kt deleted file mode 100644 index 974c40f9..00000000 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/SerializerTest.kt +++ /dev/null @@ -1,97 +0,0 @@ -package com.tryfinch.api.core.http - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.tryfinch.api.core.* -import java.util.* -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class SerializerTest { - @JsonDeserialize(builder = ClassWithBooleanFieldPrefixedWithIs.Builder::class) - class ClassWithBooleanFieldPrefixedWithIs - private constructor( - private val isActive: JsonField, - private val additionalProperties: Map, - ) { - private var validated: Boolean = false - - private var hashCode: Int = 0 - - fun isActive(): Boolean? = isActive.getNullable("is_active") - - @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate() = apply { - if (!validated) { - isActive() - validated = true - } - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ClassWithBooleanFieldPrefixedWithIs && - isActive == other.isActive && - additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(isActive, additionalProperties) - } - return hashCode - } - - override fun toString() = - "MyClass{isActive=$isActive, additionalProperties=$additionalProperties}" - - companion object { - fun builder() = Builder() - } - - class Builder internal constructor() { - - private var isActive: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) - - @JsonProperty("is_active") - @ExcludeMissing - fun isActive(isActive: JsonField) = apply { this.isActive = isActive } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): ClassWithBooleanFieldPrefixedWithIs = - ClassWithBooleanFieldPrefixedWithIs(isActive, additionalProperties.toImmutable()) - } - } - - @Test - fun serializeBooleanPrefixedWithIs() { - val value = ClassWithBooleanFieldPrefixedWithIs.builder().isActive(true).build() - assertThat(jsonMapper().writeValueAsString(value)).isEqualTo("{\"is_active\":true}") - } -} From 17c4e8fbbf4698f67ddcfedb383d677e5e5a9d1d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 14:47:12 +0000 Subject: [PATCH 48/65] fix: pluralize `list` response variables (#519) --- .../api/services/async/hris/DocumentServiceAsyncTest.kt | 6 +++--- .../api/services/async/jobs/AutomatedServiceAsyncTest.kt | 6 +++--- .../api/services/blocking/hris/DocumentServiceTest.kt | 4 ++-- .../api/services/blocking/jobs/AutomatedServiceTest.kt | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncTest.kt index 1348b9c8..5dce15e3 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncTest.kt @@ -21,7 +21,7 @@ internal class DocumentServiceAsyncTest { .build() val documentServiceAsync = client.hris().documents() - val documentFuture = + val documentsFuture = documentServiceAsync.list( HrisDocumentListParams.builder() .addIndividualId("string") @@ -31,8 +31,8 @@ internal class DocumentServiceAsyncTest { .build() ) - val document = documentFuture.get() - document.validate() + val documents = documentsFuture.get() + documents.validate() } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncTest.kt index b1eb7509..8eea4c25 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncTest.kt @@ -64,12 +64,12 @@ internal class AutomatedServiceAsyncTest { .build() val automatedServiceAsync = client.jobs().automated() - val automatedFuture = + val automatedsFuture = automatedServiceAsync.list( JobAutomatedListParams.builder().limit(0L).offset(0L).build() ) - val automated = automatedFuture.get() - automated.validate() + val automateds = automatedsFuture.get() + automateds.validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceTest.kt index c90cbabd..4faa8f0a 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceTest.kt @@ -21,7 +21,7 @@ internal class DocumentServiceTest { .build() val documentService = client.hris().documents() - val document = + val documents = documentService.list( HrisDocumentListParams.builder() .addIndividualId("string") @@ -31,7 +31,7 @@ internal class DocumentServiceTest { .build() ) - document.validate() + documents.validate() } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt index ee65f389..226173ab 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt @@ -60,9 +60,9 @@ internal class AutomatedServiceTest { .build() val automatedService = client.jobs().automated() - val automated = + val automateds = automatedService.list(JobAutomatedListParams.builder().limit(0L).offset(0L).build()) - automated.validate() + automateds.validate() } } From a6b3092d8ce9e17f78f267d36467ca2057e6ac1f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 21:15:29 +0000 Subject: [PATCH 49/65] feat(api): api update (#520) --- .stats.yml | 4 ++-- .../com/tryfinch/api/models/EmploymentData.kt | 4 ++-- .../api/models/EmploymentDataResponse.kt | 3 +++ .../api/models/IndividualInDirectory.kt | 4 ++-- .../api/models/EmploymentDataResponseTest.kt | 21 +++++++++++++------ .../tryfinch/api/models/EmploymentDataTest.kt | 14 +++++++++---- .../models/EmploymentUpdateResponseTest.kt | 16 ++++++++++---- .../HrisPayStatementRetrieveManyParamsTest.kt | 14 ++++++++----- .../api/models/IndividualInDirectoryTest.kt | 16 ++++++++++---- .../api/models/IndividualResponseTest.kt | 4 ++-- .../com/tryfinch/api/models/IndividualTest.kt | 4 ++-- .../models/IndividualUpdateResponseTest.kt | 4 ++-- .../api/models/PayGroupListResponseTest.kt | 4 ++-- .../com/tryfinch/api/models/PaymentTest.kt | 14 +++++++------ .../SandboxDirectoryCreateParamsTest.kt | 6 +++--- .../SandboxEmploymentUpdateParamsTest.kt | 18 +++++++++++++--- .../hris/PayStatementServiceAsyncTest.kt | 2 +- .../sandbox/DirectoryServiceAsyncTest.kt | 2 +- .../sandbox/EmploymentServiceAsyncTest.kt | 6 +++++- .../blocking/hris/PayStatementServiceTest.kt | 2 +- .../blocking/sandbox/DirectoryServiceTest.kt | 2 +- .../blocking/sandbox/EmploymentServiceTest.kt | 6 +++++- 22 files changed, 115 insertions(+), 55 deletions(-) diff --git a/.stats.yml b/.stats.yml index f68ad445..82baa2a8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-3224f142ed1542ed2535c155e8eb23b7ea10470c12448d60c3ce584126073a93.yml -openapi_spec_hash: 6c4b213ed5e4f7d1b369e04e4bfb5164 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-01e6814875a5c867925b75141c5450f528389ac6c4b63d91aa341cb8a1249ef9.yml +openapi_spec_hash: ce8289026fb42111f01b37d5138ca100 config_hash: 8303e755d3e16cf28542d5f0aec83851 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt index dd9961a4..c5aeeed4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt @@ -105,7 +105,7 @@ private constructor( ) /** - * string A stable Finch `id` (UUID v4) for an individual in the company. + * A stable Finch `id` (UUID v4) for an individual in the company. * * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -492,7 +492,7 @@ private constructor( additionalProperties = employmentData.additionalProperties.toMutableMap() } - /** string A stable Finch `id` (UUID v4) for an individual in the company. */ + /** A stable Finch `id` (UUID v4) for an individual in the company. */ fun id(id: String) = id(JsonField.of(id)) /** diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt index a63c32b9..06e6b3c1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt @@ -45,6 +45,8 @@ private constructor( fun code(): Optional = Optional.ofNullable(code.getNullable("code")) /** + * A stable Finch `id` (UUID v4) for an individual in the company. + * * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ @@ -129,6 +131,7 @@ private constructor( */ fun code(code: JsonField) = apply { this.code = code } + /** A stable Finch `id` (UUID v4) for an individual in the company. */ fun individualId(individualId: String) = individualId(JsonField.of(individualId)) /** diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt index 98873c36..043e1873 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt @@ -44,7 +44,7 @@ private constructor( ) : this(id, department, firstName, isActive, lastName, manager, middleName, mutableMapOf()) /** - * A stable Finch id (UUID v4) for an individual in the company. + * A stable Finch `id` (UUID v4) for an individual in the company. * * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -193,7 +193,7 @@ private constructor( additionalProperties = individualInDirectory.additionalProperties.toMutableMap() } - /** A stable Finch id (UUID v4) for an individual in the company. */ + /** A stable Finch `id` (UUID v4) for an individual in the company. */ fun id(id: String) = id(JsonField.of(id)) /** diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataResponseTest.kt index d56cf7fb..72d48fd7 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataResponseTest.kt @@ -14,7 +14,7 @@ internal class EmploymentDataResponseTest { EmploymentDataResponse.builder() .body( EmploymentData.builder() - .id("id") + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .classCode("class_code") .addCustomField( EmploymentData.CustomField.builder() @@ -63,7 +63,11 @@ internal class EmploymentDataResponseTest { .state("state") .build() ) - .manager(EmploymentData.Manager.builder().id("id").build()) + .manager( + EmploymentData.Manager.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) .middleName("middle_name") .sourceId("source_id") .startDate("start_date") @@ -72,13 +76,13 @@ internal class EmploymentDataResponseTest { .build() ) .code(0L) - .individualId("individual_id") + .individualId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() assertThat(employmentDataResponse.body()) .contains( EmploymentData.builder() - .id("id") + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .classCode("class_code") .addCustomField( EmploymentData.CustomField.builder() @@ -127,7 +131,11 @@ internal class EmploymentDataResponseTest { .state("state") .build() ) - .manager(EmploymentData.Manager.builder().id("id").build()) + .manager( + EmploymentData.Manager.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) .middleName("middle_name") .sourceId("source_id") .startDate("start_date") @@ -136,6 +144,7 @@ internal class EmploymentDataResponseTest { .build() ) assertThat(employmentDataResponse.code()).contains(0L) - assertThat(employmentDataResponse.individualId()).contains("individual_id") + assertThat(employmentDataResponse.individualId()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt index 12543a92..09ffd8a8 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt @@ -13,7 +13,7 @@ internal class EmploymentDataTest { fun create() { val employmentData = EmploymentData.builder() - .id("id") + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .classCode("class_code") .addCustomField( EmploymentData.CustomField.builder() @@ -62,7 +62,11 @@ internal class EmploymentDataTest { .state("state") .build() ) - .manager(EmploymentData.Manager.builder().id("id").build()) + .manager( + EmploymentData.Manager.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) .middleName("middle_name") .sourceId("source_id") .startDate("start_date") @@ -70,7 +74,7 @@ internal class EmploymentDataTest { .workId("work_id") .build() - assertThat(employmentData.id()).contains("id") + assertThat(employmentData.id()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(employmentData.classCode()).contains("class_code") assertThat(employmentData.customFields().getOrNull()) .containsExactly( @@ -127,7 +131,9 @@ internal class EmploymentDataTest { .build() ) assertThat(employmentData.manager()) - .contains(EmploymentData.Manager.builder().id("id").build()) + .contains( + EmploymentData.Manager.builder().id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + ) assertThat(employmentData.middleName()).contains("middle_name") assertThat(employmentData.sourceId()).contains("source_id") assertThat(employmentData.startDate()).contains("start_date") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt index 4fe464e0..8ac4990e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt @@ -13,7 +13,7 @@ internal class EmploymentUpdateResponseTest { fun create() { val employmentUpdateResponse = EmploymentUpdateResponse.builder() - .id("id") + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .classCode("class_code") .addCustomField( EmploymentUpdateResponse.CustomField.builder() @@ -62,14 +62,18 @@ internal class EmploymentUpdateResponseTest { .state("state") .build() ) - .manager(EmploymentUpdateResponse.Manager.builder().id("id").build()) + .manager( + EmploymentUpdateResponse.Manager.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) .middleName("middle_name") .sourceId("source_id") .startDate("start_date") .title("title") .build() - assertThat(employmentUpdateResponse.id()).contains("id") + assertThat(employmentUpdateResponse.id()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(employmentUpdateResponse.classCode()).contains("class_code") assertThat(employmentUpdateResponse.customFields().getOrNull()) .containsExactly( @@ -126,7 +130,11 @@ internal class EmploymentUpdateResponseTest { .build() ) assertThat(employmentUpdateResponse.manager()) - .contains(EmploymentUpdateResponse.Manager.builder().id("id").build()) + .contains( + EmploymentUpdateResponse.Manager.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) assertThat(employmentUpdateResponse.middleName()).contains("middle_name") assertThat(employmentUpdateResponse.sourceId()).contains("source_id") assertThat(employmentUpdateResponse.startDate()).contains("start_date") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt index 5162d787..f7e8edfa 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt @@ -12,7 +12,7 @@ internal class HrisPayStatementRetrieveManyParamsTest { HrisPayStatementRetrieveManyParams.builder() .addRequest( HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("string") + .paymentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .limit(50L) .offset(0L) .build() @@ -26,7 +26,7 @@ internal class HrisPayStatementRetrieveManyParamsTest { HrisPayStatementRetrieveManyParams.builder() .addRequest( HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("string") + .paymentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .limit(50L) .offset(0L) .build() @@ -38,7 +38,7 @@ internal class HrisPayStatementRetrieveManyParamsTest { assertThat(body.requests()) .containsExactly( HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("string") + .paymentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .limit(50L) .offset(0L) .build() @@ -50,7 +50,9 @@ internal class HrisPayStatementRetrieveManyParamsTest { val params = HrisPayStatementRetrieveManyParams.builder() .addRequest( - HrisPayStatementRetrieveManyParams.Request.builder().paymentId("string").build() + HrisPayStatementRetrieveManyParams.Request.builder() + .paymentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() ) .build() @@ -58,7 +60,9 @@ internal class HrisPayStatementRetrieveManyParamsTest { assertThat(body.requests()) .containsExactly( - HrisPayStatementRetrieveManyParams.Request.builder().paymentId("string").build() + HrisPayStatementRetrieveManyParams.Request.builder() + .paymentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() ) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualInDirectoryTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualInDirectoryTest.kt index 406378a5..0cc70443 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualInDirectoryTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualInDirectoryTest.kt @@ -11,23 +11,31 @@ internal class IndividualInDirectoryTest { fun create() { val individualInDirectory = IndividualInDirectory.builder() - .id("id") + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .department(IndividualInDirectory.Department.builder().name("name").build()) .firstName("first_name") .isActive(true) .lastName("last_name") - .manager(IndividualInDirectory.Manager.builder().id("id").build()) + .manager( + IndividualInDirectory.Manager.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) .middleName("middle_name") .build() - assertThat(individualInDirectory.id()).contains("id") + assertThat(individualInDirectory.id()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(individualInDirectory.department()) .contains(IndividualInDirectory.Department.builder().name("name").build()) assertThat(individualInDirectory.firstName()).contains("first_name") assertThat(individualInDirectory.isActive()).contains(true) assertThat(individualInDirectory.lastName()).contains("last_name") assertThat(individualInDirectory.manager()) - .contains(IndividualInDirectory.Manager.builder().id("id").build()) + .contains( + IndividualInDirectory.Manager.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) assertThat(individualInDirectory.middleName()).contains("middle_name") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualResponseTest.kt index b489d6a4..c61271dd 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualResponseTest.kt @@ -13,7 +13,7 @@ internal class IndividualResponseTest { IndividualResponse.builder() .body( Individual.builder() - .id("id") + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dob("dob") .addEmail( Individual.Email.builder() @@ -56,7 +56,7 @@ internal class IndividualResponseTest { assertThat(individualResponse.body()) .contains( Individual.builder() - .id("id") + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dob("dob") .addEmail( Individual.Email.builder() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt index 54f13cdc..2052a640 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt @@ -12,7 +12,7 @@ internal class IndividualTest { fun create() { val individual = Individual.builder() - .id("id") + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dob("dob") .addEmail( Individual.Email.builder().data("data").type(Individual.Email.Type.WORK).build() @@ -45,7 +45,7 @@ internal class IndividualTest { .ssn("ssn") .build() - assertThat(individual.id()).contains("id") + assertThat(individual.id()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(individual.dob()).contains("dob") assertThat(individual.emails().getOrNull()) .containsExactly( diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt index 1e3e3326..92a84287 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt @@ -12,7 +12,7 @@ internal class IndividualUpdateResponseTest { fun create() { val individualUpdateResponse = IndividualUpdateResponse.builder() - .id("id") + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .dob("dob") .addEmail( IndividualUpdateResponse.Email.builder() @@ -48,7 +48,7 @@ internal class IndividualUpdateResponseTest { .ssn("ssn") .build() - assertThat(individualUpdateResponse.id()).contains("id") + assertThat(individualUpdateResponse.id()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(individualUpdateResponse.dob()).contains("dob") assertThat(individualUpdateResponse.emails().getOrNull()) .containsExactly( diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt index cdcb40ce..91a6f24b 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt @@ -12,12 +12,12 @@ internal class PayGroupListResponseTest { fun create() { val payGroupListResponse = PayGroupListResponse.builder() - .id("id") + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .name("name") .addPayFrequency(PayGroupListResponse.PayFrequency.ANNUALLY) .build() - assertThat(payGroupListResponse.id()).contains("id") + assertThat(payGroupListResponse.id()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(payGroupListResponse.name()).contains("name") assertThat(payGroupListResponse.payFrequencies().getOrNull()) .containsExactly(PayGroupListResponse.PayFrequency.ANNUALLY) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt index 9e8f2f19..8390af5a 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt @@ -12,23 +12,23 @@ internal class PaymentTest { fun create() { val payment = Payment.builder() - .id("id") + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .companyDebit(Money.builder().amount(0L).currency("currency").build()) .debitDate("debit_date") .employeeTaxes(Money.builder().amount(0L).currency("currency").build()) .employerTaxes(Money.builder().amount(0L).currency("currency").build()) .grossPay(Money.builder().amount(0L).currency("currency").build()) - .addIndividualId("string") + .addIndividualId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .netPay(Money.builder().amount(0L).currency("currency").build()) .payDate("pay_date") .addPayFrequency(Payment.PayFrequency.ANNUALLY) - .addPayGroupId("string") + .addPayGroupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .payPeriod( Payment.PayPeriod.builder().endDate("end_date").startDate("start_date").build() ) .build() - assertThat(payment.id()).contains("id") + assertThat(payment.id()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(payment.companyDebit()) .contains(Money.builder().amount(0L).currency("currency").build()) assertThat(payment.debitDate()).contains("debit_date") @@ -38,13 +38,15 @@ internal class PaymentTest { .contains(Money.builder().amount(0L).currency("currency").build()) assertThat(payment.grossPay()) .contains(Money.builder().amount(0L).currency("currency").build()) - assertThat(payment.individualIds().getOrNull()).containsExactly("string") + assertThat(payment.individualIds().getOrNull()) + .containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(payment.netPay()) .contains(Money.builder().amount(0L).currency("currency").build()) assertThat(payment.payDate()).contains("pay_date") assertThat(payment.payFrequencies().getOrNull()) .containsExactly(Payment.PayFrequency.ANNUALLY) - assertThat(payment.payGroupIds().getOrNull()).containsExactly("string") + assertThat(payment.payGroupIds().getOrNull()) + .containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(payment.payPeriod()) .contains( Payment.PayPeriod.builder().endDate("end_date").startDate("start_date").build() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParamsTest.kt index a21be284..b054e2fd 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParamsTest.kt @@ -89,7 +89,7 @@ internal class SandboxDirectoryCreateParamsTest { ) .manager( SandboxDirectoryCreateParams.IndividualOrEmployment.Manager.builder() - .id("id") + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .middleName("middle_name") @@ -211,7 +211,7 @@ internal class SandboxDirectoryCreateParamsTest { ) .manager( SandboxDirectoryCreateParams.IndividualOrEmployment.Manager.builder() - .id("id") + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .middleName("middle_name") @@ -327,7 +327,7 @@ internal class SandboxDirectoryCreateParamsTest { ) .manager( SandboxDirectoryCreateParams.IndividualOrEmployment.Manager.builder() - .id("id") + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .middleName("middle_name") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt index 09a821d3..fbe2b905 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt @@ -61,7 +61,11 @@ internal class SandboxEmploymentUpdateParamsTest { .state("state") .build() ) - .manager(SandboxEmploymentUpdateParams.Manager.builder().id("id").build()) + .manager( + SandboxEmploymentUpdateParams.Manager.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) .middleName("middle_name") .sourceId("source_id") .startDate("start_date") @@ -131,7 +135,11 @@ internal class SandboxEmploymentUpdateParamsTest { .state("state") .build() ) - .manager(SandboxEmploymentUpdateParams.Manager.builder().id("id").build()) + .manager( + SandboxEmploymentUpdateParams.Manager.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) .middleName("middle_name") .sourceId("source_id") .startDate("start_date") @@ -196,7 +204,11 @@ internal class SandboxEmploymentUpdateParamsTest { .build() ) assertThat(body.manager()) - .contains(SandboxEmploymentUpdateParams.Manager.builder().id("id").build()) + .contains( + SandboxEmploymentUpdateParams.Manager.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) assertThat(body.middleName()).contains("middle_name") assertThat(body.sourceId()).contains("source_id") assertThat(body.startDate()).contains("start_date") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncTest.kt index 585036ae..7e582c59 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncTest.kt @@ -25,7 +25,7 @@ internal class PayStatementServiceAsyncTest { HrisPayStatementRetrieveManyParams.builder() .addRequest( HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("string") + .paymentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .build() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncTest.kt index 95617991..5572fa2d 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncTest.kt @@ -117,7 +117,7 @@ internal class DirectoryServiceAsyncTest { .manager( SandboxDirectoryCreateParams.IndividualOrEmployment.Manager .builder() - .id("id") + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .middleName("middle_name") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncTest.kt index 9ce17913..e85386fd 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncTest.kt @@ -77,7 +77,11 @@ internal class EmploymentServiceAsyncTest { .state("state") .build() ) - .manager(SandboxEmploymentUpdateParams.Manager.builder().id("id").build()) + .manager( + SandboxEmploymentUpdateParams.Manager.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) .middleName("middle_name") .sourceId("source_id") .startDate("start_date") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceTest.kt index 14ef62a2..cca8bd08 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceTest.kt @@ -25,7 +25,7 @@ internal class PayStatementServiceTest { HrisPayStatementRetrieveManyParams.builder() .addRequest( HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("string") + .paymentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .build() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt index 9bc7cf52..dc3d0a26 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt @@ -117,7 +117,7 @@ internal class DirectoryServiceTest { .manager( SandboxDirectoryCreateParams.IndividualOrEmployment.Manager .builder() - .id("id") + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .middleName("middle_name") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceTest.kt index 96892e6b..a14004ae 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceTest.kt @@ -77,7 +77,11 @@ internal class EmploymentServiceTest { .state("state") .build() ) - .manager(SandboxEmploymentUpdateParams.Manager.builder().id("id").build()) + .manager( + SandboxEmploymentUpdateParams.Manager.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) .middleName("middle_name") .sourceId("source_id") .startDate("start_date") From bad2fb7567ec846cca1f0eccbebc878269cfd023 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 21:40:48 +0000 Subject: [PATCH 50/65] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 82baa2a8..98472e0a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-01e6814875a5c867925b75141c5450f528389ac6c4b63d91aa341cb8a1249ef9.yml -openapi_spec_hash: ce8289026fb42111f01b37d5138ca100 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-df94542d153a8558bbe63b273e8d6ae79f46b8d81df1ebeeacd07fee6f9ee22a.yml +openapi_spec_hash: aeb92e382ee0a9b86e2ba39e54cdfe9a config_hash: 8303e755d3e16cf28542d5f0aec83851 From 1bd0c2538ce50578fcd7ae51c944cdfb0736aa9b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 23:09:51 +0000 Subject: [PATCH 51/65] feat(client): make union deserialization more robust (#521) feat(client): add enum validation method chore(client): remove unnecessary json state from some query param classes chore(internal): add json roundtripping tests chore(internal): add invalid json deserialization tests --- .../com/tryfinch/api/core/BaseDeserializer.kt | 33 +- .../kotlin/com/tryfinch/api/core/Utils.kt | 28 + .../api/models/AccessTokenCreateParams.kt | 21 + .../api/models/AccountCreateResponse.kt | 53 +- .../tryfinch/api/models/AccountUpdateEvent.kt | 789 +++++- .../api/models/AccountUpdateResponse.kt | 52 +- .../tryfinch/api/models/AutomatedAsyncJob.kt | 100 +- .../api/models/AutomatedCreateResponse.kt | 20 + .../api/models/AutomatedListResponse.kt | 71 + .../tryfinch/api/models/BaseWebhookEvent.kt | 19 + .../api/models/BenefitContribution.kt | 46 +- .../models/BenefitFeaturesAndOperations.kt | 134 +- .../tryfinch/api/models/BenefitFrequency.kt | 26 + .../com/tryfinch/api/models/BenefitType.kt | 26 + .../tryfinch/api/models/BenefitsSupport.kt | 28 + .../kotlin/com/tryfinch/api/models/Company.kt | 188 +- .../com/tryfinch/api/models/CompanyBenefit.kt | 24 +- .../com/tryfinch/api/models/CompanyEvent.kt | 68 +- .../api/models/CompanyUpdateResponse.kt | 187 +- .../api/models/ConnectSessionNewParams.kt | 132 +- .../ConnectSessionReauthenticateParams.kt | 50 +- .../api/models/ConnectionCreateResponse.kt | 54 +- .../api/models/ConnectionStatusType.kt | 26 + .../api/models/CreateAccessTokenResponse.kt | 84 +- .../models/CreateCompanyBenefitsResponse.kt | 15 + .../api/models/DirectoryCreateResponse.kt | 16 + .../com/tryfinch/api/models/DirectoryEvent.kt | 68 +- .../tryfinch/api/models/DisconnectResponse.kt | 15 + .../api/models/DocumentListResponse.kt | 19 + .../tryfinch/api/models/DocumentResponse.kt | 50 +- .../api/models/DocumentRetreiveResponse.kt | 44 +- .../com/tryfinch/api/models/EmploymentData.kt | 190 +- .../api/models/EmploymentDataResponse.kt | 20 + .../tryfinch/api/models/EmploymentEvent.kt | 68 +- .../api/models/EmploymentUpdateResponse.kt | 189 +- .../tryfinch/api/models/EnrolledIndividual.kt | 68 +- .../api/models/HrisBenefitCreateParams.kt | 24 +- ...nefitIndividualRetrieveManyBenefitsPage.kt | 9 + ...IndividualRetrieveManyBenefitsPageAsync.kt | 9 + .../HrisBenefitIndividualUnenrollManyPage.kt | 9 + ...sBenefitIndividualUnenrollManyPageAsync.kt | 9 + ...HrisBenefitIndividualUnenrollManyParams.kt | 18 + .../api/models/HrisBenefitListPage.kt | 9 + .../api/models/HrisBenefitListPageAsync.kt | 9 + .../HrisBenefitListSupportedBenefitsPage.kt | 9 + ...isBenefitListSupportedBenefitsPageAsync.kt | 9 + .../api/models/HrisBenefitUpdateParams.kt | 16 + .../HrisDirectoryListIndividualsPage.kt | 9 + .../HrisDirectoryListIndividualsPageAsync.kt | 9 + .../api/models/HrisDirectoryListPage.kt | 9 + .../api/models/HrisDirectoryListPageAsync.kt | 9 + .../api/models/HrisDocumentListParams.kt | 27 + .../models/HrisEmploymentRetrieveManyPage.kt | 9 + .../HrisEmploymentRetrieveManyPageAsync.kt | 9 + .../HrisEmploymentRetrieveManyParams.kt | 36 + .../models/HrisIndividualRetrieveManyPage.kt | 9 + .../HrisIndividualRetrieveManyPageAsync.kt | 9 + .../HrisIndividualRetrieveManyParams.kt | 52 + .../HrisPayStatementRetrieveManyPage.kt | 9 + .../HrisPayStatementRetrieveManyPageAsync.kt | 9 + .../HrisPayStatementRetrieveManyParams.kt | 39 + .../api/models/HrisPaymentListPage.kt | 9 + .../api/models/HrisPaymentListPageAsync.kt | 9 + .../kotlin/com/tryfinch/api/models/Income.kt | 49 +- .../com/tryfinch/api/models/Individual.kt | 181 +- .../tryfinch/api/models/IndividualBenefit.kt | 70 +- .../models/IndividualEnrolledIdsResponse.kt | 19 + .../tryfinch/api/models/IndividualEvent.kt | 68 +- .../api/models/IndividualInDirectory.kt | 55 + .../tryfinch/api/models/IndividualResponse.kt | 20 + .../api/models/IndividualUpdateResponse.kt | 181 +- .../com/tryfinch/api/models/Introspection.kt | 182 +- .../api/models/JobAutomatedCreateParams.kt | 158 +- .../tryfinch/api/models/JobCompletionEvent.kt | 69 +- .../tryfinch/api/models/JobCreateResponse.kt | 20 + .../com/tryfinch/api/models/Location.kt | 24 + .../com/tryfinch/api/models/ManualAsyncJob.kt | 48 +- .../kotlin/com/tryfinch/api/models/Money.kt | 17 + .../tryfinch/api/models/OperationSupport.kt | 26 + .../api/models/OperationSupportMatrix.kt | 29 +- .../kotlin/com/tryfinch/api/models/Paging.kt | 17 + .../api/models/PayGroupListResponse.kt | 49 +- .../api/models/PayGroupRetrieveResponse.kt | 50 +- .../com/tryfinch/api/models/PayStatement.kt | 455 ++- .../tryfinch/api/models/PayStatementEvent.kt | 70 +- .../api/models/PayStatementResponse.kt | 20 + .../api/models/PayStatementResponseBody.kt | 19 + .../kotlin/com/tryfinch/api/models/Payment.kt | 76 +- .../api/models/PaymentCreateResponse.kt | 17 + .../com/tryfinch/api/models/PaymentEvent.kt | 70 +- .../api/models/PayrollPayGroupListPage.kt | 9 + .../models/PayrollPayGroupListPageAsync.kt | 9 + .../com/tryfinch/api/models/Provider.kt | 744 ++++- .../tryfinch/api/models/ProviderListPage.kt | 9 + .../api/models/ProviderListPageAsync.kt | 9 + .../models/RequestForwardingForwardParams.kt | 20 + .../RequestForwardingForwardResponse.kt | 39 + .../api/models/SandboxCompanyUpdateParams.kt | 188 +- .../SandboxConnectionAccountCreateParams.kt | 51 +- .../SandboxConnectionAccountUpdateParams.kt | 20 +- .../models/SandboxConnectionCreateParams.kt | 51 +- .../models/SandboxDirectoryCreateParams.kt | 353 ++- .../models/SandboxEmploymentUpdateParams.kt | 190 +- .../models/SandboxIndividualUpdateParams.kt | 181 +- .../api/models/SandboxJobConfiguration.kt | 77 +- .../api/models/SandboxJobCreateParams.kt | 46 +- .../api/models/SandboxPaymentCreateParams.kt | 477 +++- .../tryfinch/api/models/SessionNewResponse.kt | 18 + .../models/SessionReauthenticateResponse.kt | 18 + .../api/models/SupportPerBenefitType.kt | 19 + .../tryfinch/api/models/SupportedBenefit.kt | 118 +- .../api/models/UnenrolledIndividual.kt | 39 + .../models/UpdateCompanyBenefitResponse.kt | 15 + .../kotlin/com/tryfinch/api/models/W42005.kt | 128 +- .../kotlin/com/tryfinch/api/models/W42020.kt | 102 +- .../com/tryfinch/api/models/WebhookEvent.kt | 120 +- .../api/models/AccountCreateResponseTest.kt | 25 + .../api/models/AccountUpdateEventTest.kt | 1014 +++++++ .../api/models/AccountUpdateResponseTest.kt | 24 + .../api/models/AutomatedAsyncJobTest.kt | 27 + .../api/models/AutomatedCreateResponseTest.kt | 22 + .../api/models/AutomatedListResponseTest.kt | 47 + .../api/models/BaseWebhookEventTest.kt | 21 + .../api/models/BenefitContributionTest.kt | 17 + .../BenefitFeaturesAndOperationsTest.kt | 56 + .../api/models/BenefitsSupportTest.kt | 546 ++++ .../tryfinch/api/models/CompanyBenefitTest.kt | 22 + .../tryfinch/api/models/CompanyEventTest.kt | 27 + .../com/tryfinch/api/models/CompanyTest.kt | 53 + .../api/models/CompanyUpdateResponseTest.kt | 57 + .../models/ConnectionCreateResponseTest.kt | 26 + .../models/CreateAccessTokenResponseTest.kt | 28 + .../CreateCompanyBenefitsResponseTest.kt | 18 + .../api/models/DirectoryCreateResponseTest.kt | 17 + .../tryfinch/api/models/DirectoryEventTest.kt | 23 + .../api/models/DisconnectResponseTest.kt | 16 + .../api/models/DocumentListResponseTest.kt | 28 + .../api/models/DocumentResponseTest.kt | 23 + .../models/DocumentRetreiveResponseTest.kt | 119 +- .../api/models/EmploymentDataResponseTest.kt | 83 + .../tryfinch/api/models/EmploymentDataTest.kt | 77 + .../api/models/EmploymentEventTest.kt | 23 + .../models/EmploymentUpdateResponseTest.kt | 76 + .../api/models/EnrolledIndividualTest.kt | 27 + .../com/tryfinch/api/models/IncomeTest.kt | 19 + .../api/models/IndividualBenefitTest.kt | 41 + .../IndividualEnrolledIdsResponseTest.kt | 21 + .../api/models/IndividualEventTest.kt | 23 + .../api/models/IndividualInDirectoryTest.kt | 29 + .../api/models/IndividualResponseTest.kt | 58 + .../com/tryfinch/api/models/IndividualTest.kt | 49 + .../models/IndividualUpdateResponseTest.kt | 52 + .../tryfinch/api/models/IntrospectionTest.kt | 51 + .../api/models/JobCompletionEventTest.kt | 23 + .../api/models/JobCreateResponseTest.kt | 22 + .../com/tryfinch/api/models/LocationTest.kt | 26 + .../tryfinch/api/models/ManualAsyncJobTest.kt | 21 + .../com/tryfinch/api/models/MoneyTest.kt | 13 + .../api/models/OperationSupportMatrixTest.kt | 22 + .../com/tryfinch/api/models/PagingTest.kt | 13 + .../api/models/PayGroupListResponseTest.kt | 21 + .../models/PayGroupRetrieveResponseTest.kt | 22 + .../api/models/PayStatementEventTest.kt | 28 + .../models/PayStatementResponseBodyTest.kt | 140 + .../api/models/PayStatementResponseTest.kt | 151 + .../tryfinch/api/models/PayStatementTest.kt | 117 + .../api/models/PaymentCreateResponseTest.kt | 17 + .../tryfinch/api/models/PaymentEventTest.kt | 28 + .../com/tryfinch/api/models/PaymentTest.kt | 29 + .../com/tryfinch/api/models/ProviderTest.kt | 929 ++++++ .../RequestForwardingForwardResponseTest.kt | 31 + .../api/models/SandboxJobConfigurationTest.kt | 20 + .../api/models/SessionNewResponseTest.kt | 20 + .../SessionReauthenticateResponseTest.kt | 21 + .../api/models/SupportPerBenefitTypeTest.kt | 34 + .../api/models/SupportedBenefitTest.kt | 26 + .../api/models/UnenrolledIndividualTest.kt | 27 + .../UpdateCompanyBenefitResponseTest.kt | 17 + .../com/tryfinch/api/models/W42005Test.kt | 26 + .../com/tryfinch/api/models/W42020Test.kt | 29 + .../tryfinch/api/models/WebhookEventTest.kt | 2479 ++++++++++++++++- 181 files changed, 15546 insertions(+), 213 deletions(-) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/BaseDeserializer.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/BaseDeserializer.kt index b0de5889..315d2cb2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/BaseDeserializer.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/BaseDeserializer.kt @@ -7,11 +7,9 @@ import com.fasterxml.jackson.databind.BeanProperty import com.fasterxml.jackson.databind.DeserializationContext import com.fasterxml.jackson.databind.JavaType import com.fasterxml.jackson.databind.JsonDeserializer -import com.fasterxml.jackson.databind.JsonMappingException import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.deser.ContextualDeserializer import com.fasterxml.jackson.databind.deser.std.StdDeserializer -import com.tryfinch.api.errors.FinchInvalidDataException import kotlin.reflect.KClass abstract class BaseDeserializer(type: KClass) : @@ -30,38 +28,17 @@ abstract class BaseDeserializer(type: KClass) : protected abstract fun ObjectCodec.deserialize(node: JsonNode): T - protected fun ObjectCodec.deserialize(node: JsonNode, type: TypeReference): T = + protected fun ObjectCodec.tryDeserialize(node: JsonNode, type: TypeReference): T? = try { readValue(treeAsTokens(node), type) } catch (e: Exception) { - throw FinchInvalidDataException("Error deserializing", e) - } - - protected fun ObjectCodec.tryDeserialize( - node: JsonNode, - type: TypeReference, - validate: (T) -> Unit = {}, - ): T? { - return try { - readValue(treeAsTokens(node), type).apply(validate) - } catch (e: JsonMappingException) { - null - } catch (e: RuntimeException) { null } - } - protected fun ObjectCodec.tryDeserialize( - node: JsonNode, - type: JavaType, - validate: (T) -> Unit = {}, - ): T? { - return try { - readValue(treeAsTokens(node), type).apply(validate) - } catch (e: JsonMappingException) { - null - } catch (e: RuntimeException) { + protected fun ObjectCodec.tryDeserialize(node: JsonNode, type: JavaType): T? = + try { + readValue(treeAsTokens(node), type) + } catch (e: Exception) { null } - } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Utils.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Utils.kt index 979a3580..3acb9ed3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Utils.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Utils.kt @@ -26,6 +26,34 @@ internal fun , V> SortedMap.toImmutable(): SortedMap> Sequence.allMaxBy(selector: (T) -> R): List { + var maxValue: R? = null + val maxElements = mutableListOf() + + val iterator = iterator() + while (iterator.hasNext()) { + val element = iterator.next() + val value = selector(element) + if (maxValue == null || value > maxValue) { + maxValue = value + maxElements.clear() + maxElements.add(element) + } else if (value == maxValue) { + maxElements.add(element) + } + } + + return maxElements +} + /** * Returns whether [this] is equal to [other]. * diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt index 4e9db5ad..47aff207 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt @@ -529,6 +529,27 @@ private constructor( 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 (code.asKnown().isPresent) 1 else 0) + + (if (clientId.asKnown().isPresent) 1 else 0) + + (if (clientSecret.asKnown().isPresent) 1 else 0) + + (if (redirectUri.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt index 7862f668..e54605fa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt @@ -17,6 +17,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects +import kotlin.jvm.optionals.getOrNull class AccountCreateResponse private constructor( @@ -391,7 +392,7 @@ private constructor( accessToken() accountId() - authenticationType() + authenticationType().validate() companyId() connectionId() products() @@ -399,6 +400,29 @@ private constructor( 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 (accessToken.asKnown().isPresent) 1 else 0) + + (if (accountId.asKnown().isPresent) 1 else 0) + + (authenticationType.asKnown().getOrNull()?.validity() ?: 0) + + (if (companyId.asKnown().isPresent) 1 else 0) + + (if (connectionId.asKnown().isPresent) 1 else 0) + + (products.asKnown().getOrNull()?.size ?: 0) + + (if (providerId.asKnown().isPresent) 1 else 0) + class AuthenticationType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -500,6 +524,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): AuthenticationType = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt index a096358b..eac777e4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt @@ -299,10 +299,31 @@ private constructor( companyId() connectionId() data().ifPresent { it.validate() } - eventType() + eventType().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (accountId.asKnown().isPresent) 1 else 0) + + (if (companyId.asKnown().isPresent) 1 else 0) + + (if (connectionId.asKnown().isPresent) 1 else 0) + + (data.asKnown().getOrNull()?.validity() ?: 0) + + (eventType.asKnown().getOrNull()?.validity() ?: 0) + class Data private constructor( private val authenticationMethod: JsonField, @@ -466,10 +487,29 @@ private constructor( } authenticationMethod().validate() - status() + status().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 = + (authenticationMethod.asKnown().getOrNull()?.validity() ?: 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + class AuthenticationMethod private constructor( private val benefitsSupport: JsonField, @@ -681,10 +721,30 @@ private constructor( benefitsSupport().ifPresent { it.validate() } supportedFields().ifPresent { it.validate() } - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (benefitsSupport.asKnown().getOrNull()?.validity() ?: 0) + + (supportedFields.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + /** The supported data fields returned by our HR and payroll endpoints */ class SupportedFields private constructor( @@ -1049,6 +1109,30 @@ private constructor( 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 = + (company.asKnown().getOrNull()?.validity() ?: 0) + + (directory.asKnown().getOrNull()?.validity() ?: 0) + + (employment.asKnown().getOrNull()?.validity() ?: 0) + + (individual.asKnown().getOrNull()?.validity() ?: 0) + + (payGroup.asKnown().getOrNull()?.validity() ?: 0) + + (payStatement.asKnown().getOrNull()?.validity() ?: 0) + + (payment.asKnown().getOrNull()?.validity() ?: 0) + class SupportedCompanyFields private constructor( private val id: JsonField, @@ -1478,6 +1562,32 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + + (accounts.asKnown().getOrNull()?.validity() ?: 0) + + (departments.asKnown().getOrNull()?.validity() ?: 0) + + (if (ein.asKnown().isPresent) 1 else 0) + + (entity.asKnown().getOrNull()?.validity() ?: 0) + + (if (legalName.asKnown().isPresent) 1 else 0) + + (locations.asKnown().getOrNull()?.validity() ?: 0) + + (if (primaryEmail.asKnown().isPresent) 1 else 0) + + (if (primaryPhoneNumber.asKnown().isPresent) 1 else 0) + class Accounts private constructor( private val accountName: JsonField, @@ -1764,6 +1874,28 @@ private constructor( 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 (accountName.asKnown().isPresent) 1 else 0) + + (if (accountNumber.asKnown().isPresent) 1 else 0) + + (if (accountType.asKnown().isPresent) 1 else 0) + + (if (institutionName.asKnown().isPresent) 1 else 0) + + (if (routingNumber.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1934,6 +2066,25 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + + (parent.asKnown().getOrNull()?.validity() ?: 0) + class Parent private constructor( private val name: JsonField, @@ -2054,6 +2205,23 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2242,6 +2410,25 @@ private constructor( 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 (subtype.asKnown().isPresent) 1 else 0) + + (if (type.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2564,6 +2751,29 @@ private constructor( 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 (city.asKnown().isPresent) 1 else 0) + + (if (country.asKnown().isPresent) 1 else 0) + + (if (line1.asKnown().isPresent) 1 else 0) + + (if (line2.asKnown().isPresent) 1 else 0) + + (if (postalCode.asKnown().isPresent) 1 else 0) + + (if (state.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2761,6 +2971,25 @@ private constructor( 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 = + (individuals.asKnown().getOrNull()?.validity() ?: 0) + + (paging.asKnown().getOrNull()?.validity() ?: 0) + class Individuals private constructor( private val id: JsonField, @@ -3119,6 +3348,30 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + + (if (department.asKnown().isPresent) 1 else 0) + + (if (firstName.asKnown().isPresent) 1 else 0) + + (if (isActive.asKnown().isPresent) 1 else 0) + + (if (lastName.asKnown().isPresent) 1 else 0) + + (manager.asKnown().getOrNull()?.validity() ?: 0) + + (if (middleName.asKnown().isPresent) 1 else 0) + class Manager private constructor( private val id: JsonField, @@ -3236,6 +3489,23 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3424,6 +3694,25 @@ private constructor( 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 (count.asKnown().isPresent) 1 else 0) + + (if (offset.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4200,6 +4489,40 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + + (if (classCode.asKnown().isPresent) 1 else 0) + + (if (customFields.asKnown().isPresent) 1 else 0) + + (department.asKnown().getOrNull()?.validity() ?: 0) + + (employment.asKnown().getOrNull()?.validity() ?: 0) + + (if (employmentStatus.asKnown().isPresent) 1 else 0) + + (if (endDate.asKnown().isPresent) 1 else 0) + + (if (firstName.asKnown().isPresent) 1 else 0) + + (income.asKnown().getOrNull()?.validity() ?: 0) + + (if (incomeHistory.asKnown().isPresent) 1 else 0) + + (if (isActive.asKnown().isPresent) 1 else 0) + + (if (lastName.asKnown().isPresent) 1 else 0) + + (location.asKnown().getOrNull()?.validity() ?: 0) + + (manager.asKnown().getOrNull()?.validity() ?: 0) + + (if (middleName.asKnown().isPresent) 1 else 0) + + (if (startDate.asKnown().isPresent) 1 else 0) + + (if (title.asKnown().isPresent) 1 else 0) + class Department private constructor( private val name: JsonField, @@ -4317,6 +4640,23 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4489,6 +4829,25 @@ private constructor( 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 (subtype.asKnown().isPresent) 1 else 0) + + (if (type.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4694,6 +5053,26 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (unit.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5015,6 +5394,29 @@ private constructor( 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 (city.asKnown().isPresent) 1 else 0) + + (if (country.asKnown().isPresent) 1 else 0) + + (if (line1.asKnown().isPresent) 1 else 0) + + (if (line2.asKnown().isPresent) 1 else 0) + + (if (postalCode.asKnown().isPresent) 1 else 0) + + (if (state.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5146,6 +5548,23 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5761,6 +6180,36 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + + (if (dob.asKnown().isPresent) 1 else 0) + + (emails.asKnown().getOrNull()?.validity() ?: 0) + + (if (encryptedSsn.asKnown().isPresent) 1 else 0) + + (if (ethnicity.asKnown().isPresent) 1 else 0) + + (if (firstName.asKnown().isPresent) 1 else 0) + + (if (gender.asKnown().isPresent) 1 else 0) + + (if (lastName.asKnown().isPresent) 1 else 0) + + (if (middleName.asKnown().isPresent) 1 else 0) + + (phoneNumbers.asKnown().getOrNull()?.validity() ?: 0) + + (if (preferredName.asKnown().isPresent) 1 else 0) + + (residence.asKnown().getOrNull()?.validity() ?: 0) + + (if (ssn.asKnown().isPresent) 1 else 0) + class Emails private constructor( private val data: JsonField, @@ -5909,6 +6358,25 @@ private constructor( 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 (data.asKnown().isPresent) 1 else 0) + + (if (type.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6077,6 +6545,25 @@ private constructor( 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 (data.asKnown().isPresent) 1 else 0) + + (if (type.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6399,6 +6886,29 @@ private constructor( 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 (city.asKnown().isPresent) 1 else 0) + + (if (country.asKnown().isPresent) 1 else 0) + + (if (line1.asKnown().isPresent) 1 else 0) + + (if (line2.asKnown().isPresent) 1 else 0) + + (if (postalCode.asKnown().isPresent) 1 else 0) + + (if (state.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6665,6 +7175,27 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + + (if (individualIds.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (payFrequencies.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6845,6 +7376,25 @@ private constructor( 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 = + (paging.asKnown().getOrNull()?.validity() ?: 0) + + (payStatements.asKnown().getOrNull()?.validity() ?: 0) + class Paging private constructor( private val count: JsonField, @@ -7015,6 +7565,25 @@ private constructor( 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 (count.asKnown().isPresent) 1 else 0) + + (if (offset.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -7520,6 +8089,33 @@ private constructor( 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 = + (earnings.asKnown().getOrNull()?.validity() ?: 0) + + (employeeDeductions.asKnown().getOrNull()?.validity() ?: 0) + + (employerContributions.asKnown().getOrNull()?.validity() ?: 0) + + (if (grossPay.asKnown().isPresent) 1 else 0) + + (if (individualId.asKnown().isPresent) 1 else 0) + + (if (netPay.asKnown().isPresent) 1 else 0) + + (if (paymentMethod.asKnown().isPresent) 1 else 0) + + (taxes.asKnown().getOrNull()?.validity() ?: 0) + + (if (totalHours.asKnown().isPresent) 1 else 0) + + (if (type.asKnown().isPresent) 1 else 0) + class Earnings private constructor( private val amount: JsonField, @@ -7755,6 +8351,27 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in + * this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (type.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -8046,6 +8663,28 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in + * this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (preTax.asKnown().isPresent) 1 else 0) + + (if (type.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -8265,6 +8904,26 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in + * this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -8555,6 +9214,28 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in + * this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (employer.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (type.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -9161,6 +9842,35 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + + (if (companyDebit.asKnown().isPresent) 1 else 0) + + (if (debitDate.asKnown().isPresent) 1 else 0) + + (if (employeeTaxes.asKnown().isPresent) 1 else 0) + + (if (employerTaxes.asKnown().isPresent) 1 else 0) + + (if (grossPay.asKnown().isPresent) 1 else 0) + + (if (individualIds.asKnown().isPresent) 1 else 0) + + (if (netPay.asKnown().isPresent) 1 else 0) + + (if (payDate.asKnown().isPresent) 1 else 0) + + (if (payFrequencies.asKnown().isPresent) 1 else 0) + + (if (payGroupIds.asKnown().isPresent) 1 else 0) + + (payPeriod.asKnown().getOrNull()?.validity() ?: 0) + class PayPeriod private constructor( private val endDate: JsonField, @@ -9318,6 +10028,25 @@ private constructor( 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 (endDate.asKnown().isPresent) 1 else 0) + + (if (startDate.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -9481,6 +10210,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -9610,6 +10366,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): EventType = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt index 4400446f..fe9c6e03 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt @@ -18,6 +18,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull class AccountUpdateResponse private constructor( @@ -354,7 +355,7 @@ private constructor( } accountId() - authenticationType() + authenticationType().validate() companyId() products() providerId() @@ -362,6 +363,28 @@ private constructor( 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 (accountId.asKnown().isPresent) 1 else 0) + + (authenticationType.asKnown().getOrNull()?.validity() ?: 0) + + (if (companyId.asKnown().isPresent) 1 else 0) + + (products.asKnown().getOrNull()?.size ?: 0) + + (if (providerId.asKnown().isPresent) 1 else 0) + + (if (connectionId.asKnown().isPresent) 1 else 0) + class AuthenticationType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -463,6 +486,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): AuthenticationType = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt index 53bcf788..3805946b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt @@ -470,11 +470,36 @@ private constructor( params().ifPresent { it.validate() } scheduledAt() startedAt() - status() - type() + status().validate() + type().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 (completedAt.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (if (jobId.asKnown().isPresent) 1 else 0) + + (if (jobUrl.asKnown().isPresent) 1 else 0) + + (params.asKnown().getOrNull()?.validity() ?: 0) + + (if (scheduledAt.asKnown().isPresent) 1 else 0) + + (if (startedAt.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + /** The input parameters for the job. */ class Params private constructor( @@ -590,6 +615,23 @@ private constructor( 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 (individualId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -716,6 +758,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: 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 @@ -814,6 +883,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt index 6e9399ec..35b96448 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt @@ -258,6 +258,26 @@ private constructor( 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 (allowedRefreshes.asKnown().isPresent) 1 else 0) + + (if (jobId.asKnown().isPresent) 1 else 0) + + (if (jobUrl.asKnown().isPresent) 1 else 0) + + (if (remainingRefreshes.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt index 88839a6d..bb109152 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt @@ -17,6 +17,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull class AutomatedListResponse private constructor( @@ -186,6 +187,24 @@ private constructor( 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 = + (data.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (meta.asKnown().getOrNull()?.validity() ?: 0) + class Meta private constructor( private val quotas: JsonField, @@ -298,6 +317,22 @@ private constructor( 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 = (quotas.asKnown().getOrNull()?.validity() ?: 0) + /** * Information about remaining quotas for this connection. Only applicable for customers * opted in to use Finch's Data Sync Refresh endpoint (`POST /jobs/automated`). Please @@ -417,6 +452,23 @@ private constructor( 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 = (dataSyncAll.asKnown().getOrNull()?.validity() ?: 0) + class DataSyncAll private constructor( private val allowedRefreshes: JsonField, @@ -575,6 +627,25 @@ private constructor( 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 (allowedRefreshes.asKnown().isPresent) 1 else 0) + + (if (remainingRefreshes.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt index 01fe10d5..bb157824 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt @@ -233,6 +233,25 @@ private constructor( 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 (accountId.asKnown().isPresent) 1 else 0) + + (if (companyId.asKnown().isPresent) 1 else 0) + + (if (connectionId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt index 823f5611..a75c636d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt @@ -163,10 +163,27 @@ private constructor( } amount() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + /** Contribution type. */ class Type @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -252,6 +269,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt index a49bd18d..0b5f5b69 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt @@ -176,6 +176,24 @@ private constructor( 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 = + (supportedFeatures.asKnown().getOrNull()?.validity() ?: 0) + + (supportedOperations.asKnown().getOrNull()?.validity() ?: 0) + class BenefitFeature private constructor( private val annualMaximum: JsonField, @@ -641,14 +659,41 @@ private constructor( annualMaximum() catchUp() - companyContribution() + companyContribution().ifPresent { it.forEach { it?.validate() } } description() - employeeDeduction() - frequencies() - hsaContributionLimit() + 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 { @@ -743,6 +788,33 @@ private constructor( 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 @@ -849,6 +921,33 @@ private constructor( 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 @@ -956,6 +1055,33 @@ private constructor( 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFrequency.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFrequency.kt index 3a3183a0..01ffb309 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFrequency.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFrequency.kt @@ -99,6 +99,32 @@ class BenefitFrequency @JsonCreator private constructor(private val value: JsonF fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): BenefitFrequency = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitType.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitType.kt index 4f7b1a34..27b2ed15 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitType.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitType.kt @@ -193,6 +193,32 @@ class BenefitType @JsonCreator private constructor(private val value: JsonField< fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): BenefitType = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt index 46b8077d..0f227974 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt @@ -606,6 +606,34 @@ private constructor( 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 = + (commuter.asKnown().getOrNull()?.validity() ?: 0) + + (customPostTax.asKnown().getOrNull()?.validity() ?: 0) + + (customPreTax.asKnown().getOrNull()?.validity() ?: 0) + + (fsaDependentCare.asKnown().getOrNull()?.validity() ?: 0) + + (fsaMedical.asKnown().getOrNull()?.validity() ?: 0) + + (hsaPost.asKnown().getOrNull()?.validity() ?: 0) + + (hsaPre.asKnown().getOrNull()?.validity() ?: 0) + + (s125Dental.asKnown().getOrNull()?.validity() ?: 0) + + (s125Medical.asKnown().getOrNull()?.validity() ?: 0) + + (s125Vision.asKnown().getOrNull()?.validity() ?: 0) + + (simple.asKnown().getOrNull()?.validity() ?: 0) + + (simpleIra.asKnown().getOrNull()?.validity() ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt index 2445f95d..70e6c8f5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt @@ -528,6 +528,31 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + + (accounts.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (departments.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } ?: 0) + + (if (ein.asKnown().isPresent) 1 else 0) + + (entity.asKnown().getOrNull()?.validity() ?: 0) + + (if (legalName.asKnown().isPresent) 1 else 0) + + (locations.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } ?: 0) + + (if (primaryEmail.asKnown().isPresent) 1 else 0) + + (if (primaryPhoneNumber.asKnown().isPresent) 1 else 0) + class Account private constructor( private val accountName: JsonField, @@ -835,12 +860,34 @@ private constructor( accountName() accountNumber() - accountType() + accountType().ifPresent { it.validate() } institutionName() routingNumber() 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 (accountName.asKnown().isPresent) 1 else 0) + + (if (accountNumber.asKnown().isPresent) 1 else 0) + + (accountType.asKnown().getOrNull()?.validity() ?: 0) + + (if (institutionName.asKnown().isPresent) 1 else 0) + + (if (routingNumber.asKnown().isPresent) 1 else 0) + /** The type of bank account. */ class AccountType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -933,6 +980,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): AccountType = 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 @@ -1108,6 +1182,25 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + + (parent.asKnown().getOrNull()?.validity() ?: 0) + /** The parent department, if present. */ class Parent private constructor( @@ -1221,6 +1314,22 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1397,11 +1506,30 @@ private constructor( return@apply } - subtype() - type() + subtype().ifPresent { it.validate() } + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (subtype.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + /** The tax payer subtype of the company. */ class Subtype @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1499,6 +1627,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Subtype = 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 @@ -1630,6 +1785,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt index 00feff71..f1c411cb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt @@ -249,11 +249,31 @@ private constructor( benefitId() description() - frequency() - type() + frequency().ifPresent { it.validate() } + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (benefitId.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (frequency.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt index de42d69b..f5649b1f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt @@ -303,10 +303,31 @@ private constructor( companyId() connectionId() data().ifPresent { it.validate() } - eventType() + eventType().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (accountId.asKnown().isPresent) 1 else 0) + + (if (companyId.asKnown().isPresent) 1 else 0) + + (if (connectionId.asKnown().isPresent) 1 else 0) + + (data.asKnown().getOrNull()?.validity() ?: 0) + + (eventType.asKnown().getOrNull()?.validity() ?: 0) + class Data @JsonCreator private constructor( @@ -373,6 +394,24 @@ private constructor( 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 = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -470,6 +509,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): EventType = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt index 664e177e..05508d53 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt @@ -493,6 +493,30 @@ private constructor( 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 = + (accounts.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (departments.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } ?: 0) + + (if (ein.asKnown().isPresent) 1 else 0) + + (entity.asKnown().getOrNull()?.validity() ?: 0) + + (if (legalName.asKnown().isPresent) 1 else 0) + + (locations.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } ?: 0) + + (if (primaryEmail.asKnown().isPresent) 1 else 0) + + (if (primaryPhoneNumber.asKnown().isPresent) 1 else 0) + class Account private constructor( private val accountName: JsonField, @@ -800,12 +824,34 @@ private constructor( accountName() accountNumber() - accountType() + accountType().ifPresent { it.validate() } institutionName() routingNumber() 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 (accountName.asKnown().isPresent) 1 else 0) + + (if (accountNumber.asKnown().isPresent) 1 else 0) + + (accountType.asKnown().getOrNull()?.validity() ?: 0) + + (if (institutionName.asKnown().isPresent) 1 else 0) + + (if (routingNumber.asKnown().isPresent) 1 else 0) + /** The type of bank account. */ class AccountType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -898,6 +944,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): AccountType = 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 @@ -1073,6 +1146,25 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + + (parent.asKnown().getOrNull()?.validity() ?: 0) + /** The parent department, if present. */ class Parent private constructor( @@ -1186,6 +1278,22 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1362,11 +1470,30 @@ private constructor( return@apply } - subtype() - type() + subtype().ifPresent { it.validate() } + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (subtype.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + /** The tax payer subtype of the company. */ class Subtype @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1464,6 +1591,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Subtype = 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 @@ -1595,6 +1749,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt index ddc3b85f..d7b1ec37 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt @@ -953,16 +953,42 @@ private constructor( customerId() customerName() - products() + products().forEach { it.validate() } customerEmail() integration().ifPresent { it.validate() } manual() minutesToExpire() redirectUri() - sandbox() + sandbox().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (customerId.asKnown().isPresent) 1 else 0) + + (if (customerName.asKnown().isPresent) 1 else 0) + + (products.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (customerEmail.asKnown().isPresent) 1 else 0) + + (integration.asKnown().getOrNull()?.validity() ?: 0) + + (if (manual.asKnown().isPresent) 1 else 0) + + (if (minutesToExpire.asKnown().isPresent) 1 else 0) + + (if (redirectUri.asKnown().isPresent) 1 else 0) + + (sandbox.asKnown().getOrNull()?.validity() ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1106,6 +1132,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): ConnectProducts = 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 @@ -1260,11 +1313,30 @@ private constructor( return@apply } - authMethod() + authMethod().ifPresent { it.validate() } provider() 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 = + (authMethod.asKnown().getOrNull()?.validity() ?: 0) + + (if (provider.asKnown().isPresent) 1 else 0) + class AuthMethod @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1368,6 +1440,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): AuthMethod = 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 @@ -1483,6 +1582,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Sandbox = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt index 34998a03..412b2a7e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt @@ -633,11 +633,32 @@ private constructor( connectionId() minutesToExpire() - products() + products().ifPresent { it.forEach { it.validate() } } redirectUri() 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 (connectionId.asKnown().isPresent) 1 else 0) + + (if (minutesToExpire.asKnown().isPresent) 1 else 0) + + (products.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (redirectUri.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -781,6 +802,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): ConnectProducts = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt index 9b90cbb1..08b37f51 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt @@ -18,6 +18,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull class ConnectionCreateResponse private constructor( @@ -422,7 +423,7 @@ private constructor( accessToken() accountId() - authenticationType() + authenticationType().validate() companyId() connectionId() products() @@ -431,6 +432,30 @@ private constructor( 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 (accessToken.asKnown().isPresent) 1 else 0) + + (if (accountId.asKnown().isPresent) 1 else 0) + + (authenticationType.asKnown().getOrNull()?.validity() ?: 0) + + (if (companyId.asKnown().isPresent) 1 else 0) + + (if (connectionId.asKnown().isPresent) 1 else 0) + + (products.asKnown().getOrNull()?.size ?: 0) + + (if (providerId.asKnown().isPresent) 1 else 0) + + (if (tokenType.asKnown().isPresent) 1 else 0) + class AuthenticationType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -532,6 +557,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): AuthenticationType = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionStatusType.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionStatusType.kt index 8911a636..08471c42 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionStatusType.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionStatusType.kt @@ -118,6 +118,32 @@ class ConnectionStatusType @JsonCreator private constructor(private val value: J fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): ConnectionStatusType = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt index 091bfa7b..258e1198 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt @@ -524,10 +524,10 @@ private constructor( accessToken() accountId() - clientType() + clientType().validate() companyId() connectionId() - connectionType() + connectionType().validate() products() providerId() customerId() @@ -535,6 +535,32 @@ private constructor( 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 (accessToken.asKnown().isPresent) 1 else 0) + + (if (accountId.asKnown().isPresent) 1 else 0) + + (clientType.asKnown().getOrNull()?.validity() ?: 0) + + (if (companyId.asKnown().isPresent) 1 else 0) + + (if (connectionId.asKnown().isPresent) 1 else 0) + + (connectionType.asKnown().getOrNull()?.validity() ?: 0) + + (products.asKnown().getOrNull()?.size ?: 0) + + (if (providerId.asKnown().isPresent) 1 else 0) + + (if (customerId.asKnown().isPresent) 1 else 0) + + (if (tokenType.asKnown().isPresent) 1 else 0) + /** The type of application associated with a token. */ class ClientType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -628,6 +654,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): ClientType = 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 @@ -734,6 +787,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): ConnectionType = 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 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 08366225..abd10a3f 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 @@ -137,6 +137,21 @@ private constructor( 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 (benefitId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryCreateResponse.kt index b8cb2537..0efe9871 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryCreateResponse.kt @@ -7,6 +7,7 @@ import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects @@ -81,6 +82,21 @@ private constructor(private val additionalProperties: MutableMap, @@ -416,6 +438,23 @@ private constructor( 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 (individualId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -526,6 +565,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): EventType = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt index a988ef07..c46c0b60 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt @@ -135,6 +135,21 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (status.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt index ba4d517f..85ef0727 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt @@ -16,6 +16,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects +import kotlin.jvm.optionals.getOrNull class DocumentListResponse private constructor( @@ -187,6 +188,24 @@ private constructor( 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 = + (documents.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (paging.asKnown().getOrNull()?.validity() ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt index befd7f3f..45158baf 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt @@ -270,12 +270,33 @@ private constructor( id() individualId() - type() + type().ifPresent { it.validate() } url() year() 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 (id.asKnown().isPresent) 1 else 0) + + (if (individualId.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (url.asKnown().isPresent) 1 else 0) + + (if (year.asKnown().isPresent) 1 else 0) + /** The type of document. */ class Type @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -361,6 +382,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentRetreiveResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentRetreiveResponse.kt index 25647646..57f278d9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentRetreiveResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentRetreiveResponse.kt @@ -61,13 +61,12 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) - fun accept(visitor: Visitor): T { - return when { + fun accept(visitor: Visitor): T = + when { w42020 != null -> visitor.visitW42020(w42020) w42005 != null -> visitor.visitW42005(w42005) else -> visitor.unknown(_json) } - } private var validated: Boolean = false @@ -90,6 +89,31 @@ private constructor( 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 = + accept( + object : Visitor { + override fun visitW42020(w42020: W42020) = w42020.validity() + + override fun visitW42005(w42005: W42005) = w42005.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -165,16 +189,14 @@ private constructor( when (type) { "w4_2020" -> { - return DocumentRetreiveResponse( - w42020 = deserialize(node, jacksonTypeRef()), - _json = json, - ) + return tryDeserialize(node, jacksonTypeRef())?.let { + DocumentRetreiveResponse(w42020 = it, _json = json) + } ?: DocumentRetreiveResponse(_json = json) } "w4_2005" -> { - return DocumentRetreiveResponse( - w42005 = deserialize(node, jacksonTypeRef()), - _json = json, - ) + return tryDeserialize(node, jacksonTypeRef())?.let { + DocumentRetreiveResponse(w42005 = it, _json = json) + } ?: DocumentRetreiveResponse(_json = json) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt index c5aeeed4..bdb938ed 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt @@ -897,7 +897,7 @@ private constructor( customFields().ifPresent { it.forEach { it.validate() } } department().ifPresent { it.validate() } employment().ifPresent { it.validate() } - employmentStatus() + employmentStatus().ifPresent { it.validate() } endDate() firstName() income().ifPresent { it.validate() } @@ -915,6 +915,42 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + + (if (classCode.asKnown().isPresent) 1 else 0) + + (customFields.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (department.asKnown().getOrNull()?.validity() ?: 0) + + (employment.asKnown().getOrNull()?.validity() ?: 0) + + (employmentStatus.asKnown().getOrNull()?.validity() ?: 0) + + (if (endDate.asKnown().isPresent) 1 else 0) + + (if (firstName.asKnown().isPresent) 1 else 0) + + (income.asKnown().getOrNull()?.validity() ?: 0) + + (incomeHistory.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } ?: 0) + + (if (isActive.asKnown().isPresent) 1 else 0) + + (if (lastName.asKnown().isPresent) 1 else 0) + + (if (latestRehireDate.asKnown().isPresent) 1 else 0) + + (location.asKnown().getOrNull()?.validity() ?: 0) + + (manager.asKnown().getOrNull()?.validity() ?: 0) + + (if (middleName.asKnown().isPresent) 1 else 0) + + (if (sourceId.asKnown().isPresent) 1 else 0) + + (if (startDate.asKnown().isPresent) 1 else 0) + + (if (title.asKnown().isPresent) 1 else 0) + + (if (workId.asKnown().isPresent) 1 else 0) + class CustomField private constructor( private val name: JsonField, @@ -1026,6 +1062,22 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1154,6 +1206,22 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1316,11 +1384,30 @@ private constructor( return@apply } - subtype() - type() + subtype().ifPresent { it.validate() } + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (subtype.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, * `intern`, `temp`, `seasonal` and `individual_contractor`. @@ -1439,6 +1526,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Subtype = 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 @@ -1540,6 +1654,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1693,6 +1834,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): EmploymentStatus = 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 @@ -1813,6 +1981,22 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt index 06e6b3c1..0a598fa8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt @@ -14,6 +14,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull class EmploymentDataResponse private constructor( @@ -186,6 +187,25 @@ private constructor( 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) + + (if (code.asKnown().isPresent) 1 else 0) + + (if (individualId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt index 7fd21bce..9a9453e7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt @@ -16,6 +16,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull class EmploymentEvent private constructor( @@ -298,10 +299,31 @@ private constructor( companyId() connectionId() data().ifPresent { it.validate() } - eventType() + eventType().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (accountId.asKnown().isPresent) 1 else 0) + + (if (companyId.asKnown().isPresent) 1 else 0) + + (if (connectionId.asKnown().isPresent) 1 else 0) + + (data.asKnown().getOrNull()?.validity() ?: 0) + + (eventType.asKnown().getOrNull()?.validity() ?: 0) + class Data private constructor( private val individualId: JsonField, @@ -416,6 +438,23 @@ private constructor( 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 (individualId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -526,6 +565,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): EventType = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt index 6dec26c8..c2f1ebbc 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt @@ -845,7 +845,7 @@ private constructor( customFields().ifPresent { it.forEach { it.validate() } } department().ifPresent { it.validate() } employment().ifPresent { it.validate() } - employmentStatus() + employmentStatus().ifPresent { it.validate() } endDate() firstName() income().ifPresent { it.validate() } @@ -862,6 +862,41 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + + (if (classCode.asKnown().isPresent) 1 else 0) + + (customFields.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (department.asKnown().getOrNull()?.validity() ?: 0) + + (employment.asKnown().getOrNull()?.validity() ?: 0) + + (employmentStatus.asKnown().getOrNull()?.validity() ?: 0) + + (if (endDate.asKnown().isPresent) 1 else 0) + + (if (firstName.asKnown().isPresent) 1 else 0) + + (income.asKnown().getOrNull()?.validity() ?: 0) + + (incomeHistory.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } ?: 0) + + (if (isActive.asKnown().isPresent) 1 else 0) + + (if (lastName.asKnown().isPresent) 1 else 0) + + (if (latestRehireDate.asKnown().isPresent) 1 else 0) + + (location.asKnown().getOrNull()?.validity() ?: 0) + + (manager.asKnown().getOrNull()?.validity() ?: 0) + + (if (middleName.asKnown().isPresent) 1 else 0) + + (if (sourceId.asKnown().isPresent) 1 else 0) + + (if (startDate.asKnown().isPresent) 1 else 0) + + (if (title.asKnown().isPresent) 1 else 0) + class CustomField private constructor( private val name: JsonField, @@ -976,6 +1011,22 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1104,6 +1155,22 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1266,11 +1333,30 @@ private constructor( return@apply } - subtype() - type() + subtype().ifPresent { it.validate() } + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (subtype.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, * `intern`, `temp`, `seasonal` and `individual_contractor`. @@ -1389,6 +1475,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Subtype = 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 @@ -1490,6 +1603,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1640,6 +1780,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): EmploymentStatus = 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 @@ -1760,6 +1927,22 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true 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 index ca8189dc..6c7df11f 100644 --- 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 @@ -182,11 +182,30 @@ private constructor( } body().ifPresent { it.validate() } - code() + 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, @@ -368,6 +387,26 @@ private constructor( 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 @@ -482,6 +521,33 @@ private constructor( 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt index 323fa76d..d8c5bfe2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt @@ -472,11 +472,31 @@ private constructor( } description() - frequency() - type() + frequency().ifPresent { it.validate() } + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (description.asKnown().isPresent) 1 else 0) + + (frequency.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true 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 ce5d2e4e..d1bb8a22 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 @@ -10,6 +10,7 @@ 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 @@ -103,6 +104,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { 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 29f26bc2..64b9d98b 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 @@ -10,6 +10,7 @@ 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 @@ -106,6 +107,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { 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 index 8fc2b027..0e084d12 100644 --- 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 @@ -10,6 +10,7 @@ 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 @@ -103,6 +104,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { 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 index 86cc73b9..a3e43f1d 100644 --- 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 @@ -10,6 +10,7 @@ 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 @@ -105,6 +106,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt index 42011764..0cb6b392 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt @@ -20,6 +20,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Unenroll individuals from a deduction or contribution */ class HrisBenefitIndividualUnenrollManyParams @@ -393,6 +394,23 @@ private constructor( 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 = (individualIds.asKnown().getOrNull()?.size ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true 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 ef6cff70..ae8f160a 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 @@ -10,6 +10,7 @@ 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.BenefitService import java.util.Collections import java.util.Objects @@ -100,6 +101,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { 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 08c0e585..ce6047cd 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 @@ -10,6 +10,7 @@ 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.BenefitServiceAsync import java.util.Collections import java.util.Objects @@ -105,6 +106,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt index 82f8cbfe..692b53de 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt @@ -10,6 +10,7 @@ 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.BenefitService import java.util.Collections import java.util.Objects @@ -103,6 +104,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt index 6f0261d6..b1ea55b3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt @@ -10,6 +10,7 @@ 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.BenefitServiceAsync import java.util.Collections import java.util.Objects @@ -105,6 +106,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt index 112cc16e..c052e709 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt @@ -359,6 +359,22 @@ private constructor( 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 (description.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt index abf208ab..cca3bb81 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt @@ -10,6 +10,7 @@ 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.DirectoryService import java.util.Collections import java.util.Objects @@ -131,6 +132,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt index c1aea587..51ea0014 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt @@ -10,6 +10,7 @@ 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.DirectoryServiceAsync import java.util.Collections import java.util.Objects @@ -133,6 +134,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt index 83b38d4c..c4eb2953 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt @@ -10,6 +10,7 @@ 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.DirectoryService import java.util.Collections import java.util.Objects @@ -130,6 +131,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt index a468dcb8..38d13a73 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt @@ -10,6 +10,7 @@ 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.DirectoryServiceAsync import java.util.Collections import java.util.Objects @@ -132,6 +133,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt index bad93273..dd322628 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt @@ -345,6 +345,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt index 8add822b..3e6422c0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt @@ -10,6 +10,7 @@ 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.EmploymentService import java.util.Collections import java.util.Objects @@ -106,6 +107,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt index eb91301b..4ceb2b95 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt @@ -10,6 +10,7 @@ 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.EmploymentServiceAsync import java.util.Collections import java.util.Objects @@ -108,6 +109,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt index ad18d402..742efe78 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt @@ -19,6 +19,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects +import kotlin.jvm.optionals.getOrNull /** Read individual employment and income data */ class HrisEmploymentRetrieveManyParams @@ -386,6 +387,24 @@ private constructor( 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 = + (requests.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -541,6 +560,23 @@ private constructor( 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 (individualId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt index 6d690971..9ef47277 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt @@ -10,6 +10,7 @@ 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.IndividualService import java.util.Collections import java.util.Objects @@ -105,6 +106,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt index 122692b1..ed6eac2c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt @@ -10,6 +10,7 @@ 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.IndividualServiceAsync import java.util.Collections import java.util.Objects @@ -107,6 +108,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt index 5acd586f..329d1cfe 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt @@ -416,6 +416,25 @@ private constructor( 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 = + (options.asKnown().getOrNull()?.validity() ?: 0) + + (requests.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -557,6 +576,22 @@ private constructor( 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 = (include.asKnown().getOrNull()?.size ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -686,6 +721,23 @@ private constructor( 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 (individualId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt index d8fa7562..a0493f31 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt @@ -10,6 +10,7 @@ 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.PayStatementService import java.util.Collections import java.util.Objects @@ -109,6 +110,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt index 8dfdaa54..aa025bc9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt @@ -10,6 +10,7 @@ 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.PayStatementServiceAsync import java.util.Collections import java.util.Objects @@ -111,6 +112,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt index 3af58f7f..d6f78e32 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt @@ -20,6 +20,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * Read detailed pay statements for each individual. @@ -390,6 +391,24 @@ private constructor( 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 = + (requests.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -600,6 +619,26 @@ private constructor( 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 (paymentId.asKnown().isPresent) 1 else 0) + + (if (limit.asKnown().isPresent) 1 else 0) + + (if (offset.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt index f0913915..09b82bbc 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt @@ -10,6 +10,7 @@ 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.PaymentService import java.util.Collections import java.util.Objects @@ -100,6 +101,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt index 4caac89d..790ee608 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt @@ -10,6 +10,7 @@ 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.PaymentServiceAsync import java.util.Collections import java.util.Objects @@ -105,6 +106,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt index fe56733d..6a556e41 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt @@ -250,10 +250,30 @@ private constructor( amount() currency() effectiveDate() - unit() + unit().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (effectiveDate.asKnown().isPresent) 1 else 0) + + (unit.asKnown().getOrNull()?.validity() ?: 0) + /** * The income unit of payment. Options: `yearly`, `quarterly`, `monthly`, `semi_monthly`, * `bi_weekly`, `weekly`, `daily`, `hourly`, and `fixed`. @@ -384,6 +404,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Unit = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt index 55779ae1..d386cf7a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt @@ -616,9 +616,9 @@ private constructor( dob() emails().ifPresent { it.forEach { it.validate() } } encryptedSsn() - ethnicity() + ethnicity().ifPresent { it.validate() } firstName() - gender() + gender().ifPresent { it.validate() } lastName() middleName() phoneNumbers().ifPresent { it.forEach { it?.validate() } } @@ -628,6 +628,35 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + + (if (dob.asKnown().isPresent) 1 else 0) + + (emails.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (encryptedSsn.asKnown().isPresent) 1 else 0) + + (ethnicity.asKnown().getOrNull()?.validity() ?: 0) + + (if (firstName.asKnown().isPresent) 1 else 0) + + (gender.asKnown().getOrNull()?.validity() ?: 0) + + (if (lastName.asKnown().isPresent) 1 else 0) + + (if (middleName.asKnown().isPresent) 1 else 0) + + (phoneNumbers.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } ?: 0) + + (if (preferredName.asKnown().isPresent) 1 else 0) + + (residence.asKnown().getOrNull()?.validity() ?: 0) + + (if (ssn.asKnown().isPresent) 1 else 0) + class Email private constructor( private val data: JsonField, @@ -759,10 +788,28 @@ private constructor( } data() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (data.asKnown().isPresent) 1 else 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -850,6 +897,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1005,6 +1079,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Ethnicity = 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 @@ -1115,6 +1216,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Gender = 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 @@ -1262,10 +1390,28 @@ private constructor( } data() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (data.asKnown().isPresent) 1 else 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -1353,6 +1499,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt index e0442180..fdcc4c1a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt @@ -184,6 +184,25 @@ private constructor( 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) + + (if (code.asKnown().isPresent) 1 else 0) + + (if (individualId.asKnown().isPresent) 1 else 0) + class Body private constructor( private val annualMaximum: JsonField, @@ -507,10 +526,32 @@ private constructor( catchUp() companyContribution().ifPresent { it.validate() } employeeDeduction().ifPresent { it.validate() } - hsaContributionLimit() + hsaContributionLimit().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (annualMaximum.asKnown().isPresent) 1 else 0) + + (if (catchUp.asKnown().isPresent) 1 else 0) + + (companyContribution.asKnown().getOrNull()?.validity() ?: 0) + + (employeeDeduction.asKnown().getOrNull()?.validity() ?: 0) + + (hsaContributionLimit.asKnown().getOrNull()?.validity() ?: 0) + /** Type for HSA contribution limit if the benefit is a HSA. */ class HsaContributionLimit @JsonCreator @@ -606,6 +647,33 @@ private constructor( 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt index 6c37ea7d..4bf7affd 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt @@ -16,6 +16,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects +import kotlin.jvm.optionals.getOrNull class IndividualEnrolledIdsResponse private constructor( @@ -189,6 +190,24 @@ private constructor( 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 (benefitId.asKnown().isPresent) 1 else 0) + + (individualIds.asKnown().getOrNull()?.size ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt index a9032b2a..eb46215a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt @@ -16,6 +16,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull class IndividualEvent private constructor( @@ -298,10 +299,31 @@ private constructor( companyId() connectionId() data().ifPresent { it.validate() } - eventType() + eventType().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (accountId.asKnown().isPresent) 1 else 0) + + (if (companyId.asKnown().isPresent) 1 else 0) + + (if (connectionId.asKnown().isPresent) 1 else 0) + + (data.asKnown().getOrNull()?.validity() ?: 0) + + (eventType.asKnown().getOrNull()?.validity() ?: 0) + class Data private constructor( private val individualId: JsonField, @@ -416,6 +438,23 @@ private constructor( 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 (individualId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -526,6 +565,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): EventType = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt index 043e1873..16493986 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt @@ -353,6 +353,29 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + + (department.asKnown().getOrNull()?.validity() ?: 0) + + (if (firstName.asKnown().isPresent) 1 else 0) + + (if (isActive.asKnown().isPresent) 1 else 0) + + (if (lastName.asKnown().isPresent) 1 else 0) + + (manager.asKnown().getOrNull()?.validity() ?: 0) + + (if (middleName.asKnown().isPresent) 1 else 0) + /** The department object. */ class Department private constructor( @@ -463,6 +486,22 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -588,6 +627,22 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt index f3f63c7c..dff785bb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt @@ -14,6 +14,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull class IndividualResponse private constructor( @@ -182,6 +183,25 @@ private constructor( 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) + + (if (code.asKnown().isPresent) 1 else 0) + + (if (individualId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt index dbaa72c2..6bfc0c62 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt @@ -616,9 +616,9 @@ private constructor( dob() emails().ifPresent { it.forEach { it.validate() } } encryptedSsn() - ethnicity() + ethnicity().ifPresent { it.validate() } firstName() - gender() + gender().ifPresent { it.validate() } lastName() middleName() phoneNumbers().ifPresent { it.forEach { it?.validate() } } @@ -628,6 +628,35 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + + (if (dob.asKnown().isPresent) 1 else 0) + + (emails.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (encryptedSsn.asKnown().isPresent) 1 else 0) + + (ethnicity.asKnown().getOrNull()?.validity() ?: 0) + + (if (firstName.asKnown().isPresent) 1 else 0) + + (gender.asKnown().getOrNull()?.validity() ?: 0) + + (if (lastName.asKnown().isPresent) 1 else 0) + + (if (middleName.asKnown().isPresent) 1 else 0) + + (phoneNumbers.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } ?: 0) + + (if (preferredName.asKnown().isPresent) 1 else 0) + + (residence.asKnown().getOrNull()?.validity() ?: 0) + + (if (ssn.asKnown().isPresent) 1 else 0) + class Email private constructor( private val data: JsonField, @@ -759,10 +788,28 @@ private constructor( } data() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (data.asKnown().isPresent) 1 else 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -850,6 +897,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1005,6 +1079,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Ethnicity = 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 @@ -1115,6 +1216,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Gender = 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 @@ -1262,10 +1390,28 @@ private constructor( } data() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (data.asKnown().isPresent) 1 else 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -1353,6 +1499,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt index 4276cda9..87a17c6a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt @@ -812,11 +812,11 @@ private constructor( accountId() authenticationMethods().forEach { it.validate() } clientId() - clientType() + clientType().validate() companyId() connectionId() connectionStatus().validate() - connectionType() + connectionType().validate() customerEmail() customerId() customerName() @@ -828,6 +828,38 @@ private constructor( 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 (accountId.asKnown().isPresent) 1 else 0) + + (authenticationMethods.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (clientId.asKnown().isPresent) 1 else 0) + + (clientType.asKnown().getOrNull()?.validity() ?: 0) + + (if (companyId.asKnown().isPresent) 1 else 0) + + (if (connectionId.asKnown().isPresent) 1 else 0) + + (connectionStatus.asKnown().getOrNull()?.validity() ?: 0) + + (connectionType.asKnown().getOrNull()?.validity() ?: 0) + + (if (customerEmail.asKnown().isPresent) 1 else 0) + + (if (customerId.asKnown().isPresent) 1 else 0) + + (if (customerName.asKnown().isPresent) 1 else 0) + + (if (manual.asKnown().isPresent) 1 else 0) + + (if (payrollProviderId.asKnown().isPresent) 1 else 0) + + (products.asKnown().getOrNull()?.size ?: 0) + + (if (providerId.asKnown().isPresent) 1 else 0) + + (if (username.asKnown().isPresent) 1 else 0) + class AuthenticationMethod private constructor( private val connectionStatus: JsonField, @@ -1025,10 +1057,30 @@ private constructor( connectionStatus().ifPresent { it.validate() } products() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (connectionStatus.asKnown().getOrNull()?.validity() ?: 0) + + (products.asKnown().getOrNull()?.size ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + class ConnectionStatus private constructor( private val message: JsonField, @@ -1168,10 +1220,29 @@ private constructor( } message() - status() + status().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (message.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1296,6 +1367,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1420,6 +1518,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): ClientType = 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 @@ -1613,10 +1738,30 @@ private constructor( lastSuccessfulSync() message() - status() + status().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (lastSuccessfulSync.asKnown().isPresent) 1 else 0) + + (if (message.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1728,6 +1873,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): ConnectionType = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt index 9bf31100..e7bbcb87 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt @@ -252,13 +252,12 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) - fun accept(visitor: Visitor): T { - return when { + fun accept(visitor: Visitor): T = + when { dataSyncAll != null -> visitor.visitDataSyncAll(dataSyncAll) w4FormEmployeeSync != null -> visitor.visitW4FormEmployeeSync(w4FormEmployeeSync) else -> visitor.unknown(_json) } - } private var validated: Boolean = false @@ -281,6 +280,33 @@ private constructor( 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 = + accept( + object : Visitor { + override fun visitDataSyncAll(dataSyncAll: DataSyncAll) = dataSyncAll.validity() + + override fun visitW4FormEmployeeSync(w4FormEmployeeSync: W4FormEmployeeSync) = + w4FormEmployeeSync.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -337,17 +363,14 @@ private constructor( when (type) { "data_sync_all" -> { - return Body( - dataSyncAll = deserialize(node, jacksonTypeRef()), - _json = json, - ) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(dataSyncAll = it, _json = json) + } ?: Body(_json = json) } "w4_form_employee_sync" -> { - return Body( - w4FormEmployeeSync = - deserialize(node, jacksonTypeRef()), - _json = json, - ) + return tryDeserialize(node, jacksonTypeRef())?.let { + Body(w4FormEmployeeSync = it, _json = json) + } ?: Body(_json = json) } } @@ -493,10 +516,27 @@ private constructor( return@apply } - type() + type().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 = (type.asKnown().getOrNull()?.validity() ?: 0) + /** The type of job to start. */ class Type @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -582,6 +622,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -772,10 +839,29 @@ private constructor( } params().validate() - type() + type().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 = + (params.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + class Params private constructor( private val individualId: JsonField, @@ -912,6 +998,23 @@ private constructor( 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 (individualId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1015,6 +1118,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt index 0bbf4e95..92cef502 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt @@ -16,6 +16,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull class JobCompletionEvent private constructor( @@ -298,10 +299,31 @@ private constructor( companyId() connectionId() data().ifPresent { it.validate() } - eventType() + eventType().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (accountId.asKnown().isPresent) 1 else 0) + + (if (companyId.asKnown().isPresent) 1 else 0) + + (if (connectionId.asKnown().isPresent) 1 else 0) + + (data.asKnown().getOrNull()?.validity() ?: 0) + + (eventType.asKnown().getOrNull()?.validity() ?: 0) + class Data private constructor( private val jobId: JsonField, @@ -461,6 +483,24 @@ private constructor( 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) + (if (jobUrl.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -589,6 +629,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): EventType = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt index 2b00d8f4..0899bd84 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt @@ -258,6 +258,26 @@ private constructor( 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 (allowedRefreshes.asKnown().isPresent) 1 else 0) + + (if (jobId.asKnown().isPresent) 1 else 0) + + (if (jobUrl.asKnown().isPresent) 1 else 0) + + (if (remainingRefreshes.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt index 567987ef..9887da8b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt @@ -370,6 +370,30 @@ private constructor( 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 (city.asKnown().isPresent) 1 else 0) + + (if (country.asKnown().isPresent) 1 else 0) + + (if (line1.asKnown().isPresent) 1 else 0) + + (if (line2.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (postalCode.asKnown().isPresent) 1 else 0) + + (if (sourceId.asKnown().isPresent) 1 else 0) + + (if (state.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt index a8e4898f..5850806e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt @@ -219,10 +219,29 @@ private constructor( body() jobId() - status() + status().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 = + (body.asKnown().getOrNull()?.size ?: 0) + + (if (jobId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -319,6 +338,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt index d8be1fda..e6c95791 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt @@ -159,6 +159,23 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + (if (currency.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupport.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupport.kt index 2cd1bc73..170e62fd 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupport.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupport.kt @@ -114,6 +114,32 @@ class OperationSupport @JsonCreator private constructor(private val value: JsonF fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): OperationSupport = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt index f33ad738..62d2c161 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt @@ -14,6 +14,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull class OperationSupportMatrix private constructor( @@ -279,13 +280,33 @@ private constructor( return@apply } - create() - delete() - read() - update() + create().ifPresent { it.validate() } + delete().ifPresent { it.validate() } + read().ifPresent { it.validate() } + update().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (create.asKnown().getOrNull()?.validity() ?: 0) + + (delete.asKnown().getOrNull()?.validity() ?: 0) + + (read.asKnown().getOrNull()?.validity() ?: 0) + + (update.asKnown().getOrNull()?.validity() ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt index e8ef2ff8..77fb26b3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt @@ -151,6 +151,23 @@ private constructor( 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 (count.asKnown().isPresent) 1 else 0) + (if (offset.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt index 64acbf4e..a9c30931 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt @@ -17,6 +17,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull class PayGroupListResponse private constructor( @@ -208,10 +209,29 @@ private constructor( id() name() - payFrequencies() + payFrequencies().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 (id.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (payFrequencies.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + class PayFrequency @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -341,6 +361,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): PayFrequency = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt index 959124dc..e6e2c27b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt @@ -17,6 +17,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects +import kotlin.jvm.optionals.getOrNull class PayGroupRetrieveResponse private constructor( @@ -275,10 +276,30 @@ private constructor( id() individualIds() name() - payFrequencies() + payFrequencies().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 (id.asKnown().isPresent) 1 else 0) + + (individualIds.asKnown().getOrNull()?.size ?: 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (payFrequencies.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + class PayFrequency @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -408,6 +429,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): PayFrequency = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt index 45ffe3fc..3369c527 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt @@ -549,13 +549,41 @@ private constructor( grossPay().ifPresent { it.validate() } individualId() netPay().ifPresent { it.validate() } - paymentMethod() + paymentMethod().ifPresent { it.validate() } taxes().ifPresent { it.forEach { it?.validate() } } totalHours() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (earnings.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } ?: 0) + + (employeeDeductions.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } + ?: 0) + + (employerContributions.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } + ?: 0) + + (grossPay.asKnown().getOrNull()?.validity() ?: 0) + + (if (individualId.asKnown().isPresent) 1 else 0) + + (netPay.asKnown().getOrNull()?.validity() ?: 0) + + (paymentMethod.asKnown().getOrNull()?.validity() ?: 0) + + (taxes.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } ?: 0) + + (if (totalHours.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + class Earning private constructor( private val amount: JsonField, @@ -869,10 +897,33 @@ private constructor( currency() hours() name() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (attributes.asKnown().getOrNull()?.validity() ?: 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (hours.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + class Attributes private constructor( private val metadata: JsonField, @@ -985,6 +1036,23 @@ private constructor( 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 = (metadata.asKnown().getOrNull()?.validity() ?: 0) + class Metadata private constructor( private val metadata: JsonField, @@ -1108,6 +1176,23 @@ private constructor( 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 = (metadata.asKnown().getOrNull()?.validity() ?: 0) + /** * The metadata to be attached to the entity by existing rules. It is a key-value * pairs where the values can be of any type (string, number, boolean, object, @@ -1187,6 +1272,26 @@ private constructor( 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 = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1395,6 +1500,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1735,10 +1867,33 @@ private constructor( currency() name() preTax() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (attributes.asKnown().getOrNull()?.validity() ?: 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (preTax.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + class Attributes private constructor( private val metadata: JsonField, @@ -1851,6 +2006,23 @@ private constructor( 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 = (metadata.asKnown().getOrNull()?.validity() ?: 0) + class Metadata private constructor( private val metadata: JsonField, @@ -1974,6 +2146,23 @@ private constructor( 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 = (metadata.asKnown().getOrNull()?.validity() ?: 0) + /** * The metadata to be attached to the entity by existing rules. It is a key-value * pairs where the values can be of any type (string, number, boolean, object, @@ -2053,6 +2242,26 @@ private constructor( 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 = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2391,10 +2600,32 @@ private constructor( attributes().ifPresent { it.validate() } currency() name() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (attributes.asKnown().getOrNull()?.validity() ?: 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + class Attributes private constructor( private val metadata: JsonField, @@ -2507,6 +2738,23 @@ private constructor( 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 = (metadata.asKnown().getOrNull()?.validity() ?: 0) + class Metadata private constructor( private val metadata: JsonField, @@ -2630,6 +2878,23 @@ private constructor( 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 = (metadata.asKnown().getOrNull()?.validity() ?: 0) + /** * The metadata to be attached to the entity by existing rules. It is a key-value * pairs where the values can be of any type (string, number, boolean, object, @@ -2709,6 +2974,26 @@ private constructor( 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 = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2870,6 +3155,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): PaymentMethod = 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 @@ -3194,10 +3506,33 @@ private constructor( currency() employer() name() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (attributes.asKnown().getOrNull()?.validity() ?: 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (employer.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + class Attributes private constructor( private val metadata: JsonField, @@ -3310,6 +3645,23 @@ private constructor( 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 = (metadata.asKnown().getOrNull()?.validity() ?: 0) + class Metadata private constructor( private val metadata: JsonField, @@ -3433,6 +3785,23 @@ private constructor( 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 = (metadata.asKnown().getOrNull()?.validity() ?: 0) + /** * The metadata to be attached to the entity by existing rules. It is a key-value * pairs where the values can be of any type (string, number, boolean, object, @@ -3512,6 +3881,26 @@ private constructor( 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 = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3666,6 +4055,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3788,6 +4204,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt index 30407494..cf4cbb73 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt @@ -16,6 +16,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull class PayStatementEvent private constructor( @@ -298,10 +299,31 @@ private constructor( companyId() connectionId() data().ifPresent { it.validate() } - eventType() + eventType().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (accountId.asKnown().isPresent) 1 else 0) + + (if (companyId.asKnown().isPresent) 1 else 0) + + (if (connectionId.asKnown().isPresent) 1 else 0) + + (data.asKnown().getOrNull()?.validity() ?: 0) + + (eventType.asKnown().getOrNull()?.validity() ?: 0) + class Data private constructor( private val individualId: JsonField, @@ -450,6 +472,25 @@ private constructor( 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 (individualId.asKnown().isPresent) 1 else 0) + + (if (paymentId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -560,6 +601,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): EventType = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt index 16256880..4adc0090 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt @@ -14,6 +14,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull class PayStatementResponse private constructor( @@ -178,6 +179,25 @@ private constructor( 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) + + (if (code.asKnown().isPresent) 1 else 0) + + (if (paymentId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt index 9703dfd1..d92a3d49 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt @@ -16,6 +16,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull class PayStatementResponseBody private constructor( @@ -176,6 +177,24 @@ private constructor( 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 = + (paging.asKnown().getOrNull()?.validity() ?: 0) + + (payStatements.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt index 1eb633a5..a3ebe7e8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt @@ -594,12 +594,40 @@ private constructor( individualIds() netPay().ifPresent { it.validate() } payDate() - payFrequencies() + payFrequencies().ifPresent { it.forEach { it.validate() } } payGroupIds() payPeriod().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (companyDebit.asKnown().getOrNull()?.validity() ?: 0) + + (if (debitDate.asKnown().isPresent) 1 else 0) + + (employeeTaxes.asKnown().getOrNull()?.validity() ?: 0) + + (employerTaxes.asKnown().getOrNull()?.validity() ?: 0) + + (grossPay.asKnown().getOrNull()?.validity() ?: 0) + + (individualIds.asKnown().getOrNull()?.size ?: 0) + + (netPay.asKnown().getOrNull()?.validity() ?: 0) + + (if (payDate.asKnown().isPresent) 1 else 0) + + (payFrequencies.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (payGroupIds.asKnown().getOrNull()?.size ?: 0) + + (payPeriod.asKnown().getOrNull()?.validity() ?: 0) + class PayFrequency @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -729,6 +757,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): PayFrequency = 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 @@ -884,6 +939,25 @@ private constructor( 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 (endDate.asKnown().isPresent) 1 else 0) + + (if (startDate.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt index 86e5cffc..9504615b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt @@ -173,6 +173,23 @@ private constructor( 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 (payDate.asKnown().isPresent) 1 else 0) + (if (paymentId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt index 5c1774dc..e299f2b6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt @@ -16,6 +16,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull class PaymentEvent private constructor( @@ -301,10 +302,31 @@ private constructor( companyId() connectionId() data().ifPresent { it.validate() } - eventType() + eventType().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (accountId.asKnown().isPresent) 1 else 0) + + (if (companyId.asKnown().isPresent) 1 else 0) + + (if (connectionId.asKnown().isPresent) 1 else 0) + + (data.asKnown().getOrNull()?.validity() ?: 0) + + (eventType.asKnown().getOrNull()?.validity() ?: 0) + class PaymentIdentifiers private constructor( private val payDate: JsonField, @@ -466,6 +488,25 @@ private constructor( 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 (payDate.asKnown().isPresent) 1 else 0) + + (if (paymentId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -576,6 +617,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): EventType = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt index f31582e4..f3c491b7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt @@ -10,6 +10,7 @@ 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.payroll.PayGroupService import java.util.Collections import java.util.Objects @@ -103,6 +104,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt index 9ab3a4f1..5f64e744 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt @@ -10,6 +10,7 @@ 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.payroll.PayGroupServiceAsync import java.util.Collections import java.util.Objects @@ -105,6 +106,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt index 2b9a68b5..4c3bb476 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt @@ -495,6 +495,32 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + + (authenticationMethods.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (beta.asKnown().isPresent) 1 else 0) + + (if (displayName.asKnown().isPresent) 1 else 0) + + (if (icon.asKnown().isPresent) 1 else 0) + + (if (logo.asKnown().isPresent) 1 else 0) + + (if (manual.asKnown().isPresent) 1 else 0) + + (if (mfaRequired.asKnown().isPresent) 1 else 0) + + (if (primaryColor.asKnown().isPresent) 1 else 0) + + (products.asKnown().getOrNull()?.size ?: 0) + class AuthenticationMethod private constructor( private val benefitsSupport: JsonField, @@ -697,10 +723,30 @@ private constructor( benefitsSupport().ifPresent { it.validate() } supportedFields().ifPresent { it.validate() } - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (benefitsSupport.asKnown().getOrNull()?.validity() ?: 0) + + (supportedFields.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + /** The supported data fields returned by our HR and payroll endpoints */ class SupportedFields private constructor( @@ -1059,6 +1105,30 @@ private constructor( 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 = + (company.asKnown().getOrNull()?.validity() ?: 0) + + (directory.asKnown().getOrNull()?.validity() ?: 0) + + (employment.asKnown().getOrNull()?.validity() ?: 0) + + (individual.asKnown().getOrNull()?.validity() ?: 0) + + (payGroup.asKnown().getOrNull()?.validity() ?: 0) + + (payStatement.asKnown().getOrNull()?.validity() ?: 0) + + (payment.asKnown().getOrNull()?.validity() ?: 0) + class SupportedCompanyFields private constructor( private val id: JsonField, @@ -1476,6 +1546,32 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + + (accounts.asKnown().getOrNull()?.validity() ?: 0) + + (departments.asKnown().getOrNull()?.validity() ?: 0) + + (if (ein.asKnown().isPresent) 1 else 0) + + (entity.asKnown().getOrNull()?.validity() ?: 0) + + (if (legalName.asKnown().isPresent) 1 else 0) + + (locations.asKnown().getOrNull()?.validity() ?: 0) + + (if (primaryEmail.asKnown().isPresent) 1 else 0) + + (if (primaryPhoneNumber.asKnown().isPresent) 1 else 0) + class Accounts private constructor( private val accountName: JsonField, @@ -1759,6 +1855,28 @@ private constructor( 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 (accountName.asKnown().isPresent) 1 else 0) + + (if (accountNumber.asKnown().isPresent) 1 else 0) + + (if (accountType.asKnown().isPresent) 1 else 0) + + (if (institutionName.asKnown().isPresent) 1 else 0) + + (if (routingNumber.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1925,6 +2043,25 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + + (parent.asKnown().getOrNull()?.validity() ?: 0) + class Parent private constructor( private val name: JsonField, @@ -2039,6 +2176,23 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2221,6 +2375,25 @@ private constructor( 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 (subtype.asKnown().isPresent) 1 else 0) + + (if (type.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2528,6 +2701,29 @@ private constructor( 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 (city.asKnown().isPresent) 1 else 0) + + (if (country.asKnown().isPresent) 1 else 0) + + (if (line1.asKnown().isPresent) 1 else 0) + + (if (line2.asKnown().isPresent) 1 else 0) + + (if (postalCode.asKnown().isPresent) 1 else 0) + + (if (state.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2720,6 +2916,25 @@ private constructor( 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 = + (individuals.asKnown().getOrNull()?.validity() ?: 0) + + (paging.asKnown().getOrNull()?.validity() ?: 0) + class Individuals private constructor( private val id: JsonField, @@ -3071,6 +3286,30 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + + (if (department.asKnown().isPresent) 1 else 0) + + (if (firstName.asKnown().isPresent) 1 else 0) + + (if (isActive.asKnown().isPresent) 1 else 0) + + (if (lastName.asKnown().isPresent) 1 else 0) + + (manager.asKnown().getOrNull()?.validity() ?: 0) + + (if (middleName.asKnown().isPresent) 1 else 0) + class Manager private constructor( private val id: JsonField, @@ -3184,6 +3423,23 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3366,6 +3622,25 @@ private constructor( 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 (count.asKnown().isPresent) 1 else 0) + + (if (offset.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4127,6 +4402,40 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + + (if (classCode.asKnown().isPresent) 1 else 0) + + (if (customFields.asKnown().isPresent) 1 else 0) + + (department.asKnown().getOrNull()?.validity() ?: 0) + + (employment.asKnown().getOrNull()?.validity() ?: 0) + + (if (employmentStatus.asKnown().isPresent) 1 else 0) + + (if (endDate.asKnown().isPresent) 1 else 0) + + (if (firstName.asKnown().isPresent) 1 else 0) + + (income.asKnown().getOrNull()?.validity() ?: 0) + + (if (incomeHistory.asKnown().isPresent) 1 else 0) + + (if (isActive.asKnown().isPresent) 1 else 0) + + (if (lastName.asKnown().isPresent) 1 else 0) + + (location.asKnown().getOrNull()?.validity() ?: 0) + + (manager.asKnown().getOrNull()?.validity() ?: 0) + + (if (middleName.asKnown().isPresent) 1 else 0) + + (if (startDate.asKnown().isPresent) 1 else 0) + + (if (title.asKnown().isPresent) 1 else 0) + class Department private constructor( private val name: JsonField, @@ -4240,6 +4549,23 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4406,6 +4732,25 @@ private constructor( 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 (subtype.asKnown().isPresent) 1 else 0) + + (if (type.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4607,6 +4952,26 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (unit.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4912,6 +5277,29 @@ private constructor( 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 (city.asKnown().isPresent) 1 else 0) + + (if (country.asKnown().isPresent) 1 else 0) + + (if (line1.asKnown().isPresent) 1 else 0) + + (if (line2.asKnown().isPresent) 1 else 0) + + (if (postalCode.asKnown().isPresent) 1 else 0) + + (if (state.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5040,6 +5428,23 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5637,6 +6042,36 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + + (if (dob.asKnown().isPresent) 1 else 0) + + (emails.asKnown().getOrNull()?.validity() ?: 0) + + (if (encryptedSsn.asKnown().isPresent) 1 else 0) + + (if (ethnicity.asKnown().isPresent) 1 else 0) + + (if (firstName.asKnown().isPresent) 1 else 0) + + (if (gender.asKnown().isPresent) 1 else 0) + + (if (lastName.asKnown().isPresent) 1 else 0) + + (if (middleName.asKnown().isPresent) 1 else 0) + + (phoneNumbers.asKnown().getOrNull()?.validity() ?: 0) + + (if (preferredName.asKnown().isPresent) 1 else 0) + + (residence.asKnown().getOrNull()?.validity() ?: 0) + + (if (ssn.asKnown().isPresent) 1 else 0) + class Emails private constructor( private val data: JsonField, @@ -5780,6 +6215,25 @@ private constructor( 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 (data.asKnown().isPresent) 1 else 0) + + (if (type.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -5943,6 +6397,25 @@ private constructor( 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 (data.asKnown().isPresent) 1 else 0) + + (if (type.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6250,6 +6723,29 @@ private constructor( 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 (city.asKnown().isPresent) 1 else 0) + + (if (country.asKnown().isPresent) 1 else 0) + + (if (line1.asKnown().isPresent) 1 else 0) + + (if (line2.asKnown().isPresent) 1 else 0) + + (if (postalCode.asKnown().isPresent) 1 else 0) + + (if (state.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6511,6 +7007,27 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + + (if (individualIds.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (payFrequencies.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -6686,6 +7203,25 @@ private constructor( 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 = + (paging.asKnown().getOrNull()?.validity() ?: 0) + + (payStatements.asKnown().getOrNull()?.validity() ?: 0) + class Paging private constructor( private val count: JsonField, @@ -6853,6 +7389,25 @@ private constructor( 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 (count.asKnown().isPresent) 1 else 0) + + (if (offset.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -7345,6 +7900,33 @@ private constructor( 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 = + (earnings.asKnown().getOrNull()?.validity() ?: 0) + + (employeeDeductions.asKnown().getOrNull()?.validity() ?: 0) + + (employerContributions.asKnown().getOrNull()?.validity() ?: 0) + + (if (grossPay.asKnown().isPresent) 1 else 0) + + (if (individualId.asKnown().isPresent) 1 else 0) + + (if (netPay.asKnown().isPresent) 1 else 0) + + (if (paymentMethod.asKnown().isPresent) 1 else 0) + + (taxes.asKnown().getOrNull()?.validity() ?: 0) + + (if (totalHours.asKnown().isPresent) 1 else 0) + + (if (type.asKnown().isPresent) 1 else 0) + class Earnings private constructor( private val amount: JsonField, @@ -7571,6 +8153,27 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (type.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -7853,6 +8456,28 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (preTax.asKnown().isPresent) 1 else 0) + + (if (type.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -8066,6 +8691,26 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -8348,6 +8993,28 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (employer.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (type.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -8944,6 +9611,35 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + + (if (companyDebit.asKnown().isPresent) 1 else 0) + + (if (debitDate.asKnown().isPresent) 1 else 0) + + (if (employeeTaxes.asKnown().isPresent) 1 else 0) + + (if (employerTaxes.asKnown().isPresent) 1 else 0) + + (if (grossPay.asKnown().isPresent) 1 else 0) + + (if (individualIds.asKnown().isPresent) 1 else 0) + + (if (netPay.asKnown().isPresent) 1 else 0) + + (if (payDate.asKnown().isPresent) 1 else 0) + + (if (payFrequencies.asKnown().isPresent) 1 else 0) + + (if (payGroupIds.asKnown().isPresent) 1 else 0) + + (payPeriod.asKnown().getOrNull()?.validity() ?: 0) + class PayPeriod private constructor( private val endDate: JsonField, @@ -9097,6 +9793,25 @@ private constructor( 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 (endDate.asKnown().isPresent) 1 else 0) + + (if (startDate.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -9257,6 +9972,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt index 8a2001ef..efe15f24 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt @@ -10,6 +10,7 @@ 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.ProviderService import java.util.Collections import java.util.Objects @@ -100,6 +101,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt index 881b0e59..47a1f674 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt @@ -10,6 +10,7 @@ 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.ProviderServiceAsync import java.util.Collections import java.util.Objects @@ -105,6 +106,14 @@ private constructor( validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt index 3d87bd25..bbd46d14 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt @@ -577,6 +577,26 @@ private constructor( 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 (method.asKnown().isPresent) 1 else 0) + + (if (route.asKnown().isPresent) 1 else 0) + + (if (data.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt index 4b07f919..5463e984 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt @@ -246,6 +246,25 @@ private constructor( 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 (data.asKnown().isPresent) 1 else 0) + + (request.asKnown().getOrNull()?.validity() ?: 0) + + (if (statusCode.asKnown().isPresent) 1 else 0) + /** * An object containing details of your original forwarded request, for your ease of reference. */ @@ -494,6 +513,26 @@ private constructor( 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 (data.asKnown().isPresent) 1 else 0) + + (if (method.asKnown().isPresent) 1 else 0) + + (if (route.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt index b1147a4a..316771d9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt @@ -976,6 +976,31 @@ private constructor( 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 = + (accounts.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (departments.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } ?: 0) + + (if (ein.asKnown().isPresent) 1 else 0) + + (entity.asKnown().getOrNull()?.validity() ?: 0) + + (if (legalName.asKnown().isPresent) 1 else 0) + + (locations.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } ?: 0) + + (if (primaryEmail.asKnown().isPresent) 1 else 0) + + (if (primaryPhoneNumber.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1301,12 +1326,34 @@ private constructor( accountName() accountNumber() - accountType() + accountType().ifPresent { it.validate() } institutionName() routingNumber() 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 (accountName.asKnown().isPresent) 1 else 0) + + (if (accountNumber.asKnown().isPresent) 1 else 0) + + (accountType.asKnown().getOrNull()?.validity() ?: 0) + + (if (institutionName.asKnown().isPresent) 1 else 0) + + (if (routingNumber.asKnown().isPresent) 1 else 0) + /** The type of bank account. */ class AccountType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1399,6 +1446,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): AccountType = 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 @@ -1574,6 +1648,25 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + + (parent.asKnown().getOrNull()?.validity() ?: 0) + /** The parent department, if present. */ class Parent private constructor( @@ -1687,6 +1780,22 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1863,11 +1972,30 @@ private constructor( return@apply } - subtype() - type() + subtype().ifPresent { it.validate() } + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (subtype.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + /** The tax payer subtype of the company. */ class Subtype @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1965,6 +2093,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Subtype = 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 @@ -2096,6 +2251,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt index 5c93064f..fb6abc67 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt @@ -21,6 +21,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Create a new account for an existing connection (company/provider pair) */ class SandboxConnectionAccountCreateParams @@ -584,11 +585,32 @@ private constructor( companyId() providerId() - authenticationType() + authenticationType().ifPresent { it.validate() } products() 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 (companyId.asKnown().isPresent) 1 else 0) + + (if (providerId.asKnown().isPresent) 1 else 0) + + (authenticationType.asKnown().getOrNull()?.validity() ?: 0) + + (products.asKnown().getOrNull()?.size ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -708,6 +730,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): AuthenticationType = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt index 209ef17f..3dc5df7a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt @@ -17,6 +17,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * Update an existing sandbox account. Change the connection status to understand how the Finch API @@ -338,10 +339,27 @@ private constructor( return@apply } - connectionStatus() + connectionStatus().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (connectionStatus.asKnown().getOrNull()?.validity() ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt index 5860e41a..c120ff39 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt @@ -21,6 +21,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Create a new connection (new company/provider pair) with a new account */ class SandboxConnectionCreateParams @@ -586,12 +587,33 @@ private constructor( } providerId() - authenticationType() + authenticationType().ifPresent { it.validate() } employeeSize() products() 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 (providerId.asKnown().isPresent) 1 else 0) + + (authenticationType.asKnown().getOrNull()?.validity() ?: 0) + + (if (employeeSize.asKnown().isPresent) 1 else 0) + + (products.asKnown().getOrNull()?.size ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -711,6 +733,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): AuthenticationType = 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt index 793f2100..27ea1094 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt @@ -1303,12 +1303,12 @@ private constructor( dob() emails().ifPresent { it.forEach { it.validate() } } employment().ifPresent { it.validate() } - employmentStatus() + employmentStatus().ifPresent { it.validate() } encryptedSsn() endDate() - ethnicity() + ethnicity().ifPresent { it.validate() } firstName() - gender() + gender().ifPresent { it.validate() } income().ifPresent { it.validate() } incomeHistory().ifPresent { it.forEach { it?.validate() } } isActive() @@ -1327,6 +1327,51 @@ private constructor( 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 (classCode.asKnown().isPresent) 1 else 0) + + (customFields.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (department.asKnown().getOrNull()?.validity() ?: 0) + + (if (dob.asKnown().isPresent) 1 else 0) + + (emails.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (employment.asKnown().getOrNull()?.validity() ?: 0) + + (employmentStatus.asKnown().getOrNull()?.validity() ?: 0) + + (if (encryptedSsn.asKnown().isPresent) 1 else 0) + + (if (endDate.asKnown().isPresent) 1 else 0) + + (ethnicity.asKnown().getOrNull()?.validity() ?: 0) + + (if (firstName.asKnown().isPresent) 1 else 0) + + (gender.asKnown().getOrNull()?.validity() ?: 0) + + (income.asKnown().getOrNull()?.validity() ?: 0) + + (incomeHistory.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } + ?: 0) + + (if (isActive.asKnown().isPresent) 1 else 0) + + (if (lastName.asKnown().isPresent) 1 else 0) + + (if (latestRehireDate.asKnown().isPresent) 1 else 0) + + (location.asKnown().getOrNull()?.validity() ?: 0) + + (manager.asKnown().getOrNull()?.validity() ?: 0) + + (if (middleName.asKnown().isPresent) 1 else 0) + + (phoneNumbers.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } ?: 0) + + (if (preferredName.asKnown().isPresent) 1 else 0) + + (residence.asKnown().getOrNull()?.validity() ?: 0) + + (if (sourceId.asKnown().isPresent) 1 else 0) + + (if (ssn.asKnown().isPresent) 1 else 0) + + (if (startDate.asKnown().isPresent) 1 else 0) + + (if (title.asKnown().isPresent) 1 else 0) + class CustomField private constructor( private val name: JsonField, @@ -1445,6 +1490,22 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1576,6 +1637,22 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1728,10 +1805,29 @@ private constructor( } data() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (data.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1822,6 +1918,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2003,11 +2126,30 @@ private constructor( return@apply } - subtype() - type() + subtype().ifPresent { it.validate() } + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (subtype.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, * `intern`, `temp`, `seasonal` and `individual_contractor`. @@ -2127,6 +2269,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Subtype = 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 @@ -2231,6 +2400,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2386,6 +2582,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): EmploymentStatus = 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 @@ -2529,6 +2752,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Ethnicity = 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 @@ -2644,6 +2894,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Gender = 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 @@ -2767,6 +3044,22 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2922,10 +3215,29 @@ private constructor( } data() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (data.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -3016,6 +3328,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt index 23ee8da9..2b150e42 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt @@ -1619,7 +1619,7 @@ private constructor( customFields().ifPresent { it.forEach { it.validate() } } department().ifPresent { it.validate() } employment().ifPresent { it.validate() } - employmentStatus() + employmentStatus().ifPresent { it.validate() } endDate() firstName() income().ifPresent { it.validate() } @@ -1636,6 +1636,42 @@ private constructor( 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 (classCode.asKnown().isPresent) 1 else 0) + + (customFields.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (department.asKnown().getOrNull()?.validity() ?: 0) + + (employment.asKnown().getOrNull()?.validity() ?: 0) + + (employmentStatus.asKnown().getOrNull()?.validity() ?: 0) + + (if (endDate.asKnown().isPresent) 1 else 0) + + (if (firstName.asKnown().isPresent) 1 else 0) + + (income.asKnown().getOrNull()?.validity() ?: 0) + + (incomeHistory.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } + ?: 0) + + (if (isActive.asKnown().isPresent) 1 else 0) + + (if (lastName.asKnown().isPresent) 1 else 0) + + (if (latestRehireDate.asKnown().isPresent) 1 else 0) + + (location.asKnown().getOrNull()?.validity() ?: 0) + + (manager.asKnown().getOrNull()?.validity() ?: 0) + + (if (middleName.asKnown().isPresent) 1 else 0) + + (if (sourceId.asKnown().isPresent) 1 else 0) + + (if (startDate.asKnown().isPresent) 1 else 0) + + (if (title.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1768,6 +1804,22 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1896,6 +1948,22 @@ private constructor( 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 (name.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2058,11 +2126,30 @@ private constructor( return@apply } - subtype() - type() + subtype().ifPresent { it.validate() } + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (subtype.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, * `intern`, `temp`, `seasonal` and `individual_contractor`. @@ -2181,6 +2268,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Subtype = 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 @@ -2282,6 +2396,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2432,6 +2573,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): EmploymentStatus = 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 @@ -2552,6 +2720,22 @@ private constructor( 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 (id.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt index ef523b2d..f68be860 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt @@ -1190,9 +1190,9 @@ private constructor( dob() emails().ifPresent { it.forEach { it.validate() } } encryptedSsn() - ethnicity() + ethnicity().ifPresent { it.validate() } firstName() - gender() + gender().ifPresent { it.validate() } lastName() middleName() phoneNumbers().ifPresent { it.forEach { it?.validate() } } @@ -1202,6 +1202,35 @@ private constructor( 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 (dob.asKnown().isPresent) 1 else 0) + + (emails.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (encryptedSsn.asKnown().isPresent) 1 else 0) + + (ethnicity.asKnown().getOrNull()?.validity() ?: 0) + + (if (firstName.asKnown().isPresent) 1 else 0) + + (gender.asKnown().getOrNull()?.validity() ?: 0) + + (if (lastName.asKnown().isPresent) 1 else 0) + + (if (middleName.asKnown().isPresent) 1 else 0) + + (phoneNumbers.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } ?: 0) + + (if (preferredName.asKnown().isPresent) 1 else 0) + + (residence.asKnown().getOrNull()?.validity() ?: 0) + + (if (ssn.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1351,10 +1380,28 @@ private constructor( } data() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (data.asKnown().isPresent) 1 else 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -1442,6 +1489,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1597,6 +1671,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Ethnicity = 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 @@ -1707,6 +1808,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Gender = 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 @@ -1854,10 +1982,28 @@ private constructor( } data() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (data.asKnown().isPresent) 1 else 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -1945,6 +2091,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt index 64c5787f..db95642a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt @@ -15,6 +15,7 @@ import com.tryfinch.api.core.checkRequired import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects +import kotlin.jvm.optionals.getOrNull class SandboxJobConfiguration private constructor( @@ -171,11 +172,29 @@ private constructor( return@apply } - completionStatus() - type() + completionStatus().validate() + type().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 = + (completionStatus.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + class CompletionStatus @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -276,6 +295,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): CompletionStatus = 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 @@ -367,6 +413,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt index 1c6e5dd1..e5e87f98 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt @@ -18,6 +18,7 @@ import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects +import kotlin.jvm.optionals.getOrNull /** Enqueue a new sandbox job */ class SandboxJobCreateParams @@ -348,10 +349,26 @@ private constructor( return@apply } - type() + type().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 = (type.asKnown().getOrNull()?.validity() ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -448,6 +465,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt index 9817ef9e..5df60293 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt @@ -476,6 +476,26 @@ private constructor( 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 (endDate.asKnown().isPresent) 1 else 0) + + (payStatements.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (startDate.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1044,13 +1064,43 @@ private constructor( grossPay().ifPresent { it.validate() } individualId() netPay().ifPresent { it.validate() } - paymentMethod() + paymentMethod().ifPresent { it.validate() } taxes().ifPresent { it.forEach { it?.validate() } } totalHours() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (earnings.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } ?: 0) + + (employeeDeductions.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } + ?: 0) + + (employerContributions.asKnown().getOrNull()?.sumOf { + (it?.validity() ?: 0).toInt() + } ?: 0) + + (grossPay.asKnown().getOrNull()?.validity() ?: 0) + + (if (individualId.asKnown().isPresent) 1 else 0) + + (netPay.asKnown().getOrNull()?.validity() ?: 0) + + (paymentMethod.asKnown().getOrNull()?.validity() ?: 0) + + (taxes.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } ?: 0) + + (if (totalHours.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + class Earning private constructor( private val amount: JsonField, @@ -1371,10 +1421,33 @@ private constructor( currency() hours() name() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (attributes.asKnown().getOrNull()?.validity() ?: 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (hours.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + class Attributes private constructor( private val metadata: JsonField, @@ -1488,6 +1561,23 @@ private constructor( 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 = (metadata.asKnown().getOrNull()?.validity() ?: 0) + class Metadata private constructor( private val metadata: JsonField, @@ -1613,6 +1703,23 @@ private constructor( 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 = (metadata.asKnown().getOrNull()?.validity() ?: 0) + /** * The metadata to be attached to the entity by existing rules. It is a * key-value pairs where the values can be of any type (string, number, boolean, @@ -1694,6 +1801,26 @@ private constructor( 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 = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1905,6 +2032,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2258,10 +2412,33 @@ private constructor( currency() name() preTax() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (attributes.asKnown().getOrNull()?.validity() ?: 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (preTax.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + class Attributes private constructor( private val metadata: JsonField, @@ -2375,6 +2552,23 @@ private constructor( 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 = (metadata.asKnown().getOrNull()?.validity() ?: 0) + class Metadata private constructor( private val metadata: JsonField, @@ -2500,6 +2694,23 @@ private constructor( 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 = (metadata.asKnown().getOrNull()?.validity() ?: 0) + /** * The metadata to be attached to the entity by existing rules. It is a * key-value pairs where the values can be of any type (string, number, boolean, @@ -2581,6 +2792,26 @@ private constructor( 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 = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2930,10 +3161,32 @@ private constructor( attributes().ifPresent { it.validate() } currency() name() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (attributes.asKnown().getOrNull()?.validity() ?: 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + class Attributes private constructor( private val metadata: JsonField, @@ -3047,6 +3300,23 @@ private constructor( 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 = (metadata.asKnown().getOrNull()?.validity() ?: 0) + class Metadata private constructor( private val metadata: JsonField, @@ -3172,6 +3442,23 @@ private constructor( 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 = (metadata.asKnown().getOrNull()?.validity() ?: 0) + /** * The metadata to be attached to the entity by existing rules. It is a * key-value pairs where the values can be of any type (string, number, boolean, @@ -3253,6 +3540,26 @@ private constructor( 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 = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -3417,6 +3724,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): PaymentMethod = 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 @@ -3750,10 +4084,33 @@ private constructor( currency() employer() name() - type() + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (attributes.asKnown().getOrNull()?.validity() ?: 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (employer.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + class Attributes private constructor( private val metadata: JsonField, @@ -3867,6 +4224,23 @@ private constructor( 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 = (metadata.asKnown().getOrNull()?.validity() ?: 0) + class Metadata private constructor( private val metadata: JsonField, @@ -3992,6 +4366,23 @@ private constructor( 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 = (metadata.asKnown().getOrNull()?.validity() ?: 0) + /** * The metadata to be attached to the entity by existing rules. It is a * key-value pairs where the values can be of any type (string, number, boolean, @@ -4073,6 +4464,26 @@ private constructor( 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 = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4230,6 +4641,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4355,6 +4793,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt index 79a726d4..621f3ceb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt @@ -176,6 +176,24 @@ private constructor( 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 (connectUrl.asKnown().isPresent) 1 else 0) + + (if (sessionId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt index 4d21d31f..f3a6a435 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt @@ -177,6 +177,24 @@ private constructor( 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 (connectUrl.asKnown().isPresent) 1 else 0) + + (if (sessionId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt index 831e93bb..d9ec9ee6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt @@ -14,6 +14,7 @@ import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull class SupportPerBenefitType private constructor( @@ -169,6 +170,24 @@ private constructor( 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 = + (companyBenefits.asKnown().getOrNull()?.validity() ?: 0) + + (individualBenefits.asKnown().getOrNull()?.validity() ?: 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt index 43f2206e..e27d7fe1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt @@ -507,15 +507,42 @@ private constructor( annualMaximum() catchUp() - companyContribution() + companyContribution().ifPresent { it.forEach { it?.validate() } } description() - employeeDeduction() - frequencies() - hsaContributionLimit() - type() + employeeDeduction().ifPresent { it.forEach { it?.validate() } } + frequencies().ifPresent { it.forEach { it?.validate() } } + hsaContributionLimit().ifPresent { it.forEach { it?.validate() } } + type().ifPresent { it.validate() } validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (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) + + (type.asKnown().getOrNull()?.validity() ?: 0) + class CompanyContribution @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -605,6 +632,33 @@ private constructor( 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 @@ -706,6 +760,33 @@ private constructor( 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 @@ -809,6 +890,33 @@ private constructor( 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt index e779fdd9..9c35bffe 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt @@ -186,6 +186,25 @@ private constructor( 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) + + (if (code.asKnown().isPresent) 1 else 0) + + (if (individualId.asKnown().isPresent) 1 else 0) + class Body private constructor( private val finchCode: JsonField, @@ -367,6 +386,26 @@ private constructor( 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 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt index edaba045..4ac16ead 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt @@ -136,6 +136,21 @@ private constructor( 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 (benefitId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt index a1aaa30f..4542936f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt @@ -193,11 +193,30 @@ private constructor( } data().ifPresent { it.validate() } - type() + type().ifPresent { it.validate() } year() 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 = + (data.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (year.asKnown().isPresent) 1 else 0) + /** Detailed information specific to the 2005 W4 form. */ class Data private constructor( @@ -515,13 +534,35 @@ private constructor( } additionalWithholding() - exemption() - filingStatus() + exemption().ifPresent { it.validate() } + filingStatus().ifPresent { it.validate() } individualId() totalNumberOfAllowances() 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 (additionalWithholding.asKnown().isPresent) 1 else 0) + + (exemption.asKnown().getOrNull()?.validity() ?: 0) + + (filingStatus.asKnown().getOrNull()?.validity() ?: 0) + + (if (individualId.asKnown().isPresent) 1 else 0) + + (if (totalNumberOfAllowances.asKnown().isPresent) 1 else 0) + /** Indicates exemption status from federal tax withholding. */ class Exemption @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -614,6 +655,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Exemption = 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 @@ -729,6 +797,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): FilingStatus = 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 @@ -839,6 +934,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt index fb2340c2..e2c50e18 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt @@ -193,11 +193,30 @@ private constructor( } data().ifPresent { it.validate() } - type() + type().ifPresent { it.validate() } year() 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 = + (data.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (year.asKnown().isPresent) 1 else 0) + /** Detailed information specific to the 2020 W4 form. */ class Data private constructor( @@ -706,13 +725,38 @@ private constructor( amountForQualifyingChildrenUnder17() deductions() extraWithholding() - filingStatus() + filingStatus().ifPresent { it.validate() } individualId() otherIncome() totalClaimDependentAndOtherCredits() 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 (amountForOtherDependents.asKnown().isPresent) 1 else 0) + + (if (amountForQualifyingChildrenUnder17.asKnown().isPresent) 1 else 0) + + (if (deductions.asKnown().isPresent) 1 else 0) + + (if (extraWithholding.asKnown().isPresent) 1 else 0) + + (filingStatus.asKnown().getOrNull()?.validity() ?: 0) + + (if (individualId.asKnown().isPresent) 1 else 0) + + (if (otherIncome.asKnown().isPresent) 1 else 0) + + (if (totalClaimDependentAndOtherCredits.asKnown().isPresent) 1 else 0) + /** The individual's filing status for tax purposes. */ class FilingStatus @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -816,6 +860,33 @@ private constructor( FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): FilingStatus = 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 @@ -926,6 +997,33 @@ private constructor( fun asString(): String = _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/WebhookEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/WebhookEvent.kt index 15918c73..43d8873e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/WebhookEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/WebhookEvent.kt @@ -12,6 +12,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.tryfinch.api.core.BaseDeserializer import com.tryfinch.api.core.BaseSerializer import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.allMaxBy import com.tryfinch.api.core.getOrThrow import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @@ -82,8 +83,8 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) - fun accept(visitor: Visitor): T { - return when { + fun accept(visitor: Visitor): T = + when { accountUpdated != null -> visitor.visitAccountUpdated(accountUpdated) jobCompletion != null -> visitor.visitJobCompletion(jobCompletion) companyUpdated != null -> visitor.visitCompanyUpdated(companyUpdated) @@ -94,7 +95,6 @@ private constructor( payStatement != null -> visitor.visitPayStatement(payStatement) else -> visitor.unknown(_json) } - } private var validated: Boolean = false @@ -141,6 +141,47 @@ private constructor( 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 = + accept( + object : Visitor { + override fun visitAccountUpdated(accountUpdated: AccountUpdateEvent) = + accountUpdated.validity() + + override fun visitJobCompletion(jobCompletion: JobCompletionEvent) = + jobCompletion.validity() + + override fun visitCompanyUpdated(companyUpdated: CompanyEvent) = + companyUpdated.validity() + + override fun visitDirectory(directory: DirectoryEvent) = directory.validity() + + override fun visitEmployment(employment: EmploymentEvent) = employment.validity() + + override fun visitIndividual(individual: IndividualEvent) = individual.validity() + + override fun visitPayment(payment: PaymentEvent) = payment.validity() + + override fun visitPayStatement(payStatement: PayStatementEvent) = + payStatement.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -234,40 +275,45 @@ private constructor( override fun ObjectCodec.deserialize(node: JsonNode): WebhookEvent { val json = JsonValue.fromJsonNode(node) - tryDeserialize(node, jacksonTypeRef()) { it.validate() } - ?.let { - return WebhookEvent(accountUpdated = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef()) { it.validate() } - ?.let { - return WebhookEvent(jobCompletion = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef()) { it.validate() } - ?.let { - return WebhookEvent(companyUpdated = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef()) { it.validate() } - ?.let { - return WebhookEvent(directory = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef()) { it.validate() } - ?.let { - return WebhookEvent(employment = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef()) { it.validate() } - ?.let { - return WebhookEvent(individual = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef()) { it.validate() } - ?.let { - return WebhookEvent(payment = it, _json = json) - } - tryDeserialize(node, jacksonTypeRef()) { it.validate() } - ?.let { - return WebhookEvent(payStatement = it, _json = json) - } - - return WebhookEvent(_json = json) + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef())?.let { + WebhookEvent(accountUpdated = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + WebhookEvent(jobCompletion = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + WebhookEvent(companyUpdated = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + WebhookEvent(directory = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + WebhookEvent(employment = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + WebhookEvent(individual = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + WebhookEvent(payment = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + WebhookEvent(payStatement = it, _json = json) + }, + ) + .filterNotNull() + .allMaxBy { it.validity() } + .toList() + return when (bestMatches.size) { + // This can happen if what we're deserializing is completely incompatible with all + // the possible variants (e.g. deserializing from boolean). + 0 -> WebhookEvent(_json = json) + 1 -> bestMatches.single() + // If there's more than one match with the highest validity, then use the first + // completely valid match, or simply the first match if none are completely valid. + else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() + } } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountCreateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountCreateResponseTest.kt index 17d495cc..5e31fef1 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountCreateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountCreateResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -33,4 +35,27 @@ internal class AccountCreateResponseTest { assertThat(accountCreateResponse.products()).containsExactly("string") assertThat(accountCreateResponse.providerId()).isEqualTo("provider_id") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val accountCreateResponse = + AccountCreateResponse.builder() + .accessToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .authenticationType(AccountCreateResponse.AuthenticationType.CREDENTIAL) + .companyId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .connectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addProduct("string") + .providerId("provider_id") + .build() + + val roundtrippedAccountCreateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(accountCreateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedAccountCreateResponse).isEqualTo(accountCreateResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateEventTest.kt index a9cf94ff..6f34f4e4 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateEventTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateEventTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -1959,4 +1961,1016 @@ internal class AccountUpdateEventTest { assertThat(accountUpdateEvent.eventType()) .contains(AccountUpdateEvent.EventType.ACCOUNT_UPDATED) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val accountUpdateEvent = + AccountUpdateEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data( + AccountUpdateEvent.Data.builder() + .authenticationMethod( + AccountUpdateEvent.Data.AuthenticationMethod.builder() + .benefitsSupport( + BenefitsSupport.builder() + .commuter( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .customPostTax( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .customPreTax( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .fsaDependentCare( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .fsaMedical( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .hsaPost( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .hsaPre( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .s125Dental( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .s125Medical( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .s125Vision( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .simple( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .simpleIra( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .build() + ) + .supportedFields( + AccountUpdateEvent.Data.AuthenticationMethod.SupportedFields + .builder() + .company( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .builder() + .id(true) + .accounts( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Accounts + .builder() + .accountName(true) + .accountNumber(true) + .accountType(true) + .institutionName(true) + .routingNumber(true) + .build() + ) + .departments( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Departments + .builder() + .name(true) + .parent( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Departments + .Parent + .builder() + .name(true) + .build() + ) + .build() + ) + .ein(true) + .entity( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Entity + .builder() + .subtype(true) + .type(true) + .build() + ) + .legalName(true) + .locations( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Locations + .builder() + .city(true) + .country(true) + .line1(true) + .line2(true) + .postalCode(true) + .state(true) + .build() + ) + .primaryEmail(true) + .primaryPhoneNumber(true) + .build() + ) + .directory( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedDirectoryFields + .builder() + .individuals( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedDirectoryFields + .Individuals + .builder() + .id(true) + .department(true) + .firstName(true) + .isActive(true) + .lastName(true) + .manager( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedDirectoryFields + .Individuals + .Manager + .builder() + .id(true) + .build() + ) + .middleName(true) + .build() + ) + .paging( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedDirectoryFields + .Paging + .builder() + .count(true) + .offset(true) + .build() + ) + .build() + ) + .employment( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .builder() + .id(true) + .classCode(true) + .customFields(true) + .department( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Department + .builder() + .name(true) + .build() + ) + .employment( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Employment + .builder() + .subtype(true) + .type(true) + .build() + ) + .employmentStatus(true) + .endDate(true) + .firstName(true) + .income( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Income + .builder() + .amount(true) + .currency(true) + .unit(true) + .build() + ) + .incomeHistory(true) + .isActive(true) + .lastName(true) + .location( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Location + .builder() + .city(true) + .country(true) + .line1(true) + .line2(true) + .postalCode(true) + .state(true) + .build() + ) + .manager( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Manager + .builder() + .id(true) + .build() + ) + .middleName(true) + .startDate(true) + .title(true) + .build() + ) + .individual( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedIndividualFields + .builder() + .id(true) + .dob(true) + .emails( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedIndividualFields + .Emails + .builder() + .data(true) + .type(true) + .build() + ) + .encryptedSsn(true) + .ethnicity(true) + .firstName(true) + .gender(true) + .lastName(true) + .middleName(true) + .phoneNumbers( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedIndividualFields + .PhoneNumbers + .builder() + .data(true) + .type(true) + .build() + ) + .preferredName(true) + .residence( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedIndividualFields + .Residence + .builder() + .city(true) + .country(true) + .line1(true) + .line2(true) + .postalCode(true) + .state(true) + .build() + ) + .ssn(true) + .build() + ) + .payGroup( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayGroupFields + .builder() + .id(true) + .individualIds(true) + .name(true) + .payFrequencies(true) + .build() + ) + .payStatement( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .builder() + .paging( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .Paging + .builder() + .count(true) + .offset(true) + .build() + ) + .payStatements( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .builder() + .earnings( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .Earnings + .builder() + .amount(true) + .currency(true) + .name(true) + .type(true) + .build() + ) + .employeeDeductions( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .EmployeeDeductions + .builder() + .amount(true) + .currency(true) + .name(true) + .preTax(true) + .type(true) + .build() + ) + .employerContributions( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .EmployerContributions + .builder() + .amount(true) + .currency(true) + .name(true) + .build() + ) + .grossPay(true) + .individualId(true) + .netPay(true) + .paymentMethod(true) + .taxes( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .Taxes + .builder() + .amount(true) + .currency(true) + .employer(true) + .name(true) + .type(true) + .build() + ) + .totalHours(true) + .type(true) + .build() + ) + .build() + ) + .payment( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPaymentFields + .builder() + .id(true) + .companyDebit(true) + .debitDate(true) + .employeeTaxes(true) + .employerTaxes(true) + .grossPay(true) + .individualIds(true) + .netPay(true) + .payDate(true) + .payFrequencies(true) + .payGroupIds(true) + .payPeriod( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPaymentFields + .PayPeriod + .builder() + .endDate(true) + .startDate(true) + .build() + ) + .build() + ) + .build() + ) + .type(AccountUpdateEvent.Data.AuthenticationMethod.Type.ASSISTED) + .build() + ) + .status(ConnectionStatusType.PENDING) + .build() + ) + .eventType(AccountUpdateEvent.EventType.ACCOUNT_UPDATED) + .build() + + val roundtrippedAccountUpdateEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(accountUpdateEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedAccountUpdateEvent).isEqualTo(accountUpdateEvent) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateResponseTest.kt index 5c995ef4..20af0d97 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -30,4 +32,26 @@ internal class AccountUpdateResponseTest { assertThat(accountUpdateResponse.connectionId()) .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val accountUpdateResponse = + AccountUpdateResponse.builder() + .accountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .authenticationType(AccountUpdateResponse.AuthenticationType.CREDENTIAL) + .companyId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addProduct("string") + .providerId("provider_id") + .connectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val roundtrippedAccountUpdateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(accountUpdateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedAccountUpdateResponse).isEqualTo(accountUpdateResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedAsyncJobTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedAsyncJobTest.kt index 938789c2..14fbbfeb 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedAsyncJobTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedAsyncJobTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -38,4 +40,29 @@ internal class AutomatedAsyncJobTest { assertThat(automatedAsyncJob.status()).isEqualTo(AutomatedAsyncJob.Status.PENDING) assertThat(automatedAsyncJob.type()).isEqualTo(AutomatedAsyncJob.Type.DATA_SYNC_ALL) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val automatedAsyncJob = + AutomatedAsyncJob.builder() + .completedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .jobId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .jobUrl("job_url") + .params(AutomatedAsyncJob.Params.builder().individualId("individual_id").build()) + .scheduledAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .startedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .status(AutomatedAsyncJob.Status.PENDING) + .type(AutomatedAsyncJob.Type.DATA_SYNC_ALL) + .build() + + val roundtrippedAutomatedAsyncJob = + jsonMapper.readValue( + jsonMapper.writeValueAsString(automatedAsyncJob), + jacksonTypeRef(), + ) + + assertThat(roundtrippedAutomatedAsyncJob).isEqualTo(automatedAsyncJob) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedCreateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedCreateResponseTest.kt index 9a4d92e7..28a4fc41 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedCreateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedCreateResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -23,4 +25,24 @@ internal class AutomatedCreateResponseTest { assertThat(automatedCreateResponse.jobUrl()).isEqualTo("job_url") assertThat(automatedCreateResponse.remainingRefreshes()).isEqualTo(0L) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val automatedCreateResponse = + AutomatedCreateResponse.builder() + .allowedRefreshes(0L) + .jobId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .jobUrl("job_url") + .remainingRefreshes(0L) + .build() + + val roundtrippedAutomatedCreateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(automatedCreateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedAutomatedCreateResponse).isEqualTo(automatedCreateResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedListResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedListResponseTest.kt index 373b7885..81a732eb 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedListResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AutomatedListResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -75,4 +77,49 @@ internal class AutomatedListResponseTest { .build() ) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val automatedListResponse = + AutomatedListResponse.builder() + .addData( + AutomatedAsyncJob.builder() + .completedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .jobId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .jobUrl("job_url") + .params( + AutomatedAsyncJob.Params.builder().individualId("individual_id").build() + ) + .scheduledAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .startedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .status(AutomatedAsyncJob.Status.PENDING) + .type(AutomatedAsyncJob.Type.DATA_SYNC_ALL) + .build() + ) + .meta( + AutomatedListResponse.Meta.builder() + .quotas( + AutomatedListResponse.Meta.Quotas.builder() + .dataSyncAll( + AutomatedListResponse.Meta.Quotas.DataSyncAll.builder() + .allowedRefreshes(0L) + .remainingRefreshes(0L) + .build() + ) + .build() + ) + .build() + ) + .build() + + val roundtrippedAutomatedListResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(automatedListResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedAutomatedListResponse).isEqualTo(automatedListResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BaseWebhookEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BaseWebhookEventTest.kt index 6fca4419..1c0999b9 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BaseWebhookEventTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BaseWebhookEventTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -20,4 +22,23 @@ internal class BaseWebhookEventTest { assertThat(baseWebhookEvent.companyId()).isEqualTo("company_id") assertThat(baseWebhookEvent.connectionId()).contains("connection_id") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val baseWebhookEvent = + BaseWebhookEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .build() + + val roundtrippedBaseWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(baseWebhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBaseWebhookEvent).isEqualTo(baseWebhookEvent) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitContributionTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitContributionTest.kt index 750d9524..7ffc1e7e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitContributionTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitContributionTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -15,4 +17,19 @@ internal class BenefitContributionTest { assertThat(benefitContribution.amount()).contains(0L) assertThat(benefitContribution.type()).contains(BenefitContribution.Type.FIXED) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val benefitContribution = + BenefitContribution.builder().amount(0L).type(BenefitContribution.Type.FIXED).build() + + val roundtrippedBenefitContribution = + jsonMapper.readValue( + jsonMapper.writeValueAsString(benefitContribution), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBenefitContribution).isEqualTo(benefitContribution) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperationsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperationsTest.kt index ed103e7f..8849aba2 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperationsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperationsTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -91,4 +93,58 @@ internal class BenefitFeaturesAndOperationsTest { .build() ) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val benefitFeaturesAndOperations = + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature.CompanyContribution.FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature.EmployeeDeduction.FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature.HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + + val roundtrippedBenefitFeaturesAndOperations = + jsonMapper.readValue( + jsonMapper.writeValueAsString(benefitFeaturesAndOperations), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBenefitFeaturesAndOperations).isEqualTo(benefitFeaturesAndOperations) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitsSupportTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitsSupportTest.kt index 971be921..6490d096 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitsSupportTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/BenefitsSupportTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -1070,4 +1072,548 @@ internal class BenefitsSupportTest { .build() ) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val benefitsSupport = + BenefitsSupport.builder() + .commuter( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature.CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature.EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature.HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .customPostTax( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature.CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature.EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature.HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .customPreTax( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature.CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature.EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature.HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .fsaDependentCare( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature.CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature.EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature.HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .fsaMedical( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature.CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature.EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature.HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .hsaPost( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature.CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature.EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature.HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .hsaPre( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature.CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature.EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature.HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .s125Dental( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature.CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature.EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature.HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .s125Medical( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature.CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature.EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature.HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .s125Vision( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature.CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature.EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature.HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .simple( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature.CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature.EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature.HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .simpleIra( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature.CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature.EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature.HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .build() + + val roundtrippedBenefitsSupport = + jsonMapper.readValue( + jsonMapper.writeValueAsString(benefitsSupport), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBenefitsSupport).isEqualTo(benefitsSupport) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyBenefitTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyBenefitTest.kt index 5f0b3f8a..5f682053 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyBenefitTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyBenefitTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -22,4 +24,24 @@ internal class CompanyBenefitTest { assertThat(companyBenefit.frequency()).contains(BenefitFrequency.ONE_TIME) assertThat(companyBenefit.type()).contains(BenefitType._401K) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val companyBenefit = + CompanyBenefit.builder() + .benefitId("benefit_id") + .description("description") + .frequency(BenefitFrequency.ONE_TIME) + .type(BenefitType._401K) + .build() + + val roundtrippedCompanyBenefit = + jsonMapper.readValue( + jsonMapper.writeValueAsString(companyBenefit), + jacksonTypeRef(), + ) + + assertThat(roundtrippedCompanyBenefit).isEqualTo(companyBenefit) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyEventTest.kt index 8ce177bd..91f000b6 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyEventTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyEventTest.kt @@ -2,7 +2,9 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -34,4 +36,29 @@ internal class CompanyEventTest { ) assertThat(companyEvent.eventType()).contains(CompanyEvent.EventType.COMPANY_UPDATED) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val companyEvent = + CompanyEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data( + CompanyEvent.Data.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .eventType(CompanyEvent.EventType.COMPANY_UPDATED) + .build() + + val roundtrippedCompanyEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(companyEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedCompanyEvent).isEqualTo(companyEvent) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt index 49ca5786..ec22941d 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -95,4 +97,55 @@ internal class CompanyTest { assertThat(company.primaryEmail()).contains("dev@stainless.com") assertThat(company.primaryPhoneNumber()).contains("primary_phone_number") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val company = + Company.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addAccount( + Company.Account.builder() + .accountName("account_name") + .accountNumber("account_number") + .accountType(Company.Account.AccountType.CHECKING) + .institutionName("institution_name") + .routingNumber("routing_number") + .build() + ) + .addDepartment( + Company.Department.builder() + .name("name") + .parent(Company.Department.Parent.builder().name("name").build()) + .build() + ) + .ein("ein") + .entity( + Company.Entity.builder() + .subtype(Company.Entity.Subtype.S_CORPORATION) + .type(Company.Entity.Type.LLC) + .build() + ) + .legalName("legal_name") + .addLocation( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + ) + .primaryEmail("dev@stainless.com") + .primaryPhoneNumber("primary_phone_number") + .build() + + val roundtrippedCompany = + jsonMapper.readValue(jsonMapper.writeValueAsString(company), jacksonTypeRef()) + + assertThat(roundtrippedCompany).isEqualTo(company) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt index 3956a3d5..40d8cb6b 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -95,4 +97,59 @@ internal class CompanyUpdateResponseTest { assertThat(companyUpdateResponse.primaryEmail()).contains("dev@stainless.com") assertThat(companyUpdateResponse.primaryPhoneNumber()).contains("primary_phone_number") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val companyUpdateResponse = + CompanyUpdateResponse.builder() + .addAccount( + CompanyUpdateResponse.Account.builder() + .accountName("account_name") + .accountNumber("account_number") + .accountType(CompanyUpdateResponse.Account.AccountType.CHECKING) + .institutionName("institution_name") + .routingNumber("routing_number") + .build() + ) + .addDepartment( + CompanyUpdateResponse.Department.builder() + .name("name") + .parent( + CompanyUpdateResponse.Department.Parent.builder().name("name").build() + ) + .build() + ) + .ein("ein") + .entity( + CompanyUpdateResponse.Entity.builder() + .subtype(CompanyUpdateResponse.Entity.Subtype.S_CORPORATION) + .type(CompanyUpdateResponse.Entity.Type.LLC) + .build() + ) + .legalName("legal_name") + .addLocation( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + ) + .primaryEmail("dev@stainless.com") + .primaryPhoneNumber("primary_phone_number") + .build() + + val roundtrippedCompanyUpdateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(companyUpdateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedCompanyUpdateResponse).isEqualTo(companyUpdateResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectionCreateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectionCreateResponseTest.kt index 08ad6fa6..1a3b4808 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectionCreateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectionCreateResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -36,4 +38,28 @@ internal class ConnectionCreateResponseTest { .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(connectionCreateResponse.tokenType()).contains("token_type") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val connectionCreateResponse = + ConnectionCreateResponse.builder() + .accessToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .authenticationType(ConnectionCreateResponse.AuthenticationType.CREDENTIAL) + .companyId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .connectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addProduct("string") + .providerId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .tokenType("token_type") + .build() + + val roundtrippedConnectionCreateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(connectionCreateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedConnectionCreateResponse).isEqualTo(connectionCreateResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateAccessTokenResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateAccessTokenResponseTest.kt index ef1a0e1f..70c06a3b 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateAccessTokenResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateAccessTokenResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -36,4 +38,30 @@ internal class CreateAccessTokenResponseTest { assertThat(createAccessTokenResponse.customerId()).contains("customer_id") assertThat(createAccessTokenResponse.tokenType()).contains("token_type") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val createAccessTokenResponse = + CreateAccessTokenResponse.builder() + .accessToken("access_token") + .accountId("account_id") + .clientType(CreateAccessTokenResponse.ClientType.PRODUCTION) + .companyId("company_id") + .connectionId("connection_id") + .connectionType(CreateAccessTokenResponse.ConnectionType.PROVIDER) + .addProduct("string") + .providerId("provider_id") + .customerId("customer_id") + .tokenType("token_type") + .build() + + val roundtrippedCreateAccessTokenResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(createAccessTokenResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedCreateAccessTokenResponse).isEqualTo(createAccessTokenResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponseTest.kt index e6c41cd2..8cb64499 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -14,4 +16,20 @@ internal class CreateCompanyBenefitsResponseTest { assertThat(createCompanyBenefitsResponse.benefitId()).isEqualTo("benefit_id") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val createCompanyBenefitsResponse = + CreateCompanyBenefitsResponse.builder().benefitId("benefit_id").build() + + val roundtrippedCreateCompanyBenefitsResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(createCompanyBenefitsResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedCreateCompanyBenefitsResponse) + .isEqualTo(createCompanyBenefitsResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DirectoryCreateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DirectoryCreateResponseTest.kt index ca37c602..5fb1523b 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DirectoryCreateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DirectoryCreateResponseTest.kt @@ -2,6 +2,9 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper +import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test internal class DirectoryCreateResponseTest { @@ -10,4 +13,18 @@ internal class DirectoryCreateResponseTest { fun create() { val directoryCreateResponse = DirectoryCreateResponse.builder().build() } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val directoryCreateResponse = DirectoryCreateResponse.builder().build() + + val roundtrippedDirectoryCreateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(directoryCreateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedDirectoryCreateResponse).isEqualTo(directoryCreateResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DirectoryEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DirectoryEventTest.kt index 6ef9f998..37a917e1 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DirectoryEventTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DirectoryEventTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -25,4 +27,25 @@ internal class DirectoryEventTest { .contains(DirectoryEvent.Data.builder().individualId("individual_id").build()) assertThat(directoryEvent.eventType()).contains(DirectoryEvent.EventType.DIRECTORY_CREATED) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val directoryEvent = + DirectoryEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data(DirectoryEvent.Data.builder().individualId("individual_id").build()) + .eventType(DirectoryEvent.EventType.DIRECTORY_CREATED) + .build() + + val roundtrippedDirectoryEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(directoryEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedDirectoryEvent).isEqualTo(directoryEvent) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DisconnectResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DisconnectResponseTest.kt index 5b3f5b72..9975aadb 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DisconnectResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DisconnectResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -13,4 +15,18 @@ internal class DisconnectResponseTest { assertThat(disconnectResponse.status()).isEqualTo("status") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val disconnectResponse = DisconnectResponse.builder().status("status").build() + + val roundtrippedDisconnectResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(disconnectResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedDisconnectResponse).isEqualTo(disconnectResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentListResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentListResponseTest.kt index adbb5048..a92d7839 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentListResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentListResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -36,4 +38,30 @@ internal class DocumentListResponseTest { assertThat(documentListResponse.paging()) .isEqualTo(Paging.builder().count(0L).offset(0L).build()) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val documentListResponse = + DocumentListResponse.builder() + .addDocument( + DocumentResponse.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .individualId("individual_id") + .type(DocumentResponse.Type.W4_2020) + .url("https://example.com") + .year(0.0) + .build() + ) + .paging(Paging.builder().count(0L).offset(0L).build()) + .build() + + val roundtrippedDocumentListResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(documentListResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedDocumentListResponse).isEqualTo(documentListResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentResponseTest.kt index f2221be1..b44bd5da 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -24,4 +26,25 @@ internal class DocumentResponseTest { assertThat(documentResponse.url()).contains("https://example.com") assertThat(documentResponse.year()).contains(0.0) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val documentResponse = + DocumentResponse.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .individualId("individual_id") + .type(DocumentResponse.Type.W4_2020) + .url("https://example.com") + .year(0.0) + .build() + + val roundtrippedDocumentResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(documentResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedDocumentResponse).isEqualTo(documentResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentRetreiveResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentRetreiveResponseTest.kt index d7f8e755..acfd9553 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentRetreiveResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentRetreiveResponseTest.kt @@ -2,14 +2,37 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.jsonMapper +import com.tryfinch.api.errors.FinchInvalidDataException import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.EnumSource internal class DocumentRetreiveResponseTest { @Test fun ofW42020() { - val w42020 = W42020.builder().build() + val w42020 = + W42020.builder() + .data( + W42020.Data.builder() + .amountForOtherDependents(0L) + .amountForQualifyingChildrenUnder17(0L) + .deductions(0L) + .extraWithholding(0L) + .filingStatus(W42020.Data.FilingStatus.HEAD_OF_HOUSEHOLD) + .individualId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .otherIncome(0L) + .totalClaimDependentAndOtherCredits(0L) + .build() + ) + .type(W42020.Type.W4_2020) + .year(0.0) + .build() val documentRetreiveResponse = DocumentRetreiveResponse.ofW42020(w42020) @@ -17,13 +40,105 @@ internal class DocumentRetreiveResponseTest { assertThat(documentRetreiveResponse.w42005()).isEmpty } + @Test + fun ofW42020Roundtrip() { + val jsonMapper = jsonMapper() + val documentRetreiveResponse = + DocumentRetreiveResponse.ofW42020( + W42020.builder() + .data( + W42020.Data.builder() + .amountForOtherDependents(0L) + .amountForQualifyingChildrenUnder17(0L) + .deductions(0L) + .extraWithholding(0L) + .filingStatus(W42020.Data.FilingStatus.HEAD_OF_HOUSEHOLD) + .individualId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .otherIncome(0L) + .totalClaimDependentAndOtherCredits(0L) + .build() + ) + .type(W42020.Type.W4_2020) + .year(0.0) + .build() + ) + + val roundtrippedDocumentRetreiveResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(documentRetreiveResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedDocumentRetreiveResponse).isEqualTo(documentRetreiveResponse) + } + @Test fun ofW42005() { - val w42005 = W42005.builder().build() + val w42005 = + W42005.builder() + .data( + W42005.Data.builder() + .additionalWithholding(0L) + .exemption(W42005.Data.Exemption.EXEMPT) + .filingStatus(W42005.Data.FilingStatus.MARRIED) + .individualId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .totalNumberOfAllowances(0L) + .build() + ) + .type(W42005.Type.W4_2005) + .year(0.0) + .build() val documentRetreiveResponse = DocumentRetreiveResponse.ofW42005(w42005) assertThat(documentRetreiveResponse.w42020()).isEmpty assertThat(documentRetreiveResponse.w42005()).contains(w42005) } + + @Test + fun ofW42005Roundtrip() { + val jsonMapper = jsonMapper() + val documentRetreiveResponse = + DocumentRetreiveResponse.ofW42005( + W42005.builder() + .data( + W42005.Data.builder() + .additionalWithholding(0L) + .exemption(W42005.Data.Exemption.EXEMPT) + .filingStatus(W42005.Data.FilingStatus.MARRIED) + .individualId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .totalNumberOfAllowances(0L) + .build() + ) + .type(W42005.Type.W4_2005) + .year(0.0) + .build() + ) + + val roundtrippedDocumentRetreiveResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(documentRetreiveResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedDocumentRetreiveResponse).isEqualTo(documentRetreiveResponse) + } + + enum class IncompatibleJsonShapeTestCase(val value: JsonValue) { + BOOLEAN(JsonValue.from(false)), + STRING(JsonValue.from("invalid")), + INTEGER(JsonValue.from(-1)), + FLOAT(JsonValue.from(3.14)), + ARRAY(JsonValue.from(listOf("invalid", "array"))), + } + + @ParameterizedTest + @EnumSource + fun incompatibleJsonShapeDeserializesToUnknown(testCase: IncompatibleJsonShapeTestCase) { + val documentRetreiveResponse = + jsonMapper().convertValue(testCase.value, jacksonTypeRef()) + + val e = assertThrows { documentRetreiveResponse.validate() } + assertThat(e).hasMessageStartingWith("Unknown ") + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataResponseTest.kt index 72d48fd7..eb681174 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataResponseTest.kt @@ -2,7 +2,9 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -147,4 +149,85 @@ internal class EmploymentDataResponseTest { assertThat(employmentDataResponse.individualId()) .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val employmentDataResponse = + EmploymentDataResponse.builder() + .body( + EmploymentData.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .classCode("class_code") + .addCustomField( + EmploymentData.CustomField.builder() + .name("name") + .value(JsonValue.from(mapOf())) + .build() + ) + .department(EmploymentData.Department.builder().name("name").build()) + .employment( + EmploymentData.Employment.builder() + .subtype(EmploymentData.Employment.Subtype.FULL_TIME) + .type(EmploymentData.Employment.Type.EMPLOYEE) + .build() + ) + .employmentStatus(EmploymentData.EmploymentStatus.ACTIVE) + .endDate("end_date") + .firstName("first_name") + .income( + Income.builder() + .amount(0L) + .currency("currency") + .effectiveDate("effective_date") + .unit(Income.Unit.YEARLY) + .build() + ) + .addIncomeHistory( + Income.builder() + .amount(0L) + .currency("currency") + .effectiveDate("effective_date") + .unit(Income.Unit.YEARLY) + .build() + ) + .isActive(true) + .lastName("last_name") + .latestRehireDate("latest_rehire_date") + .location( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + ) + .manager( + EmploymentData.Manager.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + .middleName("middle_name") + .sourceId("source_id") + .startDate("start_date") + .title("title") + .workId("work_id") + .build() + ) + .code(0L) + .individualId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val roundtrippedEmploymentDataResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(employmentDataResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedEmploymentDataResponse).isEqualTo(employmentDataResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt index 09ffd8a8..1cd072e8 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentDataTest.kt @@ -2,7 +2,9 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.jsonMapper import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -140,4 +142,79 @@ internal class EmploymentDataTest { assertThat(employmentData.title()).contains("title") assertThat(employmentData.workId()).contains("work_id") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val employmentData = + EmploymentData.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .classCode("class_code") + .addCustomField( + EmploymentData.CustomField.builder() + .name("name") + .value(JsonValue.from(mapOf())) + .build() + ) + .department(EmploymentData.Department.builder().name("name").build()) + .employment( + EmploymentData.Employment.builder() + .subtype(EmploymentData.Employment.Subtype.FULL_TIME) + .type(EmploymentData.Employment.Type.EMPLOYEE) + .build() + ) + .employmentStatus(EmploymentData.EmploymentStatus.ACTIVE) + .endDate("end_date") + .firstName("first_name") + .income( + Income.builder() + .amount(0L) + .currency("currency") + .effectiveDate("effective_date") + .unit(Income.Unit.YEARLY) + .build() + ) + .addIncomeHistory( + Income.builder() + .amount(0L) + .currency("currency") + .effectiveDate("effective_date") + .unit(Income.Unit.YEARLY) + .build() + ) + .isActive(true) + .lastName("last_name") + .latestRehireDate("latest_rehire_date") + .location( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + ) + .manager( + EmploymentData.Manager.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + .middleName("middle_name") + .sourceId("source_id") + .startDate("start_date") + .title("title") + .workId("work_id") + .build() + + val roundtrippedEmploymentData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(employmentData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedEmploymentData).isEqualTo(employmentData) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentEventTest.kt index 26201cbe..30a66f97 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentEventTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentEventTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -26,4 +28,25 @@ internal class EmploymentEventTest { assertThat(employmentEvent.eventType()) .contains(EmploymentEvent.EventType.EMPLOYMENT_CREATED) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val employmentEvent = + EmploymentEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data(EmploymentEvent.Data.builder().individualId("individual_id").build()) + .eventType(EmploymentEvent.EventType.EMPLOYMENT_CREATED) + .build() + + val roundtrippedEmploymentEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(employmentEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedEmploymentEvent).isEqualTo(employmentEvent) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt index 8ac4990e..36d22b27 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt @@ -2,7 +2,9 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.jsonMapper import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -140,4 +142,78 @@ internal class EmploymentUpdateResponseTest { assertThat(employmentUpdateResponse.startDate()).contains("start_date") assertThat(employmentUpdateResponse.title()).contains("title") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val employmentUpdateResponse = + EmploymentUpdateResponse.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .classCode("class_code") + .addCustomField( + EmploymentUpdateResponse.CustomField.builder() + .name("name") + .value(JsonValue.from(mapOf())) + .build() + ) + .department(EmploymentUpdateResponse.Department.builder().name("name").build()) + .employment( + EmploymentUpdateResponse.Employment.builder() + .subtype(EmploymentUpdateResponse.Employment.Subtype.FULL_TIME) + .type(EmploymentUpdateResponse.Employment.Type.EMPLOYEE) + .build() + ) + .employmentStatus(EmploymentUpdateResponse.EmploymentStatus.ACTIVE) + .endDate("end_date") + .firstName("first_name") + .income( + Income.builder() + .amount(0L) + .currency("currency") + .effectiveDate("effective_date") + .unit(Income.Unit.YEARLY) + .build() + ) + .addIncomeHistory( + Income.builder() + .amount(0L) + .currency("currency") + .effectiveDate("effective_date") + .unit(Income.Unit.YEARLY) + .build() + ) + .isActive(true) + .lastName("last_name") + .latestRehireDate("latest_rehire_date") + .location( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + ) + .manager( + EmploymentUpdateResponse.Manager.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + .middleName("middle_name") + .sourceId("source_id") + .startDate("start_date") + .title("title") + .build() + + val roundtrippedEmploymentUpdateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(employmentUpdateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedEmploymentUpdateResponse).isEqualTo(employmentUpdateResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EnrolledIndividualTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EnrolledIndividualTest.kt index 3fb9235f..73c9547e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EnrolledIndividualTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EnrolledIndividualTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -33,4 +35,29 @@ internal class EnrolledIndividualTest { assertThat(enrolledIndividual.code()).contains(EnrolledIndividual.Code.OK) assertThat(enrolledIndividual.individualId()).contains("individual_id") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val enrolledIndividual = + EnrolledIndividual.builder() + .body( + EnrolledIndividual.Body.builder() + .finchCode("finch_code") + .message("message") + .name("name") + .build() + ) + .code(EnrolledIndividual.Code.OK) + .individualId("individual_id") + .build() + + val roundtrippedEnrolledIndividual = + jsonMapper.readValue( + jsonMapper.writeValueAsString(enrolledIndividual), + jacksonTypeRef(), + ) + + assertThat(roundtrippedEnrolledIndividual).isEqualTo(enrolledIndividual) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IncomeTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IncomeTest.kt index b6e3ef05..f50c94ec 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IncomeTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IncomeTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -22,4 +24,21 @@ internal class IncomeTest { assertThat(income.effectiveDate()).contains("effective_date") assertThat(income.unit()).contains(Income.Unit.YEARLY) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val income = + Income.builder() + .amount(0L) + .currency("currency") + .effectiveDate("effective_date") + .unit(Income.Unit.YEARLY) + .build() + + val roundtrippedIncome = + jsonMapper.readValue(jsonMapper.writeValueAsString(income), jacksonTypeRef()) + + assertThat(roundtrippedIncome).isEqualTo(income) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualBenefitTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualBenefitTest.kt index 1f503b39..3b912383 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualBenefitTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualBenefitTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -59,4 +61,43 @@ internal class IndividualBenefitTest { assertThat(individualBenefit.code()).contains(0L) assertThat(individualBenefit.individualId()).contains("individual_id") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val individualBenefit = + IndividualBenefit.builder() + .body( + IndividualBenefit.Body.builder() + .annualMaximum(0L) + .catchUp(true) + .companyContribution( + BenefitContribution.builder() + .amount(0L) + .type(BenefitContribution.Type.FIXED) + .build() + ) + .employeeDeduction( + BenefitContribution.builder() + .amount(0L) + .type(BenefitContribution.Type.FIXED) + .build() + ) + .hsaContributionLimit( + IndividualBenefit.Body.HsaContributionLimit.INDIVIDUAL + ) + .build() + ) + .code(0L) + .individualId("individual_id") + .build() + + val roundtrippedIndividualBenefit = + jsonMapper.readValue( + jsonMapper.writeValueAsString(individualBenefit), + jacksonTypeRef(), + ) + + assertThat(roundtrippedIndividualBenefit).isEqualTo(individualBenefit) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponseTest.kt index 72e68b7e..c5f716cc 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -18,4 +20,23 @@ internal class IndividualEnrolledIdsResponseTest { assertThat(individualEnrolledIdsResponse.benefitId()).isEqualTo("benefit_id") assertThat(individualEnrolledIdsResponse.individualIds()).containsExactly("string") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val individualEnrolledIdsResponse = + IndividualEnrolledIdsResponse.builder() + .benefitId("benefit_id") + .addIndividualId("string") + .build() + + val roundtrippedIndividualEnrolledIdsResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(individualEnrolledIdsResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedIndividualEnrolledIdsResponse) + .isEqualTo(individualEnrolledIdsResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEventTest.kt index 9ce7e42e..3909ed85 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEventTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEventTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -26,4 +28,25 @@ internal class IndividualEventTest { assertThat(individualEvent.eventType()) .contains(IndividualEvent.EventType.INDIVIDUAL_CREATED) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val individualEvent = + IndividualEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data(IndividualEvent.Data.builder().individualId("individual_id").build()) + .eventType(IndividualEvent.EventType.INDIVIDUAL_CREATED) + .build() + + val roundtrippedIndividualEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(individualEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedIndividualEvent).isEqualTo(individualEvent) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualInDirectoryTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualInDirectoryTest.kt index 0cc70443..dc8f18ea 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualInDirectoryTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualInDirectoryTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -38,4 +40,31 @@ internal class IndividualInDirectoryTest { ) assertThat(individualInDirectory.middleName()).contains("middle_name") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val individualInDirectory = + IndividualInDirectory.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .department(IndividualInDirectory.Department.builder().name("name").build()) + .firstName("first_name") + .isActive(true) + .lastName("last_name") + .manager( + IndividualInDirectory.Manager.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + .middleName("middle_name") + .build() + + val roundtrippedIndividualInDirectory = + jsonMapper.readValue( + jsonMapper.writeValueAsString(individualInDirectory), + jacksonTypeRef(), + ) + + assertThat(roundtrippedIndividualInDirectory).isEqualTo(individualInDirectory) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualResponseTest.kt index c61271dd..1f022127 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -95,4 +97,60 @@ internal class IndividualResponseTest { assertThat(individualResponse.code()).contains(0L) assertThat(individualResponse.individualId()).contains("individual_id") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val individualResponse = + IndividualResponse.builder() + .body( + Individual.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dob("dob") + .addEmail( + Individual.Email.builder() + .data("data") + .type(Individual.Email.Type.WORK) + .build() + ) + .encryptedSsn("encrypted_ssn") + .ethnicity(Individual.Ethnicity.ASIAN) + .firstName("first_name") + .gender(Individual.Gender.FEMALE) + .lastName("last_name") + .middleName("middle_name") + .addPhoneNumber( + Individual.PhoneNumber.builder() + .data("data") + .type(Individual.PhoneNumber.Type.WORK) + .build() + ) + .preferredName("preferred_name") + .residence( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + ) + .ssn("ssn") + .build() + ) + .code(0L) + .individualId("individual_id") + .build() + + val roundtrippedIndividualResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(individualResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedIndividualResponse).isEqualTo(individualResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt index 2052a640..e8760c8f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -80,4 +82,51 @@ internal class IndividualTest { ) assertThat(individual.ssn()).contains("ssn") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val individual = + Individual.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dob("dob") + .addEmail( + Individual.Email.builder().data("data").type(Individual.Email.Type.WORK).build() + ) + .encryptedSsn("encrypted_ssn") + .ethnicity(Individual.Ethnicity.ASIAN) + .firstName("first_name") + .gender(Individual.Gender.FEMALE) + .lastName("last_name") + .middleName("middle_name") + .addPhoneNumber( + Individual.PhoneNumber.builder() + .data("data") + .type(Individual.PhoneNumber.Type.WORK) + .build() + ) + .preferredName("preferred_name") + .residence( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + ) + .ssn("ssn") + .build() + + val roundtrippedIndividual = + jsonMapper.readValue( + jsonMapper.writeValueAsString(individual), + jacksonTypeRef(), + ) + + assertThat(roundtrippedIndividual).isEqualTo(individual) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt index 92a84287..d61dcf48 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -88,4 +90,54 @@ internal class IndividualUpdateResponseTest { ) assertThat(individualUpdateResponse.ssn()).contains("ssn") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val individualUpdateResponse = + IndividualUpdateResponse.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dob("dob") + .addEmail( + IndividualUpdateResponse.Email.builder() + .data("data") + .type(IndividualUpdateResponse.Email.Type.WORK) + .build() + ) + .encryptedSsn("encrypted_ssn") + .ethnicity(IndividualUpdateResponse.Ethnicity.ASIAN) + .firstName("first_name") + .gender(IndividualUpdateResponse.Gender.FEMALE) + .lastName("last_name") + .middleName("middle_name") + .addPhoneNumber( + IndividualUpdateResponse.PhoneNumber.builder() + .data("data") + .type(IndividualUpdateResponse.PhoneNumber.Type.WORK) + .build() + ) + .preferredName("preferred_name") + .residence( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + ) + .ssn("ssn") + .build() + + val roundtrippedIndividualUpdateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(individualUpdateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedIndividualUpdateResponse).isEqualTo(individualUpdateResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IntrospectionTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IntrospectionTest.kt index 1fe645aa..6b07ebce 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IntrospectionTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IntrospectionTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -83,4 +85,53 @@ internal class IntrospectionTest { assertThat(introspection.providerId()).isEqualTo("provider_id") assertThat(introspection.username()).isEqualTo("username") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val introspection = + Introspection.builder() + .accountId("account_id") + .addAuthenticationMethod( + Introspection.AuthenticationMethod.builder() + .connectionStatus( + Introspection.AuthenticationMethod.ConnectionStatus.builder() + .message("message") + .status(ConnectionStatusType.PENDING) + .build() + ) + .addProduct("string") + .type(Introspection.AuthenticationMethod.Type.ASSISTED) + .build() + ) + .clientId("client_id") + .clientType(Introspection.ClientType.PRODUCTION) + .companyId("company_id") + .connectionId("connection_id") + .connectionStatus( + Introspection.ConnectionStatus.builder() + .lastSuccessfulSync(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .message("message") + .status(ConnectionStatusType.PENDING) + .build() + ) + .connectionType(Introspection.ConnectionType.PROVIDER) + .customerEmail("customer_email") + .customerId("customer_id") + .customerName("customer_name") + .manual(true) + .payrollProviderId("payroll_provider_id") + .addProduct("string") + .providerId("provider_id") + .username("username") + .build() + + val roundtrippedIntrospection = + jsonMapper.readValue( + jsonMapper.writeValueAsString(introspection), + jacksonTypeRef(), + ) + + assertThat(roundtrippedIntrospection).isEqualTo(introspection) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCompletionEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCompletionEventTest.kt index fc05d74d..0e56ec09 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCompletionEventTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCompletionEventTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -26,4 +28,25 @@ internal class JobCompletionEventTest { assertThat(jobCompletionEvent.eventType()) .contains(JobCompletionEvent.EventType.JOB_BENEFIT_CREATE_COMPLETED) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val jobCompletionEvent = + JobCompletionEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data(JobCompletionEvent.Data.builder().jobId("job_id").jobUrl("job_url").build()) + .eventType(JobCompletionEvent.EventType.JOB_BENEFIT_CREATE_COMPLETED) + .build() + + val roundtrippedJobCompletionEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(jobCompletionEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedJobCompletionEvent).isEqualTo(jobCompletionEvent) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCreateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCreateResponseTest.kt index 83b9738b..c9a4e7d8 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCreateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobCreateResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -22,4 +24,24 @@ internal class JobCreateResponseTest { assertThat(jobCreateResponse.jobUrl()).isEqualTo("job_url") assertThat(jobCreateResponse.remainingRefreshes()).isEqualTo(0L) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val jobCreateResponse = + JobCreateResponse.builder() + .allowedRefreshes(0L) + .jobId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .jobUrl("job_url") + .remainingRefreshes(0L) + .build() + + val roundtrippedJobCreateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(jobCreateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedJobCreateResponse).isEqualTo(jobCreateResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/LocationTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/LocationTest.kt index 42c76813..8dc6ed3d 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/LocationTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/LocationTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -30,4 +32,28 @@ internal class LocationTest { assertThat(location.sourceId()).contains("source_id") assertThat(location.state()).contains("state") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val location = + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + + val roundtrippedLocation = + jsonMapper.readValue( + jsonMapper.writeValueAsString(location), + jacksonTypeRef(), + ) + + assertThat(roundtrippedLocation).isEqualTo(location) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ManualAsyncJobTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ManualAsyncJobTest.kt index c3f16435..fa288270 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ManualAsyncJobTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ManualAsyncJobTest.kt @@ -2,7 +2,9 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.jsonMapper import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -23,4 +25,23 @@ internal class ManualAsyncJobTest { assertThat(manualAsyncJob.jobId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(manualAsyncJob.status()).isEqualTo(ManualAsyncJob.Status.PENDING) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val manualAsyncJob = + ManualAsyncJob.builder() + .addBody(JsonValue.from(mapOf())) + .jobId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(ManualAsyncJob.Status.PENDING) + .build() + + val roundtrippedManualAsyncJob = + jsonMapper.readValue( + jsonMapper.writeValueAsString(manualAsyncJob), + jacksonTypeRef(), + ) + + assertThat(roundtrippedManualAsyncJob).isEqualTo(manualAsyncJob) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/MoneyTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/MoneyTest.kt index 28a22dda..76045e09 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/MoneyTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/MoneyTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -14,4 +16,15 @@ internal class MoneyTest { assertThat(money.amount()).contains(0L) assertThat(money.currency()).contains("currency") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val money = Money.builder().amount(0L).currency("currency").build() + + val roundtrippedMoney = + jsonMapper.readValue(jsonMapper.writeValueAsString(money), jacksonTypeRef()) + + assertThat(roundtrippedMoney).isEqualTo(money) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/OperationSupportMatrixTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/OperationSupportMatrixTest.kt index 0d315300..72b1c48c 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/OperationSupportMatrixTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/OperationSupportMatrixTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -22,4 +24,24 @@ internal class OperationSupportMatrixTest { assertThat(operationSupportMatrix.read()).contains(OperationSupport.SUPPORTED) assertThat(operationSupportMatrix.update()).contains(OperationSupport.SUPPORTED) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val operationSupportMatrix = + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + + val roundtrippedOperationSupportMatrix = + jsonMapper.readValue( + jsonMapper.writeValueAsString(operationSupportMatrix), + jacksonTypeRef(), + ) + + assertThat(roundtrippedOperationSupportMatrix).isEqualTo(operationSupportMatrix) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PagingTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PagingTest.kt index 3ca471bf..0e455120 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PagingTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PagingTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -14,4 +16,15 @@ internal class PagingTest { assertThat(paging.count()).contains(0L) assertThat(paging.offset()).contains(0L) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val paging = Paging.builder().count(0L).offset(0L).build() + + val roundtrippedPaging = + jsonMapper.readValue(jsonMapper.writeValueAsString(paging), jacksonTypeRef()) + + assertThat(roundtrippedPaging).isEqualTo(paging) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt index 91a6f24b..e696a7ea 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupListResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -22,4 +24,23 @@ internal class PayGroupListResponseTest { assertThat(payGroupListResponse.payFrequencies().getOrNull()) .containsExactly(PayGroupListResponse.PayFrequency.ANNUALLY) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val payGroupListResponse = + PayGroupListResponse.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("name") + .addPayFrequency(PayGroupListResponse.PayFrequency.ANNUALLY) + .build() + + val roundtrippedPayGroupListResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(payGroupListResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedPayGroupListResponse).isEqualTo(payGroupListResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponseTest.kt index a4d2281a..3fd11865 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -24,4 +26,24 @@ internal class PayGroupRetrieveResponseTest { assertThat(payGroupRetrieveResponse.payFrequencies()) .containsExactly(PayGroupRetrieveResponse.PayFrequency.ANNUALLY) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val payGroupRetrieveResponse = + PayGroupRetrieveResponse.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addIndividualId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("name") + .addPayFrequency(PayGroupRetrieveResponse.PayFrequency.ANNUALLY) + .build() + + val roundtrippedPayGroupRetrieveResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(payGroupRetrieveResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedPayGroupRetrieveResponse).isEqualTo(payGroupRetrieveResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementEventTest.kt index d1757e76..126bc319 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementEventTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementEventTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -36,4 +38,30 @@ internal class PayStatementEventTest { assertThat(payStatementEvent.eventType()) .contains(PayStatementEvent.EventType.PAY_STATEMENT_CREATED) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val payStatementEvent = + PayStatementEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data( + PayStatementEvent.Data.builder() + .individualId("individual_id") + .paymentId("payment_id") + .build() + ) + .eventType(PayStatementEvent.EventType.PAY_STATEMENT_CREATED) + .build() + + val roundtrippedPayStatementEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(payStatementEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedPayStatementEvent).isEqualTo(payStatementEvent) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt index 809d998b..1d1cb6f1 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt @@ -2,7 +2,9 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.jsonMapper import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -259,4 +261,142 @@ internal class PayStatementResponseBodyTest { .build() ) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val payStatementResponseBody = + PayStatementResponseBody.builder() + .paging(Paging.builder().count(0L).offset(0L).build()) + .addPayStatement( + PayStatement.builder() + .addEarning( + PayStatement.Earning.builder() + .amount(0L) + .attributes( + PayStatement.Earning.Attributes.builder() + .metadata( + PayStatement.Earning.Attributes.Metadata.builder() + .metadata( + PayStatement.Earning.Attributes.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) + .build() + ) + .currency("currency") + .hours(0.0) + .name("name") + .type(PayStatement.Earning.Type.SALARY) + .build() + ) + .addEmployeeDeduction( + PayStatement.EmployeeDeduction.builder() + .amount(0L) + .attributes( + PayStatement.EmployeeDeduction.Attributes.builder() + .metadata( + PayStatement.EmployeeDeduction.Attributes.Metadata + .builder() + .metadata( + PayStatement.EmployeeDeduction.Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) + .build() + ) + .currency("currency") + .name("name") + .preTax(true) + .type(BenefitType._401K) + .build() + ) + .addEmployerContribution( + PayStatement.EmployerContribution.builder() + .amount(0L) + .attributes( + PayStatement.EmployerContribution.Attributes.builder() + .metadata( + PayStatement.EmployerContribution.Attributes.Metadata + .builder() + .metadata( + PayStatement.EmployerContribution.Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) + .build() + ) + .currency("currency") + .name("name") + .type(BenefitType._401K) + .build() + ) + .grossPay(Money.builder().amount(0L).currency("currency").build()) + .individualId("individual_id") + .netPay(Money.builder().amount(0L).currency("currency").build()) + .paymentMethod(PayStatement.PaymentMethod.CHECK) + .addTax( + PayStatement.Tax.builder() + .amount(0L) + .attributes( + PayStatement.Tax.Attributes.builder() + .metadata( + PayStatement.Tax.Attributes.Metadata.builder() + .metadata( + PayStatement.Tax.Attributes.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) + .build() + ) + .currency("currency") + .employer(true) + .name("name") + .type(PayStatement.Tax.Type.STATE) + .build() + ) + .totalHours(0.0) + .type(PayStatement.Type.REGULAR_PAYROLL) + .build() + ) + .build() + + val roundtrippedPayStatementResponseBody = + jsonMapper.readValue( + jsonMapper.writeValueAsString(payStatementResponseBody), + jacksonTypeRef(), + ) + + assertThat(roundtrippedPayStatementResponseBody).isEqualTo(payStatementResponseBody) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt index cfcf4a11..7eaf287b 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt @@ -2,7 +2,9 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -278,4 +280,153 @@ internal class PayStatementResponseTest { assertThat(payStatementResponse.code()).contains(0L) assertThat(payStatementResponse.paymentId()).contains("payment_id") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val payStatementResponse = + PayStatementResponse.builder() + .body( + PayStatementResponseBody.builder() + .paging(Paging.builder().count(0L).offset(0L).build()) + .addPayStatement( + PayStatement.builder() + .addEarning( + PayStatement.Earning.builder() + .amount(0L) + .attributes( + PayStatement.Earning.Attributes.builder() + .metadata( + PayStatement.Earning.Attributes.Metadata + .builder() + .metadata( + PayStatement.Earning.Attributes.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) + .build() + ) + .currency("currency") + .hours(0.0) + .name("name") + .type(PayStatement.Earning.Type.SALARY) + .build() + ) + .addEmployeeDeduction( + PayStatement.EmployeeDeduction.builder() + .amount(0L) + .attributes( + PayStatement.EmployeeDeduction.Attributes.builder() + .metadata( + PayStatement.EmployeeDeduction.Attributes + .Metadata + .builder() + .metadata( + PayStatement.EmployeeDeduction + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) + .build() + ) + .currency("currency") + .name("name") + .preTax(true) + .type(BenefitType._401K) + .build() + ) + .addEmployerContribution( + PayStatement.EmployerContribution.builder() + .amount(0L) + .attributes( + PayStatement.EmployerContribution.Attributes.builder() + .metadata( + PayStatement.EmployerContribution.Attributes + .Metadata + .builder() + .metadata( + PayStatement.EmployerContribution + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) + .build() + ) + .currency("currency") + .name("name") + .type(BenefitType._401K) + .build() + ) + .grossPay(Money.builder().amount(0L).currency("currency").build()) + .individualId("individual_id") + .netPay(Money.builder().amount(0L).currency("currency").build()) + .paymentMethod(PayStatement.PaymentMethod.CHECK) + .addTax( + PayStatement.Tax.builder() + .amount(0L) + .attributes( + PayStatement.Tax.Attributes.builder() + .metadata( + PayStatement.Tax.Attributes.Metadata.builder() + .metadata( + PayStatement.Tax.Attributes.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) + .build() + ) + .currency("currency") + .employer(true) + .name("name") + .type(PayStatement.Tax.Type.STATE) + .build() + ) + .totalHours(0.0) + .type(PayStatement.Type.REGULAR_PAYROLL) + .build() + ) + .build() + ) + .code(0L) + .paymentId("payment_id") + .build() + + val roundtrippedPayStatementResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(payStatementResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedPayStatementResponse).isEqualTo(payStatementResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt index 634aa710..db400830 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt @@ -2,7 +2,9 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.jsonMapper import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -219,4 +221,119 @@ internal class PayStatementTest { assertThat(payStatement.totalHours()).contains(0.0) assertThat(payStatement.type()).contains(PayStatement.Type.REGULAR_PAYROLL) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val payStatement = + PayStatement.builder() + .addEarning( + PayStatement.Earning.builder() + .amount(0L) + .attributes( + PayStatement.Earning.Attributes.builder() + .metadata( + PayStatement.Earning.Attributes.Metadata.builder() + .metadata( + PayStatement.Earning.Attributes.Metadata.InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + .build() + ) + .currency("currency") + .hours(0.0) + .name("name") + .type(PayStatement.Earning.Type.SALARY) + .build() + ) + .addEmployeeDeduction( + PayStatement.EmployeeDeduction.builder() + .amount(0L) + .attributes( + PayStatement.EmployeeDeduction.Attributes.builder() + .metadata( + PayStatement.EmployeeDeduction.Attributes.Metadata.builder() + .metadata( + PayStatement.EmployeeDeduction.Attributes.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + .build() + ) + .currency("currency") + .name("name") + .preTax(true) + .type(BenefitType._401K) + .build() + ) + .addEmployerContribution( + PayStatement.EmployerContribution.builder() + .amount(0L) + .attributes( + PayStatement.EmployerContribution.Attributes.builder() + .metadata( + PayStatement.EmployerContribution.Attributes.Metadata.builder() + .metadata( + PayStatement.EmployerContribution.Attributes.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + .build() + ) + .currency("currency") + .name("name") + .type(BenefitType._401K) + .build() + ) + .grossPay(Money.builder().amount(0L).currency("currency").build()) + .individualId("individual_id") + .netPay(Money.builder().amount(0L).currency("currency").build()) + .paymentMethod(PayStatement.PaymentMethod.CHECK) + .addTax( + PayStatement.Tax.builder() + .amount(0L) + .attributes( + PayStatement.Tax.Attributes.builder() + .metadata( + PayStatement.Tax.Attributes.Metadata.builder() + .metadata( + PayStatement.Tax.Attributes.Metadata.InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + .build() + ) + .currency("currency") + .employer(true) + .name("name") + .type(PayStatement.Tax.Type.STATE) + .build() + ) + .totalHours(0.0) + .type(PayStatement.Type.REGULAR_PAYROLL) + .build() + + val roundtrippedPayStatement = + jsonMapper.readValue( + jsonMapper.writeValueAsString(payStatement), + jacksonTypeRef(), + ) + + assertThat(roundtrippedPayStatement).isEqualTo(payStatement) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentCreateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentCreateResponseTest.kt index 54f50224..3b83aabc 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentCreateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentCreateResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -15,4 +17,19 @@ internal class PaymentCreateResponseTest { assertThat(paymentCreateResponse.payDate()).isEqualTo("pay_date") assertThat(paymentCreateResponse.paymentId()).isEqualTo("payment_id") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val paymentCreateResponse = + PaymentCreateResponse.builder().payDate("pay_date").paymentId("payment_id").build() + + val roundtrippedPaymentCreateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(paymentCreateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedPaymentCreateResponse).isEqualTo(paymentCreateResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentEventTest.kt index e31f2bdd..f118ea2f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentEventTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentEventTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -35,4 +37,30 @@ internal class PaymentEventTest { ) assertThat(paymentEvent.eventType()).contains(PaymentEvent.EventType.PAYMENT_CREATED) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val paymentEvent = + PaymentEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data( + PaymentEvent.PaymentIdentifiers.builder() + .payDate("pay_date") + .paymentId("payment_id") + .build() + ) + .eventType(PaymentEvent.EventType.PAYMENT_CREATED) + .build() + + val roundtrippedPaymentEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(paymentEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedPaymentEvent).isEqualTo(paymentEvent) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt index 8390af5a..fce8572b 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -52,4 +54,31 @@ internal class PaymentTest { Payment.PayPeriod.builder().endDate("end_date").startDate("start_date").build() ) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val payment = + Payment.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .companyDebit(Money.builder().amount(0L).currency("currency").build()) + .debitDate("debit_date") + .employeeTaxes(Money.builder().amount(0L).currency("currency").build()) + .employerTaxes(Money.builder().amount(0L).currency("currency").build()) + .grossPay(Money.builder().amount(0L).currency("currency").build()) + .addIndividualId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .netPay(Money.builder().amount(0L).currency("currency").build()) + .payDate("pay_date") + .addPayFrequency(Payment.PayFrequency.ANNUALLY) + .addPayGroupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .payPeriod( + Payment.PayPeriod.builder().endDate("end_date").startDate("start_date").build() + ) + .build() + + val roundtrippedPayment = + jsonMapper.readValue(jsonMapper.writeValueAsString(payment), jacksonTypeRef()) + + assertThat(roundtrippedPayment).isEqualTo(payment) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderTest.kt index 4cc0899c..c8c8d6be 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ProviderTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -1836,4 +1838,931 @@ internal class ProviderTest { assertThat(provider.primaryColor()).contains("primary_color") assertThat(provider.products().getOrNull()).containsExactly("string") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val provider = + Provider.builder() + .id("id") + .addAuthenticationMethod( + Provider.AuthenticationMethod.builder() + .benefitsSupport( + BenefitsSupport.builder() + .commuter( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .customPostTax( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .customPreTax( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .fsaDependentCare( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .fsaMedical( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .hsaPost( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .hsaPre( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .s125Dental( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .s125Medical( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .s125Vision( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .simple( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .simpleIra( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations.BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations.BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations.BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .build() + ) + .supportedFields( + Provider.AuthenticationMethod.SupportedFields.builder() + .company( + Provider.AuthenticationMethod.SupportedFields + .SupportedCompanyFields + .builder() + .id(true) + .accounts( + Provider.AuthenticationMethod.SupportedFields + .SupportedCompanyFields + .Accounts + .builder() + .accountName(true) + .accountNumber(true) + .accountType(true) + .institutionName(true) + .routingNumber(true) + .build() + ) + .departments( + Provider.AuthenticationMethod.SupportedFields + .SupportedCompanyFields + .Departments + .builder() + .name(true) + .parent( + Provider.AuthenticationMethod.SupportedFields + .SupportedCompanyFields + .Departments + .Parent + .builder() + .name(true) + .build() + ) + .build() + ) + .ein(true) + .entity( + Provider.AuthenticationMethod.SupportedFields + .SupportedCompanyFields + .Entity + .builder() + .subtype(true) + .type(true) + .build() + ) + .legalName(true) + .locations( + Provider.AuthenticationMethod.SupportedFields + .SupportedCompanyFields + .Locations + .builder() + .city(true) + .country(true) + .line1(true) + .line2(true) + .postalCode(true) + .state(true) + .build() + ) + .primaryEmail(true) + .primaryPhoneNumber(true) + .build() + ) + .directory( + Provider.AuthenticationMethod.SupportedFields + .SupportedDirectoryFields + .builder() + .individuals( + Provider.AuthenticationMethod.SupportedFields + .SupportedDirectoryFields + .Individuals + .builder() + .id(true) + .department(true) + .firstName(true) + .isActive(true) + .lastName(true) + .manager( + Provider.AuthenticationMethod.SupportedFields + .SupportedDirectoryFields + .Individuals + .Manager + .builder() + .id(true) + .build() + ) + .middleName(true) + .build() + ) + .paging( + Provider.AuthenticationMethod.SupportedFields + .SupportedDirectoryFields + .Paging + .builder() + .count(true) + .offset(true) + .build() + ) + .build() + ) + .employment( + Provider.AuthenticationMethod.SupportedFields + .SupportedEmploymentFields + .builder() + .id(true) + .classCode(true) + .customFields(true) + .department( + Provider.AuthenticationMethod.SupportedFields + .SupportedEmploymentFields + .Department + .builder() + .name(true) + .build() + ) + .employment( + Provider.AuthenticationMethod.SupportedFields + .SupportedEmploymentFields + .Employment + .builder() + .subtype(true) + .type(true) + .build() + ) + .employmentStatus(true) + .endDate(true) + .firstName(true) + .income( + Provider.AuthenticationMethod.SupportedFields + .SupportedEmploymentFields + .Income + .builder() + .amount(true) + .currency(true) + .unit(true) + .build() + ) + .incomeHistory(true) + .isActive(true) + .lastName(true) + .location( + Provider.AuthenticationMethod.SupportedFields + .SupportedEmploymentFields + .Location + .builder() + .city(true) + .country(true) + .line1(true) + .line2(true) + .postalCode(true) + .state(true) + .build() + ) + .manager( + Provider.AuthenticationMethod.SupportedFields + .SupportedEmploymentFields + .Manager + .builder() + .id(true) + .build() + ) + .middleName(true) + .startDate(true) + .title(true) + .build() + ) + .individual( + Provider.AuthenticationMethod.SupportedFields + .SupportedIndividualFields + .builder() + .id(true) + .dob(true) + .emails( + Provider.AuthenticationMethod.SupportedFields + .SupportedIndividualFields + .Emails + .builder() + .data(true) + .type(true) + .build() + ) + .encryptedSsn(true) + .ethnicity(true) + .firstName(true) + .gender(true) + .lastName(true) + .middleName(true) + .phoneNumbers( + Provider.AuthenticationMethod.SupportedFields + .SupportedIndividualFields + .PhoneNumbers + .builder() + .data(true) + .type(true) + .build() + ) + .preferredName(true) + .residence( + Provider.AuthenticationMethod.SupportedFields + .SupportedIndividualFields + .Residence + .builder() + .city(true) + .country(true) + .line1(true) + .line2(true) + .postalCode(true) + .state(true) + .build() + ) + .ssn(true) + .build() + ) + .payGroup( + Provider.AuthenticationMethod.SupportedFields + .SupportedPayGroupFields + .builder() + .id(true) + .individualIds(true) + .name(true) + .payFrequencies(true) + .build() + ) + .payStatement( + Provider.AuthenticationMethod.SupportedFields + .SupportedPayStatementFields + .builder() + .paging( + Provider.AuthenticationMethod.SupportedFields + .SupportedPayStatementFields + .Paging + .builder() + .count(true) + .offset(true) + .build() + ) + .payStatements( + Provider.AuthenticationMethod.SupportedFields + .SupportedPayStatementFields + .PayStatements + .builder() + .earnings( + Provider.AuthenticationMethod.SupportedFields + .SupportedPayStatementFields + .PayStatements + .Earnings + .builder() + .amount(true) + .currency(true) + .name(true) + .type(true) + .build() + ) + .employeeDeductions( + Provider.AuthenticationMethod.SupportedFields + .SupportedPayStatementFields + .PayStatements + .EmployeeDeductions + .builder() + .amount(true) + .currency(true) + .name(true) + .preTax(true) + .type(true) + .build() + ) + .employerContributions( + Provider.AuthenticationMethod.SupportedFields + .SupportedPayStatementFields + .PayStatements + .EmployerContributions + .builder() + .amount(true) + .currency(true) + .name(true) + .build() + ) + .grossPay(true) + .individualId(true) + .netPay(true) + .paymentMethod(true) + .taxes( + Provider.AuthenticationMethod.SupportedFields + .SupportedPayStatementFields + .PayStatements + .Taxes + .builder() + .amount(true) + .currency(true) + .employer(true) + .name(true) + .type(true) + .build() + ) + .totalHours(true) + .type(true) + .build() + ) + .build() + ) + .payment( + Provider.AuthenticationMethod.SupportedFields + .SupportedPaymentFields + .builder() + .id(true) + .companyDebit(true) + .debitDate(true) + .employeeTaxes(true) + .employerTaxes(true) + .grossPay(true) + .individualIds(true) + .netPay(true) + .payDate(true) + .payFrequencies(true) + .payGroupIds(true) + .payPeriod( + Provider.AuthenticationMethod.SupportedFields + .SupportedPaymentFields + .PayPeriod + .builder() + .endDate(true) + .startDate(true) + .build() + ) + .build() + ) + .build() + ) + .type(Provider.AuthenticationMethod.Type.ASSISTED) + .build() + ) + .beta(true) + .displayName("display_name") + .icon("icon") + .logo("logo") + .manual(true) + .mfaRequired(true) + .primaryColor("primary_color") + .addProduct("string") + .build() + + val roundtrippedProvider = + jsonMapper.readValue( + jsonMapper.writeValueAsString(provider), + jacksonTypeRef(), + ) + + assertThat(roundtrippedProvider).isEqualTo(provider) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponseTest.kt index 03b941d9..2645792c 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponseTest.kt @@ -2,7 +2,9 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -41,4 +43,33 @@ internal class RequestForwardingForwardResponseTest { ) assertThat(requestForwardingForwardResponse.statusCode()).isEqualTo(0L) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val requestForwardingForwardResponse = + RequestForwardingForwardResponse.builder() + .data("data") + .headers(JsonValue.from(mapOf())) + .request( + RequestForwardingForwardResponse.Request.builder() + .data("data") + .headers(JsonValue.from(mapOf())) + .method("method") + .params(JsonValue.from(mapOf())) + .route("route") + .build() + ) + .statusCode(0L) + .build() + + val roundtrippedRequestForwardingForwardResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(requestForwardingForwardResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRequestForwardingForwardResponse) + .isEqualTo(requestForwardingForwardResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationTest.kt index ea55104f..ac396ef1 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -20,4 +22,22 @@ internal class SandboxJobConfigurationTest { assertThat(sandboxJobConfiguration.type()) .isEqualTo(SandboxJobConfiguration.Type.DATA_SYNC_ALL) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val sandboxJobConfiguration = + SandboxJobConfiguration.builder() + .completionStatus(SandboxJobConfiguration.CompletionStatus.COMPLETE) + .type(SandboxJobConfiguration.Type.DATA_SYNC_ALL) + .build() + + val roundtrippedSandboxJobConfiguration = + jsonMapper.readValue( + jsonMapper.writeValueAsString(sandboxJobConfiguration), + jacksonTypeRef(), + ) + + assertThat(roundtrippedSandboxJobConfiguration).isEqualTo(sandboxJobConfiguration) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionNewResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionNewResponseTest.kt index 487e6726..e89800c6 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionNewResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionNewResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -18,4 +20,22 @@ internal class SessionNewResponseTest { assertThat(sessionNewResponse.connectUrl()).isEqualTo("https://example.com") assertThat(sessionNewResponse.sessionId()).isEqualTo("session_id") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val sessionNewResponse = + SessionNewResponse.builder() + .connectUrl("https://example.com") + .sessionId("session_id") + .build() + + val roundtrippedSessionNewResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(sessionNewResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedSessionNewResponse).isEqualTo(sessionNewResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionReauthenticateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionReauthenticateResponseTest.kt index 43bed076..62068842 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionReauthenticateResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SessionReauthenticateResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -18,4 +20,23 @@ internal class SessionReauthenticateResponseTest { assertThat(sessionReauthenticateResponse.connectUrl()).isEqualTo("https://example.com") assertThat(sessionReauthenticateResponse.sessionId()).isEqualTo("session_id") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val sessionReauthenticateResponse = + SessionReauthenticateResponse.builder() + .connectUrl("https://example.com") + .sessionId("session_id") + .build() + + val roundtrippedSessionReauthenticateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(sessionReauthenticateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedSessionReauthenticateResponse) + .isEqualTo(sessionReauthenticateResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportPerBenefitTypeTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportPerBenefitTypeTest.kt index 444ea4dc..16ef24a4 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportPerBenefitTypeTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportPerBenefitTypeTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -48,4 +50,36 @@ internal class SupportPerBenefitTypeTest { .build() ) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val supportPerBenefitType = + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + + val roundtrippedSupportPerBenefitType = + jsonMapper.readValue( + jsonMapper.writeValueAsString(supportPerBenefitType), + jacksonTypeRef(), + ) + + assertThat(roundtrippedSupportPerBenefitType).isEqualTo(supportPerBenefitType) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportedBenefitTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportedBenefitTest.kt index 20e1afa9..147c8735 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportedBenefitTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SupportedBenefitTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -35,4 +37,28 @@ internal class SupportedBenefitTest { .containsExactly(SupportedBenefit.HsaContributionLimit.INDIVIDUAL) assertThat(supportedBenefit.type()).contains(BenefitType._401K) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val supportedBenefit = + SupportedBenefit.builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution(SupportedBenefit.CompanyContribution.FIXED) + .description("description") + .addEmployeeDeduction(SupportedBenefit.EmployeeDeduction.FIXED) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit(SupportedBenefit.HsaContributionLimit.INDIVIDUAL) + .type(BenefitType._401K) + .build() + + val roundtrippedSupportedBenefit = + jsonMapper.readValue( + jsonMapper.writeValueAsString(supportedBenefit), + jacksonTypeRef(), + ) + + assertThat(roundtrippedSupportedBenefit).isEqualTo(supportedBenefit) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt index 634682aa..98753d93 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -33,4 +35,29 @@ internal class UnenrolledIndividualTest { assertThat(unenrolledIndividual.code()).contains(0L) assertThat(unenrolledIndividual.individualId()).contains("individual_id") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val unenrolledIndividual = + UnenrolledIndividual.builder() + .body( + UnenrolledIndividual.Body.builder() + .finchCode("finch_code") + .message("message") + .name("name") + .build() + ) + .code(0L) + .individualId("individual_id") + .build() + + val roundtrippedUnenrolledIndividual = + jsonMapper.readValue( + jsonMapper.writeValueAsString(unenrolledIndividual), + jacksonTypeRef(), + ) + + assertThat(roundtrippedUnenrolledIndividual).isEqualTo(unenrolledIndividual) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponseTest.kt index 7d5ddc90..90009f42 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponseTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -14,4 +16,19 @@ internal class UpdateCompanyBenefitResponseTest { assertThat(updateCompanyBenefitResponse.benefitId()).isEqualTo("benefit_id") } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val updateCompanyBenefitResponse = + UpdateCompanyBenefitResponse.builder().benefitId("benefit_id").build() + + val roundtrippedUpdateCompanyBenefitResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(updateCompanyBenefitResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedUpdateCompanyBenefitResponse).isEqualTo(updateCompanyBenefitResponse) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42005Test.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42005Test.kt index 6de89a3f..83299435 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42005Test.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42005Test.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -37,4 +39,28 @@ internal class W42005Test { assertThat(w42005.type()).contains(W42005.Type.W4_2005) assertThat(w42005.year()).contains(0.0) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val w42005 = + W42005.builder() + .data( + W42005.Data.builder() + .additionalWithholding(0L) + .exemption(W42005.Data.Exemption.EXEMPT) + .filingStatus(W42005.Data.FilingStatus.MARRIED) + .individualId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .totalNumberOfAllowances(0L) + .build() + ) + .type(W42005.Type.W4_2005) + .year(0.0) + .build() + + val roundtrippedW42005 = + jsonMapper.readValue(jsonMapper.writeValueAsString(w42005), jacksonTypeRef()) + + assertThat(roundtrippedW42005).isEqualTo(w42005) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42020Test.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42020Test.kt index a2dc0ff4..40c7a6f5 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42020Test.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42020Test.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -43,4 +45,31 @@ internal class W42020Test { assertThat(w42020.type()).contains(W42020.Type.W4_2020) assertThat(w42020.year()).contains(0.0) } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val w42020 = + W42020.builder() + .data( + W42020.Data.builder() + .amountForOtherDependents(0L) + .amountForQualifyingChildrenUnder17(0L) + .deductions(0L) + .extraWithholding(0L) + .filingStatus(W42020.Data.FilingStatus.HEAD_OF_HOUSEHOLD) + .individualId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .otherIncome(0L) + .totalClaimDependentAndOtherCredits(0L) + .build() + ) + .type(W42020.Type.W4_2020) + .year(0.0) + .build() + + val roundtrippedW42020 = + jsonMapper.readValue(jsonMapper.writeValueAsString(w42020), jacksonTypeRef()) + + assertThat(roundtrippedW42020).isEqualTo(w42020) + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/WebhookEventTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/WebhookEventTest.kt index f0d5af29..31778dac 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/WebhookEventTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/WebhookEventTest.kt @@ -2,15 +2,1019 @@ package com.tryfinch.api.models +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.jsonMapper +import com.tryfinch.api.errors.FinchInvalidDataException import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.EnumSource internal class WebhookEventTest { @Test fun ofAccountUpdated() { val accountUpdated = - AccountUpdateEvent.builder().accountId("account_id").companyId("company_id").build() + AccountUpdateEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data( + AccountUpdateEvent.Data.builder() + .authenticationMethod( + AccountUpdateEvent.Data.AuthenticationMethod.builder() + .benefitsSupport( + BenefitsSupport.builder() + .commuter( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .customPostTax( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .customPreTax( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .fsaDependentCare( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .fsaMedical( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .hsaPost( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .hsaPre( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .s125Dental( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .s125Medical( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .s125Vision( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .simple( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .simpleIra( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create(OperationSupport.SUPPORTED) + .delete(OperationSupport.SUPPORTED) + .read(OperationSupport.SUPPORTED) + .update(OperationSupport.SUPPORTED) + .build() + ) + .build() + ) + .build() + ) + .build() + ) + .supportedFields( + AccountUpdateEvent.Data.AuthenticationMethod.SupportedFields + .builder() + .company( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .builder() + .id(true) + .accounts( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Accounts + .builder() + .accountName(true) + .accountNumber(true) + .accountType(true) + .institutionName(true) + .routingNumber(true) + .build() + ) + .departments( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Departments + .builder() + .name(true) + .parent( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Departments + .Parent + .builder() + .name(true) + .build() + ) + .build() + ) + .ein(true) + .entity( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Entity + .builder() + .subtype(true) + .type(true) + .build() + ) + .legalName(true) + .locations( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Locations + .builder() + .city(true) + .country(true) + .line1(true) + .line2(true) + .postalCode(true) + .state(true) + .build() + ) + .primaryEmail(true) + .primaryPhoneNumber(true) + .build() + ) + .directory( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedDirectoryFields + .builder() + .individuals( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedDirectoryFields + .Individuals + .builder() + .id(true) + .department(true) + .firstName(true) + .isActive(true) + .lastName(true) + .manager( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedDirectoryFields + .Individuals + .Manager + .builder() + .id(true) + .build() + ) + .middleName(true) + .build() + ) + .paging( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedDirectoryFields + .Paging + .builder() + .count(true) + .offset(true) + .build() + ) + .build() + ) + .employment( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .builder() + .id(true) + .classCode(true) + .customFields(true) + .department( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Department + .builder() + .name(true) + .build() + ) + .employment( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Employment + .builder() + .subtype(true) + .type(true) + .build() + ) + .employmentStatus(true) + .endDate(true) + .firstName(true) + .income( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Income + .builder() + .amount(true) + .currency(true) + .unit(true) + .build() + ) + .incomeHistory(true) + .isActive(true) + .lastName(true) + .location( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Location + .builder() + .city(true) + .country(true) + .line1(true) + .line2(true) + .postalCode(true) + .state(true) + .build() + ) + .manager( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Manager + .builder() + .id(true) + .build() + ) + .middleName(true) + .startDate(true) + .title(true) + .build() + ) + .individual( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedIndividualFields + .builder() + .id(true) + .dob(true) + .emails( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedIndividualFields + .Emails + .builder() + .data(true) + .type(true) + .build() + ) + .encryptedSsn(true) + .ethnicity(true) + .firstName(true) + .gender(true) + .lastName(true) + .middleName(true) + .phoneNumbers( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedIndividualFields + .PhoneNumbers + .builder() + .data(true) + .type(true) + .build() + ) + .preferredName(true) + .residence( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedIndividualFields + .Residence + .builder() + .city(true) + .country(true) + .line1(true) + .line2(true) + .postalCode(true) + .state(true) + .build() + ) + .ssn(true) + .build() + ) + .payGroup( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayGroupFields + .builder() + .id(true) + .individualIds(true) + .name(true) + .payFrequencies(true) + .build() + ) + .payStatement( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .builder() + .paging( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .Paging + .builder() + .count(true) + .offset(true) + .build() + ) + .payStatements( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .builder() + .earnings( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .Earnings + .builder() + .amount(true) + .currency(true) + .name(true) + .type(true) + .build() + ) + .employeeDeductions( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .EmployeeDeductions + .builder() + .amount(true) + .currency(true) + .name(true) + .preTax(true) + .type(true) + .build() + ) + .employerContributions( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .EmployerContributions + .builder() + .amount(true) + .currency(true) + .name(true) + .build() + ) + .grossPay(true) + .individualId(true) + .netPay(true) + .paymentMethod(true) + .taxes( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .Taxes + .builder() + .amount(true) + .currency(true) + .employer(true) + .name(true) + .type(true) + .build() + ) + .totalHours(true) + .type(true) + .build() + ) + .build() + ) + .payment( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPaymentFields + .builder() + .id(true) + .companyDebit(true) + .debitDate(true) + .employeeTaxes(true) + .employerTaxes(true) + .grossPay(true) + .individualIds(true) + .netPay(true) + .payDate(true) + .payFrequencies(true) + .payGroupIds(true) + .payPeriod( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPaymentFields + .PayPeriod + .builder() + .endDate(true) + .startDate(true) + .build() + ) + .build() + ) + .build() + ) + .type(AccountUpdateEvent.Data.AuthenticationMethod.Type.ASSISTED) + .build() + ) + .status(ConnectionStatusType.PENDING) + .build() + ) + .eventType(AccountUpdateEvent.EventType.ACCOUNT_UPDATED) + .build() val webhookEvent = WebhookEvent.ofAccountUpdated(accountUpdated) @@ -24,10 +1028,1224 @@ internal class WebhookEventTest { assertThat(webhookEvent.payStatement()).isEmpty } + @Test + fun ofAccountUpdatedRoundtrip() { + val jsonMapper = jsonMapper() + val webhookEvent = + WebhookEvent.ofAccountUpdated( + AccountUpdateEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data( + AccountUpdateEvent.Data.builder() + .authenticationMethod( + AccountUpdateEvent.Data.AuthenticationMethod.builder() + .benefitsSupport( + BenefitsSupport.builder() + .commuter( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .build() + ) + .build() + ) + .customPostTax( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .build() + ) + .build() + ) + .customPreTax( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .build() + ) + .build() + ) + .fsaDependentCare( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .build() + ) + .build() + ) + .fsaMedical( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .build() + ) + .build() + ) + .hsaPost( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .build() + ) + .build() + ) + .hsaPre( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .build() + ) + .build() + ) + .s125Dental( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .build() + ) + .build() + ) + .s125Medical( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .build() + ) + .build() + ) + .s125Vision( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .build() + ) + .build() + ) + .simple( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .build() + ) + .build() + ) + .simpleIra( + BenefitFeaturesAndOperations.builder() + .supportedFeatures( + BenefitFeaturesAndOperations.BenefitFeature + .builder() + .annualMaximum(true) + .catchUp(true) + .addCompanyContribution( + BenefitFeaturesAndOperations + .BenefitFeature + .CompanyContribution + .FIXED + ) + .description("description") + .addEmployeeDeduction( + BenefitFeaturesAndOperations + .BenefitFeature + .EmployeeDeduction + .FIXED + ) + .addFrequency(BenefitFrequency.ONE_TIME) + .addHsaContributionLimit( + BenefitFeaturesAndOperations + .BenefitFeature + .HsaContributionLimit + .INDIVIDUAL + ) + .build() + ) + .supportedOperations( + SupportPerBenefitType.builder() + .companyBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .individualBenefits( + OperationSupportMatrix.builder() + .create( + OperationSupport.SUPPORTED + ) + .delete( + OperationSupport.SUPPORTED + ) + .read( + OperationSupport.SUPPORTED + ) + .update( + OperationSupport.SUPPORTED + ) + .build() + ) + .build() + ) + .build() + ) + .build() + ) + .supportedFields( + AccountUpdateEvent.Data.AuthenticationMethod.SupportedFields + .builder() + .company( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .builder() + .id(true) + .accounts( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Accounts + .builder() + .accountName(true) + .accountNumber(true) + .accountType(true) + .institutionName(true) + .routingNumber(true) + .build() + ) + .departments( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Departments + .builder() + .name(true) + .parent( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Departments + .Parent + .builder() + .name(true) + .build() + ) + .build() + ) + .ein(true) + .entity( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Entity + .builder() + .subtype(true) + .type(true) + .build() + ) + .legalName(true) + .locations( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedCompanyFields + .Locations + .builder() + .city(true) + .country(true) + .line1(true) + .line2(true) + .postalCode(true) + .state(true) + .build() + ) + .primaryEmail(true) + .primaryPhoneNumber(true) + .build() + ) + .directory( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedDirectoryFields + .builder() + .individuals( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedDirectoryFields + .Individuals + .builder() + .id(true) + .department(true) + .firstName(true) + .isActive(true) + .lastName(true) + .manager( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedDirectoryFields + .Individuals + .Manager + .builder() + .id(true) + .build() + ) + .middleName(true) + .build() + ) + .paging( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedDirectoryFields + .Paging + .builder() + .count(true) + .offset(true) + .build() + ) + .build() + ) + .employment( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .builder() + .id(true) + .classCode(true) + .customFields(true) + .department( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Department + .builder() + .name(true) + .build() + ) + .employment( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Employment + .builder() + .subtype(true) + .type(true) + .build() + ) + .employmentStatus(true) + .endDate(true) + .firstName(true) + .income( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Income + .builder() + .amount(true) + .currency(true) + .unit(true) + .build() + ) + .incomeHistory(true) + .isActive(true) + .lastName(true) + .location( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Location + .builder() + .city(true) + .country(true) + .line1(true) + .line2(true) + .postalCode(true) + .state(true) + .build() + ) + .manager( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedEmploymentFields + .Manager + .builder() + .id(true) + .build() + ) + .middleName(true) + .startDate(true) + .title(true) + .build() + ) + .individual( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedIndividualFields + .builder() + .id(true) + .dob(true) + .emails( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedIndividualFields + .Emails + .builder() + .data(true) + .type(true) + .build() + ) + .encryptedSsn(true) + .ethnicity(true) + .firstName(true) + .gender(true) + .lastName(true) + .middleName(true) + .phoneNumbers( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedIndividualFields + .PhoneNumbers + .builder() + .data(true) + .type(true) + .build() + ) + .preferredName(true) + .residence( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedIndividualFields + .Residence + .builder() + .city(true) + .country(true) + .line1(true) + .line2(true) + .postalCode(true) + .state(true) + .build() + ) + .ssn(true) + .build() + ) + .payGroup( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayGroupFields + .builder() + .id(true) + .individualIds(true) + .name(true) + .payFrequencies(true) + .build() + ) + .payStatement( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .builder() + .paging( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .Paging + .builder() + .count(true) + .offset(true) + .build() + ) + .payStatements( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .builder() + .earnings( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .Earnings + .builder() + .amount(true) + .currency(true) + .name(true) + .type(true) + .build() + ) + .employeeDeductions( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .EmployeeDeductions + .builder() + .amount(true) + .currency(true) + .name(true) + .preTax(true) + .type(true) + .build() + ) + .employerContributions( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .EmployerContributions + .builder() + .amount(true) + .currency(true) + .name(true) + .build() + ) + .grossPay(true) + .individualId(true) + .netPay(true) + .paymentMethod(true) + .taxes( + AccountUpdateEvent.Data + .AuthenticationMethod + .SupportedFields + .SupportedPayStatementFields + .PayStatements + .Taxes + .builder() + .amount(true) + .currency(true) + .employer(true) + .name(true) + .type(true) + .build() + ) + .totalHours(true) + .type(true) + .build() + ) + .build() + ) + .payment( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPaymentFields + .builder() + .id(true) + .companyDebit(true) + .debitDate(true) + .employeeTaxes(true) + .employerTaxes(true) + .grossPay(true) + .individualIds(true) + .netPay(true) + .payDate(true) + .payFrequencies(true) + .payGroupIds(true) + .payPeriod( + AccountUpdateEvent.Data.AuthenticationMethod + .SupportedFields + .SupportedPaymentFields + .PayPeriod + .builder() + .endDate(true) + .startDate(true) + .build() + ) + .build() + ) + .build() + ) + .type( + AccountUpdateEvent.Data.AuthenticationMethod.Type.ASSISTED + ) + .build() + ) + .status(ConnectionStatusType.PENDING) + .build() + ) + .eventType(AccountUpdateEvent.EventType.ACCOUNT_UPDATED) + .build() + ) + + val roundtrippedWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(webhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedWebhookEvent).isEqualTo(webhookEvent) + } + @Test fun ofJobCompletion() { val jobCompletion = - JobCompletionEvent.builder().accountId("account_id").companyId("company_id").build() + JobCompletionEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data(JobCompletionEvent.Data.builder().jobId("job_id").jobUrl("job_url").build()) + .eventType(JobCompletionEvent.EventType.JOB_BENEFIT_CREATE_COMPLETED) + .build() val webhookEvent = WebhookEvent.ofJobCompletion(jobCompletion) @@ -41,10 +2259,45 @@ internal class WebhookEventTest { assertThat(webhookEvent.payStatement()).isEmpty } + @Test + fun ofJobCompletionRoundtrip() { + val jsonMapper = jsonMapper() + val webhookEvent = + WebhookEvent.ofJobCompletion( + JobCompletionEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data( + JobCompletionEvent.Data.builder().jobId("job_id").jobUrl("job_url").build() + ) + .eventType(JobCompletionEvent.EventType.JOB_BENEFIT_CREATE_COMPLETED) + .build() + ) + + val roundtrippedWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(webhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedWebhookEvent).isEqualTo(webhookEvent) + } + @Test fun ofCompanyUpdated() { val companyUpdated = - CompanyEvent.builder().accountId("account_id").companyId("company_id").build() + CompanyEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data( + CompanyEvent.Data.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .eventType(CompanyEvent.EventType.COMPANY_UPDATED) + .build() val webhookEvent = WebhookEvent.ofCompanyUpdated(companyUpdated) @@ -58,10 +2311,43 @@ internal class WebhookEventTest { assertThat(webhookEvent.payStatement()).isEmpty } + @Test + fun ofCompanyUpdatedRoundtrip() { + val jsonMapper = jsonMapper() + val webhookEvent = + WebhookEvent.ofCompanyUpdated( + CompanyEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data( + CompanyEvent.Data.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .eventType(CompanyEvent.EventType.COMPANY_UPDATED) + .build() + ) + + val roundtrippedWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(webhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedWebhookEvent).isEqualTo(webhookEvent) + } + @Test fun ofDirectory() { val directory = - DirectoryEvent.builder().accountId("account_id").companyId("company_id").build() + DirectoryEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data(DirectoryEvent.Data.builder().individualId("individual_id").build()) + .eventType(DirectoryEvent.EventType.DIRECTORY_CREATED) + .build() val webhookEvent = WebhookEvent.ofDirectory(directory) @@ -75,10 +2361,39 @@ internal class WebhookEventTest { assertThat(webhookEvent.payStatement()).isEmpty } + @Test + fun ofDirectoryRoundtrip() { + val jsonMapper = jsonMapper() + val webhookEvent = + WebhookEvent.ofDirectory( + DirectoryEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data(DirectoryEvent.Data.builder().individualId("individual_id").build()) + .eventType(DirectoryEvent.EventType.DIRECTORY_CREATED) + .build() + ) + + val roundtrippedWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(webhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedWebhookEvent).isEqualTo(webhookEvent) + } + @Test fun ofEmployment() { val employment = - EmploymentEvent.builder().accountId("account_id").companyId("company_id").build() + EmploymentEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data(EmploymentEvent.Data.builder().individualId("individual_id").build()) + .eventType(EmploymentEvent.EventType.EMPLOYMENT_CREATED) + .build() val webhookEvent = WebhookEvent.ofEmployment(employment) @@ -92,10 +2407,39 @@ internal class WebhookEventTest { assertThat(webhookEvent.payStatement()).isEmpty } + @Test + fun ofEmploymentRoundtrip() { + val jsonMapper = jsonMapper() + val webhookEvent = + WebhookEvent.ofEmployment( + EmploymentEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data(EmploymentEvent.Data.builder().individualId("individual_id").build()) + .eventType(EmploymentEvent.EventType.EMPLOYMENT_CREATED) + .build() + ) + + val roundtrippedWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(webhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedWebhookEvent).isEqualTo(webhookEvent) + } + @Test fun ofIndividual() { val individual = - IndividualEvent.builder().accountId("account_id").companyId("company_id").build() + IndividualEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data(IndividualEvent.Data.builder().individualId("individual_id").build()) + .eventType(IndividualEvent.EventType.INDIVIDUAL_CREATED) + .build() val webhookEvent = WebhookEvent.ofIndividual(individual) @@ -109,9 +2453,44 @@ internal class WebhookEventTest { assertThat(webhookEvent.payStatement()).isEmpty } + @Test + fun ofIndividualRoundtrip() { + val jsonMapper = jsonMapper() + val webhookEvent = + WebhookEvent.ofIndividual( + IndividualEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data(IndividualEvent.Data.builder().individualId("individual_id").build()) + .eventType(IndividualEvent.EventType.INDIVIDUAL_CREATED) + .build() + ) + + val roundtrippedWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(webhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedWebhookEvent).isEqualTo(webhookEvent) + } + @Test fun ofPayment() { - val payment = PaymentEvent.builder().accountId("account_id").companyId("company_id").build() + val payment = + PaymentEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data( + PaymentEvent.PaymentIdentifiers.builder() + .payDate("pay_date") + .paymentId("payment_id") + .build() + ) + .eventType(PaymentEvent.EventType.PAYMENT_CREATED) + .build() val webhookEvent = WebhookEvent.ofPayment(payment) @@ -125,10 +2504,49 @@ internal class WebhookEventTest { assertThat(webhookEvent.payStatement()).isEmpty } + @Test + fun ofPaymentRoundtrip() { + val jsonMapper = jsonMapper() + val webhookEvent = + WebhookEvent.ofPayment( + PaymentEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data( + PaymentEvent.PaymentIdentifiers.builder() + .payDate("pay_date") + .paymentId("payment_id") + .build() + ) + .eventType(PaymentEvent.EventType.PAYMENT_CREATED) + .build() + ) + + val roundtrippedWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(webhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedWebhookEvent).isEqualTo(webhookEvent) + } + @Test fun ofPayStatement() { val payStatement = - PayStatementEvent.builder().accountId("account_id").companyId("company_id").build() + PayStatementEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data( + PayStatementEvent.Data.builder() + .individualId("individual_id") + .paymentId("payment_id") + .build() + ) + .eventType(PayStatementEvent.EventType.PAY_STATEMENT_CREATED) + .build() val webhookEvent = WebhookEvent.ofPayStatement(payStatement) @@ -141,4 +2559,49 @@ internal class WebhookEventTest { assertThat(webhookEvent.payment()).isEmpty assertThat(webhookEvent.payStatement()).contains(payStatement) } + + @Test + fun ofPayStatementRoundtrip() { + val jsonMapper = jsonMapper() + val webhookEvent = + WebhookEvent.ofPayStatement( + PayStatementEvent.builder() + .accountId("account_id") + .companyId("company_id") + .connectionId("connection_id") + .data( + PayStatementEvent.Data.builder() + .individualId("individual_id") + .paymentId("payment_id") + .build() + ) + .eventType(PayStatementEvent.EventType.PAY_STATEMENT_CREATED) + .build() + ) + + val roundtrippedWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(webhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedWebhookEvent).isEqualTo(webhookEvent) + } + + enum class IncompatibleJsonShapeTestCase(val value: JsonValue) { + BOOLEAN(JsonValue.from(false)), + STRING(JsonValue.from("invalid")), + INTEGER(JsonValue.from(-1)), + FLOAT(JsonValue.from(3.14)), + ARRAY(JsonValue.from(listOf("invalid", "array"))), + } + + @ParameterizedTest + @EnumSource + fun incompatibleJsonShapeDeserializesToUnknown(testCase: IncompatibleJsonShapeTestCase) { + val webhookEvent = jsonMapper().convertValue(testCase.value, jacksonTypeRef()) + + val e = assertThrows { webhookEvent.validate() } + assertThat(e).hasMessageStartingWith("Unknown ") + } } From c7265b7fec4baacc24dba2415a9bb734731a46e3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Apr 2025 14:13:03 +0000 Subject: [PATCH 52/65] feat(client): make datetime deserialization more lenient (#522) --- .../com/tryfinch/api/core/ObjectMappers.kt | 64 ++++++++++++++++++- .../tryfinch/api/core/ObjectMappersTest.kt | 21 ++++++ 2 files changed, 83 insertions(+), 2 deletions(-) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt index 6054a8c1..67e2acb4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ObjectMappers.kt @@ -4,12 +4,16 @@ package com.tryfinch.api.core import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.JsonParseException +import com.fasterxml.jackson.core.JsonParser +import com.fasterxml.jackson.databind.DeserializationContext import com.fasterxml.jackson.databind.DeserializationFeature import com.fasterxml.jackson.databind.MapperFeature import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.cfg.CoercionAction import com.fasterxml.jackson.databind.cfg.CoercionInputShape +import com.fasterxml.jackson.databind.deser.std.StdDeserializer import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.databind.module.SimpleModule import com.fasterxml.jackson.databind.type.LogicalType @@ -17,13 +21,23 @@ import com.fasterxml.jackson.datatype.jdk8.Jdk8Module import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule import com.fasterxml.jackson.module.kotlin.kotlinModule import java.io.InputStream +import java.time.DateTimeException +import java.time.LocalDate +import java.time.LocalDateTime +import java.time.ZonedDateTime +import java.time.format.DateTimeFormatter +import java.time.temporal.ChronoField fun jsonMapper(): JsonMapper = JsonMapper.builder() .addModule(kotlinModule()) .addModule(Jdk8Module()) .addModule(JavaTimeModule()) - .addModule(SimpleModule().addSerializer(InputStreamJsonSerializer)) + .addModule( + SimpleModule() + .addSerializer(InputStreamSerializer) + .addDeserializer(LocalDateTime::class.java, LenientLocalDateTimeDeserializer()) + ) .withCoercionConfig(LogicalType.Boolean) { it.setCoercion(CoercionInputShape.Integer, CoercionAction.Fail) .setCoercion(CoercionInputShape.Float, CoercionAction.Fail) @@ -91,7 +105,10 @@ fun jsonMapper(): JsonMapper = .disable(MapperFeature.AUTO_DETECT_SETTERS) .build() -private object InputStreamJsonSerializer : BaseSerializer(InputStream::class) { +/** A serializer that serializes [InputStream] to bytes. */ +private object InputStreamSerializer : BaseSerializer(InputStream::class) { + + private fun readResolve(): Any = InputStreamSerializer override fun serialize( value: InputStream?, @@ -105,3 +122,46 @@ private object InputStreamJsonSerializer : BaseSerializer(InputStre } } } + +/** + * A deserializer that can deserialize [LocalDateTime] from datetimes, dates, and zoned datetimes. + */ +private class LenientLocalDateTimeDeserializer : + StdDeserializer(LocalDateTime::class.java) { + + companion object { + + private val DATE_TIME_FORMATTERS = + listOf( + DateTimeFormatter.ISO_LOCAL_DATE_TIME, + DateTimeFormatter.ISO_LOCAL_DATE, + DateTimeFormatter.ISO_ZONED_DATE_TIME, + ) + } + + override fun logicalType(): LogicalType = LogicalType.DateTime + + override fun deserialize(p: JsonParser, context: DeserializationContext?): LocalDateTime { + val exceptions = mutableListOf() + + for (formatter in DATE_TIME_FORMATTERS) { + try { + val temporal = formatter.parse(p.text) + + return when { + !temporal.isSupported(ChronoField.HOUR_OF_DAY) -> + LocalDate.from(temporal).atStartOfDay() + !temporal.isSupported(ChronoField.OFFSET_SECONDS) -> + LocalDateTime.from(temporal) + else -> ZonedDateTime.from(temporal).toLocalDateTime() + } + } catch (e: DateTimeException) { + exceptions.add(e) + } + } + + throw JsonParseException(p, "Cannot parse `LocalDateTime` from value: ${p.text}").apply { + exceptions.forEach { addSuppressed(it) } + } + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/core/ObjectMappersTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/ObjectMappersTest.kt index a2ccffc2..75309d20 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/core/ObjectMappersTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/ObjectMappersTest.kt @@ -2,10 +2,15 @@ package com.tryfinch.api.core import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.exc.MismatchedInputException +import com.fasterxml.jackson.module.kotlin.readValue +import java.time.LocalDateTime import kotlin.reflect.KClass import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.catchThrowable import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertDoesNotThrow +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.EnumSource import org.junitpioneer.jupiter.cartesian.CartesianTest internal class ObjectMappersTest { @@ -78,4 +83,20 @@ internal class ObjectMappersTest { assertThat(e).isInstanceOf(MismatchedInputException::class.java) } } + + enum class LenientLocalDateTimeTestCase(val string: String) { + DATE("1998-04-21"), + DATE_TIME("1998-04-21T04:00:00"), + ZONED_DATE_TIME_1("1998-04-21T04:00:00+03:00"), + ZONED_DATE_TIME_2("1998-04-21T04:00:00Z"), + } + + @ParameterizedTest + @EnumSource + fun readLocalDateTime_lenient(testCase: LenientLocalDateTimeTestCase) { + val jsonMapper = jsonMapper() + val json = jsonMapper.writeValueAsString(testCase.string) + + assertDoesNotThrow { jsonMapper().readValue(json) } + } } From 842bb3fa15300004eea197bb5a8f57365f1eee78 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Apr 2025 16:22:40 +0000 Subject: [PATCH 53/65] feat(api): api update (#523) --- .stats.yml | 4 +- .../tryfinch/api/models/BenefitFrequency.kt | 1 + .../com/tryfinch/api/models/CompanyBenefit.kt | 6 + .../models/CreateCompanyBenefitsResponse.kt | 3 + .../tryfinch/api/models/EnrolledIndividual.kt | 4 +- .../api/models/HrisBenefitCreateParams.kt | 6 + .../HrisBenefitIndividualUnenrollManyPage.kt | 26 +- ...sBenefitIndividualUnenrollManyPageAsync.kt | 28 +- .../models/IndividualEnrolledIdsResponse.kt | 3 + .../models/IndividualUnenrollManyResponse.kt | 120 +++++ .../api/models/UnenrolledIndividual.kt | 443 ------------------ .../models/UpdateCompanyBenefitResponse.kt | 3 + .../benefits/IndividualServiceAsyncImpl.kt | 6 +- .../hris/benefits/IndividualServiceImpl.kt | 6 +- .../tryfinch/api/models/CompanyBenefitTest.kt | 6 +- .../CreateCompanyBenefitsResponseTest.kt | 11 +- .../IndividualEnrolledIdsResponseTest.kt | 14 +- .../IndividualUnenrollManyResponseTest.kt | 31 ++ .../api/models/UnenrolledIndividualTest.kt | 63 --- .../UpdateCompanyBenefitResponseTest.kt | 11 +- 20 files changed, 241 insertions(+), 554 deletions(-) create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUnenrollManyResponse.kt delete mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUnenrollManyResponseTest.kt delete mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt diff --git a/.stats.yml b/.stats.yml index 98472e0a..999c5524 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-df94542d153a8558bbe63b273e8d6ae79f46b8d81df1ebeeacd07fee6f9ee22a.yml -openapi_spec_hash: aeb92e382ee0a9b86e2ba39e54cdfe9a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-972e563922dedeeb94dca9a3ca8bac536488fcee56b55fcf09e6af044d3740e3.yml +openapi_spec_hash: 08b86ecbec3323717d48e4aaee48ed54 config_hash: 8303e755d3e16cf28542d5f0aec83851 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFrequency.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFrequency.kt index 01ffb309..0d37a391 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFrequency.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFrequency.kt @@ -7,6 +7,7 @@ import com.tryfinch.api.core.Enum import com.tryfinch.api.core.JsonField import com.tryfinch.api.errors.FinchInvalidDataException +/** The frequency of the benefit deduction/contribution. */ class BenefitFrequency @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt index f1c411cb..2b324216 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt @@ -39,6 +39,8 @@ private constructor( ) : this(benefitId, description, frequency, type, mutableMapOf()) /** + * The id of the benefit. + * * @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). */ @@ -52,6 +54,8 @@ private constructor( Optional.ofNullable(description.getNullable("description")) /** + * The frequency of the benefit deduction/contribution. + * * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ @@ -142,6 +146,7 @@ private constructor( additionalProperties = companyBenefit.additionalProperties.toMutableMap() } + /** The id of the benefit. */ fun benefitId(benefitId: String) = benefitId(JsonField.of(benefitId)) /** @@ -167,6 +172,7 @@ private constructor( */ fun description(description: JsonField) = apply { this.description = description } + /** The frequency of the benefit deduction/contribution. */ fun frequency(frequency: BenefitFrequency?) = frequency(JsonField.ofNullable(frequency)) /** Alias for calling [Builder.frequency] with `frequency.orElse(null)`. */ 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 abd10a3f..16e0501e 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 @@ -27,6 +27,8 @@ private constructor( ) : this(benefitId, mutableMapOf()) /** + * The id of the benefit. + * * @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). */ @@ -77,6 +79,7 @@ private constructor( additionalProperties = createCompanyBenefitsResponse.additionalProperties.toMutableMap() } + /** The id of the benefit. */ fun benefitId(benefitId: String) = benefitId(JsonField.of(benefitId)) /** 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 index 6c7df11f..1672c09e 100644 --- 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 @@ -224,7 +224,7 @@ private constructor( ) : this(finchCode, message, name, mutableMapOf()) /** - * A descriptive identifier for the response + * 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). @@ -302,7 +302,7 @@ private constructor( additionalProperties = body.additionalProperties.toMutableMap() } - /** A descriptive identifier for the response */ + /** A descriptive identifier for the response. */ fun finchCode(finchCode: String?) = finchCode(JsonField.ofNullable(finchCode)) /** Alias for calling [Builder.finchCode] with `finchCode.orElse(null)`. */ diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt index d8c5bfe2..927c9fa4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt @@ -40,6 +40,8 @@ private constructor( fun description(): Optional = body.description() /** + * The frequency of the benefit deduction/contribution. + * * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ @@ -119,6 +121,7 @@ private constructor( */ fun description(description: JsonField) = apply { body.description(description) } + /** The frequency of the benefit deduction/contribution. */ fun frequency(frequency: BenefitFrequency?) = apply { body.frequency(frequency) } /** Alias for calling [Builder.frequency] with `frequency.orElse(null)`. */ @@ -314,6 +317,8 @@ private constructor( Optional.ofNullable(description.getNullable("description")) /** + * The frequency of the benefit deduction/contribution. + * * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ @@ -405,6 +410,7 @@ private constructor( this.description = description } + /** The frequency of the benefit deduction/contribution. */ fun frequency(frequency: BenefitFrequency?) = frequency(JsonField.ofNullable(frequency)) /** Alias for calling [Builder.frequency] with `frequency.orElse(null)`. */ 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 index 0e084d12..6b2a3e67 100644 --- 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 @@ -29,7 +29,7 @@ private constructor( fun response(): Response = response - fun items(): List = response().items() + fun items(): List = response().items() override fun equals(other: Any?): Boolean { if (this === other) { @@ -69,19 +69,21 @@ private constructor( } class Response( - private val items: JsonField>, + private val items: JsonField>, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("items") items: JsonField> = JsonMissing.of() + @JsonProperty("items") + items: JsonField> = JsonMissing.of() ) : this(items, mutableMapOf()) - fun items(): List = items.getNullable("items") ?: listOf() + fun items(): List = items.getNullable("items") ?: listOf() @JsonProperty("items") - fun _items(): Optional>> = Optional.ofNullable(items) + fun _items(): Optional>> = + Optional.ofNullable(items) @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -138,7 +140,7 @@ private constructor( class Builder { - private var items: JsonField> = JsonMissing.of() + private var items: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -147,9 +149,11 @@ private constructor( this.additionalProperties.putAll(page.additionalProperties) } - fun items(items: List) = items(JsonField.of(items)) + fun items(items: List) = items(JsonField.of(items)) - fun items(items: JsonField>) = apply { this.items = items } + fun items(items: JsonField>) = apply { + this.items = items + } fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) @@ -165,9 +169,9 @@ private constructor( } class AutoPager(private val firstPage: HrisBenefitIndividualUnenrollManyPage) : - Iterable { + Iterable { - override fun iterator(): Iterator = iterator { + override fun iterator(): Iterator = iterator { var page = firstPage var index = 0 while (true) { @@ -179,7 +183,7 @@ private constructor( } } - fun stream(): Stream { + 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 index a3e43f1d..9f1bcafb 100644 --- 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 @@ -29,7 +29,7 @@ private constructor( fun response(): Response = response - fun items(): List = response().items() + fun items(): List = response().items() override fun equals(other: Any?): Boolean { if (this === other) { @@ -71,19 +71,21 @@ private constructor( } class Response( - private val items: JsonField>, + private val items: JsonField>, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("items") items: JsonField> = JsonMissing.of() + @JsonProperty("items") + items: JsonField> = JsonMissing.of() ) : this(items, mutableMapOf()) - fun items(): List = items.getNullable("items") ?: listOf() + fun items(): List = items.getNullable("items") ?: listOf() @JsonProperty("items") - fun _items(): Optional>> = Optional.ofNullable(items) + fun _items(): Optional>> = + Optional.ofNullable(items) @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -140,7 +142,7 @@ private constructor( class Builder { - private var items: JsonField> = JsonMissing.of() + private var items: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -149,9 +151,11 @@ private constructor( this.additionalProperties.putAll(page.additionalProperties) } - fun items(items: List) = items(JsonField.of(items)) + fun items(items: List) = items(JsonField.of(items)) - fun items(items: JsonField>) = apply { this.items = items } + fun items(items: JsonField>) = apply { + this.items = items + } fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) @@ -169,11 +173,11 @@ private constructor( class AutoPager(private val firstPage: HrisBenefitIndividualUnenrollManyPageAsync) { fun forEach( - action: Predicate, + action: Predicate, executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( - action: (UnenrolledIndividual) -> Boolean, + action: (IndividualUnenrollManyResponse) -> Boolean, executor: Executor, ): CompletableFuture = thenComposeAsync( @@ -189,8 +193,8 @@ private constructor( .forEach(action::test, executor) } - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() + 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/IndividualEnrolledIdsResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt index 4bf7affd..f7f80b94 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt @@ -34,6 +34,8 @@ private constructor( ) : this(benefitId, individualIds, mutableMapOf()) /** + * The id of the benefit. + * * @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). */ @@ -102,6 +104,7 @@ private constructor( additionalProperties = individualEnrolledIdsResponse.additionalProperties.toMutableMap() } + /** The id of the benefit. */ fun benefitId(benefitId: String) = benefitId(JsonField.of(benefitId)) /** diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUnenrollManyResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUnenrollManyResponse.kt new file mode 100644 index 00000000..f568b3c3 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUnenrollManyResponse.kt @@ -0,0 +1,120 @@ +// 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.tryfinch.api.core.ExcludeMissing +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections +import java.util.Objects + +class IndividualUnenrollManyResponse +private constructor(private val additionalProperties: MutableMap) { + + @JsonCreator private constructor() : this(mutableMapOf()) + + @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 + * [IndividualUnenrollManyResponse]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [IndividualUnenrollManyResponse]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(individualUnenrollManyResponse: IndividualUnenrollManyResponse) = apply { + additionalProperties = + individualUnenrollManyResponse.additionalProperties.toMutableMap() + } + + 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 [IndividualUnenrollManyResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): IndividualUnenrollManyResponse = + IndividualUnenrollManyResponse(additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): IndividualUnenrollManyResponse = apply { + if (validated) { + return@apply + } + + 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 = 0 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is IndividualUnenrollManyResponse && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "IndividualUnenrollManyResponse{additionalProperties=$additionalProperties}" +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt deleted file mode 100644 index 9c35bffe..00000000 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt +++ /dev/null @@ -1,443 +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 java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -class UnenrolledIndividual -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 = Optional.ofNullable(body.getNullable("body")) - - /** - * HTTP status code - * - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun code(): Optional = Optional.ofNullable(code.getNullable("code")) - - /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("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 [UnenrolledIndividual]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [UnenrolledIndividual]. */ - 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(unenrolledIndividual: UnenrolledIndividual) = apply { - body = unenrolledIndividual.body - code = unenrolledIndividual.code - individualId = unenrolledIndividual.individualId - additionalProperties = unenrolledIndividual.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 */ - fun code(code: Long) = code(JsonField.of(code)) - - /** - * Sets [Builder.code] to an arbitrary JSON value. - * - * You should usually call [Builder.code] with a well-typed [Long] 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 [UnenrolledIndividual]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): UnenrolledIndividual = - UnenrolledIndividual(body, code, individualId, additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - fun validate(): UnenrolledIndividual = apply { - if (validated) { - return@apply - } - - body().ifPresent { it.validate() } - code() - 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) + - (if (code.asKnown().isPresent) 1 else 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 = Optional.ofNullable(finchCode.getNullable("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 = Optional.ofNullable(message.getNullable("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 = Optional.ofNullable(name.getNullable("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}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is UnenrolledIndividual && 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() = - "UnenrolledIndividual{body=$body, code=$code, individualId=$individualId, additionalProperties=$additionalProperties}" -} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt index 4ac16ead..fc71a1bc 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt @@ -27,6 +27,8 @@ private constructor( ) : this(benefitId, mutableMapOf()) /** + * The id of the benefit. + * * @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). */ @@ -76,6 +78,7 @@ private constructor( additionalProperties = updateCompanyBenefitResponse.additionalProperties.toMutableMap() } + /** The id of the benefit. */ fun benefitId(benefitId: String) = benefitId(JsonField.of(benefitId)) /** diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt index 3c10a2e7..600a881e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt @@ -22,7 +22,7 @@ import com.tryfinch.api.models.HrisBenefitIndividualUnenrollManyPageAsync import com.tryfinch.api.models.HrisBenefitIndividualUnenrollManyParams import com.tryfinch.api.models.IndividualBenefit import com.tryfinch.api.models.IndividualEnrolledIdsResponse -import com.tryfinch.api.models.UnenrolledIndividual +import com.tryfinch.api.models.IndividualUnenrollManyResponse import java.util.concurrent.CompletableFuture class IndividualServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -130,8 +130,8 @@ class IndividualServiceAsyncImpl internal constructor(private val clientOptions: } } - private val unenrollManyHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + private val unenrollManyHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) .withErrorHandler(errorHandler) override fun unenrollMany( diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt index 34bf610b..a7e80361 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt @@ -22,7 +22,7 @@ import com.tryfinch.api.models.HrisBenefitIndividualUnenrollManyPage import com.tryfinch.api.models.HrisBenefitIndividualUnenrollManyParams import com.tryfinch.api.models.IndividualBenefit import com.tryfinch.api.models.IndividualEnrolledIdsResponse -import com.tryfinch.api.models.UnenrolledIndividual +import com.tryfinch.api.models.IndividualUnenrollManyResponse class IndividualServiceImpl internal constructor(private val clientOptions: ClientOptions) : IndividualService { @@ -122,8 +122,8 @@ class IndividualServiceImpl internal constructor(private val clientOptions: Clie } } - private val unenrollManyHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + private val unenrollManyHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) .withErrorHandler(errorHandler) override fun unenrollMany( diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyBenefitTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyBenefitTest.kt index 5f682053..b4ec445b 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyBenefitTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyBenefitTest.kt @@ -13,13 +13,13 @@ internal class CompanyBenefitTest { fun create() { val companyBenefit = CompanyBenefit.builder() - .benefitId("benefit_id") + .benefitId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .description("description") .frequency(BenefitFrequency.ONE_TIME) .type(BenefitType._401K) .build() - assertThat(companyBenefit.benefitId()).isEqualTo("benefit_id") + assertThat(companyBenefit.benefitId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(companyBenefit.description()).contains("description") assertThat(companyBenefit.frequency()).contains(BenefitFrequency.ONE_TIME) assertThat(companyBenefit.type()).contains(BenefitType._401K) @@ -30,7 +30,7 @@ internal class CompanyBenefitTest { val jsonMapper = jsonMapper() val companyBenefit = CompanyBenefit.builder() - .benefitId("benefit_id") + .benefitId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .description("description") .frequency(BenefitFrequency.ONE_TIME) .type(BenefitType._401K) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponseTest.kt index 8cb64499..ea9b034c 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponseTest.kt @@ -12,16 +12,21 @@ internal class CreateCompanyBenefitsResponseTest { @Test fun create() { val createCompanyBenefitsResponse = - CreateCompanyBenefitsResponse.builder().benefitId("benefit_id").build() + CreateCompanyBenefitsResponse.builder() + .benefitId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() - assertThat(createCompanyBenefitsResponse.benefitId()).isEqualTo("benefit_id") + assertThat(createCompanyBenefitsResponse.benefitId()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") } @Test fun roundtrip() { val jsonMapper = jsonMapper() val createCompanyBenefitsResponse = - CreateCompanyBenefitsResponse.builder().benefitId("benefit_id").build() + CreateCompanyBenefitsResponse.builder() + .benefitId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() val roundtrippedCreateCompanyBenefitsResponse = jsonMapper.readValue( diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponseTest.kt index c5f716cc..5267cd8e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponseTest.kt @@ -13,12 +13,14 @@ internal class IndividualEnrolledIdsResponseTest { fun create() { val individualEnrolledIdsResponse = IndividualEnrolledIdsResponse.builder() - .benefitId("benefit_id") - .addIndividualId("string") + .benefitId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addIndividualId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() - assertThat(individualEnrolledIdsResponse.benefitId()).isEqualTo("benefit_id") - assertThat(individualEnrolledIdsResponse.individualIds()).containsExactly("string") + assertThat(individualEnrolledIdsResponse.benefitId()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(individualEnrolledIdsResponse.individualIds()) + .containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") } @Test @@ -26,8 +28,8 @@ internal class IndividualEnrolledIdsResponseTest { val jsonMapper = jsonMapper() val individualEnrolledIdsResponse = IndividualEnrolledIdsResponse.builder() - .benefitId("benefit_id") - .addIndividualId("string") + .benefitId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addIndividualId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() val roundtrippedIndividualEnrolledIdsResponse = diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUnenrollManyResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUnenrollManyResponseTest.kt new file mode 100644 index 00000000..fca952aa --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUnenrollManyResponseTest.kt @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class IndividualUnenrollManyResponseTest { + + @Test + fun create() { + val individualUnenrollManyResponse = IndividualUnenrollManyResponse.builder().build() + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val individualUnenrollManyResponse = IndividualUnenrollManyResponse.builder().build() + + val roundtrippedIndividualUnenrollManyResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(individualUnenrollManyResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedIndividualUnenrollManyResponse) + .isEqualTo(individualUnenrollManyResponse) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt deleted file mode 100644 index 98753d93..00000000 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt +++ /dev/null @@ -1,63 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.tryfinch.api.models - -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.tryfinch.api.core.jsonMapper -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class UnenrolledIndividualTest { - - @Test - fun create() { - val unenrolledIndividual = - UnenrolledIndividual.builder() - .body( - UnenrolledIndividual.Body.builder() - .finchCode("finch_code") - .message("message") - .name("name") - .build() - ) - .code(0L) - .individualId("individual_id") - .build() - - assertThat(unenrolledIndividual.body()) - .contains( - UnenrolledIndividual.Body.builder() - .finchCode("finch_code") - .message("message") - .name("name") - .build() - ) - assertThat(unenrolledIndividual.code()).contains(0L) - assertThat(unenrolledIndividual.individualId()).contains("individual_id") - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val unenrolledIndividual = - UnenrolledIndividual.builder() - .body( - UnenrolledIndividual.Body.builder() - .finchCode("finch_code") - .message("message") - .name("name") - .build() - ) - .code(0L) - .individualId("individual_id") - .build() - - val roundtrippedUnenrolledIndividual = - jsonMapper.readValue( - jsonMapper.writeValueAsString(unenrolledIndividual), - jacksonTypeRef(), - ) - - assertThat(roundtrippedUnenrolledIndividual).isEqualTo(unenrolledIndividual) - } -} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponseTest.kt index 90009f42..dcbaa6e5 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponseTest.kt @@ -12,16 +12,21 @@ internal class UpdateCompanyBenefitResponseTest { @Test fun create() { val updateCompanyBenefitResponse = - UpdateCompanyBenefitResponse.builder().benefitId("benefit_id").build() + UpdateCompanyBenefitResponse.builder() + .benefitId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() - assertThat(updateCompanyBenefitResponse.benefitId()).isEqualTo("benefit_id") + assertThat(updateCompanyBenefitResponse.benefitId()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") } @Test fun roundtrip() { val jsonMapper = jsonMapper() val updateCompanyBenefitResponse = - UpdateCompanyBenefitResponse.builder().benefitId("benefit_id").build() + UpdateCompanyBenefitResponse.builder() + .benefitId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() val roundtrippedUpdateCompanyBenefitResponse = jsonMapper.readValue( From 1b97fe6e3dc9b0e83c9f267fd37e985258b958e5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Apr 2025 20:32:49 +0000 Subject: [PATCH 54/65] feat(client): expose request body setter and getter (#524) --- .../api/models/AccessTokenCreateParams.kt | 14 +++++++++++++- .../api/models/AccountDisconnectParams.kt | 3 +-- .../api/models/ConnectSessionNewParams.kt | 16 +++++++++++++++- .../models/ConnectSessionReauthenticateParams.kt | 14 +++++++++++++- .../api/models/HrisBenefitCreateParams.kt | 13 ++++++++++++- .../HrisBenefitIndividualUnenrollManyParams.kt | 11 ++++++++++- .../api/models/HrisBenefitUpdateParams.kt | 11 ++++++++++- .../models/HrisEmploymentRetrieveManyParams.kt | 11 ++++++++++- .../models/HrisIndividualRetrieveManyParams.kt | 12 +++++++++++- .../models/HrisPayStatementRetrieveManyParams.kt | 11 ++++++++++- .../api/models/JobAutomatedCreateParams.kt | 2 +- .../api/models/RequestForwardingForwardParams.kt | 16 +++++++++++++++- .../api/models/SandboxCompanyUpdateParams.kt | 16 +++++++++++++++- .../SandboxConnectionAccountCreateParams.kt | 14 +++++++++++++- .../SandboxConnectionAccountUpdateParams.kt | 11 ++++++++++- .../api/models/SandboxConnectionCreateParams.kt | 14 +++++++++++++- .../api/models/SandboxDirectoryCreateParams.kt | 3 +-- .../api/models/SandboxEmploymentUpdateParams.kt | 16 +++++++++++++++- .../api/models/SandboxIndividualUpdateParams.kt | 16 +++++++++++++++- .../SandboxJobConfigurationUpdateParams.kt | 2 +- .../api/models/SandboxJobCreateParams.kt | 11 ++++++++++- .../api/models/SandboxPaymentCreateParams.kt | 13 ++++++++++++- 22 files changed, 226 insertions(+), 24 deletions(-) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt index 47aff207..ac18d7b6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt @@ -114,6 +114,18 @@ private constructor( additionalQueryParams = accessTokenCreateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [code] + * - [clientId] + * - [clientSecret] + * - [redirectUri] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + fun code(code: String) = apply { body.code(code) } /** @@ -295,7 +307,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt index c1c81b71..20b1623d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt @@ -182,8 +182,7 @@ private constructor( ) } - @JvmSynthetic - internal fun _body(): Optional> = + fun _body(): Optional> = Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) override fun _headers(): Headers = additionalHeaders diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt index d7b1ec37..5c8047b9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt @@ -187,6 +187,20 @@ private constructor( additionalQueryParams = connectSessionNewParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [customerId] + * - [customerName] + * - [products] + * - [customerEmail] + * - [integration] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + fun customerId(customerId: String) = apply { body.customerId(customerId) } /** @@ -477,7 +491,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt index 412b2a7e..218872b9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt @@ -129,6 +129,18 @@ private constructor( connectSessionReauthenticateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [connectionId] + * - [minutesToExpire] + * - [products] + * - [redirectUri] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** The ID of the existing connection to reauthenticate */ fun connectionId(connectionId: String) = apply { body.connectionId(connectionId) } @@ -346,7 +358,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt index 927c9fa4..28d5da62 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt @@ -106,6 +106,17 @@ private constructor( additionalQueryParams = hrisBenefitCreateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [description] + * - [frequency] + * - [type] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** * Name of the benefit as it appears in the provider and pay statements. Recommend limiting * this to <30 characters due to limitations in specific providers (e.g. Justworks). @@ -281,7 +292,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt index 0cb6b392..d9d1ec1d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt @@ -92,6 +92,15 @@ private constructor( fun benefitId(benefitId: String) = apply { this.benefitId = benefitId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [individualIds] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** Array of individual_ids to unenroll. */ fun individualIds(individualIds: List) = apply { body.individualIds(individualIds) } @@ -251,7 +260,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt index c052e709..9020c9f4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt @@ -84,6 +84,15 @@ private constructor( fun benefitId(benefitId: String) = apply { this.benefitId = benefitId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [description] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** Updated name or description. */ fun description(description: String) = apply { body.description(description) } @@ -234,7 +243,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt index 742efe78..869a198d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt @@ -82,6 +82,15 @@ private constructor( hrisEmploymentRetrieveManyParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [requests] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** The array of batch requests. */ fun requests(requests: List) = apply { body.requests(requests) } @@ -238,7 +247,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt index 329d1cfe..adc6023a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt @@ -90,6 +90,16 @@ private constructor( hrisIndividualRetrieveManyParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [options] + * - [requests] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + fun options(options: Options?) = apply { body.options(options) } /** Alias for calling [Builder.options] with `options.orElse(null)`. */ @@ -251,7 +261,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt index d6f78e32..bbacaaf1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt @@ -87,6 +87,15 @@ private constructor( hrisPayStatementRetrieveManyParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [requests] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** The array of batch requests. */ fun requests(requests: List) = apply { body.requests(requests) } @@ -243,7 +252,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt index e7bbcb87..ac13130c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt @@ -221,7 +221,7 @@ private constructor( JobAutomatedCreateParams(body, additionalHeaders.build(), additionalQueryParams.build()) } - @JvmSynthetic internal fun _body(): Optional = Optional.ofNullable(body) + fun _body(): Optional = Optional.ofNullable(body) override fun _headers(): Headers = additionalHeaders diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt index bbd46d14..8206dfc3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt @@ -130,6 +130,20 @@ private constructor( additionalQueryParams = requestForwardingForwardParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [method] + * - [route] + * - [data] + * - [headers] + * - [params] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** * The HTTP method for the forwarded request. Valid values include: `GET` , `POST` , `PUT` , * `DELETE` , and `PATCH`. @@ -326,7 +340,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt index 316771d9..3563e3b0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt @@ -192,6 +192,20 @@ private constructor( additionalQueryParams = sandboxCompanyUpdateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [accounts] + * - [departments] + * - [ein] + * - [entity] + * - [legalName] + * - etc. + */ + fun body(body: CompanyWithoutId) = apply { this.body = body.toBuilder() } + /** An array of bank account objects associated with the payroll/HRIS system. */ fun accounts(accounts: List?) = apply { body.accounts(accounts) } @@ -486,7 +500,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): CompanyWithoutId = body + fun _body(): CompanyWithoutId = body override fun _headers(): Headers = additionalHeaders diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt index fb6abc67..8814939a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt @@ -129,6 +129,18 @@ private constructor( sandboxConnectionAccountCreateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [companyId] + * - [providerId] + * - [authenticationType] + * - [products] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + fun companyId(companyId: String) = apply { body.companyId(companyId) } /** @@ -327,7 +339,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt index 3dc5df7a..3db0a451 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt @@ -80,6 +80,15 @@ private constructor( sandboxConnectionAccountUpdateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [connectionStatus] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + fun connectionStatus(connectionStatus: ConnectionStatusType) = apply { body.connectionStatus(connectionStatus) } @@ -225,7 +234,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt index c120ff39..435cb20c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt @@ -126,6 +126,18 @@ private constructor( additionalQueryParams = sandboxConnectionCreateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [providerId] + * - [authenticationType] + * - [employeeSize] + * - [products] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** The provider associated with the connection */ fun providerId(providerId: String) = apply { body.providerId(providerId) } @@ -324,7 +336,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt index 27ea1094..a3bcfec2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt @@ -195,8 +195,7 @@ private constructor( ) } - @JvmSynthetic - internal fun _body(): Optional> = Optional.ofNullable(body) + fun _body(): Optional> = Optional.ofNullable(body) override fun _headers(): Headers = additionalHeaders diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt index 2b150e42..2ba0991f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt @@ -341,6 +341,20 @@ private constructor( fun individualId(individualId: String) = apply { this.individualId = individualId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [classCode] + * - [customFields] + * - [department] + * - [employment] + * - [employmentStatus] + * - etc. + */ + fun body(body: EmploymentWithoutId) = apply { this.body = body.toBuilder() } + /** Worker's compensation classification code for this employee */ fun classCode(classCode: String?) = apply { body.classCode(classCode) } @@ -780,7 +794,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): EmploymentWithoutId = body + fun _body(): EmploymentWithoutId = body fun _pathParam(index: Int): String = when (index) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt index f68be860..0267c1d0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt @@ -250,6 +250,20 @@ private constructor( fun individualId(individualId: String) = apply { this.individualId = individualId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [dob] + * - [emails] + * - [encryptedSsn] + * - [ethnicity] + * - [firstName] + * - etc. + */ + fun body(body: IndividualWithoutId) = apply { this.body = body.toBuilder() } + fun dob(dob: String?) = apply { body.dob(dob) } /** Alias for calling [Builder.dob] with `dob.orElse(null)`. */ @@ -592,7 +606,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): IndividualWithoutId = body + fun _body(): IndividualWithoutId = body fun _pathParam(index: Int): String = when (index) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt index c8b6d6f4..bd0c1ba4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt @@ -181,7 +181,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): SandboxJobConfiguration = sandboxJobConfiguration + fun _body(): SandboxJobConfiguration = sandboxJobConfiguration override fun _headers(): Headers = additionalHeaders diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt index e5e87f98..c102b323 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt @@ -78,6 +78,15 @@ private constructor( additionalQueryParams = sandboxJobCreateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [type] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** The type of job to start. Currently the only supported type is `data_sync_all` */ fun type(type: Type) = apply { body.type(type) } @@ -226,7 +235,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt index 5df60293..c38c97ee 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt @@ -101,6 +101,17 @@ private constructor( additionalQueryParams = sandboxPaymentCreateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [endDate] + * - [payStatements] + * - [startDate] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + fun endDate(endDate: String) = apply { body.endDate(endDate) } /** @@ -276,7 +287,7 @@ private constructor( ) } - @JvmSynthetic internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders From 16616bf6a5dab5996375d41d9b8404fb2928ac89 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 3 Apr 2025 18:44:49 +0000 Subject: [PATCH 55/65] perf(client): cached parsed type in `HttpResponseFor` (#525) --- .../main/kotlin/com/tryfinch/api/core/http/HttpResponseFor.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpResponseFor.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpResponseFor.kt index 23f27c4f..94b019b6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpResponseFor.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpResponseFor.kt @@ -11,7 +11,9 @@ interface HttpResponseFor : HttpResponse { internal fun HttpResponse.parseable(parse: () -> T): HttpResponseFor = object : HttpResponseFor { - override fun parse(): T = parse() + private val parsed: T by lazy { parse() } + + override fun parse(): T = parsed override fun statusCode(): Int = this@parseable.statusCode() From 1ab19a34148407ce143df4d49697af386e17f560 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 4 Apr 2025 17:42:58 +0000 Subject: [PATCH 56/65] feat(api): add new endpoints for pay statement items (#526) --- .stats.yml | 4 +- .../HrisCompanyPayStatementItemListPage.kt | 196 +++ ...risCompanyPayStatementItemListPageAsync.kt | 207 +++ .../HrisCompanyPayStatementItemListParams.kt | 427 +++++ ...CompanyPayStatementItemRuleCreateParams.kt | 1462 +++++++++++++++++ ...CompanyPayStatementItemRuleDeleteParams.kt | 239 +++ ...HrisCompanyPayStatementItemRuleListPage.kt | 193 +++ ...ompanyPayStatementItemRuleListPageAsync.kt | 204 +++ ...isCompanyPayStatementItemRuleListParams.kt | 179 ++ ...CompanyPayStatementItemRuleUpdateParams.kt | 378 +++++ .../models/PayStatementItemListResponse.kt | 632 +++++++ .../tryfinch/api/models/RuleCreateResponse.kt | 1224 ++++++++++++++ .../tryfinch/api/models/RuleDeleteResponse.kt | 1264 ++++++++++++++ .../tryfinch/api/models/RuleListResponse.kt | 1224 ++++++++++++++ .../tryfinch/api/models/RuleUpdateResponse.kt | 1224 ++++++++++++++ .../async/hris/CompanyServiceAsync.kt | 5 + .../async/hris/CompanyServiceAsyncImpl.kt | 15 + .../company/PayStatementItemServiceAsync.kt | 88 + .../PayStatementItemServiceAsyncImpl.kt | 91 + .../payStatementItem/RuleServiceAsync.kt | 207 +++ .../payStatementItem/RuleServiceAsyncImpl.kt | 199 +++ .../services/blocking/hris/CompanyService.kt | 5 + .../blocking/hris/CompanyServiceImpl.kt | 14 + .../hris/company/PayStatementItemService.kt | 84 + .../company/PayStatementItemServiceImpl.kt | 87 + .../company/payStatementItem/RuleService.kt | 194 +++ .../payStatementItem/RuleServiceImpl.kt | 183 +++ ...isCompanyPayStatementItemListParamsTest.kt | 56 + ...anyPayStatementItemRuleCreateParamsTest.kt | 99 ++ ...anyPayStatementItemRuleDeleteParamsTest.kt | 23 + ...mpanyPayStatementItemRuleListParamsTest.kt | 13 + ...anyPayStatementItemRuleUpdateParamsTest.kt | 47 + .../PayStatementItemListResponseTest.kt | 68 + .../api/models/RuleCreateResponseTest.kt | 112 ++ .../api/models/RuleDeleteResponseTest.kt | 116 ++ .../api/models/RuleListResponseTest.kt | 112 ++ .../api/models/RuleUpdateResponseTest.kt | 112 ++ .../PayStatementItemServiceAsyncTest.kt | 27 + .../payStatementItem/RuleServiceAsyncTest.kt | 114 ++ .../company/PayStatementItemServiceTest.kt | 26 + .../payStatementItem/RuleServiceTest.kt | 110 ++ 41 files changed, 11262 insertions(+), 2 deletions(-) create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPage.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPageAsync.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListParams.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleCreateParams.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleDeleteParams.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPage.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPageAsync.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListParams.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleUpdateParams.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementItemListResponse.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleCreateResponse.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleDeleteResponse.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleListResponse.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleUpdateResponse.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/PayStatementItemServiceAsync.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/PayStatementItemServiceAsyncImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/payStatementItem/RuleServiceAsync.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/payStatementItem/RuleServiceAsyncImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/PayStatementItemService.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/PayStatementItemServiceImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/payStatementItem/RuleService.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/payStatementItem/RuleServiceImpl.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListParamsTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleCreateParamsTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleDeleteParamsTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListParamsTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleUpdateParamsTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementItemListResponseTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/RuleCreateResponseTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/RuleDeleteResponseTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/RuleListResponseTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/RuleUpdateResponseTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/company/PayStatementItemServiceAsyncTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/company/payStatementItem/RuleServiceAsyncTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/company/PayStatementItemServiceTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/company/payStatementItem/RuleServiceTest.kt diff --git a/.stats.yml b/.stats.yml index 999c5524..aaf67d93 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 40 +configured_endpoints: 45 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-972e563922dedeeb94dca9a3ca8bac536488fcee56b55fcf09e6af044d3740e3.yml openapi_spec_hash: 08b86ecbec3323717d48e4aaee48ed54 -config_hash: 8303e755d3e16cf28542d5f0aec83851 +config_hash: b839955f81dcf0a060366274f202b185 diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPage.kt new file mode 100644 index 00000000..7541eeb6 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPage.kt @@ -0,0 +1,196 @@ +// 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.company.PayStatementItemService +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 + +/** + * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical + * support will be added soon Retrieve a list of detailed pay statement items for the access token's + * connection account. + */ +class HrisCompanyPayStatementItemListPage +private constructor( + private val payStatementItemService: PayStatementItemService, + private val params: HrisCompanyPayStatementItemListParams, + private val response: Response, +) { + + fun response(): Response = response + + fun responses(): List = response().responses() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisCompanyPayStatementItemListPage && payStatementItemService == other.payStatementItemService && params == other.params && response == other.response /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(payStatementItemService, params, response) /* spotless:on */ + + override fun toString() = + "HrisCompanyPayStatementItemListPage{payStatementItemService=$payStatementItemService, params=$params, response=$response}" + + fun hasNextPage(): Boolean { + return !responses().isEmpty() + } + + fun getNextPageParams(): Optional { + return Optional.empty() + } + + fun getNextPage(): Optional { + return getNextPageParams().map { payStatementItemService.list(it) } + } + + fun autoPager(): AutoPager = AutoPager(this) + + companion object { + + @JvmStatic + fun of( + payStatementItemService: PayStatementItemService, + params: HrisCompanyPayStatementItemListParams, + response: Response, + ) = HrisCompanyPayStatementItemListPage(payStatementItemService, params, response) + } + + class Response( + private val responses: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("responses") + responses: JsonField> = JsonMissing.of() + ) : this(responses, mutableMapOf()) + + fun responses(): List = + responses.getNullable("responses") ?: listOf() + + @JsonProperty("responses") + fun _responses(): Optional>> = + Optional.ofNullable(responses) + + @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 + } + + responses().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 && responses == other.responses && additionalProperties == other.additionalProperties /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(responses, additionalProperties) /* spotless:on */ + + override fun toString() = + "Response{responses=$responses, additionalProperties=$additionalProperties}" + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [HrisCompanyPayStatementItemListPage]. + */ + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var responses: JsonField> = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(page: Response) = apply { + this.responses = page.responses + this.additionalProperties.putAll(page.additionalProperties) + } + + fun responses(responses: List) = + responses(JsonField.of(responses)) + + fun responses(responses: JsonField>) = apply { + this.responses = responses + } + + 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(responses, additionalProperties.toMutableMap()) + } + } + + class AutoPager(private val firstPage: HrisCompanyPayStatementItemListPage) : + Iterable { + + override fun iterator(): Iterator = iterator { + var page = firstPage + var index = 0 + while (true) { + while (index < page.responses().size) { + yield(page.responses()[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/HrisCompanyPayStatementItemListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPageAsync.kt new file mode 100644 index 00000000..d4bb97a8 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPageAsync.kt @@ -0,0 +1,207 @@ +// 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.company.PayStatementItemServiceAsync +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 + +/** + * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical + * support will be added soon Retrieve a list of detailed pay statement items for the access token's + * connection account. + */ +class HrisCompanyPayStatementItemListPageAsync +private constructor( + private val payStatementItemService: PayStatementItemServiceAsync, + private val params: HrisCompanyPayStatementItemListParams, + private val response: Response, +) { + + fun response(): Response = response + + fun responses(): List = response().responses() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisCompanyPayStatementItemListPageAsync && payStatementItemService == other.payStatementItemService && params == other.params && response == other.response /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(payStatementItemService, params, response) /* spotless:on */ + + override fun toString() = + "HrisCompanyPayStatementItemListPageAsync{payStatementItemService=$payStatementItemService, params=$params, response=$response}" + + fun hasNextPage(): Boolean { + return !responses().isEmpty() + } + + fun getNextPageParams(): Optional { + return Optional.empty() + } + + fun getNextPage(): CompletableFuture> { + return getNextPageParams() + .map { payStatementItemService.list(it).thenApply { Optional.of(it) } } + .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + } + + fun autoPager(): AutoPager = AutoPager(this) + + companion object { + + @JvmStatic + fun of( + payStatementItemService: PayStatementItemServiceAsync, + params: HrisCompanyPayStatementItemListParams, + response: Response, + ) = HrisCompanyPayStatementItemListPageAsync(payStatementItemService, params, response) + } + + class Response( + private val responses: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("responses") + responses: JsonField> = JsonMissing.of() + ) : this(responses, mutableMapOf()) + + fun responses(): List = + responses.getNullable("responses") ?: listOf() + + @JsonProperty("responses") + fun _responses(): Optional>> = + Optional.ofNullable(responses) + + @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 + } + + responses().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 && responses == other.responses && additionalProperties == other.additionalProperties /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(responses, additionalProperties) /* spotless:on */ + + override fun toString() = + "Response{responses=$responses, additionalProperties=$additionalProperties}" + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [HrisCompanyPayStatementItemListPageAsync]. + */ + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var responses: JsonField> = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(page: Response) = apply { + this.responses = page.responses + this.additionalProperties.putAll(page.additionalProperties) + } + + fun responses(responses: List) = + responses(JsonField.of(responses)) + + fun responses(responses: JsonField>) = apply { + this.responses = responses + } + + 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(responses, additionalProperties.toMutableMap()) + } + } + + class AutoPager(private val firstPage: HrisCompanyPayStatementItemListPageAsync) { + + fun forEach( + action: Predicate, + executor: Executor, + ): CompletableFuture { + fun CompletableFuture>.forEach( + action: (PayStatementItemListResponse) -> Boolean, + executor: Executor, + ): CompletableFuture = + thenComposeAsync( + { page -> + page + .filter { it.responses().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/HrisCompanyPayStatementItemListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListParams.kt new file mode 100644 index 00000000..5c38f85d --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListParams.kt @@ -0,0 +1,427 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.fasterxml.jackson.annotation.JsonCreator +import com.tryfinch.api.core.Enum +import com.tryfinch.api.core.JsonField +import com.tryfinch.api.core.Params +import com.tryfinch.api.core.http.Headers +import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException +import java.time.LocalDate +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical + * support will be added soon Retrieve a list of detailed pay statement items for the access token's + * connection account. + */ +class HrisCompanyPayStatementItemListParams +private constructor( + private val categories: List?, + private val endDate: LocalDate?, + private val name: String?, + private val startDate: LocalDate?, + private val type: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * Comma-delimited list of pay statement item categories to filter on. If empty, defaults to all + * categories. + */ + fun categories(): Optional> = Optional.ofNullable(categories) + + /** + * The end date to retrieve pay statement items by via their last seen pay date in `YYYY-MM-DD` + * format. + */ + fun endDate(): Optional = Optional.ofNullable(endDate) + + /** Case-insensitive partial match search by pay statement item name. */ + fun name(): Optional = Optional.ofNullable(name) + + /** + * The start date to retrieve pay statement items by via their last seen pay date (inclusive) in + * `YYYY-MM-DD` format. + */ + fun startDate(): Optional = Optional.ofNullable(startDate) + + /** String search by pay statement item type. */ + fun type(): Optional = Optional.ofNullable(type) + + fun _additionalHeaders(): Headers = additionalHeaders + + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): HrisCompanyPayStatementItemListParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of + * [HrisCompanyPayStatementItemListParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HrisCompanyPayStatementItemListParams]. */ + class Builder internal constructor() { + + private var categories: MutableList? = null + private var endDate: LocalDate? = null + private var name: String? = null + private var startDate: LocalDate? = null + private var type: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from( + hrisCompanyPayStatementItemListParams: HrisCompanyPayStatementItemListParams + ) = apply { + categories = hrisCompanyPayStatementItemListParams.categories?.toMutableList() + endDate = hrisCompanyPayStatementItemListParams.endDate + name = hrisCompanyPayStatementItemListParams.name + startDate = hrisCompanyPayStatementItemListParams.startDate + type = hrisCompanyPayStatementItemListParams.type + additionalHeaders = hrisCompanyPayStatementItemListParams.additionalHeaders.toBuilder() + additionalQueryParams = + hrisCompanyPayStatementItemListParams.additionalQueryParams.toBuilder() + } + + /** + * Comma-delimited list of pay statement item categories to filter on. If empty, defaults to + * all categories. + */ + fun categories(categories: List?) = apply { + this.categories = categories?.toMutableList() + } + + /** Alias for calling [Builder.categories] with `categories.orElse(null)`. */ + fun categories(categories: Optional>) = categories(categories.getOrNull()) + + /** + * Adds a single [Category] to [categories]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addCategory(category: Category) = apply { + categories = (categories ?: mutableListOf()).apply { add(category) } + } + + /** + * The end date to retrieve pay statement items by via their last seen pay date in + * `YYYY-MM-DD` format. + */ + fun endDate(endDate: LocalDate?) = apply { this.endDate = endDate } + + /** Alias for calling [Builder.endDate] with `endDate.orElse(null)`. */ + fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) + + /** Case-insensitive partial match search by pay statement item name. */ + fun name(name: String?) = apply { this.name = name } + + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ + fun name(name: Optional) = name(name.getOrNull()) + + /** + * The start date to retrieve pay statement items by via their last seen pay date + * (inclusive) in `YYYY-MM-DD` format. + */ + fun startDate(startDate: LocalDate?) = apply { this.startDate = startDate } + + /** Alias for calling [Builder.startDate] with `startDate.orElse(null)`. */ + fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) + + /** String search by pay statement item type. */ + fun type(type: String?) = apply { this.type = type } + + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ + fun type(type: Optional) = type(type.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [HrisCompanyPayStatementItemListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): HrisCompanyPayStatementItemListParams = + HrisCompanyPayStatementItemListParams( + categories?.toImmutable(), + endDate, + name, + startDate, + type, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + categories?.forEach { put("categories[]", it.toString()) } + endDate?.let { put("end_date", it.toString()) } + name?.let { put("name", it) } + startDate?.let { put("start_date", it.toString()) } + type?.let { put("type", it) } + putAll(additionalQueryParams) + } + .build() + + class Category @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 EARNINGS = of("earnings") + + @JvmField val TAXES = of("taxes") + + @JvmField val EMPLOYEE_DEDUCTIONS = of("employee_deductions") + + @JvmField val EMPLOYER_CONTRIBUTIONS = of("employer_contributions") + + @JvmStatic fun of(value: String) = Category(JsonField.of(value)) + } + + /** An enum containing [Category]'s known values. */ + enum class Known { + EARNINGS, + TAXES, + EMPLOYEE_DEDUCTIONS, + EMPLOYER_CONTRIBUTIONS, + } + + /** + * An enum containing [Category]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Category] 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 { + EARNINGS, + TAXES, + EMPLOYEE_DEDUCTIONS, + EMPLOYER_CONTRIBUTIONS, + /** An enum member indicating that [Category] 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) { + EARNINGS -> Value.EARNINGS + TAXES -> Value.TAXES + EMPLOYEE_DEDUCTIONS -> Value.EMPLOYEE_DEDUCTIONS + EMPLOYER_CONTRIBUTIONS -> Value.EMPLOYER_CONTRIBUTIONS + 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) { + EARNINGS -> Known.EARNINGS + TAXES -> Known.TAXES + EMPLOYEE_DEDUCTIONS -> Known.EMPLOYEE_DEDUCTIONS + EMPLOYER_CONTRIBUTIONS -> Known.EMPLOYER_CONTRIBUTIONS + else -> throw FinchInvalidDataException("Unknown Category: $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(): Category = 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 Category && 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 HrisCompanyPayStatementItemListParams && categories == other.categories && endDate == other.endDate && name == other.name && startDate == other.startDate && type == other.type && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(categories, endDate, name, startDate, type, additionalHeaders, additionalQueryParams) /* spotless:on */ + + override fun toString() = + "HrisCompanyPayStatementItemListParams{categories=$categories, endDate=$endDate, name=$name, startDate=$startDate, type=$type, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleCreateParams.kt new file mode 100644 index 00000000..ed6a75ad --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleCreateParams.kt @@ -0,0 +1,1462 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.tryfinch.api.core.Enum +import com.tryfinch.api.core.ExcludeMissing +import com.tryfinch.api.core.JsonField +import com.tryfinch.api.core.JsonMissing +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.Params +import com.tryfinch.api.core.checkKnown +import com.tryfinch.api.core.http.Headers +import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical + * support will be added soon Custom rules can be created to associate specific attributes to pay + * statement items depending on the use case. For example, pay statement items that meet certain + * conditions can be labeled as a pre-tax 401k. This metadata can be retrieved where pay statement + * item information is available. + */ +class HrisCompanyPayStatementItemRuleCreateParams +private constructor( + private val body: CreateRuleRequest, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * Specifies the fields to be applied when the condition is met. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun attributes(): Optional = body.attributes() + + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun conditions(): Optional> = body.conditions() + + /** + * Specifies when the rules should stop applying rules based on the date. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun effectiveEndDate(): Optional = body.effectiveEndDate() + + /** + * Specifies when the rule should begin applying based on the date. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun effectiveStartDate(): Optional = body.effectiveStartDate() + + /** + * The entity type to which the rule is applied. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun entityType(): Optional = body.entityType() + + /** + * Returns the raw JSON value of [attributes]. + * + * Unlike [attributes], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _attributes(): JsonField = body._attributes() + + /** + * Returns the raw JSON value of [conditions]. + * + * Unlike [conditions], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _conditions(): JsonField> = body._conditions() + + /** + * Returns the raw JSON value of [effectiveEndDate]. + * + * Unlike [effectiveEndDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _effectiveEndDate(): JsonField = body._effectiveEndDate() + + /** + * Returns the raw JSON value of [effectiveStartDate]. + * + * Unlike [effectiveStartDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _effectiveStartDate(): JsonField = body._effectiveStartDate() + + /** + * Returns the raw JSON value of [entityType]. + * + * Unlike [entityType], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _entityType(): JsonField = body._entityType() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + fun _additionalHeaders(): Headers = additionalHeaders + + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): HrisCompanyPayStatementItemRuleCreateParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of + * [HrisCompanyPayStatementItemRuleCreateParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HrisCompanyPayStatementItemRuleCreateParams]. */ + class Builder internal constructor() { + + private var body: CreateRuleRequest.Builder = CreateRuleRequest.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from( + hrisCompanyPayStatementItemRuleCreateParams: HrisCompanyPayStatementItemRuleCreateParams + ) = apply { + body = hrisCompanyPayStatementItemRuleCreateParams.body.toBuilder() + additionalHeaders = + hrisCompanyPayStatementItemRuleCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = + hrisCompanyPayStatementItemRuleCreateParams.additionalQueryParams.toBuilder() + } + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [attributes] + * - [conditions] + * - [effectiveEndDate] + * - [effectiveStartDate] + * - [entityType] + * - etc. + */ + fun body(body: CreateRuleRequest) = apply { this.body = body.toBuilder() } + + /** Specifies the fields to be applied when the condition is met. */ + fun attributes(attributes: Attributes) = apply { body.attributes(attributes) } + + /** + * Sets [Builder.attributes] to an arbitrary JSON value. + * + * You should usually call [Builder.attributes] with a well-typed [Attributes] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun attributes(attributes: JsonField) = apply { body.attributes(attributes) } + + fun conditions(conditions: List) = apply { body.conditions(conditions) } + + /** + * Sets [Builder.conditions] to an arbitrary JSON value. + * + * You should usually call [Builder.conditions] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun conditions(conditions: JsonField>) = apply { + body.conditions(conditions) + } + + /** + * Adds a single [Condition] to [conditions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addCondition(condition: Condition) = apply { body.addCondition(condition) } + + /** Specifies when the rules should stop applying rules based on the date. */ + fun effectiveEndDate(effectiveEndDate: String?) = apply { + body.effectiveEndDate(effectiveEndDate) + } + + /** Alias for calling [Builder.effectiveEndDate] with `effectiveEndDate.orElse(null)`. */ + fun effectiveEndDate(effectiveEndDate: Optional) = + effectiveEndDate(effectiveEndDate.getOrNull()) + + /** + * Sets [Builder.effectiveEndDate] to an arbitrary JSON value. + * + * You should usually call [Builder.effectiveEndDate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun effectiveEndDate(effectiveEndDate: JsonField) = apply { + body.effectiveEndDate(effectiveEndDate) + } + + /** Specifies when the rule should begin applying based on the date. */ + fun effectiveStartDate(effectiveStartDate: String?) = apply { + body.effectiveStartDate(effectiveStartDate) + } + + /** + * Alias for calling [Builder.effectiveStartDate] with `effectiveStartDate.orElse(null)`. + */ + fun effectiveStartDate(effectiveStartDate: Optional) = + effectiveStartDate(effectiveStartDate.getOrNull()) + + /** + * Sets [Builder.effectiveStartDate] to an arbitrary JSON value. + * + * You should usually call [Builder.effectiveStartDate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun effectiveStartDate(effectiveStartDate: JsonField) = apply { + body.effectiveStartDate(effectiveStartDate) + } + + /** The entity type to which the rule is applied. */ + fun entityType(entityType: EntityType) = apply { body.entityType(entityType) } + + /** + * Sets [Builder.entityType] to an arbitrary JSON value. + * + * You should usually call [Builder.entityType] with a well-typed [EntityType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun entityType(entityType: JsonField) = apply { body.entityType(entityType) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [HrisCompanyPayStatementItemRuleCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): HrisCompanyPayStatementItemRuleCreateParams = + HrisCompanyPayStatementItemRuleCreateParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): CreateRuleRequest = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class CreateRuleRequest + private constructor( + private val attributes: JsonField, + private val conditions: JsonField>, + private val effectiveEndDate: JsonField, + private val effectiveStartDate: JsonField, + private val entityType: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("attributes") + @ExcludeMissing + attributes: JsonField = JsonMissing.of(), + @JsonProperty("conditions") + @ExcludeMissing + conditions: JsonField> = JsonMissing.of(), + @JsonProperty("effective_end_date") + @ExcludeMissing + effectiveEndDate: JsonField = JsonMissing.of(), + @JsonProperty("effective_start_date") + @ExcludeMissing + effectiveStartDate: JsonField = JsonMissing.of(), + @JsonProperty("entity_type") + @ExcludeMissing + entityType: JsonField = JsonMissing.of(), + ) : this( + attributes, + conditions, + effectiveEndDate, + effectiveStartDate, + entityType, + mutableMapOf(), + ) + + /** + * Specifies the fields to be applied when the condition is met. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun attributes(): Optional = + Optional.ofNullable(attributes.getNullable("attributes")) + + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun conditions(): Optional> = + Optional.ofNullable(conditions.getNullable("conditions")) + + /** + * Specifies when the rules should stop applying rules based on the date. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun effectiveEndDate(): Optional = + Optional.ofNullable(effectiveEndDate.getNullable("effective_end_date")) + + /** + * Specifies when the rule should begin applying based on the date. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun effectiveStartDate(): Optional = + Optional.ofNullable(effectiveStartDate.getNullable("effective_start_date")) + + /** + * The entity type to which the rule is applied. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun entityType(): Optional = + Optional.ofNullable(entityType.getNullable("entity_type")) + + /** + * Returns the raw JSON value of [attributes]. + * + * Unlike [attributes], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("attributes") + @ExcludeMissing + fun _attributes(): JsonField = attributes + + /** + * Returns the raw JSON value of [conditions]. + * + * Unlike [conditions], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("conditions") + @ExcludeMissing + fun _conditions(): JsonField> = conditions + + /** + * Returns the raw JSON value of [effectiveEndDate]. + * + * Unlike [effectiveEndDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("effective_end_date") + @ExcludeMissing + fun _effectiveEndDate(): JsonField = effectiveEndDate + + /** + * Returns the raw JSON value of [effectiveStartDate]. + * + * Unlike [effectiveStartDate], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("effective_start_date") + @ExcludeMissing + fun _effectiveStartDate(): JsonField = effectiveStartDate + + /** + * Returns the raw JSON value of [entityType]. + * + * Unlike [entityType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("entity_type") + @ExcludeMissing + fun _entityType(): JsonField = entityType + + @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 [CreateRuleRequest]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CreateRuleRequest]. */ + class Builder internal constructor() { + + private var attributes: JsonField = JsonMissing.of() + private var conditions: JsonField>? = null + private var effectiveEndDate: JsonField = JsonMissing.of() + private var effectiveStartDate: JsonField = JsonMissing.of() + private var entityType: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(createRuleRequest: CreateRuleRequest) = apply { + attributes = createRuleRequest.attributes + conditions = createRuleRequest.conditions.map { it.toMutableList() } + effectiveEndDate = createRuleRequest.effectiveEndDate + effectiveStartDate = createRuleRequest.effectiveStartDate + entityType = createRuleRequest.entityType + additionalProperties = createRuleRequest.additionalProperties.toMutableMap() + } + + /** Specifies the fields to be applied when the condition is met. */ + fun attributes(attributes: Attributes) = attributes(JsonField.of(attributes)) + + /** + * Sets [Builder.attributes] to an arbitrary JSON value. + * + * You should usually call [Builder.attributes] with a well-typed [Attributes] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun attributes(attributes: JsonField) = apply { + this.attributes = attributes + } + + fun conditions(conditions: List) = conditions(JsonField.of(conditions)) + + /** + * Sets [Builder.conditions] to an arbitrary JSON value. + * + * You should usually call [Builder.conditions] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun conditions(conditions: JsonField>) = apply { + this.conditions = conditions.map { it.toMutableList() } + } + + /** + * Adds a single [Condition] to [conditions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addCondition(condition: Condition) = apply { + conditions = + (conditions ?: JsonField.of(mutableListOf())).also { + checkKnown("conditions", it).add(condition) + } + } + + /** Specifies when the rules should stop applying rules based on the date. */ + fun effectiveEndDate(effectiveEndDate: String?) = + effectiveEndDate(JsonField.ofNullable(effectiveEndDate)) + + /** + * Alias for calling [Builder.effectiveEndDate] with `effectiveEndDate.orElse(null)`. + */ + fun effectiveEndDate(effectiveEndDate: Optional) = + effectiveEndDate(effectiveEndDate.getOrNull()) + + /** + * Sets [Builder.effectiveEndDate] to an arbitrary JSON value. + * + * You should usually call [Builder.effectiveEndDate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun effectiveEndDate(effectiveEndDate: JsonField) = apply { + this.effectiveEndDate = effectiveEndDate + } + + /** Specifies when the rule should begin applying based on the date. */ + fun effectiveStartDate(effectiveStartDate: String?) = + effectiveStartDate(JsonField.ofNullable(effectiveStartDate)) + + /** + * Alias for calling [Builder.effectiveStartDate] with + * `effectiveStartDate.orElse(null)`. + */ + fun effectiveStartDate(effectiveStartDate: Optional) = + effectiveStartDate(effectiveStartDate.getOrNull()) + + /** + * Sets [Builder.effectiveStartDate] to an arbitrary JSON value. + * + * You should usually call [Builder.effectiveStartDate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun effectiveStartDate(effectiveStartDate: JsonField) = apply { + this.effectiveStartDate = effectiveStartDate + } + + /** The entity type to which the rule is applied. */ + fun entityType(entityType: EntityType) = entityType(JsonField.of(entityType)) + + /** + * Sets [Builder.entityType] to an arbitrary JSON value. + * + * You should usually call [Builder.entityType] with a well-typed [EntityType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun entityType(entityType: JsonField) = apply { + this.entityType = entityType + } + + 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 [CreateRuleRequest]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): CreateRuleRequest = + CreateRuleRequest( + attributes, + (conditions ?: JsonMissing.of()).map { it.toImmutable() }, + effectiveEndDate, + effectiveStartDate, + entityType, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): CreateRuleRequest = apply { + if (validated) { + return@apply + } + + attributes().ifPresent { it.validate() } + conditions().ifPresent { it.forEach { it.validate() } } + effectiveEndDate() + effectiveStartDate() + entityType().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (attributes.asKnown().getOrNull()?.validity() ?: 0) + + (conditions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (effectiveEndDate.asKnown().isPresent) 1 else 0) + + (if (effectiveStartDate.asKnown().isPresent) 1 else 0) + + (entityType.asKnown().getOrNull()?.validity() ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is CreateRuleRequest && attributes == other.attributes && conditions == other.conditions && effectiveEndDate == other.effectiveEndDate && effectiveStartDate == other.effectiveStartDate && entityType == other.entityType && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(attributes, conditions, effectiveEndDate, effectiveStartDate, entityType, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CreateRuleRequest{attributes=$attributes, conditions=$conditions, effectiveEndDate=$effectiveEndDate, effectiveStartDate=$effectiveStartDate, entityType=$entityType, additionalProperties=$additionalProperties}" + } + + /** Specifies the fields to be applied when the condition is met. */ + class Attributes + private constructor( + private val metadata: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + + /** + * The metadata to be attached in the entity. It is a key-value pairs where the values can + * be of any type (string, number, boolean, object, array, etc.). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + + @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 [Attributes]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Attributes]. */ + class Builder internal constructor() { + + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(attributes: Attributes) = apply { + metadata = attributes.metadata + additionalProperties = attributes.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached in the entity. It is a key-value pairs where the values + * can be of any type (string, number, boolean, object, array, etc.). + */ + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + 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 [Attributes]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Attributes = Attributes(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Attributes = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (metadata.asKnown().getOrNull()?.validity() ?: 0) + + /** + * The metadata to be attached in the entity. It is a key-value pairs where the values can + * be of any type (string, number, boolean, object, array, etc.). + */ + class Metadata + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Metadata]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + 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 [Metadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + 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 = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Attributes && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Attributes{metadata=$metadata, additionalProperties=$additionalProperties}" + } + + class Condition + private constructor( + private val field: JsonField, + private val operator: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("field") @ExcludeMissing field: JsonField = JsonMissing.of(), + @JsonProperty("operator") + @ExcludeMissing + operator: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + ) : this(field, operator, value, mutableMapOf()) + + /** + * The field to be checked in the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun field(): Optional = Optional.ofNullable(field.getNullable("field")) + + /** + * The operator to be used in the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) + + /** + * The value of the field to be checked in the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun value(): Optional = Optional.ofNullable(value.getNullable("value")) + + /** + * Returns the raw JSON value of [field]. + * + * Unlike [field], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("field") @ExcludeMissing fun _field(): JsonField = field + + /** + * Returns the raw JSON value of [operator]. + * + * Unlike [operator], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("operator") @ExcludeMissing fun _operator(): JsonField = operator + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @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 [Condition]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Condition]. */ + class Builder internal constructor() { + + private var field: JsonField = JsonMissing.of() + private var operator: JsonField = JsonMissing.of() + private var value: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(condition: Condition) = apply { + field = condition.field + operator = condition.operator + value = condition.value + additionalProperties = condition.additionalProperties.toMutableMap() + } + + /** The field to be checked in the rule. */ + fun field(field: String) = field(JsonField.of(field)) + + /** + * Sets [Builder.field] to an arbitrary JSON value. + * + * You should usually call [Builder.field] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun field(field: JsonField) = apply { this.field = field } + + /** The operator to be used in the rule. */ + fun operator(operator: Operator) = operator(JsonField.of(operator)) + + /** + * Sets [Builder.operator] to an arbitrary JSON value. + * + * You should usually call [Builder.operator] with a well-typed [Operator] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun operator(operator: JsonField) = apply { this.operator = operator } + + /** The value of the field to be checked in the rule. */ + fun value(value: String) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + 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 [Condition]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Condition = + Condition(field, operator, value, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Condition = apply { + if (validated) { + return@apply + } + + field() + operator().ifPresent { it.validate() } + value() + 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 (field.asKnown().isPresent) 1 else 0) + + (operator.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + /** The operator to be used in the rule. */ + class Operator @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 EQUALS = of("equals") + + @JvmStatic fun of(value: String) = Operator(JsonField.of(value)) + } + + /** An enum containing [Operator]'s known values. */ + enum class Known { + EQUALS + } + + /** + * An enum containing [Operator]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Operator] 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 { + EQUALS, + /** + * An enum member indicating that [Operator] 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) { + EQUALS -> Value.EQUALS + 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) { + EQUALS -> Known.EQUALS + else -> throw FinchInvalidDataException("Unknown Operator: $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(): Operator = 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 Operator && 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 Condition && field == other.field && operator == other.operator && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(field, operator, value, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Condition{field=$field, operator=$operator, value=$value, additionalProperties=$additionalProperties}" + } + + /** The entity type to which the rule is applied. */ + class EntityType @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PAY_STATEMENT_ITEM = of("pay_statement_item") + + @JvmStatic fun of(value: String) = EntityType(JsonField.of(value)) + } + + /** An enum containing [EntityType]'s known values. */ + enum class Known { + PAY_STATEMENT_ITEM + } + + /** + * An enum containing [EntityType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EntityType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PAY_STATEMENT_ITEM, + /** + * An enum member indicating that [EntityType] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PAY_STATEMENT_ITEM -> Value.PAY_STATEMENT_ITEM + 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) { + PAY_STATEMENT_ITEM -> Known.PAY_STATEMENT_ITEM + else -> throw FinchInvalidDataException("Unknown EntityType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws 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(): EntityType = 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 EntityType && 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 HrisCompanyPayStatementItemRuleCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ + + override fun toString() = + "HrisCompanyPayStatementItemRuleCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleDeleteParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleDeleteParams.kt new file mode 100644 index 00000000..a9f7f64d --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleDeleteParams.kt @@ -0,0 +1,239 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.Params +import com.tryfinch.api.core.checkRequired +import com.tryfinch.api.core.http.Headers +import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.toImmutable +import java.util.Objects +import java.util.Optional + +/** + * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical + * support will be added soon Delete a rule for a pay statement item. + */ +class HrisCompanyPayStatementItemRuleDeleteParams +private constructor( + private val ruleId: String, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, + private val additionalBodyProperties: Map, +) : Params { + + fun ruleId(): String = ruleId + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + fun _additionalHeaders(): Headers = additionalHeaders + + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [HrisCompanyPayStatementItemRuleDeleteParams]. + * + * The following fields are required: + * ```java + * .ruleId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HrisCompanyPayStatementItemRuleDeleteParams]. */ + class Builder internal constructor() { + + private var ruleId: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + hrisCompanyPayStatementItemRuleDeleteParams: HrisCompanyPayStatementItemRuleDeleteParams + ) = apply { + ruleId = hrisCompanyPayStatementItemRuleDeleteParams.ruleId + additionalHeaders = + hrisCompanyPayStatementItemRuleDeleteParams.additionalHeaders.toBuilder() + additionalQueryParams = + hrisCompanyPayStatementItemRuleDeleteParams.additionalQueryParams.toBuilder() + additionalBodyProperties = + hrisCompanyPayStatementItemRuleDeleteParams.additionalBodyProperties.toMutableMap() + } + + fun ruleId(ruleId: String) = apply { this.ruleId = ruleId } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + putAllAdditionalBodyProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { + additionalBodyProperties.remove(key) + } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalBodyProperty) + } + + /** + * Returns an immutable instance of [HrisCompanyPayStatementItemRuleDeleteParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .ruleId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisCompanyPayStatementItemRuleDeleteParams = + HrisCompanyPayStatementItemRuleDeleteParams( + checkRequired("ruleId", ruleId), + additionalHeaders.build(), + additionalQueryParams.build(), + additionalBodyProperties.toImmutable(), + ) + } + + fun _body(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + + fun _pathParam(index: Int): String = + when (index) { + 0 -> ruleId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisCompanyPayStatementItemRuleDeleteParams && ruleId == other.ruleId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(ruleId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + + override fun toString() = + "HrisCompanyPayStatementItemRuleDeleteParams{ruleId=$ruleId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPage.kt new file mode 100644 index 00000000..9f22dbdd --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPage.kt @@ -0,0 +1,193 @@ +// 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.company.payStatementItem.RuleService +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 + +/** + * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical + * support will be added soon List all rules of a connection account. + */ +class HrisCompanyPayStatementItemRuleListPage +private constructor( + private val rulesService: RuleService, + private val params: HrisCompanyPayStatementItemRuleListParams, + private val response: Response, +) { + + fun response(): Response = response + + fun responses(): List = response().responses() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisCompanyPayStatementItemRuleListPage && rulesService == other.rulesService && params == other.params && response == other.response /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(rulesService, params, response) /* spotless:on */ + + override fun toString() = + "HrisCompanyPayStatementItemRuleListPage{rulesService=$rulesService, params=$params, response=$response}" + + fun hasNextPage(): Boolean { + return !responses().isEmpty() + } + + fun getNextPageParams(): Optional { + return Optional.empty() + } + + fun getNextPage(): Optional { + return getNextPageParams().map { rulesService.list(it) } + } + + fun autoPager(): AutoPager = AutoPager(this) + + companion object { + + @JvmStatic + fun of( + rulesService: RuleService, + params: HrisCompanyPayStatementItemRuleListParams, + response: Response, + ) = HrisCompanyPayStatementItemRuleListPage(rulesService, params, response) + } + + class Response( + private val responses: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("responses") + responses: JsonField> = JsonMissing.of() + ) : this(responses, mutableMapOf()) + + fun responses(): List = responses.getNullable("responses") ?: listOf() + + @JsonProperty("responses") + fun _responses(): Optional>> = + Optional.ofNullable(responses) + + @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 + } + + responses().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 && responses == other.responses && additionalProperties == other.additionalProperties /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(responses, additionalProperties) /* spotless:on */ + + override fun toString() = + "Response{responses=$responses, additionalProperties=$additionalProperties}" + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [HrisCompanyPayStatementItemRuleListPage]. + */ + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var responses: JsonField> = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(page: Response) = apply { + this.responses = page.responses + this.additionalProperties.putAll(page.additionalProperties) + } + + fun responses(responses: List) = responses(JsonField.of(responses)) + + fun responses(responses: JsonField>) = apply { + this.responses = responses + } + + 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(responses, additionalProperties.toMutableMap()) + } + } + + class AutoPager(private val firstPage: HrisCompanyPayStatementItemRuleListPage) : + Iterable { + + override fun iterator(): Iterator = iterator { + var page = firstPage + var index = 0 + while (true) { + while (index < page.responses().size) { + yield(page.responses()[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/HrisCompanyPayStatementItemRuleListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPageAsync.kt new file mode 100644 index 00000000..8d46c6b4 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPageAsync.kt @@ -0,0 +1,204 @@ +// 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.company.payStatementItem.RuleServiceAsync +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 + +/** + * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical + * support will be added soon List all rules of a connection account. + */ +class HrisCompanyPayStatementItemRuleListPageAsync +private constructor( + private val rulesService: RuleServiceAsync, + private val params: HrisCompanyPayStatementItemRuleListParams, + private val response: Response, +) { + + fun response(): Response = response + + fun responses(): List = response().responses() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisCompanyPayStatementItemRuleListPageAsync && rulesService == other.rulesService && params == other.params && response == other.response /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(rulesService, params, response) /* spotless:on */ + + override fun toString() = + "HrisCompanyPayStatementItemRuleListPageAsync{rulesService=$rulesService, params=$params, response=$response}" + + fun hasNextPage(): Boolean { + return !responses().isEmpty() + } + + fun getNextPageParams(): Optional { + return Optional.empty() + } + + fun getNextPage(): CompletableFuture> { + return getNextPageParams() + .map { rulesService.list(it).thenApply { Optional.of(it) } } + .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + } + + fun autoPager(): AutoPager = AutoPager(this) + + companion object { + + @JvmStatic + fun of( + rulesService: RuleServiceAsync, + params: HrisCompanyPayStatementItemRuleListParams, + response: Response, + ) = HrisCompanyPayStatementItemRuleListPageAsync(rulesService, params, response) + } + + class Response( + private val responses: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("responses") + responses: JsonField> = JsonMissing.of() + ) : this(responses, mutableMapOf()) + + fun responses(): List = responses.getNullable("responses") ?: listOf() + + @JsonProperty("responses") + fun _responses(): Optional>> = + Optional.ofNullable(responses) + + @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 + } + + responses().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 && responses == other.responses && additionalProperties == other.additionalProperties /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(responses, additionalProperties) /* spotless:on */ + + override fun toString() = + "Response{responses=$responses, additionalProperties=$additionalProperties}" + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [HrisCompanyPayStatementItemRuleListPageAsync]. + */ + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var responses: JsonField> = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(page: Response) = apply { + this.responses = page.responses + this.additionalProperties.putAll(page.additionalProperties) + } + + fun responses(responses: List) = responses(JsonField.of(responses)) + + fun responses(responses: JsonField>) = apply { + this.responses = responses + } + + 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(responses, additionalProperties.toMutableMap()) + } + } + + class AutoPager(private val firstPage: HrisCompanyPayStatementItemRuleListPageAsync) { + + fun forEach( + action: Predicate, + executor: Executor, + ): CompletableFuture { + fun CompletableFuture>.forEach( + action: (RuleListResponse) -> Boolean, + executor: Executor, + ): CompletableFuture = + thenComposeAsync( + { page -> + page + .filter { it.responses().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/HrisCompanyPayStatementItemRuleListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListParams.kt new file mode 100644 index 00000000..a958f121 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListParams.kt @@ -0,0 +1,179 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.core.Params +import com.tryfinch.api.core.http.Headers +import com.tryfinch.api.core.http.QueryParams +import java.util.Objects + +/** + * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical + * support will be added soon List all rules of a connection account. + */ +class HrisCompanyPayStatementItemRuleListParams +private constructor( + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun _additionalHeaders(): Headers = additionalHeaders + + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): HrisCompanyPayStatementItemRuleListParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of + * [HrisCompanyPayStatementItemRuleListParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HrisCompanyPayStatementItemRuleListParams]. */ + class Builder internal constructor() { + + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from( + hrisCompanyPayStatementItemRuleListParams: HrisCompanyPayStatementItemRuleListParams + ) = apply { + additionalHeaders = + hrisCompanyPayStatementItemRuleListParams.additionalHeaders.toBuilder() + additionalQueryParams = + hrisCompanyPayStatementItemRuleListParams.additionalQueryParams.toBuilder() + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [HrisCompanyPayStatementItemRuleListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): HrisCompanyPayStatementItemRuleListParams = + HrisCompanyPayStatementItemRuleListParams( + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisCompanyPayStatementItemRuleListParams && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(additionalHeaders, additionalQueryParams) /* spotless:on */ + + override fun toString() = + "HrisCompanyPayStatementItemRuleListParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleUpdateParams.kt new file mode 100644 index 00000000..0ec80b82 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleUpdateParams.kt @@ -0,0 +1,378 @@ +// 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.JsonMissing +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.Params +import com.tryfinch.api.core.checkRequired +import com.tryfinch.api.core.http.Headers +import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Collections +import java.util.Objects + +/** + * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical + * support will be added soon Update a rule for a pay statement item. + */ +class HrisCompanyPayStatementItemRuleUpdateParams +private constructor( + private val ruleId: String, + private val body: UpdateRuleRequest, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun ruleId(): String = ruleId + + fun _optionalProperty(): JsonValue = body._optionalProperty() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + fun _additionalHeaders(): Headers = additionalHeaders + + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [HrisCompanyPayStatementItemRuleUpdateParams]. + * + * The following fields are required: + * ```java + * .ruleId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HrisCompanyPayStatementItemRuleUpdateParams]. */ + class Builder internal constructor() { + + private var ruleId: String? = null + private var body: UpdateRuleRequest.Builder = UpdateRuleRequest.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from( + hrisCompanyPayStatementItemRuleUpdateParams: HrisCompanyPayStatementItemRuleUpdateParams + ) = apply { + ruleId = hrisCompanyPayStatementItemRuleUpdateParams.ruleId + body = hrisCompanyPayStatementItemRuleUpdateParams.body.toBuilder() + additionalHeaders = + hrisCompanyPayStatementItemRuleUpdateParams.additionalHeaders.toBuilder() + additionalQueryParams = + hrisCompanyPayStatementItemRuleUpdateParams.additionalQueryParams.toBuilder() + } + + fun ruleId(ruleId: String) = apply { this.ruleId = ruleId } + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [optionalProperty] + */ + fun body(body: UpdateRuleRequest) = apply { this.body = body.toBuilder() } + + fun optionalProperty(optionalProperty: JsonValue) = apply { + body.optionalProperty(optionalProperty) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [HrisCompanyPayStatementItemRuleUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .ruleId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisCompanyPayStatementItemRuleUpdateParams = + HrisCompanyPayStatementItemRuleUpdateParams( + checkRequired("ruleId", ruleId), + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): UpdateRuleRequest = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> ruleId + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class UpdateRuleRequest + private constructor( + private val optionalProperty: JsonValue, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("optionalProperty") + @ExcludeMissing + optionalProperty: JsonValue = JsonMissing.of() + ) : this(optionalProperty, mutableMapOf()) + + @JsonProperty("optionalProperty") + @ExcludeMissing + fun _optionalProperty(): JsonValue = optionalProperty + + @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 [UpdateRuleRequest]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [UpdateRuleRequest]. */ + class Builder internal constructor() { + + private var optionalProperty: JsonValue = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(updateRuleRequest: UpdateRuleRequest) = apply { + optionalProperty = updateRuleRequest.optionalProperty + additionalProperties = updateRuleRequest.additionalProperties.toMutableMap() + } + + fun optionalProperty(optionalProperty: JsonValue) = apply { + this.optionalProperty = optionalProperty + } + + 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 [UpdateRuleRequest]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): UpdateRuleRequest = + UpdateRuleRequest(optionalProperty, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): UpdateRuleRequest = apply { + if (validated) { + return@apply + } + + 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 = 0 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is UpdateRuleRequest && optionalProperty == other.optionalProperty && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(optionalProperty, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "UpdateRuleRequest{optionalProperty=$optionalProperty, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisCompanyPayStatementItemRuleUpdateParams && ruleId == other.ruleId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(ruleId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ + + override fun toString() = + "HrisCompanyPayStatementItemRuleUpdateParams{ruleId=$ruleId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementItemListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementItemListResponse.kt new file mode 100644 index 00000000..4fb2b05a --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementItemListResponse.kt @@ -0,0 +1,632 @@ +// 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 PayStatementItemListResponse +private constructor( + private val attributes: JsonField, + private val category: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("attributes") + @ExcludeMissing + attributes: JsonField = JsonMissing.of(), + @JsonProperty("category") @ExcludeMissing category: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(attributes, category, name, mutableMapOf()) + + /** + * The attributes of the pay statement item. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun attributes(): Optional = + Optional.ofNullable(attributes.getNullable("attributes")) + + /** + * The category of the pay statement item. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun category(): Optional = Optional.ofNullable(category.getNullable("category")) + + /** + * The name of the pay statement item. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + + /** + * Returns the raw JSON value of [attributes]. + * + * Unlike [attributes], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("attributes") + @ExcludeMissing + fun _attributes(): JsonField = attributes + + /** + * Returns the raw JSON value of [category]. + * + * Unlike [category], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("category") @ExcludeMissing fun _category(): JsonField = category + + /** + * Returns the raw JSON value of [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 [PayStatementItemListResponse]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [PayStatementItemListResponse]. */ + class Builder internal constructor() { + + private var attributes: JsonField = JsonMissing.of() + private var category: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(payStatementItemListResponse: PayStatementItemListResponse) = apply { + attributes = payStatementItemListResponse.attributes + category = payStatementItemListResponse.category + name = payStatementItemListResponse.name + additionalProperties = payStatementItemListResponse.additionalProperties.toMutableMap() + } + + /** The attributes of the pay statement item. */ + fun attributes(attributes: Attributes) = attributes(JsonField.of(attributes)) + + /** + * Sets [Builder.attributes] to an arbitrary JSON value. + * + * You should usually call [Builder.attributes] with a well-typed [Attributes] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun attributes(attributes: JsonField) = apply { this.attributes = attributes } + + /** The category of the pay statement item. */ + fun category(category: Category) = category(JsonField.of(category)) + + /** + * Sets [Builder.category] to an arbitrary JSON value. + * + * You should usually call [Builder.category] with a well-typed [Category] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun category(category: JsonField) = apply { this.category = category } + + /** The name of the pay statement item. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * 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 [PayStatementItemListResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): PayStatementItemListResponse = + PayStatementItemListResponse( + attributes, + category, + name, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): PayStatementItemListResponse = apply { + if (validated) { + return@apply + } + + attributes().ifPresent { it.validate() } + category().ifPresent { it.validate() } + 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 = + (attributes.asKnown().getOrNull()?.validity() ?: 0) + + (category.asKnown().getOrNull()?.validity() ?: 0) + + (if (name.asKnown().isPresent) 1 else 0) + + /** The attributes of the pay statement item. */ + class Attributes + private constructor( + private val employer: JsonField, + private val metadata: JsonValue, + private val preTax: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("employer") + @ExcludeMissing + employer: JsonField = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(), + @JsonProperty("pre_tax") @ExcludeMissing preTax: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(employer, metadata, preTax, type, mutableMapOf()) + + /** + * `true` if the amount is paid by the employers. This field is only available for taxes. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun employer(): Optional = Optional.ofNullable(employer.getNullable("employer")) + + /** + * The metadata of the pay statement item derived by the rules engine if available. Each + * attribute will be a key-value pair defined by a rule. + */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata + + /** + * `true` if the pay statement item is pre-tax. This field is only available for employee + * deductions. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun preTax(): Optional = Optional.ofNullable(preTax.getNullable("pre_tax")) + + /** + * The type of the pay statement item. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + + /** + * Returns the raw JSON value of [employer]. + * + * Unlike [employer], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("employer") @ExcludeMissing fun _employer(): JsonField = employer + + /** + * Returns the raw JSON value of [preTax]. + * + * Unlike [preTax], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("pre_tax") @ExcludeMissing fun _preTax(): JsonField = preTax + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Attributes]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Attributes]. */ + class Builder internal constructor() { + + private var employer: JsonField = JsonMissing.of() + private var metadata: JsonValue = JsonMissing.of() + private var preTax: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(attributes: Attributes) = apply { + employer = attributes.employer + metadata = attributes.metadata + preTax = attributes.preTax + type = attributes.type + additionalProperties = attributes.additionalProperties.toMutableMap() + } + + /** + * `true` if the amount is paid by the employers. This field is only available for + * taxes. + */ + fun employer(employer: Boolean?) = employer(JsonField.ofNullable(employer)) + + /** + * Alias for [Builder.employer]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun employer(employer: Boolean) = employer(employer as Boolean?) + + /** Alias for calling [Builder.employer] with `employer.orElse(null)`. */ + fun employer(employer: Optional) = employer(employer.getOrNull()) + + /** + * Sets [Builder.employer] to an arbitrary JSON value. + * + * You should usually call [Builder.employer] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun employer(employer: JsonField) = apply { this.employer = employer } + + /** + * The metadata of the pay statement item derived by the rules engine if available. Each + * attribute will be a key-value pair defined by a rule. + */ + fun metadata(metadata: JsonValue) = apply { this.metadata = metadata } + + /** + * `true` if the pay statement item is pre-tax. This field is only available for + * employee deductions. + */ + fun preTax(preTax: Boolean?) = preTax(JsonField.ofNullable(preTax)) + + /** + * Alias for [Builder.preTax]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun preTax(preTax: Boolean) = preTax(preTax as Boolean?) + + /** Alias for calling [Builder.preTax] with `preTax.orElse(null)`. */ + fun preTax(preTax: Optional) = preTax(preTax.getOrNull()) + + /** + * Sets [Builder.preTax] to an arbitrary JSON value. + * + * You should usually call [Builder.preTax] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun preTax(preTax: JsonField) = apply { this.preTax = preTax } + + /** The type of the pay statement item. */ + fun type(type: String?) = type(JsonField.ofNullable(type)) + + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ + fun type(type: Optional) = type(type.getOrNull()) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Attributes]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Attributes = + Attributes(employer, metadata, preTax, type, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Attributes = apply { + if (validated) { + return@apply + } + + employer() + preTax() + type() + 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 (employer.asKnown().isPresent) 1 else 0) + + (if (preTax.asKnown().isPresent) 1 else 0) + + (if (type.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Attributes && employer == other.employer && metadata == other.metadata && preTax == other.preTax && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(employer, metadata, preTax, type, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Attributes{employer=$employer, metadata=$metadata, preTax=$preTax, type=$type, additionalProperties=$additionalProperties}" + } + + /** The category of the pay statement item. */ + class Category @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 EARNINGS = of("earnings") + + @JvmField val TAXES = of("taxes") + + @JvmField val EMPLOYEE_DEDUCTIONS = of("employee_deductions") + + @JvmField val EMPLOYER_CONTRIBUTIONS = of("employer_contributions") + + @JvmStatic fun of(value: String) = Category(JsonField.of(value)) + } + + /** An enum containing [Category]'s known values. */ + enum class Known { + EARNINGS, + TAXES, + EMPLOYEE_DEDUCTIONS, + EMPLOYER_CONTRIBUTIONS, + } + + /** + * An enum containing [Category]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Category] 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 { + EARNINGS, + TAXES, + EMPLOYEE_DEDUCTIONS, + EMPLOYER_CONTRIBUTIONS, + /** An enum member indicating that [Category] 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) { + EARNINGS -> Value.EARNINGS + TAXES -> Value.TAXES + EMPLOYEE_DEDUCTIONS -> Value.EMPLOYEE_DEDUCTIONS + EMPLOYER_CONTRIBUTIONS -> Value.EMPLOYER_CONTRIBUTIONS + 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) { + EARNINGS -> Known.EARNINGS + TAXES -> Known.TAXES + EMPLOYEE_DEDUCTIONS -> Known.EMPLOYEE_DEDUCTIONS + EMPLOYER_CONTRIBUTIONS -> Known.EMPLOYER_CONTRIBUTIONS + else -> throw FinchInvalidDataException("Unknown Category: $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(): Category = 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 Category && 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 PayStatementItemListResponse && attributes == other.attributes && category == other.category && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(attributes, category, name, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "PayStatementItemListResponse{attributes=$attributes, category=$category, name=$name, additionalProperties=$additionalProperties}" +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleCreateResponse.kt new file mode 100644 index 00000000..0eeaf04c --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleCreateResponse.kt @@ -0,0 +1,1224 @@ +// 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.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class RuleCreateResponse +private constructor( + private val id: JsonField, + private val attributes: JsonField, + private val conditions: JsonField>, + private val createdAt: JsonField, + private val effectiveEndDate: JsonField, + private val effectiveStartDate: JsonField, + private val entityType: JsonField, + private val priority: JsonField, + private val updatedAt: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + attributes: JsonField = JsonMissing.of(), + @JsonProperty("conditions") + @ExcludeMissing + conditions: JsonField> = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("effective_end_date") + @ExcludeMissing + effectiveEndDate: JsonField = JsonMissing.of(), + @JsonProperty("effective_start_date") + @ExcludeMissing + effectiveStartDate: JsonField = JsonMissing.of(), + @JsonProperty("entity_type") + @ExcludeMissing + entityType: JsonField = JsonMissing.of(), + @JsonProperty("priority") @ExcludeMissing priority: JsonField = JsonMissing.of(), + @JsonProperty("updated_at") + @ExcludeMissing + updatedAt: JsonField = JsonMissing.of(), + ) : this( + id, + attributes, + conditions, + createdAt, + effectiveEndDate, + effectiveStartDate, + entityType, + priority, + updatedAt, + mutableMapOf(), + ) + + /** + * Finch id (uuidv4) for the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + + /** + * Specifies the fields to be applied when the condition is met. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun attributes(): Optional = + Optional.ofNullable(attributes.getNullable("attributes")) + + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun conditions(): Optional> = + Optional.ofNullable(conditions.getNullable("conditions")) + + /** + * The datetime when the rule was created. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun createdAt(): Optional = + Optional.ofNullable(createdAt.getNullable("created_at")) + + /** + * Specifies when the rules should stop applying rules based on the date. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun effectiveEndDate(): Optional = + Optional.ofNullable(effectiveEndDate.getNullable("effective_end_date")) + + /** + * Specifies when the rule should begin applying based on the date. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun effectiveStartDate(): Optional = + Optional.ofNullable(effectiveStartDate.getNullable("effective_start_date")) + + /** + * The entity type to which the rule is applied. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun entityType(): Optional = + Optional.ofNullable(entityType.getNullable("entity_type")) + + /** + * The priority of the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun priority(): Optional = Optional.ofNullable(priority.getNullable("priority")) + + /** + * The datetime when the rule was last updated. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun updatedAt(): Optional = + Optional.ofNullable(updatedAt.getNullable("updated_at")) + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [attributes]. + * + * Unlike [attributes], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("attributes") + @ExcludeMissing + fun _attributes(): JsonField = attributes + + /** + * Returns the raw JSON value of [conditions]. + * + * Unlike [conditions], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("conditions") + @ExcludeMissing + fun _conditions(): JsonField> = conditions + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [effectiveEndDate]. + * + * Unlike [effectiveEndDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("effective_end_date") + @ExcludeMissing + fun _effectiveEndDate(): JsonField = effectiveEndDate + + /** + * Returns the raw JSON value of [effectiveStartDate]. + * + * Unlike [effectiveStartDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("effective_start_date") + @ExcludeMissing + fun _effectiveStartDate(): JsonField = effectiveStartDate + + /** + * Returns the raw JSON value of [entityType]. + * + * Unlike [entityType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("entity_type") + @ExcludeMissing + fun _entityType(): JsonField = entityType + + /** + * Returns the raw JSON value of [priority]. + * + * Unlike [priority], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("priority") @ExcludeMissing fun _priority(): JsonField = priority + + /** + * Returns the raw JSON value of [updatedAt]. + * + * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("updated_at") + @ExcludeMissing + fun _updatedAt(): JsonField = updatedAt + + @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 [RuleCreateResponse]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleCreateResponse]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() + private var conditions: JsonField>? = null + private var createdAt: JsonField = JsonMissing.of() + private var effectiveEndDate: JsonField = JsonMissing.of() + private var effectiveStartDate: JsonField = JsonMissing.of() + private var entityType: JsonField = JsonMissing.of() + private var priority: JsonField = JsonMissing.of() + private var updatedAt: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleCreateResponse: RuleCreateResponse) = apply { + id = ruleCreateResponse.id + attributes = ruleCreateResponse.attributes + conditions = ruleCreateResponse.conditions.map { it.toMutableList() } + createdAt = ruleCreateResponse.createdAt + effectiveEndDate = ruleCreateResponse.effectiveEndDate + effectiveStartDate = ruleCreateResponse.effectiveStartDate + entityType = ruleCreateResponse.entityType + priority = ruleCreateResponse.priority + updatedAt = ruleCreateResponse.updatedAt + additionalProperties = ruleCreateResponse.additionalProperties.toMutableMap() + } + + /** Finch id (uuidv4) for the rule. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** Specifies the fields to be applied when the condition is met. */ + fun attributes(attributes: Attributes) = attributes(JsonField.of(attributes)) + + /** + * Sets [Builder.attributes] to an arbitrary JSON value. + * + * You should usually call [Builder.attributes] with a well-typed [Attributes] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun attributes(attributes: JsonField) = apply { this.attributes = attributes } + + fun conditions(conditions: List) = conditions(JsonField.of(conditions)) + + /** + * Sets [Builder.conditions] to an arbitrary JSON value. + * + * You should usually call [Builder.conditions] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun conditions(conditions: JsonField>) = apply { + this.conditions = conditions.map { it.toMutableList() } + } + + /** + * Adds a single [Condition] to [conditions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addCondition(condition: Condition) = apply { + conditions = + (conditions ?: JsonField.of(mutableListOf())).also { + checkKnown("conditions", it).add(condition) + } + } + + /** The datetime when the rule was created. */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + /** Specifies when the rules should stop applying rules based on the date. */ + fun effectiveEndDate(effectiveEndDate: String?) = + effectiveEndDate(JsonField.ofNullable(effectiveEndDate)) + + /** Alias for calling [Builder.effectiveEndDate] with `effectiveEndDate.orElse(null)`. */ + fun effectiveEndDate(effectiveEndDate: Optional) = + effectiveEndDate(effectiveEndDate.getOrNull()) + + /** + * Sets [Builder.effectiveEndDate] to an arbitrary JSON value. + * + * You should usually call [Builder.effectiveEndDate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun effectiveEndDate(effectiveEndDate: JsonField) = apply { + this.effectiveEndDate = effectiveEndDate + } + + /** Specifies when the rule should begin applying based on the date. */ + fun effectiveStartDate(effectiveStartDate: String?) = + effectiveStartDate(JsonField.ofNullable(effectiveStartDate)) + + /** + * Alias for calling [Builder.effectiveStartDate] with `effectiveStartDate.orElse(null)`. + */ + fun effectiveStartDate(effectiveStartDate: Optional) = + effectiveStartDate(effectiveStartDate.getOrNull()) + + /** + * Sets [Builder.effectiveStartDate] to an arbitrary JSON value. + * + * You should usually call [Builder.effectiveStartDate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun effectiveStartDate(effectiveStartDate: JsonField) = apply { + this.effectiveStartDate = effectiveStartDate + } + + /** The entity type to which the rule is applied. */ + fun entityType(entityType: EntityType) = entityType(JsonField.of(entityType)) + + /** + * Sets [Builder.entityType] to an arbitrary JSON value. + * + * You should usually call [Builder.entityType] with a well-typed [EntityType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun entityType(entityType: JsonField) = apply { this.entityType = entityType } + + /** The priority of the rule. */ + fun priority(priority: Long) = priority(JsonField.of(priority)) + + /** + * Sets [Builder.priority] to an arbitrary JSON value. + * + * You should usually call [Builder.priority] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun priority(priority: JsonField) = apply { this.priority = priority } + + /** The datetime when the rule was last updated. */ + fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) + + /** + * Sets [Builder.updatedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun updatedAt(updatedAt: JsonField) = apply { this.updatedAt = updatedAt } + + 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 [RuleCreateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): RuleCreateResponse = + RuleCreateResponse( + id, + attributes, + (conditions ?: JsonMissing.of()).map { it.toImmutable() }, + createdAt, + effectiveEndDate, + effectiveStartDate, + entityType, + priority, + updatedAt, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): RuleCreateResponse = apply { + if (validated) { + return@apply + } + + id() + attributes().ifPresent { it.validate() } + conditions().ifPresent { it.forEach { it.validate() } } + createdAt() + effectiveEndDate() + effectiveStartDate() + entityType().ifPresent { it.validate() } + priority() + updatedAt() + 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 (id.asKnown().isPresent) 1 else 0) + + (attributes.asKnown().getOrNull()?.validity() ?: 0) + + (conditions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (if (effectiveEndDate.asKnown().isPresent) 1 else 0) + + (if (effectiveStartDate.asKnown().isPresent) 1 else 0) + + (entityType.asKnown().getOrNull()?.validity() ?: 0) + + (if (priority.asKnown().isPresent) 1 else 0) + + (if (updatedAt.asKnown().isPresent) 1 else 0) + + /** Specifies the fields to be applied when the condition is met. */ + class Attributes + private constructor( + private val metadata: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + + /** + * The metadata to be attached in the entity. It is a key-value pairs where the values can + * be of any type (string, number, boolean, object, array, etc.). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + + @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 [Attributes]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Attributes]. */ + class Builder internal constructor() { + + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(attributes: Attributes) = apply { + metadata = attributes.metadata + additionalProperties = attributes.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached in the entity. It is a key-value pairs where the values + * can be of any type (string, number, boolean, object, array, etc.). + */ + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + 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 [Attributes]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Attributes = Attributes(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Attributes = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (metadata.asKnown().getOrNull()?.validity() ?: 0) + + /** + * The metadata to be attached in the entity. It is a key-value pairs where the values can + * be of any type (string, number, boolean, object, array, etc.). + */ + class Metadata + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Metadata]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + 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 [Metadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + 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 = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Attributes && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Attributes{metadata=$metadata, additionalProperties=$additionalProperties}" + } + + class Condition + private constructor( + private val field: JsonField, + private val operator: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("field") @ExcludeMissing field: JsonField = JsonMissing.of(), + @JsonProperty("operator") + @ExcludeMissing + operator: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + ) : this(field, operator, value, mutableMapOf()) + + /** + * The field to be checked in the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun field(): Optional = Optional.ofNullable(field.getNullable("field")) + + /** + * The operator to be used in the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) + + /** + * The value of the field to be checked in the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun value(): Optional = Optional.ofNullable(value.getNullable("value")) + + /** + * Returns the raw JSON value of [field]. + * + * Unlike [field], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("field") @ExcludeMissing fun _field(): JsonField = field + + /** + * Returns the raw JSON value of [operator]. + * + * Unlike [operator], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("operator") @ExcludeMissing fun _operator(): JsonField = operator + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @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 [Condition]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Condition]. */ + class Builder internal constructor() { + + private var field: JsonField = JsonMissing.of() + private var operator: JsonField = JsonMissing.of() + private var value: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(condition: Condition) = apply { + field = condition.field + operator = condition.operator + value = condition.value + additionalProperties = condition.additionalProperties.toMutableMap() + } + + /** The field to be checked in the rule. */ + fun field(field: String) = field(JsonField.of(field)) + + /** + * Sets [Builder.field] to an arbitrary JSON value. + * + * You should usually call [Builder.field] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun field(field: JsonField) = apply { this.field = field } + + /** The operator to be used in the rule. */ + fun operator(operator: Operator) = operator(JsonField.of(operator)) + + /** + * Sets [Builder.operator] to an arbitrary JSON value. + * + * You should usually call [Builder.operator] with a well-typed [Operator] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun operator(operator: JsonField) = apply { this.operator = operator } + + /** The value of the field to be checked in the rule. */ + fun value(value: String) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + 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 [Condition]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Condition = + Condition(field, operator, value, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Condition = apply { + if (validated) { + return@apply + } + + field() + operator().ifPresent { it.validate() } + value() + 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 (field.asKnown().isPresent) 1 else 0) + + (operator.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + /** The operator to be used in the rule. */ + class Operator @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 EQUALS = of("equals") + + @JvmStatic fun of(value: String) = Operator(JsonField.of(value)) + } + + /** An enum containing [Operator]'s known values. */ + enum class Known { + EQUALS + } + + /** + * An enum containing [Operator]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Operator] 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 { + EQUALS, + /** + * An enum member indicating that [Operator] 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) { + EQUALS -> Value.EQUALS + 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) { + EQUALS -> Known.EQUALS + else -> throw FinchInvalidDataException("Unknown Operator: $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(): Operator = 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 Operator && 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 Condition && field == other.field && operator == other.operator && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(field, operator, value, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Condition{field=$field, operator=$operator, value=$value, additionalProperties=$additionalProperties}" + } + + /** The entity type to which the rule is applied. */ + class EntityType @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PAY_STATEMENT_ITEM = of("pay_statement_item") + + @JvmStatic fun of(value: String) = EntityType(JsonField.of(value)) + } + + /** An enum containing [EntityType]'s known values. */ + enum class Known { + PAY_STATEMENT_ITEM + } + + /** + * An enum containing [EntityType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EntityType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PAY_STATEMENT_ITEM, + /** + * An enum member indicating that [EntityType] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PAY_STATEMENT_ITEM -> Value.PAY_STATEMENT_ITEM + 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) { + PAY_STATEMENT_ITEM -> Known.PAY_STATEMENT_ITEM + else -> throw FinchInvalidDataException("Unknown EntityType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws 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(): EntityType = 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 EntityType && 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 RuleCreateResponse && id == other.id && attributes == other.attributes && conditions == other.conditions && createdAt == other.createdAt && effectiveEndDate == other.effectiveEndDate && effectiveStartDate == other.effectiveStartDate && entityType == other.entityType && priority == other.priority && updatedAt == other.updatedAt && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, attributes, conditions, createdAt, effectiveEndDate, effectiveStartDate, entityType, priority, updatedAt, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleCreateResponse{id=$id, attributes=$attributes, conditions=$conditions, createdAt=$createdAt, effectiveEndDate=$effectiveEndDate, effectiveStartDate=$effectiveStartDate, entityType=$entityType, priority=$priority, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleDeleteResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleDeleteResponse.kt new file mode 100644 index 00000000..b82c564b --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleDeleteResponse.kt @@ -0,0 +1,1264 @@ +// 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.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class RuleDeleteResponse +private constructor( + private val id: JsonField, + private val attributes: JsonField, + private val conditions: JsonField>, + private val createdAt: JsonField, + private val deletedAt: JsonField, + private val effectiveEndDate: JsonField, + private val effectiveStartDate: JsonField, + private val entityType: JsonField, + private val priority: JsonField, + private val updatedAt: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + attributes: JsonField = JsonMissing.of(), + @JsonProperty("conditions") + @ExcludeMissing + conditions: JsonField> = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("deleted_at") + @ExcludeMissing + deletedAt: JsonField = JsonMissing.of(), + @JsonProperty("effective_end_date") + @ExcludeMissing + effectiveEndDate: JsonField = JsonMissing.of(), + @JsonProperty("effective_start_date") + @ExcludeMissing + effectiveStartDate: JsonField = JsonMissing.of(), + @JsonProperty("entity_type") + @ExcludeMissing + entityType: JsonField = JsonMissing.of(), + @JsonProperty("priority") @ExcludeMissing priority: JsonField = JsonMissing.of(), + @JsonProperty("updated_at") + @ExcludeMissing + updatedAt: JsonField = JsonMissing.of(), + ) : this( + id, + attributes, + conditions, + createdAt, + deletedAt, + effectiveEndDate, + effectiveStartDate, + entityType, + priority, + updatedAt, + mutableMapOf(), + ) + + /** + * Finch id (uuidv4) for the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + + /** + * Specifies the fields to be applied when the condition is met. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun attributes(): Optional = + Optional.ofNullable(attributes.getNullable("attributes")) + + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun conditions(): Optional> = + Optional.ofNullable(conditions.getNullable("conditions")) + + /** + * The datetime when the rule was created. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun createdAt(): Optional = + Optional.ofNullable(createdAt.getNullable("created_at")) + + /** + * The datetime when the rule was deleted. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun deletedAt(): Optional = + Optional.ofNullable(deletedAt.getNullable("deleted_at")) + + /** + * Specifies when the rules should stop applying rules based on the date. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun effectiveEndDate(): Optional = + Optional.ofNullable(effectiveEndDate.getNullable("effective_end_date")) + + /** + * Specifies when the rule should begin applying based on the date. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun effectiveStartDate(): Optional = + Optional.ofNullable(effectiveStartDate.getNullable("effective_start_date")) + + /** + * The entity type to which the rule is applied. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun entityType(): Optional = + Optional.ofNullable(entityType.getNullable("entity_type")) + + /** + * The priority of the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun priority(): Optional = Optional.ofNullable(priority.getNullable("priority")) + + /** + * The datetime when the rule was last updated. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun updatedAt(): Optional = + Optional.ofNullable(updatedAt.getNullable("updated_at")) + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [attributes]. + * + * Unlike [attributes], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("attributes") + @ExcludeMissing + fun _attributes(): JsonField = attributes + + /** + * Returns the raw JSON value of [conditions]. + * + * Unlike [conditions], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("conditions") + @ExcludeMissing + fun _conditions(): JsonField> = conditions + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [deletedAt]. + * + * Unlike [deletedAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("deleted_at") + @ExcludeMissing + fun _deletedAt(): JsonField = deletedAt + + /** + * Returns the raw JSON value of [effectiveEndDate]. + * + * Unlike [effectiveEndDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("effective_end_date") + @ExcludeMissing + fun _effectiveEndDate(): JsonField = effectiveEndDate + + /** + * Returns the raw JSON value of [effectiveStartDate]. + * + * Unlike [effectiveStartDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("effective_start_date") + @ExcludeMissing + fun _effectiveStartDate(): JsonField = effectiveStartDate + + /** + * Returns the raw JSON value of [entityType]. + * + * Unlike [entityType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("entity_type") + @ExcludeMissing + fun _entityType(): JsonField = entityType + + /** + * Returns the raw JSON value of [priority]. + * + * Unlike [priority], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("priority") @ExcludeMissing fun _priority(): JsonField = priority + + /** + * Returns the raw JSON value of [updatedAt]. + * + * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("updated_at") + @ExcludeMissing + fun _updatedAt(): JsonField = updatedAt + + @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 [RuleDeleteResponse]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleDeleteResponse]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() + private var conditions: JsonField>? = null + private var createdAt: JsonField = JsonMissing.of() + private var deletedAt: JsonField = JsonMissing.of() + private var effectiveEndDate: JsonField = JsonMissing.of() + private var effectiveStartDate: JsonField = JsonMissing.of() + private var entityType: JsonField = JsonMissing.of() + private var priority: JsonField = JsonMissing.of() + private var updatedAt: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleDeleteResponse: RuleDeleteResponse) = apply { + id = ruleDeleteResponse.id + attributes = ruleDeleteResponse.attributes + conditions = ruleDeleteResponse.conditions.map { it.toMutableList() } + createdAt = ruleDeleteResponse.createdAt + deletedAt = ruleDeleteResponse.deletedAt + effectiveEndDate = ruleDeleteResponse.effectiveEndDate + effectiveStartDate = ruleDeleteResponse.effectiveStartDate + entityType = ruleDeleteResponse.entityType + priority = ruleDeleteResponse.priority + updatedAt = ruleDeleteResponse.updatedAt + additionalProperties = ruleDeleteResponse.additionalProperties.toMutableMap() + } + + /** Finch id (uuidv4) for the rule. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** Specifies the fields to be applied when the condition is met. */ + fun attributes(attributes: Attributes) = attributes(JsonField.of(attributes)) + + /** + * Sets [Builder.attributes] to an arbitrary JSON value. + * + * You should usually call [Builder.attributes] with a well-typed [Attributes] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun attributes(attributes: JsonField) = apply { this.attributes = attributes } + + fun conditions(conditions: List) = conditions(JsonField.of(conditions)) + + /** + * Sets [Builder.conditions] to an arbitrary JSON value. + * + * You should usually call [Builder.conditions] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun conditions(conditions: JsonField>) = apply { + this.conditions = conditions.map { it.toMutableList() } + } + + /** + * Adds a single [Condition] to [conditions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addCondition(condition: Condition) = apply { + conditions = + (conditions ?: JsonField.of(mutableListOf())).also { + checkKnown("conditions", it).add(condition) + } + } + + /** The datetime when the rule was created. */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + /** The datetime when the rule was deleted. */ + fun deletedAt(deletedAt: OffsetDateTime) = deletedAt(JsonField.of(deletedAt)) + + /** + * Sets [Builder.deletedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.deletedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deletedAt(deletedAt: JsonField) = apply { this.deletedAt = deletedAt } + + /** Specifies when the rules should stop applying rules based on the date. */ + fun effectiveEndDate(effectiveEndDate: String?) = + effectiveEndDate(JsonField.ofNullable(effectiveEndDate)) + + /** Alias for calling [Builder.effectiveEndDate] with `effectiveEndDate.orElse(null)`. */ + fun effectiveEndDate(effectiveEndDate: Optional) = + effectiveEndDate(effectiveEndDate.getOrNull()) + + /** + * Sets [Builder.effectiveEndDate] to an arbitrary JSON value. + * + * You should usually call [Builder.effectiveEndDate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun effectiveEndDate(effectiveEndDate: JsonField) = apply { + this.effectiveEndDate = effectiveEndDate + } + + /** Specifies when the rule should begin applying based on the date. */ + fun effectiveStartDate(effectiveStartDate: String?) = + effectiveStartDate(JsonField.ofNullable(effectiveStartDate)) + + /** + * Alias for calling [Builder.effectiveStartDate] with `effectiveStartDate.orElse(null)`. + */ + fun effectiveStartDate(effectiveStartDate: Optional) = + effectiveStartDate(effectiveStartDate.getOrNull()) + + /** + * Sets [Builder.effectiveStartDate] to an arbitrary JSON value. + * + * You should usually call [Builder.effectiveStartDate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun effectiveStartDate(effectiveStartDate: JsonField) = apply { + this.effectiveStartDate = effectiveStartDate + } + + /** The entity type to which the rule is applied. */ + fun entityType(entityType: EntityType) = entityType(JsonField.of(entityType)) + + /** + * Sets [Builder.entityType] to an arbitrary JSON value. + * + * You should usually call [Builder.entityType] with a well-typed [EntityType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun entityType(entityType: JsonField) = apply { this.entityType = entityType } + + /** The priority of the rule. */ + fun priority(priority: Long) = priority(JsonField.of(priority)) + + /** + * Sets [Builder.priority] to an arbitrary JSON value. + * + * You should usually call [Builder.priority] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun priority(priority: JsonField) = apply { this.priority = priority } + + /** The datetime when the rule was last updated. */ + fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) + + /** + * Sets [Builder.updatedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun updatedAt(updatedAt: JsonField) = apply { this.updatedAt = updatedAt } + + 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 [RuleDeleteResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): RuleDeleteResponse = + RuleDeleteResponse( + id, + attributes, + (conditions ?: JsonMissing.of()).map { it.toImmutable() }, + createdAt, + deletedAt, + effectiveEndDate, + effectiveStartDate, + entityType, + priority, + updatedAt, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): RuleDeleteResponse = apply { + if (validated) { + return@apply + } + + id() + attributes().ifPresent { it.validate() } + conditions().ifPresent { it.forEach { it.validate() } } + createdAt() + deletedAt() + effectiveEndDate() + effectiveStartDate() + entityType().ifPresent { it.validate() } + priority() + updatedAt() + 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 (id.asKnown().isPresent) 1 else 0) + + (attributes.asKnown().getOrNull()?.validity() ?: 0) + + (conditions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (if (deletedAt.asKnown().isPresent) 1 else 0) + + (if (effectiveEndDate.asKnown().isPresent) 1 else 0) + + (if (effectiveStartDate.asKnown().isPresent) 1 else 0) + + (entityType.asKnown().getOrNull()?.validity() ?: 0) + + (if (priority.asKnown().isPresent) 1 else 0) + + (if (updatedAt.asKnown().isPresent) 1 else 0) + + /** Specifies the fields to be applied when the condition is met. */ + class Attributes + private constructor( + private val metadata: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + + /** + * The metadata to be attached in the entity. It is a key-value pairs where the values can + * be of any type (string, number, boolean, object, array, etc.). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + + @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 [Attributes]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Attributes]. */ + class Builder internal constructor() { + + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(attributes: Attributes) = apply { + metadata = attributes.metadata + additionalProperties = attributes.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached in the entity. It is a key-value pairs where the values + * can be of any type (string, number, boolean, object, array, etc.). + */ + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + 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 [Attributes]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Attributes = Attributes(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Attributes = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (metadata.asKnown().getOrNull()?.validity() ?: 0) + + /** + * The metadata to be attached in the entity. It is a key-value pairs where the values can + * be of any type (string, number, boolean, object, array, etc.). + */ + class Metadata + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Metadata]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + 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 [Metadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + 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 = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Attributes && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Attributes{metadata=$metadata, additionalProperties=$additionalProperties}" + } + + class Condition + private constructor( + private val field: JsonField, + private val operator: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("field") @ExcludeMissing field: JsonField = JsonMissing.of(), + @JsonProperty("operator") + @ExcludeMissing + operator: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + ) : this(field, operator, value, mutableMapOf()) + + /** + * The field to be checked in the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun field(): Optional = Optional.ofNullable(field.getNullable("field")) + + /** + * The operator to be used in the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) + + /** + * The value of the field to be checked in the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun value(): Optional = Optional.ofNullable(value.getNullable("value")) + + /** + * Returns the raw JSON value of [field]. + * + * Unlike [field], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("field") @ExcludeMissing fun _field(): JsonField = field + + /** + * Returns the raw JSON value of [operator]. + * + * Unlike [operator], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("operator") @ExcludeMissing fun _operator(): JsonField = operator + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @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 [Condition]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Condition]. */ + class Builder internal constructor() { + + private var field: JsonField = JsonMissing.of() + private var operator: JsonField = JsonMissing.of() + private var value: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(condition: Condition) = apply { + field = condition.field + operator = condition.operator + value = condition.value + additionalProperties = condition.additionalProperties.toMutableMap() + } + + /** The field to be checked in the rule. */ + fun field(field: String) = field(JsonField.of(field)) + + /** + * Sets [Builder.field] to an arbitrary JSON value. + * + * You should usually call [Builder.field] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun field(field: JsonField) = apply { this.field = field } + + /** The operator to be used in the rule. */ + fun operator(operator: Operator) = operator(JsonField.of(operator)) + + /** + * Sets [Builder.operator] to an arbitrary JSON value. + * + * You should usually call [Builder.operator] with a well-typed [Operator] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun operator(operator: JsonField) = apply { this.operator = operator } + + /** The value of the field to be checked in the rule. */ + fun value(value: String) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + 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 [Condition]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Condition = + Condition(field, operator, value, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Condition = apply { + if (validated) { + return@apply + } + + field() + operator().ifPresent { it.validate() } + value() + 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 (field.asKnown().isPresent) 1 else 0) + + (operator.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + /** The operator to be used in the rule. */ + class Operator @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 EQUALS = of("equals") + + @JvmStatic fun of(value: String) = Operator(JsonField.of(value)) + } + + /** An enum containing [Operator]'s known values. */ + enum class Known { + EQUALS + } + + /** + * An enum containing [Operator]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Operator] 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 { + EQUALS, + /** + * An enum member indicating that [Operator] 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) { + EQUALS -> Value.EQUALS + 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) { + EQUALS -> Known.EQUALS + else -> throw FinchInvalidDataException("Unknown Operator: $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(): Operator = 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 Operator && 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 Condition && field == other.field && operator == other.operator && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(field, operator, value, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Condition{field=$field, operator=$operator, value=$value, additionalProperties=$additionalProperties}" + } + + /** The entity type to which the rule is applied. */ + class EntityType @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PAY_STATEMENT_ITEM = of("pay_statement_item") + + @JvmStatic fun of(value: String) = EntityType(JsonField.of(value)) + } + + /** An enum containing [EntityType]'s known values. */ + enum class Known { + PAY_STATEMENT_ITEM + } + + /** + * An enum containing [EntityType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EntityType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PAY_STATEMENT_ITEM, + /** + * An enum member indicating that [EntityType] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PAY_STATEMENT_ITEM -> Value.PAY_STATEMENT_ITEM + 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) { + PAY_STATEMENT_ITEM -> Known.PAY_STATEMENT_ITEM + else -> throw FinchInvalidDataException("Unknown EntityType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws 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(): EntityType = 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 EntityType && 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 RuleDeleteResponse && id == other.id && attributes == other.attributes && conditions == other.conditions && createdAt == other.createdAt && deletedAt == other.deletedAt && effectiveEndDate == other.effectiveEndDate && effectiveStartDate == other.effectiveStartDate && entityType == other.entityType && priority == other.priority && updatedAt == other.updatedAt && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, attributes, conditions, createdAt, deletedAt, effectiveEndDate, effectiveStartDate, entityType, priority, updatedAt, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleDeleteResponse{id=$id, attributes=$attributes, conditions=$conditions, createdAt=$createdAt, deletedAt=$deletedAt, effectiveEndDate=$effectiveEndDate, effectiveStartDate=$effectiveStartDate, entityType=$entityType, priority=$priority, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleListResponse.kt new file mode 100644 index 00000000..21295a5d --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleListResponse.kt @@ -0,0 +1,1224 @@ +// 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.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class RuleListResponse +private constructor( + private val id: JsonField, + private val attributes: JsonField, + private val conditions: JsonField>, + private val createdAt: JsonField, + private val effectiveEndDate: JsonField, + private val effectiveStartDate: JsonField, + private val entityType: JsonField, + private val priority: JsonField, + private val updatedAt: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + attributes: JsonField = JsonMissing.of(), + @JsonProperty("conditions") + @ExcludeMissing + conditions: JsonField> = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("effective_end_date") + @ExcludeMissing + effectiveEndDate: JsonField = JsonMissing.of(), + @JsonProperty("effective_start_date") + @ExcludeMissing + effectiveStartDate: JsonField = JsonMissing.of(), + @JsonProperty("entity_type") + @ExcludeMissing + entityType: JsonField = JsonMissing.of(), + @JsonProperty("priority") @ExcludeMissing priority: JsonField = JsonMissing.of(), + @JsonProperty("updated_at") + @ExcludeMissing + updatedAt: JsonField = JsonMissing.of(), + ) : this( + id, + attributes, + conditions, + createdAt, + effectiveEndDate, + effectiveStartDate, + entityType, + priority, + updatedAt, + mutableMapOf(), + ) + + /** + * Finch id (uuidv4) for the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + + /** + * Specifies the fields to be applied when the condition is met. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun attributes(): Optional = + Optional.ofNullable(attributes.getNullable("attributes")) + + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun conditions(): Optional> = + Optional.ofNullable(conditions.getNullable("conditions")) + + /** + * The datetime when the rule was created. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun createdAt(): Optional = + Optional.ofNullable(createdAt.getNullable("created_at")) + + /** + * Specifies when the rules should stop applying rules based on the date. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun effectiveEndDate(): Optional = + Optional.ofNullable(effectiveEndDate.getNullable("effective_end_date")) + + /** + * Specifies when the rule should begin applying based on the date. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun effectiveStartDate(): Optional = + Optional.ofNullable(effectiveStartDate.getNullable("effective_start_date")) + + /** + * The entity type to which the rule is applied. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun entityType(): Optional = + Optional.ofNullable(entityType.getNullable("entity_type")) + + /** + * The priority of the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun priority(): Optional = Optional.ofNullable(priority.getNullable("priority")) + + /** + * The datetime when the rule was last updated. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun updatedAt(): Optional = + Optional.ofNullable(updatedAt.getNullable("updated_at")) + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [attributes]. + * + * Unlike [attributes], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("attributes") + @ExcludeMissing + fun _attributes(): JsonField = attributes + + /** + * Returns the raw JSON value of [conditions]. + * + * Unlike [conditions], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("conditions") + @ExcludeMissing + fun _conditions(): JsonField> = conditions + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [effectiveEndDate]. + * + * Unlike [effectiveEndDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("effective_end_date") + @ExcludeMissing + fun _effectiveEndDate(): JsonField = effectiveEndDate + + /** + * Returns the raw JSON value of [effectiveStartDate]. + * + * Unlike [effectiveStartDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("effective_start_date") + @ExcludeMissing + fun _effectiveStartDate(): JsonField = effectiveStartDate + + /** + * Returns the raw JSON value of [entityType]. + * + * Unlike [entityType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("entity_type") + @ExcludeMissing + fun _entityType(): JsonField = entityType + + /** + * Returns the raw JSON value of [priority]. + * + * Unlike [priority], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("priority") @ExcludeMissing fun _priority(): JsonField = priority + + /** + * Returns the raw JSON value of [updatedAt]. + * + * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("updated_at") + @ExcludeMissing + fun _updatedAt(): JsonField = updatedAt + + @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 [RuleListResponse]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleListResponse]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() + private var conditions: JsonField>? = null + private var createdAt: JsonField = JsonMissing.of() + private var effectiveEndDate: JsonField = JsonMissing.of() + private var effectiveStartDate: JsonField = JsonMissing.of() + private var entityType: JsonField = JsonMissing.of() + private var priority: JsonField = JsonMissing.of() + private var updatedAt: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleListResponse: RuleListResponse) = apply { + id = ruleListResponse.id + attributes = ruleListResponse.attributes + conditions = ruleListResponse.conditions.map { it.toMutableList() } + createdAt = ruleListResponse.createdAt + effectiveEndDate = ruleListResponse.effectiveEndDate + effectiveStartDate = ruleListResponse.effectiveStartDate + entityType = ruleListResponse.entityType + priority = ruleListResponse.priority + updatedAt = ruleListResponse.updatedAt + additionalProperties = ruleListResponse.additionalProperties.toMutableMap() + } + + /** Finch id (uuidv4) for the rule. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** Specifies the fields to be applied when the condition is met. */ + fun attributes(attributes: Attributes) = attributes(JsonField.of(attributes)) + + /** + * Sets [Builder.attributes] to an arbitrary JSON value. + * + * You should usually call [Builder.attributes] with a well-typed [Attributes] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun attributes(attributes: JsonField) = apply { this.attributes = attributes } + + fun conditions(conditions: List) = conditions(JsonField.of(conditions)) + + /** + * Sets [Builder.conditions] to an arbitrary JSON value. + * + * You should usually call [Builder.conditions] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun conditions(conditions: JsonField>) = apply { + this.conditions = conditions.map { it.toMutableList() } + } + + /** + * Adds a single [Condition] to [conditions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addCondition(condition: Condition) = apply { + conditions = + (conditions ?: JsonField.of(mutableListOf())).also { + checkKnown("conditions", it).add(condition) + } + } + + /** The datetime when the rule was created. */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + /** Specifies when the rules should stop applying rules based on the date. */ + fun effectiveEndDate(effectiveEndDate: String?) = + effectiveEndDate(JsonField.ofNullable(effectiveEndDate)) + + /** Alias for calling [Builder.effectiveEndDate] with `effectiveEndDate.orElse(null)`. */ + fun effectiveEndDate(effectiveEndDate: Optional) = + effectiveEndDate(effectiveEndDate.getOrNull()) + + /** + * Sets [Builder.effectiveEndDate] to an arbitrary JSON value. + * + * You should usually call [Builder.effectiveEndDate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun effectiveEndDate(effectiveEndDate: JsonField) = apply { + this.effectiveEndDate = effectiveEndDate + } + + /** Specifies when the rule should begin applying based on the date. */ + fun effectiveStartDate(effectiveStartDate: String?) = + effectiveStartDate(JsonField.ofNullable(effectiveStartDate)) + + /** + * Alias for calling [Builder.effectiveStartDate] with `effectiveStartDate.orElse(null)`. + */ + fun effectiveStartDate(effectiveStartDate: Optional) = + effectiveStartDate(effectiveStartDate.getOrNull()) + + /** + * Sets [Builder.effectiveStartDate] to an arbitrary JSON value. + * + * You should usually call [Builder.effectiveStartDate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun effectiveStartDate(effectiveStartDate: JsonField) = apply { + this.effectiveStartDate = effectiveStartDate + } + + /** The entity type to which the rule is applied. */ + fun entityType(entityType: EntityType) = entityType(JsonField.of(entityType)) + + /** + * Sets [Builder.entityType] to an arbitrary JSON value. + * + * You should usually call [Builder.entityType] with a well-typed [EntityType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun entityType(entityType: JsonField) = apply { this.entityType = entityType } + + /** The priority of the rule. */ + fun priority(priority: Long) = priority(JsonField.of(priority)) + + /** + * Sets [Builder.priority] to an arbitrary JSON value. + * + * You should usually call [Builder.priority] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun priority(priority: JsonField) = apply { this.priority = priority } + + /** The datetime when the rule was last updated. */ + fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) + + /** + * Sets [Builder.updatedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun updatedAt(updatedAt: JsonField) = apply { this.updatedAt = updatedAt } + + 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 [RuleListResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): RuleListResponse = + RuleListResponse( + id, + attributes, + (conditions ?: JsonMissing.of()).map { it.toImmutable() }, + createdAt, + effectiveEndDate, + effectiveStartDate, + entityType, + priority, + updatedAt, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): RuleListResponse = apply { + if (validated) { + return@apply + } + + id() + attributes().ifPresent { it.validate() } + conditions().ifPresent { it.forEach { it.validate() } } + createdAt() + effectiveEndDate() + effectiveStartDate() + entityType().ifPresent { it.validate() } + priority() + updatedAt() + 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 (id.asKnown().isPresent) 1 else 0) + + (attributes.asKnown().getOrNull()?.validity() ?: 0) + + (conditions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (if (effectiveEndDate.asKnown().isPresent) 1 else 0) + + (if (effectiveStartDate.asKnown().isPresent) 1 else 0) + + (entityType.asKnown().getOrNull()?.validity() ?: 0) + + (if (priority.asKnown().isPresent) 1 else 0) + + (if (updatedAt.asKnown().isPresent) 1 else 0) + + /** Specifies the fields to be applied when the condition is met. */ + class Attributes + private constructor( + private val metadata: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + + /** + * The metadata to be attached in the entity. It is a key-value pairs where the values can + * be of any type (string, number, boolean, object, array, etc.). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + + @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 [Attributes]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Attributes]. */ + class Builder internal constructor() { + + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(attributes: Attributes) = apply { + metadata = attributes.metadata + additionalProperties = attributes.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached in the entity. It is a key-value pairs where the values + * can be of any type (string, number, boolean, object, array, etc.). + */ + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + 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 [Attributes]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Attributes = Attributes(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Attributes = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (metadata.asKnown().getOrNull()?.validity() ?: 0) + + /** + * The metadata to be attached in the entity. It is a key-value pairs where the values can + * be of any type (string, number, boolean, object, array, etc.). + */ + class Metadata + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Metadata]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + 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 [Metadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + 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 = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Attributes && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Attributes{metadata=$metadata, additionalProperties=$additionalProperties}" + } + + class Condition + private constructor( + private val field: JsonField, + private val operator: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("field") @ExcludeMissing field: JsonField = JsonMissing.of(), + @JsonProperty("operator") + @ExcludeMissing + operator: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + ) : this(field, operator, value, mutableMapOf()) + + /** + * The field to be checked in the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun field(): Optional = Optional.ofNullable(field.getNullable("field")) + + /** + * The operator to be used in the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) + + /** + * The value of the field to be checked in the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun value(): Optional = Optional.ofNullable(value.getNullable("value")) + + /** + * Returns the raw JSON value of [field]. + * + * Unlike [field], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("field") @ExcludeMissing fun _field(): JsonField = field + + /** + * Returns the raw JSON value of [operator]. + * + * Unlike [operator], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("operator") @ExcludeMissing fun _operator(): JsonField = operator + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @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 [Condition]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Condition]. */ + class Builder internal constructor() { + + private var field: JsonField = JsonMissing.of() + private var operator: JsonField = JsonMissing.of() + private var value: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(condition: Condition) = apply { + field = condition.field + operator = condition.operator + value = condition.value + additionalProperties = condition.additionalProperties.toMutableMap() + } + + /** The field to be checked in the rule. */ + fun field(field: String) = field(JsonField.of(field)) + + /** + * Sets [Builder.field] to an arbitrary JSON value. + * + * You should usually call [Builder.field] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun field(field: JsonField) = apply { this.field = field } + + /** The operator to be used in the rule. */ + fun operator(operator: Operator) = operator(JsonField.of(operator)) + + /** + * Sets [Builder.operator] to an arbitrary JSON value. + * + * You should usually call [Builder.operator] with a well-typed [Operator] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun operator(operator: JsonField) = apply { this.operator = operator } + + /** The value of the field to be checked in the rule. */ + fun value(value: String) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + 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 [Condition]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Condition = + Condition(field, operator, value, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Condition = apply { + if (validated) { + return@apply + } + + field() + operator().ifPresent { it.validate() } + value() + 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 (field.asKnown().isPresent) 1 else 0) + + (operator.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + /** The operator to be used in the rule. */ + class Operator @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 EQUALS = of("equals") + + @JvmStatic fun of(value: String) = Operator(JsonField.of(value)) + } + + /** An enum containing [Operator]'s known values. */ + enum class Known { + EQUALS + } + + /** + * An enum containing [Operator]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Operator] 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 { + EQUALS, + /** + * An enum member indicating that [Operator] 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) { + EQUALS -> Value.EQUALS + 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) { + EQUALS -> Known.EQUALS + else -> throw FinchInvalidDataException("Unknown Operator: $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(): Operator = 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 Operator && 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 Condition && field == other.field && operator == other.operator && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(field, operator, value, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Condition{field=$field, operator=$operator, value=$value, additionalProperties=$additionalProperties}" + } + + /** The entity type to which the rule is applied. */ + class EntityType @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PAY_STATEMENT_ITEM = of("pay_statement_item") + + @JvmStatic fun of(value: String) = EntityType(JsonField.of(value)) + } + + /** An enum containing [EntityType]'s known values. */ + enum class Known { + PAY_STATEMENT_ITEM + } + + /** + * An enum containing [EntityType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EntityType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PAY_STATEMENT_ITEM, + /** + * An enum member indicating that [EntityType] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PAY_STATEMENT_ITEM -> Value.PAY_STATEMENT_ITEM + 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) { + PAY_STATEMENT_ITEM -> Known.PAY_STATEMENT_ITEM + else -> throw FinchInvalidDataException("Unknown EntityType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws 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(): EntityType = 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 EntityType && 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 RuleListResponse && id == other.id && attributes == other.attributes && conditions == other.conditions && createdAt == other.createdAt && effectiveEndDate == other.effectiveEndDate && effectiveStartDate == other.effectiveStartDate && entityType == other.entityType && priority == other.priority && updatedAt == other.updatedAt && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, attributes, conditions, createdAt, effectiveEndDate, effectiveStartDate, entityType, priority, updatedAt, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleListResponse{id=$id, attributes=$attributes, conditions=$conditions, createdAt=$createdAt, effectiveEndDate=$effectiveEndDate, effectiveStartDate=$effectiveStartDate, entityType=$entityType, priority=$priority, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleUpdateResponse.kt new file mode 100644 index 00000000..ab9209fe --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleUpdateResponse.kt @@ -0,0 +1,1224 @@ +// 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.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class RuleUpdateResponse +private constructor( + private val id: JsonField, + private val attributes: JsonField, + private val conditions: JsonField>, + private val createdAt: JsonField, + private val effectiveEndDate: JsonField, + private val effectiveStartDate: JsonField, + private val entityType: JsonField, + private val priority: JsonField, + private val updatedAt: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + attributes: JsonField = JsonMissing.of(), + @JsonProperty("conditions") + @ExcludeMissing + conditions: JsonField> = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("effective_end_date") + @ExcludeMissing + effectiveEndDate: JsonField = JsonMissing.of(), + @JsonProperty("effective_start_date") + @ExcludeMissing + effectiveStartDate: JsonField = JsonMissing.of(), + @JsonProperty("entity_type") + @ExcludeMissing + entityType: JsonField = JsonMissing.of(), + @JsonProperty("priority") @ExcludeMissing priority: JsonField = JsonMissing.of(), + @JsonProperty("updated_at") + @ExcludeMissing + updatedAt: JsonField = JsonMissing.of(), + ) : this( + id, + attributes, + conditions, + createdAt, + effectiveEndDate, + effectiveStartDate, + entityType, + priority, + updatedAt, + mutableMapOf(), + ) + + /** + * Finch id (uuidv4) for the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + + /** + * Specifies the fields to be applied when the condition is met. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun attributes(): Optional = + Optional.ofNullable(attributes.getNullable("attributes")) + + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun conditions(): Optional> = + Optional.ofNullable(conditions.getNullable("conditions")) + + /** + * The datetime when the rule was created. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun createdAt(): Optional = + Optional.ofNullable(createdAt.getNullable("created_at")) + + /** + * Specifies when the rules should stop applying rules based on the date. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun effectiveEndDate(): Optional = + Optional.ofNullable(effectiveEndDate.getNullable("effective_end_date")) + + /** + * Specifies when the rule should begin applying based on the date. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun effectiveStartDate(): Optional = + Optional.ofNullable(effectiveStartDate.getNullable("effective_start_date")) + + /** + * The entity type to which the rule is applied. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun entityType(): Optional = + Optional.ofNullable(entityType.getNullable("entity_type")) + + /** + * The priority of the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun priority(): Optional = Optional.ofNullable(priority.getNullable("priority")) + + /** + * The datetime when the rule was last updated. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun updatedAt(): Optional = + Optional.ofNullable(updatedAt.getNullable("updated_at")) + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [attributes]. + * + * Unlike [attributes], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("attributes") + @ExcludeMissing + fun _attributes(): JsonField = attributes + + /** + * Returns the raw JSON value of [conditions]. + * + * Unlike [conditions], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("conditions") + @ExcludeMissing + fun _conditions(): JsonField> = conditions + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [effectiveEndDate]. + * + * Unlike [effectiveEndDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("effective_end_date") + @ExcludeMissing + fun _effectiveEndDate(): JsonField = effectiveEndDate + + /** + * Returns the raw JSON value of [effectiveStartDate]. + * + * Unlike [effectiveStartDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("effective_start_date") + @ExcludeMissing + fun _effectiveStartDate(): JsonField = effectiveStartDate + + /** + * Returns the raw JSON value of [entityType]. + * + * Unlike [entityType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("entity_type") + @ExcludeMissing + fun _entityType(): JsonField = entityType + + /** + * Returns the raw JSON value of [priority]. + * + * Unlike [priority], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("priority") @ExcludeMissing fun _priority(): JsonField = priority + + /** + * Returns the raw JSON value of [updatedAt]. + * + * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("updated_at") + @ExcludeMissing + fun _updatedAt(): JsonField = updatedAt + + @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 [RuleUpdateResponse]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleUpdateResponse]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() + private var conditions: JsonField>? = null + private var createdAt: JsonField = JsonMissing.of() + private var effectiveEndDate: JsonField = JsonMissing.of() + private var effectiveStartDate: JsonField = JsonMissing.of() + private var entityType: JsonField = JsonMissing.of() + private var priority: JsonField = JsonMissing.of() + private var updatedAt: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleUpdateResponse: RuleUpdateResponse) = apply { + id = ruleUpdateResponse.id + attributes = ruleUpdateResponse.attributes + conditions = ruleUpdateResponse.conditions.map { it.toMutableList() } + createdAt = ruleUpdateResponse.createdAt + effectiveEndDate = ruleUpdateResponse.effectiveEndDate + effectiveStartDate = ruleUpdateResponse.effectiveStartDate + entityType = ruleUpdateResponse.entityType + priority = ruleUpdateResponse.priority + updatedAt = ruleUpdateResponse.updatedAt + additionalProperties = ruleUpdateResponse.additionalProperties.toMutableMap() + } + + /** Finch id (uuidv4) for the rule. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** Specifies the fields to be applied when the condition is met. */ + fun attributes(attributes: Attributes) = attributes(JsonField.of(attributes)) + + /** + * Sets [Builder.attributes] to an arbitrary JSON value. + * + * You should usually call [Builder.attributes] with a well-typed [Attributes] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun attributes(attributes: JsonField) = apply { this.attributes = attributes } + + fun conditions(conditions: List) = conditions(JsonField.of(conditions)) + + /** + * Sets [Builder.conditions] to an arbitrary JSON value. + * + * You should usually call [Builder.conditions] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun conditions(conditions: JsonField>) = apply { + this.conditions = conditions.map { it.toMutableList() } + } + + /** + * Adds a single [Condition] to [conditions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addCondition(condition: Condition) = apply { + conditions = + (conditions ?: JsonField.of(mutableListOf())).also { + checkKnown("conditions", it).add(condition) + } + } + + /** The datetime when the rule was created. */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + /** Specifies when the rules should stop applying rules based on the date. */ + fun effectiveEndDate(effectiveEndDate: String?) = + effectiveEndDate(JsonField.ofNullable(effectiveEndDate)) + + /** Alias for calling [Builder.effectiveEndDate] with `effectiveEndDate.orElse(null)`. */ + fun effectiveEndDate(effectiveEndDate: Optional) = + effectiveEndDate(effectiveEndDate.getOrNull()) + + /** + * Sets [Builder.effectiveEndDate] to an arbitrary JSON value. + * + * You should usually call [Builder.effectiveEndDate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun effectiveEndDate(effectiveEndDate: JsonField) = apply { + this.effectiveEndDate = effectiveEndDate + } + + /** Specifies when the rule should begin applying based on the date. */ + fun effectiveStartDate(effectiveStartDate: String?) = + effectiveStartDate(JsonField.ofNullable(effectiveStartDate)) + + /** + * Alias for calling [Builder.effectiveStartDate] with `effectiveStartDate.orElse(null)`. + */ + fun effectiveStartDate(effectiveStartDate: Optional) = + effectiveStartDate(effectiveStartDate.getOrNull()) + + /** + * Sets [Builder.effectiveStartDate] to an arbitrary JSON value. + * + * You should usually call [Builder.effectiveStartDate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun effectiveStartDate(effectiveStartDate: JsonField) = apply { + this.effectiveStartDate = effectiveStartDate + } + + /** The entity type to which the rule is applied. */ + fun entityType(entityType: EntityType) = entityType(JsonField.of(entityType)) + + /** + * Sets [Builder.entityType] to an arbitrary JSON value. + * + * You should usually call [Builder.entityType] with a well-typed [EntityType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun entityType(entityType: JsonField) = apply { this.entityType = entityType } + + /** The priority of the rule. */ + fun priority(priority: Long) = priority(JsonField.of(priority)) + + /** + * Sets [Builder.priority] to an arbitrary JSON value. + * + * You should usually call [Builder.priority] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun priority(priority: JsonField) = apply { this.priority = priority } + + /** The datetime when the rule was last updated. */ + fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) + + /** + * Sets [Builder.updatedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun updatedAt(updatedAt: JsonField) = apply { this.updatedAt = updatedAt } + + 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 [RuleUpdateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): RuleUpdateResponse = + RuleUpdateResponse( + id, + attributes, + (conditions ?: JsonMissing.of()).map { it.toImmutable() }, + createdAt, + effectiveEndDate, + effectiveStartDate, + entityType, + priority, + updatedAt, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): RuleUpdateResponse = apply { + if (validated) { + return@apply + } + + id() + attributes().ifPresent { it.validate() } + conditions().ifPresent { it.forEach { it.validate() } } + createdAt() + effectiveEndDate() + effectiveStartDate() + entityType().ifPresent { it.validate() } + priority() + updatedAt() + 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 (id.asKnown().isPresent) 1 else 0) + + (attributes.asKnown().getOrNull()?.validity() ?: 0) + + (conditions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (if (effectiveEndDate.asKnown().isPresent) 1 else 0) + + (if (effectiveStartDate.asKnown().isPresent) 1 else 0) + + (entityType.asKnown().getOrNull()?.validity() ?: 0) + + (if (priority.asKnown().isPresent) 1 else 0) + + (if (updatedAt.asKnown().isPresent) 1 else 0) + + /** Specifies the fields to be applied when the condition is met. */ + class Attributes + private constructor( + private val metadata: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of() + ) : this(metadata, mutableMapOf()) + + /** + * The metadata to be attached in the entity. It is a key-value pairs where the values can + * be of any type (string, number, boolean, object, array, etc.). + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + + @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 [Attributes]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Attributes]. */ + class Builder internal constructor() { + + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(attributes: Attributes) = apply { + metadata = attributes.metadata + additionalProperties = attributes.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached in the entity. It is a key-value pairs where the values + * can be of any type (string, number, boolean, object, array, etc.). + */ + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + 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 [Attributes]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Attributes = Attributes(metadata, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Attributes = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: FinchInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (metadata.asKnown().getOrNull()?.validity() ?: 0) + + /** + * The metadata to be attached in the entity. It is a key-value pairs where the values can + * be of any type (string, number, boolean, object, array, etc.). + */ + class Metadata + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Metadata]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + 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 [Metadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + 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 = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Attributes && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Attributes{metadata=$metadata, additionalProperties=$additionalProperties}" + } + + class Condition + private constructor( + private val field: JsonField, + private val operator: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("field") @ExcludeMissing field: JsonField = JsonMissing.of(), + @JsonProperty("operator") + @ExcludeMissing + operator: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + ) : this(field, operator, value, mutableMapOf()) + + /** + * The field to be checked in the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun field(): Optional = Optional.ofNullable(field.getNullable("field")) + + /** + * The operator to be used in the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) + + /** + * The value of the field to be checked in the rule. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun value(): Optional = Optional.ofNullable(value.getNullable("value")) + + /** + * Returns the raw JSON value of [field]. + * + * Unlike [field], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("field") @ExcludeMissing fun _field(): JsonField = field + + /** + * Returns the raw JSON value of [operator]. + * + * Unlike [operator], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("operator") @ExcludeMissing fun _operator(): JsonField = operator + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @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 [Condition]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Condition]. */ + class Builder internal constructor() { + + private var field: JsonField = JsonMissing.of() + private var operator: JsonField = JsonMissing.of() + private var value: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(condition: Condition) = apply { + field = condition.field + operator = condition.operator + value = condition.value + additionalProperties = condition.additionalProperties.toMutableMap() + } + + /** The field to be checked in the rule. */ + fun field(field: String) = field(JsonField.of(field)) + + /** + * Sets [Builder.field] to an arbitrary JSON value. + * + * You should usually call [Builder.field] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun field(field: JsonField) = apply { this.field = field } + + /** The operator to be used in the rule. */ + fun operator(operator: Operator) = operator(JsonField.of(operator)) + + /** + * Sets [Builder.operator] to an arbitrary JSON value. + * + * You should usually call [Builder.operator] with a well-typed [Operator] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun operator(operator: JsonField) = apply { this.operator = operator } + + /** The value of the field to be checked in the rule. */ + fun value(value: String) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + 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 [Condition]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Condition = + Condition(field, operator, value, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Condition = apply { + if (validated) { + return@apply + } + + field() + operator().ifPresent { it.validate() } + value() + 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 (field.asKnown().isPresent) 1 else 0) + + (operator.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + /** The operator to be used in the rule. */ + class Operator @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 EQUALS = of("equals") + + @JvmStatic fun of(value: String) = Operator(JsonField.of(value)) + } + + /** An enum containing [Operator]'s known values. */ + enum class Known { + EQUALS + } + + /** + * An enum containing [Operator]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Operator] 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 { + EQUALS, + /** + * An enum member indicating that [Operator] 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) { + EQUALS -> Value.EQUALS + 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) { + EQUALS -> Known.EQUALS + else -> throw FinchInvalidDataException("Unknown Operator: $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(): Operator = 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 Operator && 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 Condition && field == other.field && operator == other.operator && value == other.value && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(field, operator, value, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Condition{field=$field, operator=$operator, value=$value, additionalProperties=$additionalProperties}" + } + + /** The entity type to which the rule is applied. */ + class EntityType @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PAY_STATEMENT_ITEM = of("pay_statement_item") + + @JvmStatic fun of(value: String) = EntityType(JsonField.of(value)) + } + + /** An enum containing [EntityType]'s known values. */ + enum class Known { + PAY_STATEMENT_ITEM + } + + /** + * An enum containing [EntityType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EntityType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PAY_STATEMENT_ITEM, + /** + * An enum member indicating that [EntityType] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PAY_STATEMENT_ITEM -> Value.PAY_STATEMENT_ITEM + 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) { + PAY_STATEMENT_ITEM -> Known.PAY_STATEMENT_ITEM + else -> throw FinchInvalidDataException("Unknown EntityType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws 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(): EntityType = 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 EntityType && 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 RuleUpdateResponse && id == other.id && attributes == other.attributes && conditions == other.conditions && createdAt == other.createdAt && effectiveEndDate == other.effectiveEndDate && effectiveStartDate == other.effectiveStartDate && entityType == other.entityType && priority == other.priority && updatedAt == other.updatedAt && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, attributes, conditions, createdAt, effectiveEndDate, effectiveStartDate, entityType, priority, updatedAt, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleUpdateResponse{id=$id, attributes=$attributes, conditions=$conditions, createdAt=$createdAt, effectiveEndDate=$effectiveEndDate, effectiveStartDate=$effectiveStartDate, entityType=$entityType, priority=$priority, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt index b1cd877e..cfdf2ff3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt @@ -7,6 +7,7 @@ import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.Company import com.tryfinch.api.models.HrisCompanyRetrieveParams +import com.tryfinch.api.services.async.hris.company.PayStatementItemServiceAsync import java.util.concurrent.CompletableFuture interface CompanyServiceAsync { @@ -16,6 +17,8 @@ interface CompanyServiceAsync { */ fun withRawResponse(): WithRawResponse + fun payStatementItem(): PayStatementItemServiceAsync + /** Read basic company data */ fun retrieve(): CompletableFuture = retrieve(HrisCompanyRetrieveParams.none()) @@ -39,6 +42,8 @@ interface CompanyServiceAsync { */ interface WithRawResponse { + fun payStatementItem(): PayStatementItemServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `get /employer/company`, but is otherwise the same as * [CompanyServiceAsync.retrieve]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt index 30733b3c..36674057 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt @@ -16,6 +16,8 @@ import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepareAsync import com.tryfinch.api.models.Company import com.tryfinch.api.models.HrisCompanyRetrieveParams +import com.tryfinch.api.services.async.hris.company.PayStatementItemServiceAsync +import com.tryfinch.api.services.async.hris.company.PayStatementItemServiceAsyncImpl import java.util.concurrent.CompletableFuture class CompanyServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -25,8 +27,14 @@ class CompanyServiceAsyncImpl internal constructor(private val clientOptions: Cl WithRawResponseImpl(clientOptions) } + private val payStatementItem: PayStatementItemServiceAsync by lazy { + PayStatementItemServiceAsyncImpl(clientOptions) + } + override fun withRawResponse(): CompanyServiceAsync.WithRawResponse = withRawResponse + override fun payStatementItem(): PayStatementItemServiceAsync = payStatementItem + override fun retrieve( params: HrisCompanyRetrieveParams, requestOptions: RequestOptions, @@ -39,6 +47,13 @@ class CompanyServiceAsyncImpl internal constructor(private val clientOptions: Cl private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val payStatementItem: PayStatementItemServiceAsync.WithRawResponse by lazy { + PayStatementItemServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun payStatementItem(): PayStatementItemServiceAsync.WithRawResponse = + payStatementItem + private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/PayStatementItemServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/PayStatementItemServiceAsync.kt new file mode 100644 index 00000000..a0fdb11b --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/PayStatementItemServiceAsync.kt @@ -0,0 +1,88 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.hris.company + +import com.google.errorprone.annotations.MustBeClosed +import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.models.HrisCompanyPayStatementItemListPageAsync +import com.tryfinch.api.models.HrisCompanyPayStatementItemListParams +import com.tryfinch.api.services.async.hris.company.payStatementItem.RuleServiceAsync +import java.util.concurrent.CompletableFuture + +interface PayStatementItemServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + fun rules(): RuleServiceAsync + + /** + * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical + * support will be added soon Retrieve a list of detailed pay statement items for the access + * token's connection account. + */ + fun list(): CompletableFuture = + list(HrisCompanyPayStatementItemListParams.none()) + + /** @see [list] */ + fun list( + params: HrisCompanyPayStatementItemListParams = + HrisCompanyPayStatementItemListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see [list] */ + fun list( + params: HrisCompanyPayStatementItemListParams = HrisCompanyPayStatementItemListParams.none() + ): CompletableFuture = + list(params, RequestOptions.none()) + + /** @see [list] */ + fun list( + requestOptions: RequestOptions + ): CompletableFuture = + list(HrisCompanyPayStatementItemListParams.none(), requestOptions) + + /** + * A view of [PayStatementItemServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + fun rules(): RuleServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `get /employer/pay-statement-item`, but is otherwise the + * same as [PayStatementItemServiceAsync.list]. + */ + @MustBeClosed + fun list(): CompletableFuture> = + list(HrisCompanyPayStatementItemListParams.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + params: HrisCompanyPayStatementItemListParams = + HrisCompanyPayStatementItemListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see [list] */ + @MustBeClosed + fun list( + params: HrisCompanyPayStatementItemListParams = + HrisCompanyPayStatementItemListParams.none() + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + requestOptions: RequestOptions + ): CompletableFuture> = + list(HrisCompanyPayStatementItemListParams.none(), requestOptions) + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/PayStatementItemServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/PayStatementItemServiceAsyncImpl.kt new file mode 100644 index 00000000..fd4b52bf --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/PayStatementItemServiceAsyncImpl.kt @@ -0,0 +1,91 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.hris.company + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.handlers.errorHandler +import com.tryfinch.api.core.handlers.jsonHandler +import com.tryfinch.api.core.handlers.withErrorHandler +import com.tryfinch.api.core.http.HttpMethod +import com.tryfinch.api.core.http.HttpRequest +import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable +import com.tryfinch.api.core.prepareAsync +import com.tryfinch.api.models.HrisCompanyPayStatementItemListPageAsync +import com.tryfinch.api.models.HrisCompanyPayStatementItemListParams +import com.tryfinch.api.services.async.hris.company.payStatementItem.RuleServiceAsync +import com.tryfinch.api.services.async.hris.company.payStatementItem.RuleServiceAsyncImpl +import java.util.concurrent.CompletableFuture + +class PayStatementItemServiceAsyncImpl +internal constructor(private val clientOptions: ClientOptions) : PayStatementItemServiceAsync { + + private val withRawResponse: PayStatementItemServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + private val rules: RuleServiceAsync by lazy { RuleServiceAsyncImpl(clientOptions) } + + override fun withRawResponse(): PayStatementItemServiceAsync.WithRawResponse = withRawResponse + + override fun rules(): RuleServiceAsync = rules + + override fun list( + params: HrisCompanyPayStatementItemListParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /employer/pay-statement-item + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + PayStatementItemServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val rules: RuleServiceAsync.WithRawResponse by lazy { + RuleServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun rules(): RuleServiceAsync.WithRawResponse = rules + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: HrisCompanyPayStatementItemListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "pay-statement-item") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + HrisCompanyPayStatementItemListPageAsync.of( + PayStatementItemServiceAsyncImpl(clientOptions), + params, + it, + ) + } + } + } + } + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/payStatementItem/RuleServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/payStatementItem/RuleServiceAsync.kt new file mode 100644 index 00000000..e19add98 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/payStatementItem/RuleServiceAsync.kt @@ -0,0 +1,207 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.hris.company.payStatementItem + +import com.google.errorprone.annotations.MustBeClosed +import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleCreateParams +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleDeleteParams +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleListPageAsync +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleListParams +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleUpdateParams +import com.tryfinch.api.models.RuleCreateResponse +import com.tryfinch.api.models.RuleDeleteResponse +import com.tryfinch.api.models.RuleUpdateResponse +import java.util.concurrent.CompletableFuture + +interface RuleServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical + * support will be added soon Custom rules can be created to associate specific attributes to + * pay statement items depending on the use case. For example, pay statement items that meet + * certain conditions can be labeled as a pre-tax 401k. This metadata can be retrieved where pay + * statement item information is available. + */ + fun create(): CompletableFuture = + create(HrisCompanyPayStatementItemRuleCreateParams.none()) + + /** @see [create] */ + fun create( + params: HrisCompanyPayStatementItemRuleCreateParams = + HrisCompanyPayStatementItemRuleCreateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see [create] */ + fun create( + params: HrisCompanyPayStatementItemRuleCreateParams = + HrisCompanyPayStatementItemRuleCreateParams.none() + ): CompletableFuture = create(params, RequestOptions.none()) + + /** @see [create] */ + fun create(requestOptions: RequestOptions): CompletableFuture = + create(HrisCompanyPayStatementItemRuleCreateParams.none(), requestOptions) + + /** + * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical + * support will be added soon Update a rule for a pay statement item. + */ + fun update( + params: HrisCompanyPayStatementItemRuleUpdateParams + ): CompletableFuture = update(params, RequestOptions.none()) + + /** @see [update] */ + fun update( + params: HrisCompanyPayStatementItemRuleUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** + * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical + * support will be added soon List all rules of a connection account. + */ + fun list(): CompletableFuture = + list(HrisCompanyPayStatementItemRuleListParams.none()) + + /** @see [list] */ + fun list( + params: HrisCompanyPayStatementItemRuleListParams = + HrisCompanyPayStatementItemRuleListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see [list] */ + fun list( + params: HrisCompanyPayStatementItemRuleListParams = + HrisCompanyPayStatementItemRuleListParams.none() + ): CompletableFuture = + list(params, RequestOptions.none()) + + /** @see [list] */ + fun list( + requestOptions: RequestOptions + ): CompletableFuture = + list(HrisCompanyPayStatementItemRuleListParams.none(), requestOptions) + + /** + * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical + * support will be added soon Delete a rule for a pay statement item. + */ + fun delete( + params: HrisCompanyPayStatementItemRuleDeleteParams + ): CompletableFuture = delete(params, RequestOptions.none()) + + /** @see [delete] */ + fun delete( + params: HrisCompanyPayStatementItemRuleDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** A view of [RuleServiceAsync] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /employer/pay-statement-item/rule`, but is + * otherwise the same as [RuleServiceAsync.create]. + */ + @MustBeClosed + fun create(): CompletableFuture> = + create(HrisCompanyPayStatementItemRuleCreateParams.none()) + + /** @see [create] */ + @MustBeClosed + fun create( + params: HrisCompanyPayStatementItemRuleCreateParams = + HrisCompanyPayStatementItemRuleCreateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see [create] */ + @MustBeClosed + fun create( + params: HrisCompanyPayStatementItemRuleCreateParams = + HrisCompanyPayStatementItemRuleCreateParams.none() + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see [create] */ + @MustBeClosed + fun create( + requestOptions: RequestOptions + ): CompletableFuture> = + create(HrisCompanyPayStatementItemRuleCreateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `put /employer/pay-statement-item/rule/{rule_id}`, but is + * otherwise the same as [RuleServiceAsync.update]. + */ + @MustBeClosed + fun update( + params: HrisCompanyPayStatementItemRuleUpdateParams + ): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + params: HrisCompanyPayStatementItemRuleUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /employer/pay-statement-item/rule`, but is otherwise + * the same as [RuleServiceAsync.list]. + */ + @MustBeClosed + fun list(): + CompletableFuture> = + list(HrisCompanyPayStatementItemRuleListParams.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + params: HrisCompanyPayStatementItemRuleListParams = + HrisCompanyPayStatementItemRuleListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see [list] */ + @MustBeClosed + fun list( + params: HrisCompanyPayStatementItemRuleListParams = + HrisCompanyPayStatementItemRuleListParams.none() + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + requestOptions: RequestOptions + ): CompletableFuture> = + list(HrisCompanyPayStatementItemRuleListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `delete /employer/pay-statement-item/rule/{rule_id}`, but + * is otherwise the same as [RuleServiceAsync.delete]. + */ + @MustBeClosed + fun delete( + params: HrisCompanyPayStatementItemRuleDeleteParams + ): CompletableFuture> = + delete(params, RequestOptions.none()) + + /** @see [delete] */ + @MustBeClosed + fun delete( + params: HrisCompanyPayStatementItemRuleDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/payStatementItem/RuleServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/payStatementItem/RuleServiceAsyncImpl.kt new file mode 100644 index 00000000..1f3cb3b0 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/payStatementItem/RuleServiceAsyncImpl.kt @@ -0,0 +1,199 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.hris.company.payStatementItem + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.handlers.errorHandler +import com.tryfinch.api.core.handlers.jsonHandler +import com.tryfinch.api.core.handlers.withErrorHandler +import com.tryfinch.api.core.http.HttpMethod +import com.tryfinch.api.core.http.HttpRequest +import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json +import com.tryfinch.api.core.http.parseable +import com.tryfinch.api.core.prepareAsync +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleCreateParams +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleDeleteParams +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleListPageAsync +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleListParams +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleUpdateParams +import com.tryfinch.api.models.RuleCreateResponse +import com.tryfinch.api.models.RuleDeleteResponse +import com.tryfinch.api.models.RuleUpdateResponse +import java.util.concurrent.CompletableFuture + +class RuleServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + RuleServiceAsync { + + private val withRawResponse: RuleServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): RuleServiceAsync.WithRawResponse = withRawResponse + + override fun create( + params: HrisCompanyPayStatementItemRuleCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /employer/pay-statement-item/rule + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + override fun update( + params: HrisCompanyPayStatementItemRuleUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // put /employer/pay-statement-item/rule/{rule_id} + withRawResponse().update(params, requestOptions).thenApply { it.parse() } + + override fun list( + params: HrisCompanyPayStatementItemRuleListParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /employer/pay-statement-item/rule + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + override fun delete( + params: HrisCompanyPayStatementItemRuleDeleteParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // delete /employer/pay-statement-item/rule/{rule_id} + withRawResponse().delete(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + RuleServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun create( + params: HrisCompanyPayStatementItemRuleCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("employer", "pay-statement-item", "rule") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun update( + params: HrisCompanyPayStatementItemRuleUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("employer", "pay-statement-item", "rule", params._pathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listHandler: Handler = + jsonHandler( + clientOptions.jsonMapper + ) + .withErrorHandler(errorHandler) + + override fun list( + params: HrisCompanyPayStatementItemRuleListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "pay-statement-item", "rule") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + HrisCompanyPayStatementItemRuleListPageAsync.of( + RuleServiceAsyncImpl(clientOptions), + params, + it, + ) + } + } + } + } + + private val deleteHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun delete( + params: HrisCompanyPayStatementItemRuleDeleteParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .addPathSegments("employer", "pay-statement-item", "rule", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { deleteHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt index d8c248da..82ff7c15 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt @@ -7,6 +7,7 @@ import com.tryfinch.api.core.RequestOptions import com.tryfinch.api.core.http.HttpResponseFor import com.tryfinch.api.models.Company import com.tryfinch.api.models.HrisCompanyRetrieveParams +import com.tryfinch.api.services.blocking.hris.company.PayStatementItemService interface CompanyService { @@ -15,6 +16,8 @@ interface CompanyService { */ fun withRawResponse(): WithRawResponse + fun payStatementItem(): PayStatementItemService + /** Read basic company data */ fun retrieve(): Company = retrieve(HrisCompanyRetrieveParams.none()) @@ -35,6 +38,8 @@ interface CompanyService { /** A view of [CompanyService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + fun payStatementItem(): PayStatementItemService.WithRawResponse + /** * Returns a raw HTTP response for `get /employer/company`, but is otherwise the same as * [CompanyService.retrieve]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt index bbc9fcea..89a1abcf 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt @@ -16,6 +16,8 @@ import com.tryfinch.api.core.http.parseable import com.tryfinch.api.core.prepare import com.tryfinch.api.models.Company import com.tryfinch.api.models.HrisCompanyRetrieveParams +import com.tryfinch.api.services.blocking.hris.company.PayStatementItemService +import com.tryfinch.api.services.blocking.hris.company.PayStatementItemServiceImpl class CompanyServiceImpl internal constructor(private val clientOptions: ClientOptions) : CompanyService { @@ -24,8 +26,14 @@ class CompanyServiceImpl internal constructor(private val clientOptions: ClientO WithRawResponseImpl(clientOptions) } + private val payStatementItem: PayStatementItemService by lazy { + PayStatementItemServiceImpl(clientOptions) + } + override fun withRawResponse(): CompanyService.WithRawResponse = withRawResponse + override fun payStatementItem(): PayStatementItemService = payStatementItem + override fun retrieve( params: HrisCompanyRetrieveParams, requestOptions: RequestOptions, @@ -38,6 +46,12 @@ class CompanyServiceImpl internal constructor(private val clientOptions: ClientO private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val payStatementItem: PayStatementItemService.WithRawResponse by lazy { + PayStatementItemServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun payStatementItem(): PayStatementItemService.WithRawResponse = payStatementItem + private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/PayStatementItemService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/PayStatementItemService.kt new file mode 100644 index 00000000..c498a733 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/PayStatementItemService.kt @@ -0,0 +1,84 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.hris.company + +import com.google.errorprone.annotations.MustBeClosed +import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.models.HrisCompanyPayStatementItemListPage +import com.tryfinch.api.models.HrisCompanyPayStatementItemListParams +import com.tryfinch.api.services.blocking.hris.company.payStatementItem.RuleService + +interface PayStatementItemService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + fun rules(): RuleService + + /** + * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical + * support will be added soon Retrieve a list of detailed pay statement items for the access + * token's connection account. + */ + fun list(): HrisCompanyPayStatementItemListPage = + list(HrisCompanyPayStatementItemListParams.none()) + + /** @see [list] */ + fun list( + params: HrisCompanyPayStatementItemListParams = + HrisCompanyPayStatementItemListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HrisCompanyPayStatementItemListPage + + /** @see [list] */ + fun list( + params: HrisCompanyPayStatementItemListParams = HrisCompanyPayStatementItemListParams.none() + ): HrisCompanyPayStatementItemListPage = list(params, RequestOptions.none()) + + /** @see [list] */ + fun list(requestOptions: RequestOptions): HrisCompanyPayStatementItemListPage = + list(HrisCompanyPayStatementItemListParams.none(), requestOptions) + + /** + * A view of [PayStatementItemService] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + fun rules(): RuleService.WithRawResponse + + /** + * Returns a raw HTTP response for `get /employer/pay-statement-item`, but is otherwise the + * same as [PayStatementItemService.list]. + */ + @MustBeClosed + fun list(): HttpResponseFor = + list(HrisCompanyPayStatementItemListParams.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + params: HrisCompanyPayStatementItemListParams = + HrisCompanyPayStatementItemListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see [list] */ + @MustBeClosed + fun list( + params: HrisCompanyPayStatementItemListParams = + HrisCompanyPayStatementItemListParams.none() + ): HttpResponseFor = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + requestOptions: RequestOptions + ): HttpResponseFor = + list(HrisCompanyPayStatementItemListParams.none(), requestOptions) + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/PayStatementItemServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/PayStatementItemServiceImpl.kt new file mode 100644 index 00000000..3deb88a5 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/PayStatementItemServiceImpl.kt @@ -0,0 +1,87 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.hris.company + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.handlers.errorHandler +import com.tryfinch.api.core.handlers.jsonHandler +import com.tryfinch.api.core.handlers.withErrorHandler +import com.tryfinch.api.core.http.HttpMethod +import com.tryfinch.api.core.http.HttpRequest +import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.parseable +import com.tryfinch.api.core.prepare +import com.tryfinch.api.models.HrisCompanyPayStatementItemListPage +import com.tryfinch.api.models.HrisCompanyPayStatementItemListParams +import com.tryfinch.api.services.blocking.hris.company.payStatementItem.RuleService +import com.tryfinch.api.services.blocking.hris.company.payStatementItem.RuleServiceImpl + +class PayStatementItemServiceImpl internal constructor(private val clientOptions: ClientOptions) : + PayStatementItemService { + + private val withRawResponse: PayStatementItemService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + private val rules: RuleService by lazy { RuleServiceImpl(clientOptions) } + + override fun withRawResponse(): PayStatementItemService.WithRawResponse = withRawResponse + + override fun rules(): RuleService = rules + + override fun list( + params: HrisCompanyPayStatementItemListParams, + requestOptions: RequestOptions, + ): HrisCompanyPayStatementItemListPage = + // get /employer/pay-statement-item + withRawResponse().list(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + PayStatementItemService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val rules: RuleService.WithRawResponse by lazy { + RuleServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun rules(): RuleService.WithRawResponse = rules + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: HrisCompanyPayStatementItemListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "pay-statement-item") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + HrisCompanyPayStatementItemListPage.of( + PayStatementItemServiceImpl(clientOptions), + params, + it, + ) + } + } + } + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/payStatementItem/RuleService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/payStatementItem/RuleService.kt new file mode 100644 index 00000000..34a2124d --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/payStatementItem/RuleService.kt @@ -0,0 +1,194 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.hris.company.payStatementItem + +import com.google.errorprone.annotations.MustBeClosed +import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleCreateParams +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleDeleteParams +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleListPage +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleListParams +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleUpdateParams +import com.tryfinch.api.models.RuleCreateResponse +import com.tryfinch.api.models.RuleDeleteResponse +import com.tryfinch.api.models.RuleUpdateResponse + +interface RuleService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical + * support will be added soon Custom rules can be created to associate specific attributes to + * pay statement items depending on the use case. For example, pay statement items that meet + * certain conditions can be labeled as a pre-tax 401k. This metadata can be retrieved where pay + * statement item information is available. + */ + fun create(): RuleCreateResponse = create(HrisCompanyPayStatementItemRuleCreateParams.none()) + + /** @see [create] */ + fun create( + params: HrisCompanyPayStatementItemRuleCreateParams = + HrisCompanyPayStatementItemRuleCreateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleCreateResponse + + /** @see [create] */ + fun create( + params: HrisCompanyPayStatementItemRuleCreateParams = + HrisCompanyPayStatementItemRuleCreateParams.none() + ): RuleCreateResponse = create(params, RequestOptions.none()) + + /** @see [create] */ + fun create(requestOptions: RequestOptions): RuleCreateResponse = + create(HrisCompanyPayStatementItemRuleCreateParams.none(), requestOptions) + + /** + * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical + * support will be added soon Update a rule for a pay statement item. + */ + fun update(params: HrisCompanyPayStatementItemRuleUpdateParams): RuleUpdateResponse = + update(params, RequestOptions.none()) + + /** @see [update] */ + fun update( + params: HrisCompanyPayStatementItemRuleUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleUpdateResponse + + /** + * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical + * support will be added soon List all rules of a connection account. + */ + fun list(): HrisCompanyPayStatementItemRuleListPage = + list(HrisCompanyPayStatementItemRuleListParams.none()) + + /** @see [list] */ + fun list( + params: HrisCompanyPayStatementItemRuleListParams = + HrisCompanyPayStatementItemRuleListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HrisCompanyPayStatementItemRuleListPage + + /** @see [list] */ + fun list( + params: HrisCompanyPayStatementItemRuleListParams = + HrisCompanyPayStatementItemRuleListParams.none() + ): HrisCompanyPayStatementItemRuleListPage = list(params, RequestOptions.none()) + + /** @see [list] */ + fun list(requestOptions: RequestOptions): HrisCompanyPayStatementItemRuleListPage = + list(HrisCompanyPayStatementItemRuleListParams.none(), requestOptions) + + /** + * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical + * support will be added soon Delete a rule for a pay statement item. + */ + fun delete(params: HrisCompanyPayStatementItemRuleDeleteParams): RuleDeleteResponse = + delete(params, RequestOptions.none()) + + /** @see [delete] */ + fun delete( + params: HrisCompanyPayStatementItemRuleDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleDeleteResponse + + /** A view of [RuleService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a raw HTTP response for `post /employer/pay-statement-item/rule`, but is + * otherwise the same as [RuleService.create]. + */ + @MustBeClosed + fun create(): HttpResponseFor = + create(HrisCompanyPayStatementItemRuleCreateParams.none()) + + /** @see [create] */ + @MustBeClosed + fun create( + params: HrisCompanyPayStatementItemRuleCreateParams = + HrisCompanyPayStatementItemRuleCreateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see [create] */ + @MustBeClosed + fun create( + params: HrisCompanyPayStatementItemRuleCreateParams = + HrisCompanyPayStatementItemRuleCreateParams.none() + ): HttpResponseFor = create(params, RequestOptions.none()) + + /** @see [create] */ + @MustBeClosed + fun create(requestOptions: RequestOptions): HttpResponseFor = + create(HrisCompanyPayStatementItemRuleCreateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `put /employer/pay-statement-item/rule/{rule_id}`, but is + * otherwise the same as [RuleService.update]. + */ + @MustBeClosed + fun update( + params: HrisCompanyPayStatementItemRuleUpdateParams + ): HttpResponseFor = update(params, RequestOptions.none()) + + /** @see [update] */ + @MustBeClosed + fun update( + params: HrisCompanyPayStatementItemRuleUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /employer/pay-statement-item/rule`, but is otherwise + * the same as [RuleService.list]. + */ + @MustBeClosed + fun list(): HttpResponseFor = + list(HrisCompanyPayStatementItemRuleListParams.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + params: HrisCompanyPayStatementItemRuleListParams = + HrisCompanyPayStatementItemRuleListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see [list] */ + @MustBeClosed + fun list( + params: HrisCompanyPayStatementItemRuleListParams = + HrisCompanyPayStatementItemRuleListParams.none() + ): HttpResponseFor = + list(params, RequestOptions.none()) + + /** @see [list] */ + @MustBeClosed + fun list( + requestOptions: RequestOptions + ): HttpResponseFor = + list(HrisCompanyPayStatementItemRuleListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `delete /employer/pay-statement-item/rule/{rule_id}`, but + * is otherwise the same as [RuleService.delete]. + */ + @MustBeClosed + fun delete( + params: HrisCompanyPayStatementItemRuleDeleteParams + ): HttpResponseFor = delete(params, RequestOptions.none()) + + /** @see [delete] */ + @MustBeClosed + fun delete( + params: HrisCompanyPayStatementItemRuleDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/payStatementItem/RuleServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/payStatementItem/RuleServiceImpl.kt new file mode 100644 index 00000000..d13e4f22 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/payStatementItem/RuleServiceImpl.kt @@ -0,0 +1,183 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.hris.company.payStatementItem + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.handlers.errorHandler +import com.tryfinch.api.core.handlers.jsonHandler +import com.tryfinch.api.core.handlers.withErrorHandler +import com.tryfinch.api.core.http.HttpMethod +import com.tryfinch.api.core.http.HttpRequest +import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.core.http.HttpResponseFor +import com.tryfinch.api.core.http.json +import com.tryfinch.api.core.http.parseable +import com.tryfinch.api.core.prepare +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleCreateParams +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleDeleteParams +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleListPage +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleListParams +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleUpdateParams +import com.tryfinch.api.models.RuleCreateResponse +import com.tryfinch.api.models.RuleDeleteResponse +import com.tryfinch.api.models.RuleUpdateResponse + +class RuleServiceImpl internal constructor(private val clientOptions: ClientOptions) : RuleService { + + private val withRawResponse: RuleService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): RuleService.WithRawResponse = withRawResponse + + override fun create( + params: HrisCompanyPayStatementItemRuleCreateParams, + requestOptions: RequestOptions, + ): RuleCreateResponse = + // post /employer/pay-statement-item/rule + withRawResponse().create(params, requestOptions).parse() + + override fun update( + params: HrisCompanyPayStatementItemRuleUpdateParams, + requestOptions: RequestOptions, + ): RuleUpdateResponse = + // put /employer/pay-statement-item/rule/{rule_id} + withRawResponse().update(params, requestOptions).parse() + + override fun list( + params: HrisCompanyPayStatementItemRuleListParams, + requestOptions: RequestOptions, + ): HrisCompanyPayStatementItemRuleListPage = + // get /employer/pay-statement-item/rule + withRawResponse().list(params, requestOptions).parse() + + override fun delete( + params: HrisCompanyPayStatementItemRuleDeleteParams, + requestOptions: RequestOptions, + ): RuleDeleteResponse = + // delete /employer/pay-statement-item/rule/{rule_id} + withRawResponse().delete(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + RuleService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun create( + params: HrisCompanyPayStatementItemRuleCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("employer", "pay-statement-item", "rule") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun update( + params: HrisCompanyPayStatementItemRuleUpdateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("employer", "pay-statement-item", "rule", params._pathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun list( + params: HrisCompanyPayStatementItemRuleListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "pay-statement-item", "rule") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + HrisCompanyPayStatementItemRuleListPage.of( + RuleServiceImpl(clientOptions), + params, + it, + ) + } + } + } + + private val deleteHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + override fun delete( + params: HrisCompanyPayStatementItemRuleDeleteParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .addPathSegments("employer", "pay-statement-item", "rule", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { deleteHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListParamsTest.kt new file mode 100644 index 00000000..f96974b4 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListParamsTest.kt @@ -0,0 +1,56 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.core.http.QueryParams +import java.time.LocalDate +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class HrisCompanyPayStatementItemListParamsTest { + + @Test + fun create() { + HrisCompanyPayStatementItemListParams.builder() + .addCategory(HrisCompanyPayStatementItemListParams.Category.EARNINGS) + .endDate(LocalDate.parse("2024-07-01")) + .name("name") + .startDate(LocalDate.parse("2024-01-01")) + .type("base_compensation") + .build() + } + + @Test + fun queryParams() { + val params = + HrisCompanyPayStatementItemListParams.builder() + .addCategory(HrisCompanyPayStatementItemListParams.Category.EARNINGS) + .endDate(LocalDate.parse("2024-07-01")) + .name("name") + .startDate(LocalDate.parse("2024-01-01")) + .type("base_compensation") + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("categories[]", "earnings") + .put("end_date", "2024-07-01") + .put("name", "name") + .put("start_date", "2024-01-01") + .put("type", "base_compensation") + .build() + ) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = HrisCompanyPayStatementItemListParams.builder().build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleCreateParamsTest.kt new file mode 100644 index 00000000..aaafb200 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleCreateParamsTest.kt @@ -0,0 +1,99 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.core.JsonValue +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class HrisCompanyPayStatementItemRuleCreateParamsTest { + + @Test + fun create() { + HrisCompanyPayStatementItemRuleCreateParams.builder() + .attributes( + HrisCompanyPayStatementItemRuleCreateParams.Attributes.builder() + .metadata( + HrisCompanyPayStatementItemRuleCreateParams.Attributes.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + .addCondition( + HrisCompanyPayStatementItemRuleCreateParams.Condition.builder() + .field("field") + .operator(HrisCompanyPayStatementItemRuleCreateParams.Condition.Operator.EQUALS) + .value("value") + .build() + ) + .effectiveEndDate("effective_end_date") + .effectiveStartDate("effective_start_date") + .entityType(HrisCompanyPayStatementItemRuleCreateParams.EntityType.PAY_STATEMENT_ITEM) + .build() + } + + @Test + fun body() { + val params = + HrisCompanyPayStatementItemRuleCreateParams.builder() + .attributes( + HrisCompanyPayStatementItemRuleCreateParams.Attributes.builder() + .metadata( + HrisCompanyPayStatementItemRuleCreateParams.Attributes.Metadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + .addCondition( + HrisCompanyPayStatementItemRuleCreateParams.Condition.builder() + .field("field") + .operator( + HrisCompanyPayStatementItemRuleCreateParams.Condition.Operator.EQUALS + ) + .value("value") + .build() + ) + .effectiveEndDate("effective_end_date") + .effectiveStartDate("effective_start_date") + .entityType( + HrisCompanyPayStatementItemRuleCreateParams.EntityType.PAY_STATEMENT_ITEM + ) + .build() + + val body = params._body() + + assertThat(body.attributes()) + .contains( + HrisCompanyPayStatementItemRuleCreateParams.Attributes.builder() + .metadata( + HrisCompanyPayStatementItemRuleCreateParams.Attributes.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + assertThat(body.conditions().getOrNull()) + .containsExactly( + HrisCompanyPayStatementItemRuleCreateParams.Condition.builder() + .field("field") + .operator(HrisCompanyPayStatementItemRuleCreateParams.Condition.Operator.EQUALS) + .value("value") + .build() + ) + assertThat(body.effectiveEndDate()).contains("effective_end_date") + assertThat(body.effectiveStartDate()).contains("effective_start_date") + assertThat(body.entityType()) + .contains(HrisCompanyPayStatementItemRuleCreateParams.EntityType.PAY_STATEMENT_ITEM) + } + + @Test + fun bodyWithoutOptionalFields() { + val params = HrisCompanyPayStatementItemRuleCreateParams.builder().build() + + val body = params._body() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleDeleteParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleDeleteParamsTest.kt new file mode 100644 index 00000000..803a0650 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleDeleteParamsTest.kt @@ -0,0 +1,23 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class HrisCompanyPayStatementItemRuleDeleteParamsTest { + + @Test + fun create() { + HrisCompanyPayStatementItemRuleDeleteParams.builder().ruleId("rule_id").build() + } + + @Test + fun pathParams() { + val params = HrisCompanyPayStatementItemRuleDeleteParams.builder().ruleId("rule_id").build() + + assertThat(params._pathParam(0)).isEqualTo("rule_id") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListParamsTest.kt new file mode 100644 index 00000000..05fa5101 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListParamsTest.kt @@ -0,0 +1,13 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import org.junit.jupiter.api.Test + +internal class HrisCompanyPayStatementItemRuleListParamsTest { + + @Test + fun create() { + HrisCompanyPayStatementItemRuleListParams.builder().build() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleUpdateParamsTest.kt new file mode 100644 index 00000000..9243af8c --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleUpdateParamsTest.kt @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.core.JsonValue +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class HrisCompanyPayStatementItemRuleUpdateParamsTest { + + @Test + fun create() { + HrisCompanyPayStatementItemRuleUpdateParams.builder() + .ruleId("rule_id") + .optionalProperty(JsonValue.from(mapOf())) + .build() + } + + @Test + fun pathParams() { + val params = HrisCompanyPayStatementItemRuleUpdateParams.builder().ruleId("rule_id").build() + + assertThat(params._pathParam(0)).isEqualTo("rule_id") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun body() { + val params = + HrisCompanyPayStatementItemRuleUpdateParams.builder() + .ruleId("rule_id") + .optionalProperty(JsonValue.from(mapOf())) + .build() + + val body = params._body() + + assertThat(body._optionalProperty()).isEqualTo(JsonValue.from(mapOf())) + } + + @Test + fun bodyWithoutOptionalFields() { + val params = HrisCompanyPayStatementItemRuleUpdateParams.builder().ruleId("rule_id").build() + + val body = params._body() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementItemListResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementItemListResponseTest.kt new file mode 100644 index 00000000..060f17e7 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementItemListResponseTest.kt @@ -0,0 +1,68 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.jsonMapper +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class PayStatementItemListResponseTest { + + @Test + fun create() { + val payStatementItemListResponse = + PayStatementItemListResponse.builder() + .attributes( + PayStatementItemListResponse.Attributes.builder() + .employer(true) + .metadata(JsonValue.from(mapOf())) + .preTax(true) + .type("type") + .build() + ) + .category(PayStatementItemListResponse.Category.EARNINGS) + .name("name") + .build() + + assertThat(payStatementItemListResponse.attributes()) + .contains( + PayStatementItemListResponse.Attributes.builder() + .employer(true) + .metadata(JsonValue.from(mapOf())) + .preTax(true) + .type("type") + .build() + ) + assertThat(payStatementItemListResponse.category()) + .contains(PayStatementItemListResponse.Category.EARNINGS) + assertThat(payStatementItemListResponse.name()).contains("name") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val payStatementItemListResponse = + PayStatementItemListResponse.builder() + .attributes( + PayStatementItemListResponse.Attributes.builder() + .employer(true) + .metadata(JsonValue.from(mapOf())) + .preTax(true) + .type("type") + .build() + ) + .category(PayStatementItemListResponse.Category.EARNINGS) + .name("name") + .build() + + val roundtrippedPayStatementItemListResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(payStatementItemListResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedPayStatementItemListResponse).isEqualTo(payStatementItemListResponse) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RuleCreateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RuleCreateResponseTest.kt new file mode 100644 index 00000000..dd7461a8 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RuleCreateResponseTest.kt @@ -0,0 +1,112 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.jsonMapper +import java.time.OffsetDateTime +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleCreateResponseTest { + + @Test + fun create() { + val ruleCreateResponse = + RuleCreateResponse.builder() + .id("id") + .attributes( + RuleCreateResponse.Attributes.builder() + .metadata( + RuleCreateResponse.Attributes.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + .addCondition( + RuleCreateResponse.Condition.builder() + .field("field") + .operator(RuleCreateResponse.Condition.Operator.EQUALS) + .value("value") + .build() + ) + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .effectiveEndDate("effective_end_date") + .effectiveStartDate("effective_start_date") + .entityType(RuleCreateResponse.EntityType.PAY_STATEMENT_ITEM) + .priority(0L) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + assertThat(ruleCreateResponse.id()).contains("id") + assertThat(ruleCreateResponse.attributes()) + .contains( + RuleCreateResponse.Attributes.builder() + .metadata( + RuleCreateResponse.Attributes.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + assertThat(ruleCreateResponse.conditions().getOrNull()) + .containsExactly( + RuleCreateResponse.Condition.builder() + .field("field") + .operator(RuleCreateResponse.Condition.Operator.EQUALS) + .value("value") + .build() + ) + assertThat(ruleCreateResponse.createdAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(ruleCreateResponse.effectiveEndDate()).contains("effective_end_date") + assertThat(ruleCreateResponse.effectiveStartDate()).contains("effective_start_date") + assertThat(ruleCreateResponse.entityType()) + .contains(RuleCreateResponse.EntityType.PAY_STATEMENT_ITEM) + assertThat(ruleCreateResponse.priority()).contains(0L) + assertThat(ruleCreateResponse.updatedAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val ruleCreateResponse = + RuleCreateResponse.builder() + .id("id") + .attributes( + RuleCreateResponse.Attributes.builder() + .metadata( + RuleCreateResponse.Attributes.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + .addCondition( + RuleCreateResponse.Condition.builder() + .field("field") + .operator(RuleCreateResponse.Condition.Operator.EQUALS) + .value("value") + .build() + ) + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .effectiveEndDate("effective_end_date") + .effectiveStartDate("effective_start_date") + .entityType(RuleCreateResponse.EntityType.PAY_STATEMENT_ITEM) + .priority(0L) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + val roundtrippedRuleCreateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleCreateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleCreateResponse).isEqualTo(ruleCreateResponse) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RuleDeleteResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RuleDeleteResponseTest.kt new file mode 100644 index 00000000..c8bd0e40 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RuleDeleteResponseTest.kt @@ -0,0 +1,116 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.jsonMapper +import java.time.OffsetDateTime +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleDeleteResponseTest { + + @Test + fun create() { + val ruleDeleteResponse = + RuleDeleteResponse.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .attributes( + RuleDeleteResponse.Attributes.builder() + .metadata( + RuleDeleteResponse.Attributes.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + .addCondition( + RuleDeleteResponse.Condition.builder() + .field("field") + .operator(RuleDeleteResponse.Condition.Operator.EQUALS) + .value("value") + .build() + ) + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deletedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .effectiveEndDate("effective_end_date") + .effectiveStartDate("effective_start_date") + .entityType(RuleDeleteResponse.EntityType.PAY_STATEMENT_ITEM) + .priority(0L) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + assertThat(ruleDeleteResponse.id()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleDeleteResponse.attributes()) + .contains( + RuleDeleteResponse.Attributes.builder() + .metadata( + RuleDeleteResponse.Attributes.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + assertThat(ruleDeleteResponse.conditions().getOrNull()) + .containsExactly( + RuleDeleteResponse.Condition.builder() + .field("field") + .operator(RuleDeleteResponse.Condition.Operator.EQUALS) + .value("value") + .build() + ) + assertThat(ruleDeleteResponse.createdAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(ruleDeleteResponse.deletedAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(ruleDeleteResponse.effectiveEndDate()).contains("effective_end_date") + assertThat(ruleDeleteResponse.effectiveStartDate()).contains("effective_start_date") + assertThat(ruleDeleteResponse.entityType()) + .contains(RuleDeleteResponse.EntityType.PAY_STATEMENT_ITEM) + assertThat(ruleDeleteResponse.priority()).contains(0L) + assertThat(ruleDeleteResponse.updatedAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val ruleDeleteResponse = + RuleDeleteResponse.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .attributes( + RuleDeleteResponse.Attributes.builder() + .metadata( + RuleDeleteResponse.Attributes.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + .addCondition( + RuleDeleteResponse.Condition.builder() + .field("field") + .operator(RuleDeleteResponse.Condition.Operator.EQUALS) + .value("value") + .build() + ) + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deletedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .effectiveEndDate("effective_end_date") + .effectiveStartDate("effective_start_date") + .entityType(RuleDeleteResponse.EntityType.PAY_STATEMENT_ITEM) + .priority(0L) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + val roundtrippedRuleDeleteResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleDeleteResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleDeleteResponse).isEqualTo(ruleDeleteResponse) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RuleListResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RuleListResponseTest.kt new file mode 100644 index 00000000..0b94935a --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RuleListResponseTest.kt @@ -0,0 +1,112 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.jsonMapper +import java.time.OffsetDateTime +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleListResponseTest { + + @Test + fun create() { + val ruleListResponse = + RuleListResponse.builder() + .id("id") + .attributes( + RuleListResponse.Attributes.builder() + .metadata( + RuleListResponse.Attributes.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + .addCondition( + RuleListResponse.Condition.builder() + .field("field") + .operator(RuleListResponse.Condition.Operator.EQUALS) + .value("value") + .build() + ) + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .effectiveEndDate("effective_end_date") + .effectiveStartDate("effective_start_date") + .entityType(RuleListResponse.EntityType.PAY_STATEMENT_ITEM) + .priority(0L) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + assertThat(ruleListResponse.id()).contains("id") + assertThat(ruleListResponse.attributes()) + .contains( + RuleListResponse.Attributes.builder() + .metadata( + RuleListResponse.Attributes.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + assertThat(ruleListResponse.conditions().getOrNull()) + .containsExactly( + RuleListResponse.Condition.builder() + .field("field") + .operator(RuleListResponse.Condition.Operator.EQUALS) + .value("value") + .build() + ) + assertThat(ruleListResponse.createdAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(ruleListResponse.effectiveEndDate()).contains("effective_end_date") + assertThat(ruleListResponse.effectiveStartDate()).contains("effective_start_date") + assertThat(ruleListResponse.entityType()) + .contains(RuleListResponse.EntityType.PAY_STATEMENT_ITEM) + assertThat(ruleListResponse.priority()).contains(0L) + assertThat(ruleListResponse.updatedAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val ruleListResponse = + RuleListResponse.builder() + .id("id") + .attributes( + RuleListResponse.Attributes.builder() + .metadata( + RuleListResponse.Attributes.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + .addCondition( + RuleListResponse.Condition.builder() + .field("field") + .operator(RuleListResponse.Condition.Operator.EQUALS) + .value("value") + .build() + ) + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .effectiveEndDate("effective_end_date") + .effectiveStartDate("effective_start_date") + .entityType(RuleListResponse.EntityType.PAY_STATEMENT_ITEM) + .priority(0L) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + val roundtrippedRuleListResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleListResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleListResponse).isEqualTo(ruleListResponse) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RuleUpdateResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RuleUpdateResponseTest.kt new file mode 100644 index 00000000..3594a5ce --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RuleUpdateResponseTest.kt @@ -0,0 +1,112 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.jsonMapper +import java.time.OffsetDateTime +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleUpdateResponseTest { + + @Test + fun create() { + val ruleUpdateResponse = + RuleUpdateResponse.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .attributes( + RuleUpdateResponse.Attributes.builder() + .metadata( + RuleUpdateResponse.Attributes.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + .addCondition( + RuleUpdateResponse.Condition.builder() + .field("field") + .operator(RuleUpdateResponse.Condition.Operator.EQUALS) + .value("value") + .build() + ) + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .effectiveEndDate("effective_end_date") + .effectiveStartDate("effective_start_date") + .entityType(RuleUpdateResponse.EntityType.PAY_STATEMENT_ITEM) + .priority(0L) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + assertThat(ruleUpdateResponse.id()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleUpdateResponse.attributes()) + .contains( + RuleUpdateResponse.Attributes.builder() + .metadata( + RuleUpdateResponse.Attributes.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + assertThat(ruleUpdateResponse.conditions().getOrNull()) + .containsExactly( + RuleUpdateResponse.Condition.builder() + .field("field") + .operator(RuleUpdateResponse.Condition.Operator.EQUALS) + .value("value") + .build() + ) + assertThat(ruleUpdateResponse.createdAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(ruleUpdateResponse.effectiveEndDate()).contains("effective_end_date") + assertThat(ruleUpdateResponse.effectiveStartDate()).contains("effective_start_date") + assertThat(ruleUpdateResponse.entityType()) + .contains(RuleUpdateResponse.EntityType.PAY_STATEMENT_ITEM) + assertThat(ruleUpdateResponse.priority()).contains(0L) + assertThat(ruleUpdateResponse.updatedAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val ruleUpdateResponse = + RuleUpdateResponse.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .attributes( + RuleUpdateResponse.Attributes.builder() + .metadata( + RuleUpdateResponse.Attributes.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + .addCondition( + RuleUpdateResponse.Condition.builder() + .field("field") + .operator(RuleUpdateResponse.Condition.Operator.EQUALS) + .value("value") + .build() + ) + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .effectiveEndDate("effective_end_date") + .effectiveStartDate("effective_start_date") + .entityType(RuleUpdateResponse.EntityType.PAY_STATEMENT_ITEM) + .priority(0L) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + val roundtrippedRuleUpdateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleUpdateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleUpdateResponse).isEqualTo(ruleUpdateResponse) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/company/PayStatementItemServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/company/PayStatementItemServiceAsyncTest.kt new file mode 100644 index 00000000..2e3dfe28 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/company/PayStatementItemServiceAsyncTest.kt @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.hris.company + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class PayStatementItemServiceAsyncTest { + + @Test + fun list() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val payStatementItemServiceAsync = client.hris().company().payStatementItem() + + val pageFuture = payStatementItemServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/company/payStatementItem/RuleServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/company/payStatementItem/RuleServiceAsyncTest.kt new file mode 100644 index 00000000..d2089357 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/company/payStatementItem/RuleServiceAsyncTest.kt @@ -0,0 +1,114 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.hris.company.payStatementItem + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleCreateParams +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleDeleteParams +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class RuleServiceAsyncTest { + + @Test + fun create() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val ruleServiceAsync = client.hris().company().payStatementItem().rules() + + val ruleFuture = + ruleServiceAsync.create( + HrisCompanyPayStatementItemRuleCreateParams.builder() + .attributes( + HrisCompanyPayStatementItemRuleCreateParams.Attributes.builder() + .metadata( + HrisCompanyPayStatementItemRuleCreateParams.Attributes.Metadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + .addCondition( + HrisCompanyPayStatementItemRuleCreateParams.Condition.builder() + .field("field") + .operator( + HrisCompanyPayStatementItemRuleCreateParams.Condition.Operator + .EQUALS + ) + .value("value") + .build() + ) + .effectiveEndDate("effective_end_date") + .effectiveStartDate("effective_start_date") + .entityType( + HrisCompanyPayStatementItemRuleCreateParams.EntityType.PAY_STATEMENT_ITEM + ) + .build() + ) + + val rule = ruleFuture.get() + rule.validate() + } + + @Test + fun update() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val ruleServiceAsync = client.hris().company().payStatementItem().rules() + + val ruleFuture = + ruleServiceAsync.update( + HrisCompanyPayStatementItemRuleUpdateParams.builder() + .ruleId("rule_id") + .optionalProperty(JsonValue.from(mapOf())) + .build() + ) + + val rule = ruleFuture.get() + rule.validate() + } + + @Test + fun list() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val ruleServiceAsync = client.hris().company().payStatementItem().rules() + + val pageFuture = ruleServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } + + @Test + fun delete() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val ruleServiceAsync = client.hris().company().payStatementItem().rules() + + val ruleFuture = + ruleServiceAsync.delete( + HrisCompanyPayStatementItemRuleDeleteParams.builder().ruleId("rule_id").build() + ) + + val rule = ruleFuture.get() + rule.validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/company/PayStatementItemServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/company/PayStatementItemServiceTest.kt new file mode 100644 index 00000000..f5a32058 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/company/PayStatementItemServiceTest.kt @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.hris.company + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClient +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class PayStatementItemServiceTest { + + @Test + fun list() { + val client = + FinchOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val payStatementItemService = client.hris().company().payStatementItem() + + val page = payStatementItemService.list() + + page.response().validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/company/payStatementItem/RuleServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/company/payStatementItem/RuleServiceTest.kt new file mode 100644 index 00000000..be36e133 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/company/payStatementItem/RuleServiceTest.kt @@ -0,0 +1,110 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.hris.company.payStatementItem + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClient +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleCreateParams +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleDeleteParams +import com.tryfinch.api.models.HrisCompanyPayStatementItemRuleUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class RuleServiceTest { + + @Test + fun create() { + val client = + FinchOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val ruleService = client.hris().company().payStatementItem().rules() + + val rule = + ruleService.create( + HrisCompanyPayStatementItemRuleCreateParams.builder() + .attributes( + HrisCompanyPayStatementItemRuleCreateParams.Attributes.builder() + .metadata( + HrisCompanyPayStatementItemRuleCreateParams.Attributes.Metadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + .addCondition( + HrisCompanyPayStatementItemRuleCreateParams.Condition.builder() + .field("field") + .operator( + HrisCompanyPayStatementItemRuleCreateParams.Condition.Operator + .EQUALS + ) + .value("value") + .build() + ) + .effectiveEndDate("effective_end_date") + .effectiveStartDate("effective_start_date") + .entityType( + HrisCompanyPayStatementItemRuleCreateParams.EntityType.PAY_STATEMENT_ITEM + ) + .build() + ) + + rule.validate() + } + + @Test + fun update() { + val client = + FinchOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val ruleService = client.hris().company().payStatementItem().rules() + + val rule = + ruleService.update( + HrisCompanyPayStatementItemRuleUpdateParams.builder() + .ruleId("rule_id") + .optionalProperty(JsonValue.from(mapOf())) + .build() + ) + + rule.validate() + } + + @Test + fun list() { + val client = + FinchOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val ruleService = client.hris().company().payStatementItem().rules() + + val page = ruleService.list() + + page.response().validate() + } + + @Test + fun delete() { + val client = + FinchOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val ruleService = client.hris().company().payStatementItem().rules() + + val rule = + ruleService.delete( + HrisCompanyPayStatementItemRuleDeleteParams.builder().ruleId("rule_id").build() + ) + + rule.validate() + } +} From b5a2343b89278949689abdfb5b1303713ac57fbf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 4 Apr 2025 18:01:18 +0000 Subject: [PATCH 57/65] feat(api): manual updates (#527) --- .stats.yml | 4 +- .../HrisBenefitIndividualUnenrollManyPage.kt | 26 +- ...sBenefitIndividualUnenrollManyPageAsync.kt | 28 +- .../models/IndividualUnenrollManyResponse.kt | 120 ----- .../api/models/UnenrolledIndividual.kt | 443 ++++++++++++++++++ .../benefits/IndividualServiceAsyncImpl.kt | 6 +- .../hris/benefits/IndividualServiceImpl.kt | 6 +- .../IndividualUnenrollManyResponseTest.kt | 31 -- .../api/models/UnenrolledIndividualTest.kt | 63 +++ 9 files changed, 537 insertions(+), 190 deletions(-) delete mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUnenrollManyResponse.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt delete mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUnenrollManyResponseTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt diff --git a/.stats.yml b/.stats.yml index aaf67d93..34a10d13 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-972e563922dedeeb94dca9a3ca8bac536488fcee56b55fcf09e6af044d3740e3.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-14d375aab89e6b212fe459805a42d6ea7d7da8eae2037ae710a187d06911be1d.yml openapi_spec_hash: 08b86ecbec3323717d48e4aaee48ed54 -config_hash: b839955f81dcf0a060366274f202b185 +config_hash: 2bca9e6b32f742acb077cf8822ec9e23 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 index 6b2a3e67..0e084d12 100644 --- 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 @@ -29,7 +29,7 @@ private constructor( fun response(): Response = response - fun items(): List = response().items() + fun items(): List = response().items() override fun equals(other: Any?): Boolean { if (this === other) { @@ -69,21 +69,19 @@ private constructor( } class Response( - private val items: JsonField>, + private val items: JsonField>, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("items") - items: JsonField> = JsonMissing.of() + @JsonProperty("items") items: JsonField> = JsonMissing.of() ) : this(items, mutableMapOf()) - fun items(): List = items.getNullable("items") ?: listOf() + fun items(): List = items.getNullable("items") ?: listOf() @JsonProperty("items") - fun _items(): Optional>> = - Optional.ofNullable(items) + fun _items(): Optional>> = Optional.ofNullable(items) @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -140,7 +138,7 @@ private constructor( class Builder { - private var items: JsonField> = JsonMissing.of() + private var items: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -149,11 +147,9 @@ private constructor( this.additionalProperties.putAll(page.additionalProperties) } - fun items(items: List) = items(JsonField.of(items)) + fun items(items: List) = items(JsonField.of(items)) - fun items(items: JsonField>) = apply { - this.items = items - } + fun items(items: JsonField>) = apply { this.items = items } fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) @@ -169,9 +165,9 @@ private constructor( } class AutoPager(private val firstPage: HrisBenefitIndividualUnenrollManyPage) : - Iterable { + Iterable { - override fun iterator(): Iterator = iterator { + override fun iterator(): Iterator = iterator { var page = firstPage var index = 0 while (true) { @@ -183,7 +179,7 @@ private constructor( } } - fun stream(): Stream { + 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 index 9f1bcafb..a3e43f1d 100644 --- 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 @@ -29,7 +29,7 @@ private constructor( fun response(): Response = response - fun items(): List = response().items() + fun items(): List = response().items() override fun equals(other: Any?): Boolean { if (this === other) { @@ -71,21 +71,19 @@ private constructor( } class Response( - private val items: JsonField>, + private val items: JsonField>, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("items") - items: JsonField> = JsonMissing.of() + @JsonProperty("items") items: JsonField> = JsonMissing.of() ) : this(items, mutableMapOf()) - fun items(): List = items.getNullable("items") ?: listOf() + fun items(): List = items.getNullable("items") ?: listOf() @JsonProperty("items") - fun _items(): Optional>> = - Optional.ofNullable(items) + fun _items(): Optional>> = Optional.ofNullable(items) @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -142,7 +140,7 @@ private constructor( class Builder { - private var items: JsonField> = JsonMissing.of() + private var items: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -151,11 +149,9 @@ private constructor( this.additionalProperties.putAll(page.additionalProperties) } - fun items(items: List) = items(JsonField.of(items)) + fun items(items: List) = items(JsonField.of(items)) - fun items(items: JsonField>) = apply { - this.items = items - } + fun items(items: JsonField>) = apply { this.items = items } fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) @@ -173,11 +169,11 @@ private constructor( class AutoPager(private val firstPage: HrisBenefitIndividualUnenrollManyPageAsync) { fun forEach( - action: Predicate, + action: Predicate, executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( - action: (IndividualUnenrollManyResponse) -> Boolean, + action: (UnenrolledIndividual) -> Boolean, executor: Executor, ): CompletableFuture = thenComposeAsync( @@ -193,8 +189,8 @@ private constructor( .forEach(action::test, executor) } - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() + 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/IndividualUnenrollManyResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUnenrollManyResponse.kt deleted file mode 100644 index f568b3c3..00000000 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUnenrollManyResponse.kt +++ /dev/null @@ -1,120 +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.tryfinch.api.core.ExcludeMissing -import com.tryfinch.api.core.JsonValue -import com.tryfinch.api.errors.FinchInvalidDataException -import java.util.Collections -import java.util.Objects - -class IndividualUnenrollManyResponse -private constructor(private val additionalProperties: MutableMap) { - - @JsonCreator private constructor() : this(mutableMapOf()) - - @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 - * [IndividualUnenrollManyResponse]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [IndividualUnenrollManyResponse]. */ - class Builder internal constructor() { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(individualUnenrollManyResponse: IndividualUnenrollManyResponse) = apply { - additionalProperties = - individualUnenrollManyResponse.additionalProperties.toMutableMap() - } - - 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 [IndividualUnenrollManyResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): IndividualUnenrollManyResponse = - IndividualUnenrollManyResponse(additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - fun validate(): IndividualUnenrollManyResponse = apply { - if (validated) { - return@apply - } - - 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 = 0 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is IndividualUnenrollManyResponse && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "IndividualUnenrollManyResponse{additionalProperties=$additionalProperties}" -} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt new file mode 100644 index 00000000..9c35bffe --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt @@ -0,0 +1,443 @@ +// 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 java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class UnenrolledIndividual +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 = Optional.ofNullable(body.getNullable("body")) + + /** + * HTTP status code + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun code(): Optional = Optional.ofNullable(code.getNullable("code")) + + /** + * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun individualId(): Optional = + Optional.ofNullable(individualId.getNullable("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 [UnenrolledIndividual]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [UnenrolledIndividual]. */ + 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(unenrolledIndividual: UnenrolledIndividual) = apply { + body = unenrolledIndividual.body + code = unenrolledIndividual.code + individualId = unenrolledIndividual.individualId + additionalProperties = unenrolledIndividual.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 */ + fun code(code: Long) = code(JsonField.of(code)) + + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [Long] 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 [UnenrolledIndividual]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): UnenrolledIndividual = + UnenrolledIndividual(body, code, individualId, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): UnenrolledIndividual = apply { + if (validated) { + return@apply + } + + body().ifPresent { it.validate() } + code() + 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) + + (if (code.asKnown().isPresent) 1 else 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 = Optional.ofNullable(finchCode.getNullable("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 = Optional.ofNullable(message.getNullable("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 = Optional.ofNullable(name.getNullable("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}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is UnenrolledIndividual && 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() = + "UnenrolledIndividual{body=$body, code=$code, individualId=$individualId, additionalProperties=$additionalProperties}" +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt index 600a881e..3c10a2e7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt @@ -22,7 +22,7 @@ import com.tryfinch.api.models.HrisBenefitIndividualUnenrollManyPageAsync import com.tryfinch.api.models.HrisBenefitIndividualUnenrollManyParams import com.tryfinch.api.models.IndividualBenefit import com.tryfinch.api.models.IndividualEnrolledIdsResponse -import com.tryfinch.api.models.IndividualUnenrollManyResponse +import com.tryfinch.api.models.UnenrolledIndividual import java.util.concurrent.CompletableFuture class IndividualServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -130,8 +130,8 @@ class IndividualServiceAsyncImpl internal constructor(private val clientOptions: } } - private val unenrollManyHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + private val unenrollManyHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) .withErrorHandler(errorHandler) override fun unenrollMany( diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt index a7e80361..34bf610b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt @@ -22,7 +22,7 @@ import com.tryfinch.api.models.HrisBenefitIndividualUnenrollManyPage import com.tryfinch.api.models.HrisBenefitIndividualUnenrollManyParams import com.tryfinch.api.models.IndividualBenefit import com.tryfinch.api.models.IndividualEnrolledIdsResponse -import com.tryfinch.api.models.IndividualUnenrollManyResponse +import com.tryfinch.api.models.UnenrolledIndividual class IndividualServiceImpl internal constructor(private val clientOptions: ClientOptions) : IndividualService { @@ -122,8 +122,8 @@ class IndividualServiceImpl internal constructor(private val clientOptions: Clie } } - private val unenrollManyHandler: Handler> = - jsonHandler>(clientOptions.jsonMapper) + private val unenrollManyHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) .withErrorHandler(errorHandler) override fun unenrollMany( diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUnenrollManyResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUnenrollManyResponseTest.kt deleted file mode 100644 index fca952aa..00000000 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUnenrollManyResponseTest.kt +++ /dev/null @@ -1,31 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.tryfinch.api.models - -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.tryfinch.api.core.jsonMapper -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class IndividualUnenrollManyResponseTest { - - @Test - fun create() { - val individualUnenrollManyResponse = IndividualUnenrollManyResponse.builder().build() - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val individualUnenrollManyResponse = IndividualUnenrollManyResponse.builder().build() - - val roundtrippedIndividualUnenrollManyResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(individualUnenrollManyResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedIndividualUnenrollManyResponse) - .isEqualTo(individualUnenrollManyResponse) - } -} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt new file mode 100644 index 00000000..98753d93 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/UnenrolledIndividualTest.kt @@ -0,0 +1,63 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.jsonMapper +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class UnenrolledIndividualTest { + + @Test + fun create() { + val unenrolledIndividual = + UnenrolledIndividual.builder() + .body( + UnenrolledIndividual.Body.builder() + .finchCode("finch_code") + .message("message") + .name("name") + .build() + ) + .code(0L) + .individualId("individual_id") + .build() + + assertThat(unenrolledIndividual.body()) + .contains( + UnenrolledIndividual.Body.builder() + .finchCode("finch_code") + .message("message") + .name("name") + .build() + ) + assertThat(unenrolledIndividual.code()).contains(0L) + assertThat(unenrolledIndividual.individualId()).contains("individual_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val unenrolledIndividual = + UnenrolledIndividual.builder() + .body( + UnenrolledIndividual.Body.builder() + .finchCode("finch_code") + .message("message") + .name("name") + .build() + ) + .code(0L) + .individualId("individual_id") + .build() + + val roundtrippedUnenrolledIndividual = + jsonMapper.readValue( + jsonMapper.writeValueAsString(unenrolledIndividual), + jacksonTypeRef(), + ) + + assertThat(roundtrippedUnenrolledIndividual).isEqualTo(unenrolledIndividual) + } +} From 70033bd2f85bbb1cccefbff8eb86193f912e92c2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 4 Apr 2025 21:10:19 +0000 Subject: [PATCH 58/65] chore(internal): swap from `getNullable` to `getOptional` (#528) --- .../kotlin/com/tryfinch/api/core/Values.kt | 8 +- .../api/models/AccessTokenCreateParams.kt | 8 +- .../tryfinch/api/models/AccountUpdateEvent.kt | 404 +++++++----------- .../api/models/AccountUpdateResponse.kt | 3 +- .../tryfinch/api/models/AutomatedAsyncJob.kt | 14 +- .../api/models/AutomatedListResponse.kt | 9 +- .../tryfinch/api/models/BaseWebhookEvent.kt | 3 +- .../api/models/BenefitContribution.kt | 4 +- .../models/BenefitFeaturesAndOperations.kt | 20 +- .../tryfinch/api/models/BenefitsSupport.kt | 32 +- .../kotlin/com/tryfinch/api/models/Company.kt | 44 +- .../com/tryfinch/api/models/CompanyBenefit.kt | 8 +- .../com/tryfinch/api/models/CompanyEvent.kt | 7 +- .../api/models/CompanyUpdateResponse.kt | 44 +- .../api/models/ConnectSessionNewParams.kt | 21 +- .../ConnectSessionReauthenticateParams.kt | 9 +- .../api/models/ConnectionCreateResponse.kt | 2 +- .../api/models/CreateAccessTokenResponse.kt | 4 +- .../com/tryfinch/api/models/DirectoryEvent.kt | 10 +- .../tryfinch/api/models/DocumentResponse.kt | 11 +- .../com/tryfinch/api/models/EmploymentData.kt | 56 ++- .../api/models/EmploymentDataResponse.kt | 7 +- .../tryfinch/api/models/EmploymentEvent.kt | 10 +- .../api/models/EmploymentUpdateResponse.kt | 53 ++- .../tryfinch/api/models/EnrolledIndividual.kt | 13 +- .../api/models/HrisBenefitCreateParams.kt | 8 +- ...nefitIndividualRetrieveManyBenefitsPage.kt | 2 +- ...IndividualRetrieveManyBenefitsPageAsync.kt | 3 +- .../HrisBenefitIndividualUnenrollManyPage.kt | 2 +- ...sBenefitIndividualUnenrollManyPageAsync.kt | 3 +- ...HrisBenefitIndividualUnenrollManyParams.kt | 3 +- .../api/models/HrisBenefitListPage.kt | 2 +- .../api/models/HrisBenefitListPageAsync.kt | 3 +- .../HrisBenefitListSupportedBenefitsPage.kt | 2 +- ...isBenefitListSupportedBenefitsPageAsync.kt | 3 +- .../api/models/HrisBenefitUpdateParams.kt | 3 +- .../HrisCompanyPayStatementItemListPage.kt | 2 +- ...risCompanyPayStatementItemListPageAsync.kt | 3 +- ...CompanyPayStatementItemRuleCreateParams.kt | 21 +- ...HrisCompanyPayStatementItemRuleListPage.kt | 3 +- ...ompanyPayStatementItemRuleListPageAsync.kt | 4 +- .../HrisDirectoryListIndividualsPage.kt | 4 +- .../HrisDirectoryListIndividualsPageAsync.kt | 5 +- .../api/models/HrisDirectoryListPage.kt | 4 +- .../api/models/HrisDirectoryListPageAsync.kt | 5 +- .../models/HrisEmploymentRetrieveManyPage.kt | 2 +- .../HrisEmploymentRetrieveManyPageAsync.kt | 3 +- .../models/HrisIndividualRetrieveManyPage.kt | 3 +- .../HrisIndividualRetrieveManyPageAsync.kt | 4 +- .../HrisIndividualRetrieveManyParams.kt | 10 +- .../HrisPayStatementRetrieveManyPage.kt | 3 +- .../HrisPayStatementRetrieveManyPageAsync.kt | 4 +- .../HrisPayStatementRetrieveManyParams.kt | 4 +- .../api/models/HrisPaymentListPage.kt | 2 +- .../api/models/HrisPaymentListPageAsync.kt | 3 +- .../kotlin/com/tryfinch/api/models/Income.kt | 9 +- .../com/tryfinch/api/models/Individual.kt | 37 +- .../tryfinch/api/models/IndividualBenefit.kt | 18 +- .../tryfinch/api/models/IndividualEvent.kt | 10 +- .../api/models/IndividualInDirectory.kt | 19 +- .../tryfinch/api/models/IndividualResponse.kt | 7 +- .../api/models/IndividualUpdateResponse.kt | 37 +- .../com/tryfinch/api/models/Introspection.kt | 27 +- .../tryfinch/api/models/JobCompletionEvent.kt | 7 +- .../com/tryfinch/api/models/Location.kt | 16 +- .../com/tryfinch/api/models/ManualAsyncJob.kt | 2 +- .../kotlin/com/tryfinch/api/models/Money.kt | 4 +- .../api/models/OperationSupportMatrix.kt | 8 +- .../kotlin/com/tryfinch/api/models/Paging.kt | 4 +- .../api/models/PayGroupListResponse.kt | 6 +- .../com/tryfinch/api/models/PayStatement.kt | 96 ++--- .../tryfinch/api/models/PayStatementEvent.kt | 12 +- .../models/PayStatementItemListResponse.kt | 13 +- .../api/models/PayStatementResponse.kt | 6 +- .../api/models/PayStatementResponseBody.kt | 5 +- .../kotlin/com/tryfinch/api/models/Payment.kt | 33 +- .../com/tryfinch/api/models/PaymentEvent.kt | 7 +- .../api/models/PayrollPayGroupListPage.kt | 2 +- .../models/PayrollPayGroupListPageAsync.kt | 3 +- .../com/tryfinch/api/models/Provider.kt | 403 +++++++---------- .../tryfinch/api/models/ProviderListPage.kt | 2 +- .../api/models/ProviderListPageAsync.kt | 3 +- .../models/RequestForwardingForwardParams.kt | 2 +- .../RequestForwardingForwardResponse.kt | 4 +- .../tryfinch/api/models/RuleCreateResponse.kt | 32 +- .../tryfinch/api/models/RuleDeleteResponse.kt | 35 +- .../tryfinch/api/models/RuleListResponse.kt | 32 +- .../tryfinch/api/models/RuleUpdateResponse.kt | 32 +- .../api/models/SandboxCompanyUpdateParams.kt | 45 +- .../SandboxConnectionAccountCreateParams.kt | 5 +- .../SandboxConnectionAccountUpdateParams.kt | 2 +- .../models/SandboxConnectionCreateParams.kt | 8 +- .../models/SandboxDirectoryCreateParams.kt | 82 ++-- .../models/SandboxEmploymentUpdateParams.kt | 51 +-- .../models/SandboxIndividualUpdateParams.kt | 38 +- .../api/models/SandboxPaymentCreateParams.kt | 105 ++--- .../api/models/SupportPerBenefitType.kt | 4 +- .../tryfinch/api/models/SupportedBenefit.kt | 19 +- .../api/models/UnenrolledIndividual.kt | 13 +- .../kotlin/com/tryfinch/api/models/W42005.kt | 19 +- .../kotlin/com/tryfinch/api/models/W42020.kt | 34 +- 101 files changed, 953 insertions(+), 1332 deletions(-) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt index e5a88d66..c6a96ebd 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt @@ -132,11 +132,11 @@ sealed class JsonField { } @JvmSynthetic - internal fun getNullable(name: String): T? = + internal fun getOptional(name: String): Optional<@UnsafeVariance T> = when (this) { - is KnownValue -> value - is JsonMissing -> null - is JsonNull -> null + is KnownValue -> Optional.of(value) + is JsonMissing, + is JsonNull -> Optional.empty() else -> throw FinchInvalidDataException("`$name` is invalid, received $this") } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt index ac18d7b6..6a89eec0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt @@ -346,21 +346,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun clientId(): Optional = Optional.ofNullable(clientId.getNullable("client_id")) + fun clientId(): Optional = clientId.getOptional("client_id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun clientSecret(): Optional = - Optional.ofNullable(clientSecret.getNullable("client_secret")) + fun clientSecret(): Optional = clientSecret.getOptional("client_secret") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun redirectUri(): Optional = - Optional.ofNullable(redirectUri.getNullable("redirect_uri")) + fun redirectUri(): Optional = redirectUri.getOptional("redirect_uri") /** * Returns the raw JSON value of [code]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt index eac777e4..e6305b42 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt @@ -72,20 +72,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) + fun connectionId(): Optional = connectionId.getOptional("connection_id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) + fun eventType(): Optional = eventType.getOptional("event_type") /** * Returns the raw JSON value of [accountId]. @@ -537,7 +536,7 @@ private constructor( * the server responded with an unexpected value). */ fun benefitsSupport(): Optional = - Optional.ofNullable(benefitsSupport.getNullable("benefits_support")) + benefitsSupport.getOptional("benefits_support") /** * The supported data fields returned by our HR and payroll endpoints @@ -546,7 +545,7 @@ private constructor( * the server responded with an unexpected value). */ fun supportedFields(): Optional = - Optional.ofNullable(supportedFields.getNullable("supported_fields")) + supportedFields.getOptional("supported_fields") /** * The type of authentication method. @@ -554,7 +553,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [benefitsSupport]. @@ -796,50 +795,48 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun company(): Optional = - Optional.ofNullable(company.getNullable("company")) + fun company(): Optional = company.getOptional("company") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ fun directory(): Optional = - Optional.ofNullable(directory.getNullable("directory")) + directory.getOptional("directory") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ fun employment(): Optional = - Optional.ofNullable(employment.getNullable("employment")) + employment.getOptional("employment") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ fun individual(): Optional = - Optional.ofNullable(individual.getNullable("individual")) + individual.getOptional("individual") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ fun payGroup(): Optional = - Optional.ofNullable(payGroup.getNullable("pay_group")) + payGroup.getOptional("pay_group") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ fun payStatement(): Optional = - Optional.ofNullable(payStatement.getNullable("pay_statement")) + payStatement.getOptional("pay_statement") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun payment(): Optional = - Optional.ofNullable(payment.getNullable("payment")) + fun payment(): Optional = payment.getOptional("payment") /** * Returns the raw JSON value of [company]. @@ -1193,62 +1190,58 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun accounts(): Optional = - Optional.ofNullable(accounts.getNullable("accounts")) + fun accounts(): Optional = accounts.getOptional("accounts") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun departments(): Optional = - Optional.ofNullable(departments.getNullable("departments")) + departments.getOptional("departments") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun ein(): Optional = Optional.ofNullable(ein.getNullable("ein")) + fun ein(): Optional = ein.getOptional("ein") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun entity(): Optional = - Optional.ofNullable(entity.getNullable("entity")) + fun entity(): Optional = entity.getOptional("entity") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun legalName(): Optional = - Optional.ofNullable(legalName.getNullable("legal_name")) + fun legalName(): Optional = legalName.getOptional("legal_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun locations(): Optional = - Optional.ofNullable(locations.getNullable("locations")) + fun locations(): Optional = locations.getOptional("locations") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun primaryEmail(): Optional = - Optional.ofNullable(primaryEmail.getNullable("primary_email")) + primaryEmail.getOptional("primary_email") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun primaryPhoneNumber(): Optional = - Optional.ofNullable(primaryPhoneNumber.getNullable("primary_phone_number")) + primaryPhoneNumber.getOptional("primary_phone_number") /** * Returns the raw JSON value of [id]. @@ -1629,35 +1622,35 @@ private constructor( * type (e.g. if the server responded with an unexpected value). */ fun accountName(): Optional = - Optional.ofNullable(accountName.getNullable("account_name")) + accountName.getOptional("account_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ fun accountNumber(): Optional = - Optional.ofNullable(accountNumber.getNullable("account_number")) + accountNumber.getOptional("account_number") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ fun accountType(): Optional = - Optional.ofNullable(accountType.getNullable("account_type")) + accountType.getOptional("account_type") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ fun institutionName(): Optional = - Optional.ofNullable(institutionName.getNullable("institution_name")) + institutionName.getOptional("institution_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ fun routingNumber(): Optional = - Optional.ofNullable(routingNumber.getNullable("routing_number")) + routingNumber.getOptional("routing_number") /** * Returns the raw JSON value of [accountName]. @@ -1935,15 +1928,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun name(): Optional = - Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun parent(): Optional = - Optional.ofNullable(parent.getNullable("parent")) + fun parent(): Optional = parent.getOptional("parent") /** * Returns the raw JSON value of [name]. @@ -2102,8 +2093,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun name(): Optional = - Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Returns the raw JSON value of [name]. @@ -2279,15 +2269,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun subtype(): Optional = - Optional.ofNullable(subtype.getNullable("subtype")) + fun subtype(): Optional = subtype.getOptional("subtype") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun type(): Optional = - Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [subtype]. @@ -2484,43 +2472,37 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun city(): Optional = - Optional.ofNullable(city.getNullable("city")) + fun city(): Optional = city.getOptional("city") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun country(): Optional = - Optional.ofNullable(country.getNullable("country")) + fun country(): Optional = country.getOptional("country") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun line1(): Optional = - Optional.ofNullable(line1.getNullable("line1")) + fun line1(): Optional = line1.getOptional("line1") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun line2(): Optional = - Optional.ofNullable(line2.getNullable("line2")) + fun line2(): Optional = line2.getOptional("line2") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun postalCode(): Optional = - Optional.ofNullable(postalCode.getNullable("postal_code")) + fun postalCode(): Optional = postalCode.getOptional("postal_code") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun state(): Optional = - Optional.ofNullable(state.getNullable("state")) + fun state(): Optional = state.getOptional("state") /** * Returns the raw JSON value of [city]. @@ -2832,14 +2814,13 @@ private constructor( * (e.g. if the server responded with an unexpected value). */ fun individuals(): Optional = - Optional.ofNullable(individuals.getNullable("individuals")) + individuals.getOptional("individuals") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun paging(): Optional = - Optional.ofNullable(paging.getNullable("paging")) + fun paging(): Optional = paging.getOptional("paging") /** * Returns the raw JSON value of [individuals]. @@ -3040,49 +3021,43 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun department(): Optional = - Optional.ofNullable(department.getNullable("department")) + fun department(): Optional = department.getOptional("department") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun firstName(): Optional = - Optional.ofNullable(firstName.getNullable("first_name")) + fun firstName(): Optional = firstName.getOptional("first_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun isActive(): Optional = - Optional.ofNullable(isActive.getNullable("is_active")) + fun isActive(): Optional = isActive.getOptional("is_active") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun lastName(): Optional = - Optional.ofNullable(lastName.getNullable("last_name")) + fun lastName(): Optional = lastName.getOptional("last_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun manager(): Optional = - Optional.ofNullable(manager.getNullable("manager")) + fun manager(): Optional = manager.getOptional("manager") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun middleName(): Optional = - Optional.ofNullable(middleName.getNullable("middle_name")) + fun middleName(): Optional = middleName.getOptional("middle_name") /** * Returns the raw JSON value of [id]. @@ -3389,7 +3364,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * Returns the raw JSON value of [id]. @@ -3563,15 +3538,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun count(): Optional = - Optional.ofNullable(count.getNullable("count")) + fun count(): Optional = count.getOptional("count") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun offset(): Optional = - Optional.ofNullable(offset.getNullable("offset")) + fun offset(): Optional = offset.getOptional("offset") /** * Returns the raw JSON value of [count]. @@ -3849,118 +3822,106 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun classCode(): Optional = - Optional.ofNullable(classCode.getNullable("class_code")) + fun classCode(): Optional = classCode.getOptional("class_code") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun customFields(): Optional = - Optional.ofNullable(customFields.getNullable("custom_fields")) + customFields.getOptional("custom_fields") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun department(): Optional = - Optional.ofNullable(department.getNullable("department")) + fun department(): Optional = department.getOptional("department") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun employment(): Optional = - Optional.ofNullable(employment.getNullable("employment")) + fun employment(): Optional = employment.getOptional("employment") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun employmentStatus(): Optional = - Optional.ofNullable(employmentStatus.getNullable("employment_status")) + employmentStatus.getOptional("employment_status") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) + fun endDate(): Optional = endDate.getOptional("end_date") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun firstName(): Optional = - Optional.ofNullable(firstName.getNullable("first_name")) + fun firstName(): Optional = firstName.getOptional("first_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun income(): Optional = - Optional.ofNullable(income.getNullable("income")) + fun income(): Optional = income.getOptional("income") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun incomeHistory(): Optional = - Optional.ofNullable(incomeHistory.getNullable("income_history")) + incomeHistory.getOptional("income_history") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun isActive(): Optional = - Optional.ofNullable(isActive.getNullable("is_active")) + fun isActive(): Optional = isActive.getOptional("is_active") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun lastName(): Optional = - Optional.ofNullable(lastName.getNullable("last_name")) + fun lastName(): Optional = lastName.getOptional("last_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun location(): Optional = - Optional.ofNullable(location.getNullable("location")) + fun location(): Optional = location.getOptional("location") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun manager(): Optional = - Optional.ofNullable(manager.getNullable("manager")) + fun manager(): Optional = manager.getOptional("manager") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun middleName(): Optional = - Optional.ofNullable(middleName.getNullable("middle_name")) + fun middleName(): Optional = middleName.getOptional("middle_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun startDate(): Optional = - Optional.ofNullable(startDate.getNullable("start_date")) + fun startDate(): Optional = startDate.getOptional("start_date") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun title(): Optional = Optional.ofNullable(title.getNullable("title")) + fun title(): Optional = title.getOptional("title") /** * Returns the raw JSON value of [id]. @@ -4540,8 +4501,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun name(): Optional = - Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Returns the raw JSON value of [name]. @@ -4696,15 +4656,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun subtype(): Optional = - Optional.ofNullable(subtype.getNullable("subtype")) + fun subtype(): Optional = subtype.getOptional("subtype") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun type(): Optional = - Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [subtype]. @@ -4891,22 +4849,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun amount(): Optional = - Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun currency(): Optional = - Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun unit(): Optional = - Optional.ofNullable(unit.getNullable("unit")) + fun unit(): Optional = unit.getOptional("unit") /** * Returns the raw JSON value of [amount]. @@ -5128,43 +5083,37 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun city(): Optional = - Optional.ofNullable(city.getNullable("city")) + fun city(): Optional = city.getOptional("city") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun country(): Optional = - Optional.ofNullable(country.getNullable("country")) + fun country(): Optional = country.getOptional("country") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun line1(): Optional = - Optional.ofNullable(line1.getNullable("line1")) + fun line1(): Optional = line1.getOptional("line1") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun line2(): Optional = - Optional.ofNullable(line2.getNullable("line2")) + fun line2(): Optional = line2.getOptional("line2") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun postalCode(): Optional = - Optional.ofNullable(postalCode.getNullable("postal_code")) + fun postalCode(): Optional = postalCode.getOptional("postal_code") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun state(): Optional = - Optional.ofNullable(state.getNullable("state")) + fun state(): Optional = state.getOptional("state") /** * Returns the raw JSON value of [city]. @@ -5452,7 +5401,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * Returns the raw JSON value of [id]. @@ -5681,89 +5630,82 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) + fun dob(): Optional = dob.getOptional("dob") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun emails(): Optional = - Optional.ofNullable(emails.getNullable("emails")) + fun emails(): Optional = emails.getOptional("emails") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun encryptedSsn(): Optional = - Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) + encryptedSsn.getOptional("encrypted_ssn") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun ethnicity(): Optional = - Optional.ofNullable(ethnicity.getNullable("ethnicity")) + fun ethnicity(): Optional = ethnicity.getOptional("ethnicity") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun firstName(): Optional = - Optional.ofNullable(firstName.getNullable("first_name")) + fun firstName(): Optional = firstName.getOptional("first_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun gender(): Optional = - Optional.ofNullable(gender.getNullable("gender")) + fun gender(): Optional = gender.getOptional("gender") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun lastName(): Optional = - Optional.ofNullable(lastName.getNullable("last_name")) + fun lastName(): Optional = lastName.getOptional("last_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun middleName(): Optional = - Optional.ofNullable(middleName.getNullable("middle_name")) + fun middleName(): Optional = middleName.getOptional("middle_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun phoneNumbers(): Optional = - Optional.ofNullable(phoneNumbers.getNullable("phone_numbers")) + phoneNumbers.getOptional("phone_numbers") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun preferredName(): Optional = - Optional.ofNullable(preferredName.getNullable("preferred_name")) + preferredName.getOptional("preferred_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun residence(): Optional = - Optional.ofNullable(residence.getNullable("residence")) + fun residence(): Optional = residence.getOptional("residence") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) + fun ssn(): Optional = ssn.getOptional("ssn") /** * Returns the raw JSON value of [id]. @@ -6231,15 +6173,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun data(): Optional = - Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun type(): Optional = - Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [data]. @@ -6416,15 +6356,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun data(): Optional = - Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun type(): Optional = - Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [data]. @@ -6619,43 +6557,37 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun city(): Optional = - Optional.ofNullable(city.getNullable("city")) + fun city(): Optional = city.getOptional("city") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun country(): Optional = - Optional.ofNullable(country.getNullable("country")) + fun country(): Optional = country.getOptional("country") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun line1(): Optional = - Optional.ofNullable(line1.getNullable("line1")) + fun line1(): Optional = line1.getOptional("line1") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun line2(): Optional = - Optional.ofNullable(line2.getNullable("line2")) + fun line2(): Optional = line2.getOptional("line2") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun postalCode(): Optional = - Optional.ofNullable(postalCode.getNullable("postal_code")) + fun postalCode(): Optional = postalCode.getOptional("postal_code") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun state(): Optional = - Optional.ofNullable(state.getNullable("state")) + fun state(): Optional = state.getOptional("state") /** * Returns the raw JSON value of [city]. @@ -6974,27 +6906,27 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun individualIds(): Optional = - Optional.ofNullable(individualIds.getNullable("individual_ids")) + individualIds.getOptional("individual_ids") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun payFrequencies(): Optional = - Optional.ofNullable(payFrequencies.getNullable("pay_frequencies")) + payFrequencies.getOptional("pay_frequencies") /** * Returns the raw JSON value of [id]. @@ -7235,15 +7167,14 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun paging(): Optional = - Optional.ofNullable(paging.getNullable("paging")) + fun paging(): Optional = paging.getOptional("paging") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun payStatements(): Optional = - Optional.ofNullable(payStatements.getNullable("pay_statements")) + payStatements.getOptional("pay_statements") /** * Returns the raw JSON value of [paging]. @@ -7668,75 +7599,65 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun earnings(): Optional = - Optional.ofNullable(earnings.getNullable("earnings")) + fun earnings(): Optional = earnings.getOptional("earnings") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ fun employeeDeductions(): Optional = - Optional.ofNullable( - employeeDeductions.getNullable("employee_deductions") - ) + employeeDeductions.getOptional("employee_deductions") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ fun employerContributions(): Optional = - Optional.ofNullable( - employerContributions.getNullable("employer_contributions") - ) + employerContributions.getOptional("employer_contributions") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun grossPay(): Optional = - Optional.ofNullable(grossPay.getNullable("gross_pay")) + fun grossPay(): Optional = grossPay.getOptional("gross_pay") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) + individualId.getOptional("individual_id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun netPay(): Optional = - Optional.ofNullable(netPay.getNullable("net_pay")) + fun netPay(): Optional = netPay.getOptional("net_pay") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ fun paymentMethod(): Optional = - Optional.ofNullable(paymentMethod.getNullable("payment_method")) + paymentMethod.getOptional("payment_method") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun taxes(): Optional = - Optional.ofNullable(taxes.getNullable("taxes")) + fun taxes(): Optional = taxes.getOptional("taxes") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun totalHours(): Optional = - Optional.ofNullable(totalHours.getNullable("total_hours")) + fun totalHours(): Optional = totalHours.getOptional("total_hours") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun type(): Optional = - Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [earnings]. @@ -8145,29 +8066,25 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun amount(): Optional = - Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun currency(): Optional = - Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun name(): Optional = - Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun type(): Optional = - Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [amount]. @@ -8423,36 +8340,31 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun amount(): Optional = - Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun currency(): Optional = - Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun name(): Optional = - Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun preTax(): Optional = - Optional.ofNullable(preTax.getNullable("pre_tax")) + fun preTax(): Optional = preTax.getOptional("pre_tax") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun type(): Optional = - Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [amount]. @@ -8728,22 +8640,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun amount(): Optional = - Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun currency(): Optional = - Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun name(): Optional = - Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Returns the raw JSON value of [amount]. @@ -8975,36 +8884,31 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun amount(): Optional = - Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun currency(): Optional = - Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun employer(): Optional = - Optional.ofNullable(employer.getNullable("employer")) + fun employer(): Optional = employer.getOptional("employer") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun name(): Optional = - Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun type(): Optional = - Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [amount]. @@ -9365,84 +9269,78 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun companyDebit(): Optional = - Optional.ofNullable(companyDebit.getNullable("company_debit")) + companyDebit.getOptional("company_debit") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun debitDate(): Optional = - Optional.ofNullable(debitDate.getNullable("debit_date")) + fun debitDate(): Optional = debitDate.getOptional("debit_date") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun employeeTaxes(): Optional = - Optional.ofNullable(employeeTaxes.getNullable("employee_taxes")) + employeeTaxes.getOptional("employee_taxes") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun employerTaxes(): Optional = - Optional.ofNullable(employerTaxes.getNullable("employer_taxes")) + employerTaxes.getOptional("employer_taxes") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun grossPay(): Optional = - Optional.ofNullable(grossPay.getNullable("gross_pay")) + fun grossPay(): Optional = grossPay.getOptional("gross_pay") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun individualIds(): Optional = - Optional.ofNullable(individualIds.getNullable("individual_ids")) + individualIds.getOptional("individual_ids") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun netPay(): Optional = - Optional.ofNullable(netPay.getNullable("net_pay")) + fun netPay(): Optional = netPay.getOptional("net_pay") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun payDate(): Optional = - Optional.ofNullable(payDate.getNullable("pay_date")) + fun payDate(): Optional = payDate.getOptional("pay_date") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun payFrequencies(): Optional = - Optional.ofNullable(payFrequencies.getNullable("pay_frequencies")) + payFrequencies.getOptional("pay_frequencies") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun payGroupIds(): Optional = - Optional.ofNullable(payGroupIds.getNullable("pay_group_ids")) + fun payGroupIds(): Optional = payGroupIds.getOptional("pay_group_ids") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun payPeriod(): Optional = - Optional.ofNullable(payPeriod.getNullable("pay_period")) + fun payPeriod(): Optional = payPeriod.getOptional("pay_period") /** * Returns the raw JSON value of [id]. @@ -9892,15 +9790,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) + fun endDate(): Optional = endDate.getOptional("end_date") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun startDate(): Optional = - Optional.ofNullable(startDate.getNullable("start_date")) + fun startDate(): Optional = startDate.getOptional("start_date") /** * Returns the raw JSON value of [endDate]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt index fe9c6e03..cbbb1e2d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt @@ -100,8 +100,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) + fun connectionId(): Optional = connectionId.getOptional("connection_id") /** * Returns the raw JSON value of [accountId]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt index 3805946b..d608907b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt @@ -71,8 +71,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun completedAt(): Optional = - Optional.ofNullable(completedAt.getNullable("completed_at")) + fun completedAt(): Optional = completedAt.getOptional("completed_at") /** * The datetime when the job was created. for scheduled jobs, this will be the initial @@ -105,7 +104,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun params(): Optional = Optional.ofNullable(params.getNullable("params")) + fun params(): Optional = params.getOptional("params") /** * The datetime a job is scheduled to be run. For scheduled jobs, this datetime can be in the @@ -114,8 +113,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun scheduledAt(): Optional = - Optional.ofNullable(scheduledAt.getNullable("scheduled_at")) + fun scheduledAt(): Optional = scheduledAt.getOptional("scheduled_at") /** * The datetime a job entered into the job queue. @@ -123,8 +121,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun startedAt(): Optional = - Optional.ofNullable(startedAt.getNullable("started_at")) + fun startedAt(): Optional = startedAt.getOptional("started_at") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly @@ -520,8 +517,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun individualId(): Optional = individualId.getOptional("individual_id") /** * Returns the raw JSON value of [individualId]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt index bb109152..d93686fc 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedListResponse.kt @@ -224,7 +224,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun quotas(): Optional = Optional.ofNullable(quotas.getNullable("quotas")) + fun quotas(): Optional = quotas.getOptional("quotas") /** * Returns the raw JSON value of [quotas]. @@ -355,8 +355,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun dataSyncAll(): Optional = - Optional.ofNullable(dataSyncAll.getNullable("data_sync_all")) + fun dataSyncAll(): Optional = dataSyncAll.getOptional("data_sync_all") /** * Returns the raw JSON value of [dataSyncAll]. @@ -491,14 +490,14 @@ private constructor( * if the server responded with an unexpected value). */ fun allowedRefreshes(): Optional = - Optional.ofNullable(allowedRefreshes.getNullable("allowed_refreshes")) + allowedRefreshes.getOptional("allowed_refreshes") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ fun remainingRefreshes(): Optional = - Optional.ofNullable(remainingRefreshes.getNullable("remaining_refreshes")) + remainingRefreshes.getOptional("remaining_refreshes") /** * Returns the raw JSON value of [allowedRefreshes]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt index bb157824..509f3391 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt @@ -57,8 +57,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) + fun connectionId(): Optional = connectionId.getOptional("connection_id") /** * Returns the raw JSON value of [accountId]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt index a75c636d..7c842ee6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt @@ -36,7 +36,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * Contribution type. @@ -44,7 +44,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [amount]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt index 0b5f5b69..2d9f9c47 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt @@ -41,14 +41,14 @@ private constructor( * server responded with an unexpected value). */ fun supportedFeatures(): Optional = - Optional.ofNullable(supportedFeatures.getNullable("supported_features")) + supportedFeatures.getOptional("supported_features") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ fun supportedOperations(): Optional = - Optional.ofNullable(supportedOperations.getNullable("supported_operations")) + supportedOperations.getOptional("supported_operations") /** * Returns the raw JSON value of [supportedFeatures]. @@ -246,8 +246,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun annualMaximum(): Optional = - Optional.ofNullable(annualMaximum.getNullable("annual_maximum")) + fun annualMaximum(): Optional = annualMaximum.getOptional("annual_maximum") /** * Whether the provider supports catch up for this benefit. This field will only be true for @@ -256,7 +255,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun catchUp(): Optional = Optional.ofNullable(catchUp.getNullable("catch_up")) + fun catchUp(): Optional = catchUp.getOptional("catch_up") /** * Supported contribution types. An empty array indicates contributions are not supported. @@ -265,14 +264,13 @@ private constructor( * server responded with an unexpected value). */ fun companyContribution(): Optional> = - Optional.ofNullable(companyContribution.getNullable("company_contribution")) + 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 = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = description.getOptional("description") /** * Supported deduction types. An empty array indicates deductions are not supported. @@ -281,7 +279,7 @@ private constructor( * server responded with an unexpected value). */ fun employeeDeduction(): Optional> = - Optional.ofNullable(employeeDeduction.getNullable("employee_deduction")) + employeeDeduction.getOptional("employee_deduction") /** * The list of frequencies supported by the provider for this benefit @@ -290,7 +288,7 @@ private constructor( * server responded with an unexpected value). */ fun frequencies(): Optional> = - Optional.ofNullable(frequencies.getNullable("frequencies")) + frequencies.getOptional("frequencies") /** * Whether the provider supports HSA contribution limits. Empty if this feature is not @@ -300,7 +298,7 @@ private constructor( * server responded with an unexpected value). */ fun hsaContributionLimit(): Optional> = - Optional.ofNullable(hsaContributionLimit.getNullable("hsa_contribution_limit")) + hsaContributionLimit.getOptional("hsa_contribution_limit") /** * Returns the raw JSON value of [annualMaximum]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt index 0f227974..b0b0c886 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt @@ -95,85 +95,77 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun commuter(): Optional = - Optional.ofNullable(commuter.getNullable("commuter")) + fun commuter(): Optional = commuter.getOptional("commuter") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ fun customPostTax(): Optional = - Optional.ofNullable(customPostTax.getNullable("custom_post_tax")) + customPostTax.getOptional("custom_post_tax") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ fun customPreTax(): Optional = - Optional.ofNullable(customPreTax.getNullable("custom_pre_tax")) + customPreTax.getOptional("custom_pre_tax") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ fun fsaDependentCare(): Optional = - Optional.ofNullable(fsaDependentCare.getNullable("fsa_dependent_care")) + fsaDependentCare.getOptional("fsa_dependent_care") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun fsaMedical(): Optional = - Optional.ofNullable(fsaMedical.getNullable("fsa_medical")) + fun fsaMedical(): Optional = fsaMedical.getOptional("fsa_medical") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun hsaPost(): Optional = - Optional.ofNullable(hsaPost.getNullable("hsa_post")) + fun hsaPost(): Optional = hsaPost.getOptional("hsa_post") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun hsaPre(): Optional = - Optional.ofNullable(hsaPre.getNullable("hsa_pre")) + fun hsaPre(): Optional = hsaPre.getOptional("hsa_pre") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun s125Dental(): Optional = - Optional.ofNullable(s125Dental.getNullable("s125_dental")) + fun s125Dental(): Optional = s125Dental.getOptional("s125_dental") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ fun s125Medical(): Optional = - Optional.ofNullable(s125Medical.getNullable("s125_medical")) + s125Medical.getOptional("s125_medical") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun s125Vision(): Optional = - Optional.ofNullable(s125Vision.getNullable("s125_vision")) + fun s125Vision(): Optional = s125Vision.getOptional("s125_vision") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun simple(): Optional = - Optional.ofNullable(simple.getNullable("simple")) + fun simple(): Optional = simple.getOptional("simple") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun simpleIra(): Optional = - Optional.ofNullable(simpleIra.getNullable("simple_ira")) + fun simpleIra(): Optional = simpleIra.getOptional("simple_ira") /** * Returns the raw JSON value of [commuter]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt index 70e6c8f5..d77d890c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt @@ -82,7 +82,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun accounts(): Optional> = Optional.ofNullable(accounts.getNullable("accounts")) + fun accounts(): Optional> = accounts.getOptional("accounts") /** * The array of company departments. @@ -90,8 +90,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun departments(): Optional> = - Optional.ofNullable(departments.getNullable("departments")) + fun departments(): Optional> = departments.getOptional("departments") /** * The employer identification number. @@ -99,7 +98,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun ein(): Optional = Optional.ofNullable(ein.getNullable("ein")) + fun ein(): Optional = ein.getOptional("ein") /** * The entity type object. @@ -107,7 +106,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun entity(): Optional = Optional.ofNullable(entity.getNullable("entity")) + fun entity(): Optional = entity.getOptional("entity") /** * The legal name of the company. @@ -115,14 +114,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun legalName(): Optional = Optional.ofNullable(legalName.getNullable("legal_name")) + fun legalName(): Optional = legalName.getOptional("legal_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun locations(): Optional> = - Optional.ofNullable(locations.getNullable("locations")) + fun locations(): Optional> = locations.getOptional("locations") /** * The email of the main administrator on the account. @@ -130,8 +128,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun primaryEmail(): Optional = - Optional.ofNullable(primaryEmail.getNullable("primary_email")) + fun primaryEmail(): Optional = primaryEmail.getOptional("primary_email") /** * The phone number of the main administrator on the account. Format: `XXXXXXXXXX` @@ -140,7 +137,7 @@ private constructor( * server responded with an unexpected value). */ fun primaryPhoneNumber(): Optional = - Optional.ofNullable(primaryPhoneNumber.getNullable("primary_phone_number")) + primaryPhoneNumber.getOptional("primary_phone_number") /** * Returns the raw JSON value of [id]. @@ -595,8 +592,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun accountName(): Optional = - Optional.ofNullable(accountName.getNullable("account_name")) + fun accountName(): Optional = accountName.getOptional("account_name") /** * 10-12 digit number to specify the bank account @@ -604,8 +600,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun accountNumber(): Optional = - Optional.ofNullable(accountNumber.getNullable("account_number")) + fun accountNumber(): Optional = accountNumber.getOptional("account_number") /** * The type of bank account. @@ -613,8 +608,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun accountType(): Optional = - Optional.ofNullable(accountType.getNullable("account_type")) + fun accountType(): Optional = accountType.getOptional("account_type") /** * Name of the banking institution. @@ -622,8 +616,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun institutionName(): Optional = - Optional.ofNullable(institutionName.getNullable("institution_name")) + fun institutionName(): Optional = institutionName.getOptional("institution_name") /** * A nine-digit code that's based on the U.S. Bank location where your account was opened. @@ -631,8 +624,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun routingNumber(): Optional = - Optional.ofNullable(routingNumber.getNullable("routing_number")) + fun routingNumber(): Optional = routingNumber.getOptional("routing_number") /** * Returns the raw JSON value of [accountName]. @@ -1057,7 +1049,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * The parent department, if present. @@ -1065,7 +1057,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun parent(): Optional = Optional.ofNullable(parent.getNullable("parent")) + fun parent(): Optional = parent.getOptional("parent") /** * Returns the raw JSON value of [name]. @@ -1219,7 +1211,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Returns the raw JSON value of [name]. @@ -1386,7 +1378,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) + fun subtype(): Optional = subtype.getOptional("subtype") /** * The tax payer type of the company. @@ -1394,7 +1386,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [subtype]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt index 2b324216..bc621dbe 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt @@ -50,8 +50,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = description.getOptional("description") /** * The frequency of the benefit deduction/contribution. @@ -59,8 +58,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun frequency(): Optional = - Optional.ofNullable(frequency.getNullable("frequency")) + fun frequency(): Optional = frequency.getOptional("frequency") /** * Type of benefit. @@ -68,7 +66,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [benefitId]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt index f5649b1f..ce97497c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt @@ -73,20 +73,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) + fun connectionId(): Optional = connectionId.getOptional("connection_id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) + fun eventType(): Optional = eventType.getOptional("event_type") /** * Returns the raw JSON value of [accountId]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt index 05508d53..802688bc 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt @@ -71,7 +71,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun accounts(): Optional> = Optional.ofNullable(accounts.getNullable("accounts")) + fun accounts(): Optional> = accounts.getOptional("accounts") /** * The array of company departments. @@ -79,8 +79,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun departments(): Optional> = - Optional.ofNullable(departments.getNullable("departments")) + fun departments(): Optional> = departments.getOptional("departments") /** * The employer identification number. @@ -88,7 +87,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun ein(): Optional = Optional.ofNullable(ein.getNullable("ein")) + fun ein(): Optional = ein.getOptional("ein") /** * The entity type object. @@ -96,7 +95,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun entity(): Optional = Optional.ofNullable(entity.getNullable("entity")) + fun entity(): Optional = entity.getOptional("entity") /** * The legal name of the company. @@ -104,14 +103,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun legalName(): Optional = Optional.ofNullable(legalName.getNullable("legal_name")) + fun legalName(): Optional = legalName.getOptional("legal_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun locations(): Optional> = - Optional.ofNullable(locations.getNullable("locations")) + fun locations(): Optional> = locations.getOptional("locations") /** * The email of the main administrator on the account. @@ -119,8 +117,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun primaryEmail(): Optional = - Optional.ofNullable(primaryEmail.getNullable("primary_email")) + fun primaryEmail(): Optional = primaryEmail.getOptional("primary_email") /** * The phone number of the main administrator on the account. Format: `XXXXXXXXXX` @@ -129,7 +126,7 @@ private constructor( * server responded with an unexpected value). */ fun primaryPhoneNumber(): Optional = - Optional.ofNullable(primaryPhoneNumber.getNullable("primary_phone_number")) + primaryPhoneNumber.getOptional("primary_phone_number") /** * Returns the raw JSON value of [accounts]. @@ -559,8 +556,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun accountName(): Optional = - Optional.ofNullable(accountName.getNullable("account_name")) + fun accountName(): Optional = accountName.getOptional("account_name") /** * 10-12 digit number to specify the bank account @@ -568,8 +564,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun accountNumber(): Optional = - Optional.ofNullable(accountNumber.getNullable("account_number")) + fun accountNumber(): Optional = accountNumber.getOptional("account_number") /** * The type of bank account. @@ -577,8 +572,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun accountType(): Optional = - Optional.ofNullable(accountType.getNullable("account_type")) + fun accountType(): Optional = accountType.getOptional("account_type") /** * Name of the banking institution. @@ -586,8 +580,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun institutionName(): Optional = - Optional.ofNullable(institutionName.getNullable("institution_name")) + fun institutionName(): Optional = institutionName.getOptional("institution_name") /** * A nine-digit code that's based on the U.S. Bank location where your account was opened. @@ -595,8 +588,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun routingNumber(): Optional = - Optional.ofNullable(routingNumber.getNullable("routing_number")) + fun routingNumber(): Optional = routingNumber.getOptional("routing_number") /** * Returns the raw JSON value of [accountName]. @@ -1021,7 +1013,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * The parent department, if present. @@ -1029,7 +1021,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun parent(): Optional = Optional.ofNullable(parent.getNullable("parent")) + fun parent(): Optional = parent.getOptional("parent") /** * Returns the raw JSON value of [name]. @@ -1183,7 +1175,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Returns the raw JSON value of [name]. @@ -1350,7 +1342,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) + fun subtype(): Optional = subtype.getOptional("subtype") /** * The tax payer type of the company. @@ -1358,7 +1350,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [subtype]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt index 5c8047b9..eb6903d6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt @@ -571,21 +571,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun customerEmail(): Optional = - Optional.ofNullable(customerEmail.getNullable("customer_email")) + fun customerEmail(): Optional = customerEmail.getOptional("customer_email") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun integration(): Optional = - Optional.ofNullable(integration.getNullable("integration")) + fun integration(): Optional = integration.getOptional("integration") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun manual(): Optional = Optional.ofNullable(manual.getNullable("manual")) + fun manual(): Optional = manual.getOptional("manual") /** * The number of minutes until the session expires (defaults to 43,200, which is 30 days) @@ -593,21 +591,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun minutesToExpire(): Optional = - Optional.ofNullable(minutesToExpire.getNullable("minutes_to_expire")) + fun minutesToExpire(): Optional = minutesToExpire.getOptional("minutes_to_expire") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun redirectUri(): Optional = - Optional.ofNullable(redirectUri.getNullable("redirect_uri")) + fun redirectUri(): Optional = redirectUri.getOptional("redirect_uri") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun sandbox(): Optional = Optional.ofNullable(sandbox.getNullable("sandbox")) + fun sandbox(): Optional = sandbox.getOptional("sandbox") /** * Returns the raw JSON value of [customerId]. @@ -1205,14 +1201,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun authMethod(): Optional = - Optional.ofNullable(authMethod.getNullable("auth_method")) + fun authMethod(): Optional = authMethod.getOptional("auth_method") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun provider(): Optional = Optional.ofNullable(provider.getNullable("provider")) + fun provider(): Optional = provider.getOptional("provider") /** * Returns the raw JSON value of [authMethod]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt index 218872b9..5968625d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt @@ -403,8 +403,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun minutesToExpire(): Optional = - Optional.ofNullable(minutesToExpire.getNullable("minutes_to_expire")) + fun minutesToExpire(): Optional = minutesToExpire.getOptional("minutes_to_expire") /** * The products to request access to (optional for reauthentication) @@ -412,8 +411,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun products(): Optional> = - Optional.ofNullable(products.getNullable("products")) + fun products(): Optional> = products.getOptional("products") /** * The URI to redirect to after the Connect flow is completed @@ -421,8 +419,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun redirectUri(): Optional = - Optional.ofNullable(redirectUri.getNullable("redirect_uri")) + fun redirectUri(): Optional = redirectUri.getOptional("redirect_uri") /** * Returns the raw JSON value of [connectionId]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt index 08b37f51..0bc05880 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt @@ -120,7 +120,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun tokenType(): Optional = Optional.ofNullable(tokenType.getNullable("token_type")) + fun tokenType(): Optional = tokenType.getOptional("token_type") /** * Returns the raw JSON value of [accessToken]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt index 258e1198..02a73edf 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt @@ -148,7 +148,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun customerId(): Optional = Optional.ofNullable(customerId.getNullable("customer_id")) + fun customerId(): Optional = customerId.getOptional("customer_id") /** * The RFC 8693 token type (Finch uses `bearer` tokens) @@ -156,7 +156,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun tokenType(): Optional = Optional.ofNullable(tokenType.getNullable("token_type")) + fun tokenType(): Optional = tokenType.getOptional("token_type") /** * Returns the raw JSON value of [accessToken]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt index fbc80f23..96280779 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt @@ -72,20 +72,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) + fun connectionId(): Optional = connectionId.getOptional("connection_id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) + fun eventType(): Optional = eventType.getOptional("event_type") /** * Returns the raw JSON value of [accountId]. @@ -343,8 +342,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun individualId(): Optional = individualId.getOptional("individual_id") /** * Returns the raw JSON value of [individualId]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt index 45158baf..6dcd6bcb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt @@ -44,7 +44,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * The ID of the individual associated with the document. This will be null for employer-level @@ -53,8 +53,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun individualId(): Optional = individualId.getOptional("individual_id") /** * The type of document. @@ -62,7 +61,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * A URL to access the document. Format: @@ -71,7 +70,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun url(): Optional = Optional.ofNullable(url.getNullable("url")) + fun url(): Optional = url.getOptional("url") /** * The year the document applies to, if available. @@ -79,7 +78,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun year(): Optional = Optional.ofNullable(year.getNullable("year")) + fun year(): Optional = year.getOptional("year") /** * Returns the raw JSON value of [id]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt index bdb938ed..b90cc44a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt @@ -110,7 +110,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * Worker's compensation classification code for this employee @@ -118,7 +118,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun classCode(): Optional = Optional.ofNullable(classCode.getNullable("class_code")) + fun classCode(): Optional = classCode.getOptional("class_code") /** * Custom fields for the individual. These are fields which are defined by the employer in the @@ -127,8 +127,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun customFields(): Optional> = - Optional.ofNullable(customFields.getNullable("custom_fields")) + fun customFields(): Optional> = customFields.getOptional("custom_fields") /** * The department object. @@ -136,8 +135,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun department(): Optional = - Optional.ofNullable(department.getNullable("department")) + fun department(): Optional = department.getOptional("department") /** * The employment object. @@ -145,8 +143,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun employment(): Optional = - Optional.ofNullable(employment.getNullable("employment")) + fun employment(): Optional = employment.getOptional("employment") /** * The detailed employment status of the individual. Available options: `active`, `deceased`, @@ -156,13 +153,13 @@ private constructor( * server responded with an unexpected value). */ fun employmentStatus(): Optional = - Optional.ofNullable(employmentStatus.getNullable("employment_status")) + employmentStatus.getOptional("employment_status") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + fun endDate(): Optional = endDate.getOptional("end_date") /** * The legal first name of the individual. @@ -170,7 +167,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) + fun firstName(): Optional = firstName.getOptional("first_name") /** * The employee's income as reported by the provider. This may not always be annualized income, @@ -180,7 +177,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun income(): Optional = Optional.ofNullable(income.getNullable("income")) + fun income(): Optional = income.getOptional("income") /** * The array of income history. @@ -188,8 +185,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun incomeHistory(): Optional> = - Optional.ofNullable(incomeHistory.getNullable("income_history")) + fun incomeHistory(): Optional> = incomeHistory.getOptional("income_history") /** * `true` if the individual an an active employee or contractor at the company. @@ -197,7 +193,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) + fun isActive(): Optional = isActive.getOptional("is_active") /** * The legal last name of the individual. @@ -205,20 +201,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + fun lastName(): Optional = lastName.getOptional("last_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun latestRehireDate(): Optional = - Optional.ofNullable(latestRehireDate.getNullable("latest_rehire_date")) + fun latestRehireDate(): Optional = latestRehireDate.getOptional("latest_rehire_date") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun location(): Optional = Optional.ofNullable(location.getNullable("location")) + fun location(): Optional = location.getOptional("location") /** * The manager object representing the manager of the individual within the org. @@ -226,7 +221,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) + fun manager(): Optional = manager.getOptional("manager") /** * The legal middle name of the individual. @@ -234,7 +229,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) + fun middleName(): Optional = middleName.getOptional("middle_name") /** * The source system's unique employment identifier for this individual @@ -242,13 +237,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun sourceId(): Optional = Optional.ofNullable(sourceId.getNullable("source_id")) + fun sourceId(): Optional = sourceId.getOptional("source_id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) + fun startDate(): Optional = startDate.getOptional("start_date") /** * The current title of the individual. @@ -256,7 +251,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun title(): Optional = Optional.ofNullable(title.getNullable("title")) + fun title(): Optional = title.getOptional("title") /** * This field is deprecated in favour of `source_id` @@ -264,8 +259,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - @Deprecated("deprecated") - fun workId(): Optional = Optional.ofNullable(workId.getNullable("work_id")) + @Deprecated("deprecated") fun workId(): Optional = workId.getOptional("work_id") /** * Returns the raw JSON value of [id]. @@ -968,7 +962,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value @@ -1114,7 +1108,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Returns the raw JSON value of [name]. @@ -1261,7 +1255,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) + fun subtype(): Optional = subtype.getOptional("subtype") /** * The main employment type of the individual. @@ -1269,7 +1263,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [subtype]. @@ -1892,7 +1886,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * Returns the raw JSON value of [id]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt index 0a598fa8..4f8bcca8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt @@ -37,13 +37,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun body(): Optional = Optional.ofNullable(body.getNullable("body")) + fun body(): Optional = body.getOptional("body") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun code(): Optional = Optional.ofNullable(code.getNullable("code")) + fun code(): Optional = code.getOptional("code") /** * A stable Finch `id` (UUID v4) for an individual in the company. @@ -51,8 +51,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun individualId(): Optional = individualId.getOptional("individual_id") /** * Returns the raw JSON value of [body]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt index 9a9453e7..94850259 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt @@ -72,20 +72,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) + fun connectionId(): Optional = connectionId.getOptional("connection_id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) + fun eventType(): Optional = eventType.getOptional("event_type") /** * Returns the raw JSON value of [accountId]. @@ -343,8 +342,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun individualId(): Optional = individualId.getOptional("individual_id") /** * Returns the raw JSON value of [individualId]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt index c2f1ebbc..bbd6076b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt @@ -107,7 +107,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * Worker's compensation classification code for this employee @@ -115,7 +115,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun classCode(): Optional = Optional.ofNullable(classCode.getNullable("class_code")) + fun classCode(): Optional = classCode.getOptional("class_code") /** * Custom fields for the individual. These are fields which are defined by the employer in the @@ -124,8 +124,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun customFields(): Optional> = - Optional.ofNullable(customFields.getNullable("custom_fields")) + fun customFields(): Optional> = customFields.getOptional("custom_fields") /** * The department object. @@ -133,8 +132,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun department(): Optional = - Optional.ofNullable(department.getNullable("department")) + fun department(): Optional = department.getOptional("department") /** * The employment object. @@ -142,8 +140,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun employment(): Optional = - Optional.ofNullable(employment.getNullable("employment")) + fun employment(): Optional = employment.getOptional("employment") /** * The detailed employment status of the individual. @@ -152,13 +149,13 @@ private constructor( * server responded with an unexpected value). */ fun employmentStatus(): Optional = - Optional.ofNullable(employmentStatus.getNullable("employment_status")) + employmentStatus.getOptional("employment_status") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + fun endDate(): Optional = endDate.getOptional("end_date") /** * The legal first name of the individual. @@ -166,7 +163,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) + fun firstName(): Optional = firstName.getOptional("first_name") /** * The employee's income as reported by the provider. This may not always be annualized income, @@ -176,7 +173,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun income(): Optional = Optional.ofNullable(income.getNullable("income")) + fun income(): Optional = income.getOptional("income") /** * The array of income history. @@ -184,8 +181,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun incomeHistory(): Optional> = - Optional.ofNullable(incomeHistory.getNullable("income_history")) + fun incomeHistory(): Optional> = incomeHistory.getOptional("income_history") /** * `true` if the individual an an active employee or contractor at the company. @@ -193,7 +189,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) + fun isActive(): Optional = isActive.getOptional("is_active") /** * The legal last name of the individual. @@ -201,20 +197,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + fun lastName(): Optional = lastName.getOptional("last_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun latestRehireDate(): Optional = - Optional.ofNullable(latestRehireDate.getNullable("latest_rehire_date")) + fun latestRehireDate(): Optional = latestRehireDate.getOptional("latest_rehire_date") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun location(): Optional = Optional.ofNullable(location.getNullable("location")) + fun location(): Optional = location.getOptional("location") /** * The manager object representing the manager of the individual within the org. @@ -222,7 +217,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) + fun manager(): Optional = manager.getOptional("manager") /** * The legal middle name of the individual. @@ -230,7 +225,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) + fun middleName(): Optional = middleName.getOptional("middle_name") /** * The source system's unique employment identifier for this individual @@ -238,13 +233,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun sourceId(): Optional = Optional.ofNullable(sourceId.getNullable("source_id")) + fun sourceId(): Optional = sourceId.getOptional("source_id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) + fun startDate(): Optional = startDate.getOptional("start_date") /** * The current title of the individual. @@ -252,7 +247,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun title(): Optional = Optional.ofNullable(title.getNullable("title")) + fun title(): Optional = title.getOptional("title") /** * Returns the raw JSON value of [id]. @@ -914,7 +909,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value @@ -1063,7 +1058,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Returns the raw JSON value of [name]. @@ -1210,7 +1205,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) + fun subtype(): Optional = subtype.getOptional("subtype") /** * The main employment type of the individual. @@ -1218,7 +1213,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [subtype]. @@ -1838,7 +1833,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * Returns the raw JSON value of [id]. 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 index 1672c09e..f2a7666c 100644 --- 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 @@ -38,7 +38,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun body(): Optional = Optional.ofNullable(body.getNullable("body")) + fun body(): Optional = body.getOptional("body") /** * HTTP status code. Either 201 or 200 @@ -46,14 +46,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun code(): Optional = Optional.ofNullable(code.getNullable("code")) + 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 = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun individualId(): Optional = individualId.getOptional("individual_id") /** * Returns the raw JSON value of [body]. @@ -229,7 +228,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun finchCode(): Optional = Optional.ofNullable(finchCode.getNullable("finch_code")) + fun finchCode(): Optional = finchCode.getOptional("finch_code") /** * Short description in English that provides more information about the response. @@ -237,7 +236,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun message(): Optional = Optional.ofNullable(message.getNullable("message")) + fun message(): Optional = message.getOptional("message") /** * Identifier indicating whether the benefit was newly enrolled or updated. @@ -245,7 +244,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Returns the raw JSON value of [finchCode]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt index 28d5da62..72a4557e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt @@ -324,8 +324,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = description.getOptional("description") /** * The frequency of the benefit deduction/contribution. @@ -333,8 +332,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun frequency(): Optional = - Optional.ofNullable(frequency.getNullable("frequency")) + fun frequency(): Optional = frequency.getOptional("frequency") /** * Type of benefit. @@ -342,7 +340,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [description]. 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 d1bb8a22..6ca15012 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 @@ -78,7 +78,7 @@ private constructor( @JsonProperty("items") items: JsonField> = JsonMissing.of() ) : this(items, mutableMapOf()) - fun items(): List = items.getNullable("items") ?: listOf() + fun items(): List = items.getOptional("items").getOrNull() ?: listOf() @JsonProperty("items") fun _items(): Optional>> = Optional.ofNullable(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 64b9d98b..1ff8bb43 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 @@ -18,6 +18,7 @@ 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. */ class HrisBenefitIndividualRetrieveManyBenefitsPageAsync @@ -81,7 +82,7 @@ private constructor( @JsonProperty("items") items: JsonField> = JsonMissing.of() ) : this(items, mutableMapOf()) - fun items(): List = items.getNullable("items") ?: listOf() + fun items(): List = items.getOptional("items").getOrNull() ?: listOf() @JsonProperty("items") fun _items(): Optional>> = Optional.ofNullable(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 index 0e084d12..2b7b92b4 100644 --- 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 @@ -78,7 +78,7 @@ private constructor( @JsonProperty("items") items: JsonField> = JsonMissing.of() ) : this(items, mutableMapOf()) - fun items(): List = items.getNullable("items") ?: listOf() + fun items(): List = items.getOptional("items").getOrNull() ?: listOf() @JsonProperty("items") fun _items(): Optional>> = Optional.ofNullable(items) 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 index a3e43f1d..e569d5ee 100644 --- 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 @@ -18,6 +18,7 @@ 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 @@ -80,7 +81,7 @@ private constructor( @JsonProperty("items") items: JsonField> = JsonMissing.of() ) : this(items, mutableMapOf()) - fun items(): List = items.getNullable("items") ?: listOf() + fun items(): List = items.getOptional("items").getOrNull() ?: listOf() @JsonProperty("items") fun _items(): Optional>> = Optional.ofNullable(items) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt index d9d1ec1d..da3f66cd 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt @@ -291,8 +291,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun individualIds(): Optional> = - Optional.ofNullable(individualIds.getNullable("individual_ids")) + fun individualIds(): Optional> = individualIds.getOptional("individual_ids") /** * Returns the raw JSON value of [individualIds]. 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 ae8f160a..55732adf 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 @@ -75,7 +75,7 @@ private constructor( @JsonProperty("items") items: JsonField> = JsonMissing.of() ) : this(items, mutableMapOf()) - fun items(): List = items.getNullable("items") ?: listOf() + fun items(): List = items.getOptional("items").getOrNull() ?: listOf() @JsonProperty("items") fun _items(): Optional>> = Optional.ofNullable(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 ce6047cd..1dd66c6b 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 @@ -18,6 +18,7 @@ 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. */ class HrisBenefitListPageAsync @@ -80,7 +81,7 @@ private constructor( @JsonProperty("items") items: JsonField> = JsonMissing.of() ) : this(items, mutableMapOf()) - fun items(): List = items.getNullable("items") ?: listOf() + fun items(): List = items.getOptional("items").getOrNull() ?: listOf() @JsonProperty("items") fun _items(): Optional>> = Optional.ofNullable(items) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt index 692b53de..3d15fd51 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt @@ -78,7 +78,7 @@ private constructor( @JsonProperty("items") items: JsonField> = JsonMissing.of() ) : this(items, mutableMapOf()) - fun items(): List = items.getNullable("items") ?: listOf() + fun items(): List = items.getOptional("items").getOrNull() ?: listOf() @JsonProperty("items") fun _items(): Optional>> = Optional.ofNullable(items) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt index b1ea55b3..b839cb7a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt @@ -18,6 +18,7 @@ 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 deductions metadata */ class HrisBenefitListSupportedBenefitsPageAsync @@ -80,7 +81,7 @@ private constructor( @JsonProperty("items") items: JsonField> = JsonMissing.of() ) : this(items, mutableMapOf()) - fun items(): List = items.getNullable("items") ?: listOf() + fun items(): List = items.getOptional("items").getOrNull() ?: listOf() @JsonProperty("items") fun _items(): Optional>> = Optional.ofNullable(items) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt index 9020c9f4..91bc5f13 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt @@ -274,8 +274,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = description.getOptional("description") /** * Returns the raw JSON value of [description]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPage.kt index 7541eeb6..fc858012 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPage.kt @@ -84,7 +84,7 @@ private constructor( ) : this(responses, mutableMapOf()) fun responses(): List = - responses.getNullable("responses") ?: listOf() + responses.getOptional("responses").getOrNull() ?: listOf() @JsonProperty("responses") fun _responses(): Optional>> = diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPageAsync.kt index d4bb97a8..5963daa3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPageAsync.kt @@ -18,6 +18,7 @@ import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor import java.util.function.Predicate +import kotlin.jvm.optionals.getOrNull /** * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical @@ -86,7 +87,7 @@ private constructor( ) : this(responses, mutableMapOf()) fun responses(): List = - responses.getNullable("responses") ?: listOf() + responses.getOptional("responses").getOrNull() ?: listOf() @JsonProperty("responses") fun _responses(): Optional>> = diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleCreateParams.kt index ed6a75ad..62891454 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleCreateParams.kt @@ -426,15 +426,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun attributes(): Optional = - Optional.ofNullable(attributes.getNullable("attributes")) + fun attributes(): Optional = attributes.getOptional("attributes") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun conditions(): Optional> = - Optional.ofNullable(conditions.getNullable("conditions")) + fun conditions(): Optional> = conditions.getOptional("conditions") /** * Specifies when the rules should stop applying rules based on the date. @@ -443,7 +441,7 @@ private constructor( * server responded with an unexpected value). */ fun effectiveEndDate(): Optional = - Optional.ofNullable(effectiveEndDate.getNullable("effective_end_date")) + effectiveEndDate.getOptional("effective_end_date") /** * Specifies when the rule should begin applying based on the date. @@ -452,7 +450,7 @@ private constructor( * server responded with an unexpected value). */ fun effectiveStartDate(): Optional = - Optional.ofNullable(effectiveStartDate.getNullable("effective_start_date")) + effectiveStartDate.getOptional("effective_start_date") /** * The entity type to which the rule is applied. @@ -460,8 +458,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun entityType(): Optional = - Optional.ofNullable(entityType.getNullable("entity_type")) + fun entityType(): Optional = entityType.getOptional("entity_type") /** * Returns the raw JSON value of [attributes]. @@ -755,7 +752,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -1013,7 +1010,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun field(): Optional = Optional.ofNullable(field.getNullable("field")) + fun field(): Optional = field.getOptional("field") /** * The operator to be used in the rule. @@ -1021,7 +1018,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) + fun operator(): Optional = operator.getOptional("operator") /** * The value of the field to be checked in the rule. @@ -1029,7 +1026,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun value(): Optional = Optional.ofNullable(value.getNullable("value")) + fun value(): Optional = value.getOptional("value") /** * Returns the raw JSON value of [field]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPage.kt index 9f22dbdd..cbc32bc7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPage.kt @@ -82,7 +82,8 @@ private constructor( responses: JsonField> = JsonMissing.of() ) : this(responses, mutableMapOf()) - fun responses(): List = responses.getNullable("responses") ?: listOf() + fun responses(): List = + responses.getOptional("responses").getOrNull() ?: listOf() @JsonProperty("responses") fun _responses(): Optional>> = diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPageAsync.kt index 8d46c6b4..9b3f21e3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPageAsync.kt @@ -18,6 +18,7 @@ import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor import java.util.function.Predicate +import kotlin.jvm.optionals.getOrNull /** * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical @@ -84,7 +85,8 @@ private constructor( responses: JsonField> = JsonMissing.of() ) : this(responses, mutableMapOf()) - fun responses(): List = responses.getNullable("responses") ?: listOf() + fun responses(): List = + responses.getOptional("responses").getOrNull() ?: listOf() @JsonProperty("responses") fun _responses(): Optional>> = diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt index cca3bb81..99eda4a8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt @@ -99,9 +99,9 @@ private constructor( ) : this(individuals, paging, mutableMapOf()) fun individuals(): List = - individuals.getNullable("individuals") ?: listOf() + individuals.getOptional("individuals").getOrNull() ?: listOf() - fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) + fun paging(): Optional = paging.getOptional("paging") @JsonProperty("individuals") fun _individuals(): Optional>> = diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt index 51ea0014..ba0af1df 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt @@ -18,6 +18,7 @@ import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor import java.util.function.Predicate +import kotlin.jvm.optionals.getOrNull /** Read company directory and organization structure */ @Deprecated("use `list` instead") @@ -101,9 +102,9 @@ private constructor( ) : this(individuals, paging, mutableMapOf()) fun individuals(): List = - individuals.getNullable("individuals") ?: listOf() + individuals.getOptional("individuals").getOrNull() ?: listOf() - fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) + fun paging(): Optional = paging.getOptional("paging") @JsonProperty("individuals") fun _individuals(): Optional>> = diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt index c4eb2953..66637674 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt @@ -98,9 +98,9 @@ private constructor( ) : this(individuals, paging, mutableMapOf()) fun individuals(): List = - individuals.getNullable("individuals") ?: listOf() + individuals.getOptional("individuals").getOrNull() ?: listOf() - fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) + fun paging(): Optional = paging.getOptional("paging") @JsonProperty("individuals") fun _individuals(): Optional>> = diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt index 38d13a73..edb31921 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt @@ -18,6 +18,7 @@ import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor import java.util.function.Predicate +import kotlin.jvm.optionals.getOrNull /** Read company directory and organization structure */ class HrisDirectoryListPageAsync @@ -100,9 +101,9 @@ private constructor( ) : this(individuals, paging, mutableMapOf()) fun individuals(): List = - individuals.getNullable("individuals") ?: listOf() + individuals.getOptional("individuals").getOrNull() ?: listOf() - fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) + fun paging(): Optional = paging.getOptional("paging") @JsonProperty("individuals") fun _individuals(): Optional>> = diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt index 3e6422c0..eae6a1f5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt @@ -80,7 +80,7 @@ private constructor( ) : this(responses, mutableMapOf()) fun responses(): List = - responses.getNullable("responses") ?: listOf() + responses.getOptional("responses").getOrNull() ?: listOf() @JsonProperty("responses") fun _responses(): Optional>> = diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt index 4ceb2b95..b786e90f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt @@ -18,6 +18,7 @@ import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor import java.util.function.Predicate +import kotlin.jvm.optionals.getOrNull /** Read individual employment and income data */ class HrisEmploymentRetrieveManyPageAsync @@ -82,7 +83,7 @@ private constructor( ) : this(responses, mutableMapOf()) fun responses(): List = - responses.getNullable("responses") ?: listOf() + responses.getOptional("responses").getOrNull() ?: listOf() @JsonProperty("responses") fun _responses(): Optional>> = diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt index 9ef47277..9b2e156d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt @@ -79,7 +79,8 @@ private constructor( responses: JsonField> = JsonMissing.of() ) : this(responses, mutableMapOf()) - fun responses(): List = responses.getNullable("responses") ?: listOf() + fun responses(): List = + responses.getOptional("responses").getOrNull() ?: listOf() @JsonProperty("responses") fun _responses(): Optional>> = diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt index ed6eac2c..8ac7b9d6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt @@ -18,6 +18,7 @@ import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor import java.util.function.Predicate +import kotlin.jvm.optionals.getOrNull /** Read individual data, excluding income and employment data */ class HrisIndividualRetrieveManyPageAsync @@ -81,7 +82,8 @@ private constructor( responses: JsonField> = JsonMissing.of() ) : this(responses, mutableMapOf()) - fun responses(): List = responses.getNullable("responses") ?: listOf() + fun responses(): List = + responses.getOptional("responses").getOrNull() ?: listOf() @JsonProperty("responses") fun _responses(): Optional>> = diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt index adc6023a..6a0cedfb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt @@ -286,14 +286,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun options(): Optional = Optional.ofNullable(options.getNullable("options")) + fun options(): Optional = options.getOptional("options") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun requests(): Optional> = - Optional.ofNullable(requests.getNullable("requests")) + fun requests(): Optional> = requests.getOptional("requests") /** * Returns the raw JSON value of [options]. @@ -480,7 +479,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun include(): Optional> = Optional.ofNullable(include.getNullable("include")) + fun include(): Optional> = include.getOptional("include") /** * Returns the raw JSON value of [include]. @@ -637,8 +636,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun individualId(): Optional = individualId.getOptional("individual_id") /** * Returns the raw JSON value of [individualId]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt index a0493f31..865968a0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt @@ -83,7 +83,8 @@ private constructor( responses: JsonField> = JsonMissing.of() ) : this(responses, mutableMapOf()) - fun responses(): List = responses.getNullable("responses") ?: listOf() + fun responses(): List = + responses.getOptional("responses").getOrNull() ?: listOf() @JsonProperty("responses") fun _responses(): Optional>> = diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt index aa025bc9..8ec74337 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt @@ -18,6 +18,7 @@ import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor import java.util.function.Predicate +import kotlin.jvm.optionals.getOrNull /** * Read detailed pay statements for each individual. @@ -85,7 +86,8 @@ private constructor( responses: JsonField> = JsonMissing.of() ) : this(responses, mutableMapOf()) - fun responses(): List = responses.getNullable("responses") ?: listOf() + fun responses(): List = + responses.getOptional("responses").getOrNull() ?: listOf() @JsonProperty("responses") fun _responses(): Optional>> = diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt index bbacaaf1..62779262 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt @@ -467,7 +467,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun limit(): Optional = Optional.ofNullable(limit.getNullable("limit")) + fun limit(): Optional = limit.getOptional("limit") /** * Index to start from. @@ -475,7 +475,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun offset(): Optional = Optional.ofNullable(offset.getNullable("offset")) + fun offset(): Optional = offset.getOptional("offset") /** * Returns the raw JSON value of [paymentId]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt index 09b82bbc..ba026277 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt @@ -75,7 +75,7 @@ private constructor( @JsonProperty("items") items: JsonField> = JsonMissing.of() ) : this(items, mutableMapOf()) - fun items(): List = items.getNullable("items") ?: listOf() + fun items(): List = items.getOptional("items").getOrNull() ?: listOf() @JsonProperty("items") fun _items(): Optional>> = Optional.ofNullable(items) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt index 790ee608..c4f2c62f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt @@ -18,6 +18,7 @@ import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor import java.util.function.Predicate +import kotlin.jvm.optionals.getOrNull /** Read payroll and contractor related payments by the company. */ class HrisPaymentListPageAsync @@ -80,7 +81,7 @@ private constructor( @JsonProperty("items") items: JsonField> = JsonMissing.of() ) : this(items, mutableMapOf()) - fun items(): List = items.getNullable("items") ?: listOf() + fun items(): List = items.getOptional("items").getOrNull() ?: listOf() @JsonProperty("items") fun _items(): Optional>> = Optional.ofNullable(items) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt index 6a556e41..03ac872e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt @@ -47,7 +47,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * The currency code. @@ -55,7 +55,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * The date the income amount went into effect. @@ -63,8 +63,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun effectiveDate(): Optional = - Optional.ofNullable(effectiveDate.getNullable("effective_date")) + fun effectiveDate(): Optional = effectiveDate.getOptional("effective_date") /** * The income unit of payment. Options: `yearly`, `quarterly`, `monthly`, `semi_monthly`, @@ -73,7 +72,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun unit(): Optional = Optional.ofNullable(unit.getNullable("unit")) + fun unit(): Optional = unit.getOptional("unit") /** * Returns the raw JSON value of [amount]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt index d386cf7a..bffd234c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt @@ -87,19 +87,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) + fun dob(): Optional = dob.getOptional("dob") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun emails(): Optional> = Optional.ofNullable(emails.getNullable("emails")) + fun emails(): Optional> = emails.getOptional("emails") /** * Social Security Number of the individual in **encrypted** format. This field is only @@ -109,8 +109,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun encryptedSsn(): Optional = - Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) + fun encryptedSsn(): Optional = encryptedSsn.getOptional("encrypted_ssn") /** * The EEOC-defined ethnicity of the individual. @@ -118,7 +117,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun ethnicity(): Optional = Optional.ofNullable(ethnicity.getNullable("ethnicity")) + fun ethnicity(): Optional = ethnicity.getOptional("ethnicity") /** * The legal first name of the individual. @@ -126,7 +125,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) + fun firstName(): Optional = firstName.getOptional("first_name") /** * The gender of the individual. @@ -134,7 +133,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun gender(): Optional = Optional.ofNullable(gender.getNullable("gender")) + fun gender(): Optional = gender.getOptional("gender") /** * The legal last name of the individual. @@ -142,7 +141,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + fun lastName(): Optional = lastName.getOptional("last_name") /** * The legal middle name of the individual. @@ -150,14 +149,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) + fun middleName(): Optional = middleName.getOptional("middle_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun phoneNumbers(): Optional> = - Optional.ofNullable(phoneNumbers.getNullable("phone_numbers")) + fun phoneNumbers(): Optional> = phoneNumbers.getOptional("phone_numbers") /** * The preferred name of the individual. @@ -165,14 +163,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun preferredName(): Optional = - Optional.ofNullable(preferredName.getNullable("preferred_name")) + fun preferredName(): Optional = preferredName.getOptional("preferred_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun residence(): Optional = Optional.ofNullable(residence.getNullable("residence")) + fun residence(): Optional = residence.getOptional("residence") /** * Social Security Number of the individual. This field is only available with the `ssn` scope @@ -182,7 +179,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) + fun ssn(): Optional = ssn.getOptional("ssn") /** * Returns the raw JSON value of [id]. @@ -674,13 +671,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [data]. @@ -1273,13 +1270,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [data]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt index fdcc4c1a..c42a1109 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt @@ -38,20 +38,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun body(): Optional = Optional.ofNullable(body.getNullable("body")) + fun body(): Optional = body.getOptional("body") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun code(): Optional = Optional.ofNullable(code.getNullable("code")) + 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 = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun individualId(): Optional = individualId.getOptional("individual_id") /** * Returns the raw JSON value of [body]. @@ -245,8 +244,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun annualMaximum(): Optional = - Optional.ofNullable(annualMaximum.getNullable("annual_maximum")) + fun annualMaximum(): Optional = annualMaximum.getOptional("annual_maximum") /** * If the benefit supports catch up (401k, 403b, etc.), whether catch up is enabled for this @@ -255,21 +253,21 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun catchUp(): Optional = Optional.ofNullable(catchUp.getNullable("catch_up")) + fun catchUp(): Optional = catchUp.getOptional("catch_up") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ fun companyContribution(): Optional = - Optional.ofNullable(companyContribution.getNullable("company_contribution")) + 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 employeeDeduction(): Optional = - Optional.ofNullable(employeeDeduction.getNullable("employee_deduction")) + employeeDeduction.getOptional("employee_deduction") /** * Type for HSA contribution limit if the benefit is a HSA. @@ -278,7 +276,7 @@ private constructor( * server responded with an unexpected value). */ fun hsaContributionLimit(): Optional = - Optional.ofNullable(hsaContributionLimit.getNullable("hsa_contribution_limit")) + hsaContributionLimit.getOptional("hsa_contribution_limit") /** * Returns the raw JSON value of [annualMaximum]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt index eb46215a..a1f96d7b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt @@ -72,20 +72,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) + fun connectionId(): Optional = connectionId.getOptional("connection_id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) + fun eventType(): Optional = eventType.getOptional("event_type") /** * Returns the raw JSON value of [accountId]. @@ -343,8 +342,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun individualId(): Optional = individualId.getOptional("individual_id") /** * Returns the raw JSON value of [individualId]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt index 16493986..fad446f4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt @@ -49,7 +49,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * The department object. @@ -57,8 +57,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun department(): Optional = - Optional.ofNullable(department.getNullable("department")) + fun department(): Optional = department.getOptional("department") /** * The legal first name of the individual. @@ -66,7 +65,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) + fun firstName(): Optional = firstName.getOptional("first_name") /** * `true` if the individual is an active employee or contractor at the company. @@ -74,7 +73,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) + fun isActive(): Optional = isActive.getOptional("is_active") /** * The legal last name of the individual. @@ -82,7 +81,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + fun lastName(): Optional = lastName.getOptional("last_name") /** * The manager object. @@ -90,7 +89,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) + fun manager(): Optional = manager.getOptional("manager") /** * The legal middle name of the individual. @@ -98,7 +97,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) + fun middleName(): Optional = middleName.getOptional("middle_name") /** * Returns the raw JSON value of [id]. @@ -394,7 +393,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Returns the raw JSON value of [name]. @@ -538,7 +537,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * Returns the raw JSON value of [id]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt index dff785bb..a01069c2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt @@ -37,20 +37,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun body(): Optional = Optional.ofNullable(body.getNullable("body")) + fun body(): Optional = body.getOptional("body") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun code(): Optional = Optional.ofNullable(code.getNullable("code")) + 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 = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun individualId(): Optional = individualId.getOptional("individual_id") /** * Returns the raw JSON value of [body]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt index 6bfc0c62..e95c9fa9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt @@ -87,19 +87,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) + fun dob(): Optional = dob.getOptional("dob") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun emails(): Optional> = Optional.ofNullable(emails.getNullable("emails")) + fun emails(): Optional> = emails.getOptional("emails") /** * Social Security Number of the individual in **encrypted** format. This field is only @@ -109,8 +109,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun encryptedSsn(): Optional = - Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) + fun encryptedSsn(): Optional = encryptedSsn.getOptional("encrypted_ssn") /** * The EEOC-defined ethnicity of the individual. @@ -118,7 +117,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun ethnicity(): Optional = Optional.ofNullable(ethnicity.getNullable("ethnicity")) + fun ethnicity(): Optional = ethnicity.getOptional("ethnicity") /** * The legal first name of the individual. @@ -126,7 +125,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) + fun firstName(): Optional = firstName.getOptional("first_name") /** * The gender of the individual. @@ -134,7 +133,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun gender(): Optional = Optional.ofNullable(gender.getNullable("gender")) + fun gender(): Optional = gender.getOptional("gender") /** * The legal last name of the individual. @@ -142,7 +141,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + fun lastName(): Optional = lastName.getOptional("last_name") /** * The legal middle name of the individual. @@ -150,14 +149,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) + fun middleName(): Optional = middleName.getOptional("middle_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun phoneNumbers(): Optional> = - Optional.ofNullable(phoneNumbers.getNullable("phone_numbers")) + fun phoneNumbers(): Optional> = phoneNumbers.getOptional("phone_numbers") /** * The preferred name of the individual. @@ -165,14 +163,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun preferredName(): Optional = - Optional.ofNullable(preferredName.getNullable("preferred_name")) + fun preferredName(): Optional = preferredName.getOptional("preferred_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun residence(): Optional = Optional.ofNullable(residence.getNullable("residence")) + fun residence(): Optional = residence.getOptional("residence") /** * Social Security Number of the individual. This field is only available with the `ssn` scope @@ -182,7 +179,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) + fun ssn(): Optional = ssn.getOptional("ssn") /** * Returns the raw JSON value of [id]. @@ -674,13 +671,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [data]. @@ -1273,13 +1270,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [data]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt index 87a17c6a..bf5a6265 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt @@ -174,8 +174,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun customerEmail(): Optional = - Optional.ofNullable(customerEmail.getNullable("customer_email")) + fun customerEmail(): Optional = customerEmail.getOptional("customer_email") /** * The ID of your customer you provided to Finch when a connect session was created for this @@ -184,7 +183,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun customerId(): Optional = Optional.ofNullable(customerId.getNullable("customer_id")) + fun customerId(): Optional = customerId.getOptional("customer_id") /** * The name of your customer you provided to Finch when a connect session was created for this @@ -193,8 +192,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun customerName(): Optional = - Optional.ofNullable(customerName.getNullable("customer_name")) + fun customerName(): Optional = customerName.getOptional("customer_name") /** * Whether the connection associated with the `access_token` uses the Assisted Connect Flow. @@ -884,7 +882,7 @@ private constructor( * server responded with an unexpected value). */ fun connectionStatus(): Optional = - Optional.ofNullable(connectionStatus.getNullable("connection_status")) + connectionStatus.getOptional("connection_status") /** * An array of the authorized products associated with the `access_token`. @@ -892,8 +890,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun products(): Optional> = - Optional.ofNullable(products.getNullable("products")) + fun products(): Optional> = products.getOptional("products") /** * The type of authentication method. @@ -901,7 +898,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [connectionStatus]. @@ -1102,14 +1099,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun message(): Optional = Optional.ofNullable(message.getNullable("message")) + fun message(): Optional = message.getOptional("message") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun status(): Optional = - Optional.ofNullable(status.getNullable("status")) + fun status(): Optional = status.getOptional("status") /** * Returns the raw JSON value of [message]. @@ -1584,20 +1580,19 @@ private constructor( * server responded with an unexpected value). */ fun lastSuccessfulSync(): Optional = - Optional.ofNullable(lastSuccessfulSync.getNullable("last_successful_sync")) + lastSuccessfulSync.getOptional("last_successful_sync") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun message(): Optional = Optional.ofNullable(message.getNullable("message")) + fun message(): Optional = message.getOptional("message") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun status(): Optional = - Optional.ofNullable(status.getNullable("status")) + fun status(): Optional = status.getOptional("status") /** * Returns the raw JSON value of [lastSuccessfulSync]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt index 92cef502..a8ee4168 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt @@ -72,20 +72,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) + fun connectionId(): Optional = connectionId.getOptional("connection_id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) + fun eventType(): Optional = eventType.getOptional("event_type") /** * Returns the raw JSON value of [accountId]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt index 9887da8b..5af14dcb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt @@ -49,7 +49,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + fun city(): Optional = city.getOptional("city") /** * The 2-letter ISO 3166 country code. @@ -57,7 +57,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + fun country(): Optional = country.getOptional("country") /** * Street address or PO box. @@ -65,7 +65,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) + fun line1(): Optional = line1.getOptional("line1") /** * Apartment, suite, unit, or building. @@ -73,13 +73,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) + fun line2(): Optional = line2.getOptional("line2") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * The postal code or zip code. @@ -87,13 +87,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun postalCode(): Optional = Optional.ofNullable(postalCode.getNullable("postal_code")) + fun postalCode(): Optional = postalCode.getOptional("postal_code") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun sourceId(): Optional = Optional.ofNullable(sourceId.getNullable("source_id")) + fun sourceId(): Optional = sourceId.getOptional("source_id") /** * The state code. @@ -101,7 +101,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun state(): Optional = Optional.ofNullable(state.getNullable("state")) + fun state(): Optional = state.getOptional("state") /** * Returns the raw JSON value of [city]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt index 5850806e..d76f84e3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt @@ -41,7 +41,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun body(): Optional> = Optional.ofNullable(body.getNullable("body")) + fun body(): Optional> = body.getOptional("body") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt index e6c95791..c9badec1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt @@ -35,13 +35,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * Returns the raw JSON value of [amount]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt index 62d2c161..67fbb130 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt @@ -51,7 +51,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun create(): Optional = Optional.ofNullable(create.getNullable("create")) + fun create(): Optional = create.getOptional("create") /** * - `supported`: This operation is supported by both the provider and Finch @@ -65,7 +65,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun delete(): Optional = Optional.ofNullable(delete.getNullable("delete")) + fun delete(): Optional = delete.getOptional("delete") /** * - `supported`: This operation is supported by both the provider and Finch @@ -79,7 +79,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun read(): Optional = Optional.ofNullable(read.getNullable("read")) + fun read(): Optional = read.getOptional("read") /** * - `supported`: This operation is supported by both the provider and Finch @@ -93,7 +93,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun update(): Optional = Optional.ofNullable(update.getNullable("update")) + fun update(): Optional = update.getOptional("update") /** * Returns the raw JSON value of [create]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt index 77fb26b3..c7cc6fb4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt @@ -34,7 +34,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun count(): Optional = Optional.ofNullable(count.getNullable("count")) + fun count(): Optional = count.getOptional("count") /** * The current start index of the returned list of elements @@ -42,7 +42,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun offset(): Optional = Optional.ofNullable(offset.getNullable("offset")) + fun offset(): Optional = offset.getOptional("offset") /** * Returns the raw JSON value of [count]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt index a9c30931..608a9101 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt @@ -42,7 +42,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * Name of the pay group @@ -50,7 +50,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * List of pay frequencies associated with this pay group @@ -59,7 +59,7 @@ private constructor( * server responded with an unexpected value). */ fun payFrequencies(): Optional> = - Optional.ofNullable(payFrequencies.getNullable("pay_frequencies")) + payFrequencies.getOptional("pay_frequencies") /** * Returns the raw JSON value of [id]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt index 3369c527..ae0b753f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt @@ -78,7 +78,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun earnings(): Optional> = Optional.ofNullable(earnings.getNullable("earnings")) + fun earnings(): Optional> = earnings.getOptional("earnings") /** * The array of deductions objects associated with this pay statement. @@ -87,20 +87,20 @@ private constructor( * server responded with an unexpected value). */ fun employeeDeductions(): Optional> = - Optional.ofNullable(employeeDeductions.getNullable("employee_deductions")) + employeeDeductions.getOptional("employee_deductions") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ fun employerContributions(): Optional> = - Optional.ofNullable(employerContributions.getNullable("employer_contributions")) + employerContributions.getOptional("employer_contributions") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun grossPay(): Optional = Optional.ofNullable(grossPay.getNullable("gross_pay")) + fun grossPay(): Optional = grossPay.getOptional("gross_pay") /** * A stable Finch `id` (UUID v4) for an individual in the company @@ -108,14 +108,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun individualId(): Optional = individualId.getOptional("individual_id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun netPay(): Optional = Optional.ofNullable(netPay.getNullable("net_pay")) + fun netPay(): Optional = netPay.getOptional("net_pay") /** * The payment method. @@ -123,8 +122,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun paymentMethod(): Optional = - Optional.ofNullable(paymentMethod.getNullable("payment_method")) + fun paymentMethod(): Optional = paymentMethod.getOptional("payment_method") /** * The array of taxes objects associated with this pay statement. @@ -132,7 +130,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun taxes(): Optional> = Optional.ofNullable(taxes.getNullable("taxes")) + fun taxes(): Optional> = taxes.getOptional("taxes") /** * The number of hours worked for this pay period @@ -140,7 +138,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun totalHours(): Optional = Optional.ofNullable(totalHours.getNullable("total_hours")) + fun totalHours(): Optional = totalHours.getOptional("total_hours") /** * The type of the payment associated with the pay statement. @@ -148,7 +146,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [earnings]. @@ -615,14 +613,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun attributes(): Optional = - Optional.ofNullable(attributes.getNullable("attributes")) + fun attributes(): Optional = attributes.getOptional("attributes") /** * The earnings currency code. @@ -630,7 +627,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * The number of hours associated with this earning. (For salaried employees, this could be @@ -639,7 +636,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun hours(): Optional = Optional.ofNullable(hours.getNullable("hours")) + fun hours(): Optional = hours.getOptional("hours") /** * The exact name of the deduction from the pay statement. @@ -647,7 +644,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * The type of earning. @@ -655,7 +652,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [amount]. @@ -941,8 +938,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun metadata(): Optional = - Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -1074,8 +1070,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun metadata(): Optional = - Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -1589,14 +1584,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun attributes(): Optional = - Optional.ofNullable(attributes.getNullable("attributes")) + fun attributes(): Optional = attributes.getOptional("attributes") /** * The deduction currency. @@ -1604,7 +1598,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * The deduction name from the pay statement. @@ -1612,7 +1606,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Boolean indicating if the deduction is pre-tax. @@ -1620,7 +1614,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun preTax(): Optional = Optional.ofNullable(preTax.getNullable("pre_tax")) + fun preTax(): Optional = preTax.getOptional("pre_tax") /** * Type of benefit. @@ -1628,7 +1622,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [amount]. @@ -1911,8 +1905,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun metadata(): Optional = - Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -2044,8 +2037,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun metadata(): Optional = - Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -2363,14 +2355,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun attributes(): Optional = - Optional.ofNullable(attributes.getNullable("attributes")) + fun attributes(): Optional = attributes.getOptional("attributes") /** * The contribution currency. @@ -2378,7 +2369,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * The contribution name from the pay statement. @@ -2386,7 +2377,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Type of benefit. @@ -2394,7 +2385,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [amount]. @@ -2643,8 +2634,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun metadata(): Optional = - Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -2776,8 +2766,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun metadata(): Optional = - Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -3228,14 +3217,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun attributes(): Optional = - Optional.ofNullable(attributes.getNullable("attributes")) + fun attributes(): Optional = attributes.getOptional("attributes") /** * The currency code. @@ -3243,7 +3231,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * `true` if the amount is paid by the employers. @@ -3251,7 +3239,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun employer(): Optional = Optional.ofNullable(employer.getNullable("employer")) + fun employer(): Optional = employer.getOptional("employer") /** * The exact name of tax from the pay statement. @@ -3259,7 +3247,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * The type of taxes. @@ -3267,7 +3255,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [amount]. @@ -3550,8 +3538,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun metadata(): Optional = - Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -3683,8 +3670,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun metadata(): Optional = - Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt index cf4cbb73..7adb6c95 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt @@ -72,20 +72,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) + fun connectionId(): Optional = connectionId.getOptional("connection_id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) + fun eventType(): Optional = eventType.getOptional("event_type") /** * Returns the raw JSON value of [accountId]. @@ -347,8 +346,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun individualId(): Optional = individualId.getOptional("individual_id") /** * The ID of the payment associated with the pay statement. @@ -356,7 +354,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun paymentId(): Optional = Optional.ofNullable(paymentId.getNullable("payment_id")) + fun paymentId(): Optional = paymentId.getOptional("payment_id") /** * Returns the raw JSON value of [individualId]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementItemListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementItemListResponse.kt index 4fb2b05a..2e8a895b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementItemListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementItemListResponse.kt @@ -40,8 +40,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun attributes(): Optional = - Optional.ofNullable(attributes.getNullable("attributes")) + fun attributes(): Optional = attributes.getOptional("attributes") /** * The category of the pay statement item. @@ -49,7 +48,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun category(): Optional = Optional.ofNullable(category.getNullable("category")) + fun category(): Optional = category.getOptional("category") /** * The name of the pay statement item. @@ -57,7 +56,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Returns the raw JSON value of [attributes]. @@ -244,7 +243,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun employer(): Optional = Optional.ofNullable(employer.getNullable("employer")) + fun employer(): Optional = employer.getOptional("employer") /** * The metadata of the pay statement item derived by the rules engine if available. Each @@ -259,7 +258,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun preTax(): Optional = Optional.ofNullable(preTax.getNullable("pre_tax")) + fun preTax(): Optional = preTax.getOptional("pre_tax") /** * The type of the pay statement item. @@ -267,7 +266,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [employer]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt index 4adc0090..3f5cf6c6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt @@ -37,19 +37,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun body(): Optional = Optional.ofNullable(body.getNullable("body")) + fun body(): Optional = body.getOptional("body") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun code(): Optional = Optional.ofNullable(code.getNullable("code")) + 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 paymentId(): Optional = Optional.ofNullable(paymentId.getNullable("payment_id")) + fun paymentId(): Optional = paymentId.getOptional("payment_id") /** * Returns the raw JSON value of [body]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt index d92a3d49..66722b9f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt @@ -37,7 +37,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) + fun paging(): Optional = paging.getOptional("paging") /** * The array of pay statements for the current payment. @@ -45,8 +45,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun payStatements(): Optional> = - Optional.ofNullable(payStatements.getNullable("pay_statements")) + fun payStatements(): Optional> = payStatements.getOptional("pay_statements") /** * Returns the raw JSON value of [paging]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt index a3ebe7e8..27d85584 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt @@ -86,40 +86,37 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun companyDebit(): Optional = - Optional.ofNullable(companyDebit.getNullable("company_debit")) + fun companyDebit(): Optional = companyDebit.getOptional("company_debit") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun debitDate(): Optional = Optional.ofNullable(debitDate.getNullable("debit_date")) + fun debitDate(): Optional = debitDate.getOptional("debit_date") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun employeeTaxes(): Optional = - Optional.ofNullable(employeeTaxes.getNullable("employee_taxes")) + fun employeeTaxes(): Optional = employeeTaxes.getOptional("employee_taxes") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun employerTaxes(): Optional = - Optional.ofNullable(employerTaxes.getNullable("employer_taxes")) + fun employerTaxes(): Optional = employerTaxes.getOptional("employer_taxes") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun grossPay(): Optional = Optional.ofNullable(grossPay.getNullable("gross_pay")) + fun grossPay(): Optional = grossPay.getOptional("gross_pay") /** * Array of every individual on this payment. @@ -127,20 +124,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun individualIds(): Optional> = - Optional.ofNullable(individualIds.getNullable("individual_ids")) + fun individualIds(): Optional> = individualIds.getOptional("individual_ids") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun netPay(): Optional = Optional.ofNullable(netPay.getNullable("net_pay")) + fun netPay(): Optional = netPay.getOptional("net_pay") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun payDate(): Optional = Optional.ofNullable(payDate.getNullable("pay_date")) + fun payDate(): Optional = payDate.getOptional("pay_date") /** * List of pay frequencies associated with this payment. @@ -149,7 +145,7 @@ private constructor( * server responded with an unexpected value). */ fun payFrequencies(): Optional> = - Optional.ofNullable(payFrequencies.getNullable("pay_frequencies")) + payFrequencies.getOptional("pay_frequencies") /** * Array of the Finch id (uuidv4) of every pay group associated with this payment. @@ -157,8 +153,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun payGroupIds(): Optional> = - Optional.ofNullable(payGroupIds.getNullable("pay_group_ids")) + fun payGroupIds(): Optional> = payGroupIds.getOptional("pay_group_ids") /** * The pay period object. @@ -166,7 +161,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun payPeriod(): Optional = Optional.ofNullable(payPeriod.getNullable("pay_period")) + fun payPeriod(): Optional = payPeriod.getOptional("pay_period") /** * Returns the raw JSON value of [id]. @@ -817,13 +812,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + fun endDate(): Optional = endDate.getOptional("end_date") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) + fun startDate(): Optional = startDate.getOptional("start_date") /** * Returns the raw JSON value of [endDate]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt index e299f2b6..aa2542ff 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt @@ -74,20 +74,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) + fun connectionId(): Optional = connectionId.getOptional("connection_id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) + fun eventType(): Optional = eventType.getOptional("event_type") /** * Returns the raw JSON value of [accountId]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt index f3c491b7..45c9b544 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt @@ -78,7 +78,7 @@ private constructor( @JsonProperty("items") items: JsonField> = JsonMissing.of() ) : this(items, mutableMapOf()) - fun items(): List = items.getNullable("items") ?: listOf() + fun items(): List = items.getOptional("items").getOrNull() ?: listOf() @JsonProperty("items") fun _items(): Optional>> = Optional.ofNullable(items) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt index 5f64e744..d280c90d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt @@ -18,6 +18,7 @@ import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor import java.util.function.Predicate +import kotlin.jvm.optionals.getOrNull /** Read company pay groups and frequencies */ class PayrollPayGroupListPageAsync @@ -80,7 +81,7 @@ private constructor( @JsonProperty("items") items: JsonField> = JsonMissing.of() ) : this(items, mutableMapOf()) - fun items(): List = items.getNullable("items") ?: listOf() + fun items(): List = items.getOptional("items").getOrNull() ?: listOf() @JsonProperty("items") fun _items(): Optional>> = Optional.ofNullable(items) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt index 4c3bb476..1c055bf2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt @@ -77,7 +77,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * The list of authentication methods supported by the provider. @@ -86,7 +86,7 @@ private constructor( * server responded with an unexpected value). */ fun authenticationMethods(): Optional> = - Optional.ofNullable(authenticationMethods.getNullable("authentication_methods")) + authenticationMethods.getOptional("authentication_methods") /** * `true` if the integration is in a beta state, `false` otherwise @@ -94,7 +94,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun beta(): Optional = Optional.ofNullable(beta.getNullable("beta")) + fun beta(): Optional = beta.getOptional("beta") /** * The display name of the payroll provider. @@ -102,8 +102,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun displayName(): Optional = - Optional.ofNullable(displayName.getNullable("display_name")) + fun displayName(): Optional = displayName.getOptional("display_name") /** * The url to the official icon of the payroll provider. @@ -111,7 +110,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun icon(): Optional = Optional.ofNullable(icon.getNullable("icon")) + fun icon(): Optional = icon.getOptional("icon") /** * The url to the official logo of the payroll provider. @@ -119,7 +118,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun logo(): Optional = Optional.ofNullable(logo.getNullable("logo")) + fun logo(): Optional = logo.getOptional("logo") /** * [DEPRECATED] Whether the Finch integration with this provider uses the Assisted Connect Flow @@ -129,7 +128,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun manual(): Optional = Optional.ofNullable(manual.getNullable("manual")) + fun manual(): Optional = manual.getOptional("manual") /** * whether MFA is required for the provider. @@ -137,8 +136,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun mfaRequired(): Optional = - Optional.ofNullable(mfaRequired.getNullable("mfa_required")) + fun mfaRequired(): Optional = mfaRequired.getOptional("mfa_required") /** * The hex code for the primary color of the payroll provider. @@ -146,8 +144,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun primaryColor(): Optional = - Optional.ofNullable(primaryColor.getNullable("primary_color")) + fun primaryColor(): Optional = primaryColor.getOptional("primary_color") /** * The list of Finch products supported on this payroll provider. @@ -155,7 +152,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun products(): Optional> = Optional.ofNullable(products.getNullable("products")) + fun products(): Optional> = products.getOptional("products") /** * Returns the raw JSON value of [id]. @@ -548,7 +545,7 @@ private constructor( * server responded with an unexpected value). */ fun benefitsSupport(): Optional = - Optional.ofNullable(benefitsSupport.getNullable("benefits_support")) + benefitsSupport.getOptional("benefits_support") /** * The supported data fields returned by our HR and payroll endpoints @@ -557,7 +554,7 @@ private constructor( * server responded with an unexpected value). */ fun supportedFields(): Optional = - Optional.ofNullable(supportedFields.getNullable("supported_fields")) + supportedFields.getOptional("supported_fields") /** * The type of authentication method. @@ -565,7 +562,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [benefitsSupport]. @@ -798,50 +795,46 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun company(): Optional = - Optional.ofNullable(company.getNullable("company")) + fun company(): Optional = company.getOptional("company") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun directory(): Optional = - Optional.ofNullable(directory.getNullable("directory")) + fun directory(): Optional = directory.getOptional("directory") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ fun employment(): Optional = - Optional.ofNullable(employment.getNullable("employment")) + employment.getOptional("employment") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ fun individual(): Optional = - Optional.ofNullable(individual.getNullable("individual")) + individual.getOptional("individual") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun payGroup(): Optional = - Optional.ofNullable(payGroup.getNullable("pay_group")) + fun payGroup(): Optional = payGroup.getOptional("pay_group") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ fun payStatement(): Optional = - Optional.ofNullable(payStatement.getNullable("pay_statement")) + payStatement.getOptional("pay_statement") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun payment(): Optional = - Optional.ofNullable(payment.getNullable("payment")) + fun payment(): Optional = payment.getOptional("payment") /** * Returns the raw JSON value of [company]. @@ -1185,61 +1178,56 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun accounts(): Optional = - Optional.ofNullable(accounts.getNullable("accounts")) + fun accounts(): Optional = accounts.getOptional("accounts") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun departments(): Optional = - Optional.ofNullable(departments.getNullable("departments")) + fun departments(): Optional = departments.getOptional("departments") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun ein(): Optional = Optional.ofNullable(ein.getNullable("ein")) + fun ein(): Optional = ein.getOptional("ein") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun entity(): Optional = Optional.ofNullable(entity.getNullable("entity")) + fun entity(): Optional = entity.getOptional("entity") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun legalName(): Optional = - Optional.ofNullable(legalName.getNullable("legal_name")) + fun legalName(): Optional = legalName.getOptional("legal_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun locations(): Optional = - Optional.ofNullable(locations.getNullable("locations")) + fun locations(): Optional = locations.getOptional("locations") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun primaryEmail(): Optional = - Optional.ofNullable(primaryEmail.getNullable("primary_email")) + fun primaryEmail(): Optional = primaryEmail.getOptional("primary_email") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ fun primaryPhoneNumber(): Optional = - Optional.ofNullable(primaryPhoneNumber.getNullable("primary_phone_number")) + primaryPhoneNumber.getOptional("primary_phone_number") /** * Returns the raw JSON value of [id]. @@ -1612,36 +1600,34 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun accountName(): Optional = - Optional.ofNullable(accountName.getNullable("account_name")) + fun accountName(): Optional = accountName.getOptional("account_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun accountNumber(): Optional = - Optional.ofNullable(accountNumber.getNullable("account_number")) + accountNumber.getOptional("account_number") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun accountType(): Optional = - Optional.ofNullable(accountType.getNullable("account_type")) + fun accountType(): Optional = accountType.getOptional("account_type") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun institutionName(): Optional = - Optional.ofNullable(institutionName.getNullable("institution_name")) + institutionName.getOptional("institution_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun routingNumber(): Optional = - Optional.ofNullable(routingNumber.getNullable("routing_number")) + routingNumber.getOptional("routing_number") /** * Returns the raw JSON value of [accountName]. @@ -1916,14 +1902,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun parent(): Optional = - Optional.ofNullable(parent.getNullable("parent")) + fun parent(): Optional = parent.getOptional("parent") /** * Returns the raw JSON value of [name]. @@ -2079,8 +2064,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun name(): Optional = - Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Returns the raw JSON value of [name]. @@ -2250,14 +2234,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun subtype(): Optional = - Optional.ofNullable(subtype.getNullable("subtype")) + fun subtype(): Optional = subtype.getOptional("subtype") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [subtype]. @@ -2449,39 +2432,37 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + fun city(): Optional = city.getOptional("city") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun country(): Optional = - Optional.ofNullable(country.getNullable("country")) + fun country(): Optional = country.getOptional("country") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) + fun line1(): Optional = line1.getOptional("line1") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) + fun line2(): Optional = line2.getOptional("line2") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun postalCode(): Optional = - Optional.ofNullable(postalCode.getNullable("postal_code")) + fun postalCode(): Optional = postalCode.getOptional("postal_code") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun state(): Optional = Optional.ofNullable(state.getNullable("state")) + fun state(): Optional = state.getOptional("state") /** * Returns the raw JSON value of [city]. @@ -2781,14 +2762,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun individuals(): Optional = - Optional.ofNullable(individuals.getNullable("individuals")) + fun individuals(): Optional = individuals.getOptional("individuals") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) + fun paging(): Optional = paging.getOptional("paging") /** * Returns the raw JSON value of [individuals]. @@ -2985,49 +2965,43 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun department(): Optional = - Optional.ofNullable(department.getNullable("department")) + fun department(): Optional = department.getOptional("department") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun firstName(): Optional = - Optional.ofNullable(firstName.getNullable("first_name")) + fun firstName(): Optional = firstName.getOptional("first_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun isActive(): Optional = - Optional.ofNullable(isActive.getNullable("is_active")) + fun isActive(): Optional = isActive.getOptional("is_active") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun lastName(): Optional = - Optional.ofNullable(lastName.getNullable("last_name")) + fun lastName(): Optional = lastName.getOptional("last_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun manager(): Optional = - Optional.ofNullable(manager.getNullable("manager")) + fun manager(): Optional = manager.getOptional("manager") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun middleName(): Optional = - Optional.ofNullable(middleName.getNullable("middle_name")) + fun middleName(): Optional = middleName.getOptional("middle_name") /** * Returns the raw JSON value of [id]. @@ -3327,7 +3301,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * Returns the raw JSON value of [id]. @@ -3497,14 +3471,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun count(): Optional = Optional.ofNullable(count.getNullable("count")) + fun count(): Optional = count.getOptional("count") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun offset(): Optional = - Optional.ofNullable(offset.getNullable("offset")) + fun offset(): Optional = offset.getOptional("offset") /** * Returns the raw JSON value of [count]. @@ -3775,117 +3748,104 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun classCode(): Optional = - Optional.ofNullable(classCode.getNullable("class_code")) + fun classCode(): Optional = classCode.getOptional("class_code") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun customFields(): Optional = - Optional.ofNullable(customFields.getNullable("custom_fields")) + fun customFields(): Optional = customFields.getOptional("custom_fields") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun department(): Optional = - Optional.ofNullable(department.getNullable("department")) + fun department(): Optional = department.getOptional("department") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun employment(): Optional = - Optional.ofNullable(employment.getNullable("employment")) + fun employment(): Optional = employment.getOptional("employment") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ fun employmentStatus(): Optional = - Optional.ofNullable(employmentStatus.getNullable("employment_status")) + employmentStatus.getOptional("employment_status") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) + fun endDate(): Optional = endDate.getOptional("end_date") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun firstName(): Optional = - Optional.ofNullable(firstName.getNullable("first_name")) + fun firstName(): Optional = firstName.getOptional("first_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun income(): Optional = Optional.ofNullable(income.getNullable("income")) + fun income(): Optional = income.getOptional("income") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun incomeHistory(): Optional = - Optional.ofNullable(incomeHistory.getNullable("income_history")) + fun incomeHistory(): Optional = incomeHistory.getOptional("income_history") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun isActive(): Optional = - Optional.ofNullable(isActive.getNullable("is_active")) + fun isActive(): Optional = isActive.getOptional("is_active") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun lastName(): Optional = - Optional.ofNullable(lastName.getNullable("last_name")) + fun lastName(): Optional = lastName.getOptional("last_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun location(): Optional = - Optional.ofNullable(location.getNullable("location")) + fun location(): Optional = location.getOptional("location") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun manager(): Optional = - Optional.ofNullable(manager.getNullable("manager")) + fun manager(): Optional = manager.getOptional("manager") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun middleName(): Optional = - Optional.ofNullable(middleName.getNullable("middle_name")) + fun middleName(): Optional = middleName.getOptional("middle_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun startDate(): Optional = - Optional.ofNullable(startDate.getNullable("start_date")) + fun startDate(): Optional = startDate.getOptional("start_date") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun title(): Optional = Optional.ofNullable(title.getNullable("title")) + fun title(): Optional = title.getOptional("title") /** * Returns the raw JSON value of [id]. @@ -4453,7 +4413,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Returns the raw JSON value of [name]. @@ -4605,14 +4565,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun subtype(): Optional = - Optional.ofNullable(subtype.getNullable("subtype")) + fun subtype(): Optional = subtype.getOptional("subtype") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [subtype]. @@ -4794,21 +4753,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun amount(): Optional = - Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun currency(): Optional = - Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun unit(): Optional = Optional.ofNullable(unit.getNullable("unit")) + fun unit(): Optional = unit.getOptional("unit") /** * Returns the raw JSON value of [amount]. @@ -5027,39 +4984,37 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + fun city(): Optional = city.getOptional("city") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun country(): Optional = - Optional.ofNullable(country.getNullable("country")) + fun country(): Optional = country.getOptional("country") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) + fun line1(): Optional = line1.getOptional("line1") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) + fun line2(): Optional = line2.getOptional("line2") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun postalCode(): Optional = - Optional.ofNullable(postalCode.getNullable("postal_code")) + fun postalCode(): Optional = postalCode.getOptional("postal_code") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun state(): Optional = Optional.ofNullable(state.getNullable("state")) + fun state(): Optional = state.getOptional("state") /** * Returns the raw JSON value of [city]. @@ -5335,7 +5290,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * Returns the raw JSON value of [id]. @@ -5555,87 +5510,80 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) + fun dob(): Optional = dob.getOptional("dob") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun emails(): Optional = Optional.ofNullable(emails.getNullable("emails")) + fun emails(): Optional = emails.getOptional("emails") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun encryptedSsn(): Optional = - Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) + fun encryptedSsn(): Optional = encryptedSsn.getOptional("encrypted_ssn") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun ethnicity(): Optional = - Optional.ofNullable(ethnicity.getNullable("ethnicity")) + fun ethnicity(): Optional = ethnicity.getOptional("ethnicity") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun firstName(): Optional = - Optional.ofNullable(firstName.getNullable("first_name")) + fun firstName(): Optional = firstName.getOptional("first_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun gender(): Optional = Optional.ofNullable(gender.getNullable("gender")) + fun gender(): Optional = gender.getOptional("gender") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun lastName(): Optional = - Optional.ofNullable(lastName.getNullable("last_name")) + fun lastName(): Optional = lastName.getOptional("last_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun middleName(): Optional = - Optional.ofNullable(middleName.getNullable("middle_name")) + fun middleName(): Optional = middleName.getOptional("middle_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ fun phoneNumbers(): Optional = - Optional.ofNullable(phoneNumbers.getNullable("phone_numbers")) + phoneNumbers.getOptional("phone_numbers") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun preferredName(): Optional = - Optional.ofNullable(preferredName.getNullable("preferred_name")) + fun preferredName(): Optional = preferredName.getOptional("preferred_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun residence(): Optional = - Optional.ofNullable(residence.getNullable("residence")) + fun residence(): Optional = residence.getOptional("residence") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) + fun ssn(): Optional = ssn.getOptional("ssn") /** * Returns the raw JSON value of [id]. @@ -6093,13 +6041,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [data]. @@ -6273,13 +6221,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [data]. @@ -6471,39 +6419,37 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + fun city(): Optional = city.getOptional("city") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun country(): Optional = - Optional.ofNullable(country.getNullable("country")) + fun country(): Optional = country.getOptional("country") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) + fun line1(): Optional = line1.getOptional("line1") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) + fun line2(): Optional = line2.getOptional("line2") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun postalCode(): Optional = - Optional.ofNullable(postalCode.getNullable("postal_code")) + fun postalCode(): Optional = postalCode.getOptional("postal_code") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun state(): Optional = Optional.ofNullable(state.getNullable("state")) + fun state(): Optional = state.getOptional("state") /** * Returns the raw JSON value of [city]. @@ -6809,27 +6755,26 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun individualIds(): Optional = - Optional.ofNullable(individualIds.getNullable("individual_ids")) + fun individualIds(): Optional = individualIds.getOptional("individual_ids") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ fun payFrequencies(): Optional = - Optional.ofNullable(payFrequencies.getNullable("pay_frequencies")) + payFrequencies.getOptional("pay_frequencies") /** * Returns the raw JSON value of [id]. @@ -7067,14 +7012,14 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) + fun paging(): Optional = paging.getOptional("paging") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ fun payStatements(): Optional = - Optional.ofNullable(payStatements.getNullable("pay_statements")) + payStatements.getOptional("pay_statements") /** * Returns the raw JSON value of [paging]. @@ -7491,71 +7436,65 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun earnings(): Optional = - Optional.ofNullable(earnings.getNullable("earnings")) + fun earnings(): Optional = earnings.getOptional("earnings") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun employeeDeductions(): Optional = - Optional.ofNullable(employeeDeductions.getNullable("employee_deductions")) + employeeDeductions.getOptional("employee_deductions") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun employerContributions(): Optional = - Optional.ofNullable( - employerContributions.getNullable("employer_contributions") - ) + employerContributions.getOptional("employer_contributions") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun grossPay(): Optional = - Optional.ofNullable(grossPay.getNullable("gross_pay")) + fun grossPay(): Optional = grossPay.getOptional("gross_pay") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) + individualId.getOptional("individual_id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun netPay(): Optional = - Optional.ofNullable(netPay.getNullable("net_pay")) + fun netPay(): Optional = netPay.getOptional("net_pay") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ fun paymentMethod(): Optional = - Optional.ofNullable(paymentMethod.getNullable("payment_method")) + paymentMethod.getOptional("payment_method") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun taxes(): Optional = Optional.ofNullable(taxes.getNullable("taxes")) + fun taxes(): Optional = taxes.getOptional("taxes") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun totalHours(): Optional = - Optional.ofNullable(totalHours.getNullable("total_hours")) + fun totalHours(): Optional = totalHours.getOptional("total_hours") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [earnings]. @@ -7956,29 +7895,25 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun amount(): Optional = - Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun currency(): Optional = - Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun name(): Optional = - Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun type(): Optional = - Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [amount]. @@ -8225,36 +8160,31 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun amount(): Optional = - Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun currency(): Optional = - Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun name(): Optional = - Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun preTax(): Optional = - Optional.ofNullable(preTax.getNullable("pre_tax")) + fun preTax(): Optional = preTax.getOptional("pre_tax") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun type(): Optional = - Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [amount]. @@ -8521,22 +8451,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun amount(): Optional = - Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun currency(): Optional = - Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun name(): Optional = - Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Returns the raw JSON value of [amount]. @@ -8762,36 +8689,31 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun amount(): Optional = - Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun currency(): Optional = - Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun employer(): Optional = - Optional.ofNullable(employer.getNullable("employer")) + fun employer(): Optional = employer.getOptional("employer") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun name(): Optional = - Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun type(): Optional = - Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [amount]. @@ -9142,83 +9064,74 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun companyDebit(): Optional = - Optional.ofNullable(companyDebit.getNullable("company_debit")) + fun companyDebit(): Optional = companyDebit.getOptional("company_debit") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun debitDate(): Optional = - Optional.ofNullable(debitDate.getNullable("debit_date")) + fun debitDate(): Optional = debitDate.getOptional("debit_date") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun employeeTaxes(): Optional = - Optional.ofNullable(employeeTaxes.getNullable("employee_taxes")) + fun employeeTaxes(): Optional = employeeTaxes.getOptional("employee_taxes") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun employerTaxes(): Optional = - Optional.ofNullable(employerTaxes.getNullable("employer_taxes")) + fun employerTaxes(): Optional = employerTaxes.getOptional("employer_taxes") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun grossPay(): Optional = - Optional.ofNullable(grossPay.getNullable("gross_pay")) + fun grossPay(): Optional = grossPay.getOptional("gross_pay") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun individualIds(): Optional = - Optional.ofNullable(individualIds.getNullable("individual_ids")) + fun individualIds(): Optional = individualIds.getOptional("individual_ids") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun netPay(): Optional = Optional.ofNullable(netPay.getNullable("net_pay")) + fun netPay(): Optional = netPay.getOptional("net_pay") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun payDate(): Optional = - Optional.ofNullable(payDate.getNullable("pay_date")) + fun payDate(): Optional = payDate.getOptional("pay_date") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ fun payFrequencies(): Optional = - Optional.ofNullable(payFrequencies.getNullable("pay_frequencies")) + payFrequencies.getOptional("pay_frequencies") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun payGroupIds(): Optional = - Optional.ofNullable(payGroupIds.getNullable("pay_group_ids")) + fun payGroupIds(): Optional = payGroupIds.getOptional("pay_group_ids") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun payPeriod(): Optional = - Optional.ofNullable(payPeriod.getNullable("pay_period")) + fun payPeriod(): Optional = payPeriod.getOptional("pay_period") /** * Returns the raw JSON value of [id]. @@ -9661,15 +9574,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) + fun endDate(): Optional = endDate.getOptional("end_date") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun startDate(): Optional = - Optional.ofNullable(startDate.getNullable("start_date")) + fun startDate(): Optional = startDate.getOptional("start_date") /** * Returns the raw JSON value of [endDate]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt index efe15f24..211ce9e1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt @@ -75,7 +75,7 @@ private constructor( @JsonProperty("items") items: JsonField> = JsonMissing.of() ) : this(items, mutableMapOf()) - fun items(): List = items.getNullable("items") ?: listOf() + fun items(): List = items.getOptional("items").getOrNull() ?: listOf() @JsonProperty("items") fun _items(): Optional>> = Optional.ofNullable(items) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt index 47a1f674..d8d7a8e1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt @@ -18,6 +18,7 @@ import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor import java.util.function.Predicate +import kotlin.jvm.optionals.getOrNull /** Return details on all available payroll and HR systems. */ class ProviderListPageAsync @@ -80,7 +81,7 @@ private constructor( @JsonProperty("items") items: JsonField> = JsonMissing.of() ) : this(items, mutableMapOf()) - fun items(): List = items.getNullable("items") ?: listOf() + fun items(): List = items.getOptional("items").getOrNull() ?: listOf() @JsonProperty("items") fun _items(): Optional>> = Optional.ofNullable(items) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt index 8206dfc3..b66c89fe 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt @@ -391,7 +391,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * The HTTP headers to include on the forwarded request. This value must be specified as an diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt index 5463e984..975d9d29 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt @@ -42,7 +42,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * The HTTP headers of the forwarded request’s response, exactly as received from the underlying @@ -295,7 +295,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * The specified HTTP headers that were included in the forwarded request. If no headers diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleCreateResponse.kt index 0eeaf04c..c2326d4a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleCreateResponse.kt @@ -78,7 +78,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * Specifies the fields to be applied when the condition is met. @@ -86,15 +86,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun attributes(): Optional = - Optional.ofNullable(attributes.getNullable("attributes")) + fun attributes(): Optional = attributes.getOptional("attributes") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun conditions(): Optional> = - Optional.ofNullable(conditions.getNullable("conditions")) + fun conditions(): Optional> = conditions.getOptional("conditions") /** * The datetime when the rule was created. @@ -102,8 +100,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun createdAt(): Optional = - Optional.ofNullable(createdAt.getNullable("created_at")) + fun createdAt(): Optional = createdAt.getOptional("created_at") /** * Specifies when the rules should stop applying rules based on the date. @@ -111,8 +108,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun effectiveEndDate(): Optional = - Optional.ofNullable(effectiveEndDate.getNullable("effective_end_date")) + fun effectiveEndDate(): Optional = effectiveEndDate.getOptional("effective_end_date") /** * Specifies when the rule should begin applying based on the date. @@ -121,7 +117,7 @@ private constructor( * server responded with an unexpected value). */ fun effectiveStartDate(): Optional = - Optional.ofNullable(effectiveStartDate.getNullable("effective_start_date")) + effectiveStartDate.getOptional("effective_start_date") /** * The entity type to which the rule is applied. @@ -129,8 +125,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun entityType(): Optional = - Optional.ofNullable(entityType.getNullable("entity_type")) + fun entityType(): Optional = entityType.getOptional("entity_type") /** * The priority of the rule. @@ -138,7 +133,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun priority(): Optional = Optional.ofNullable(priority.getNullable("priority")) + fun priority(): Optional = priority.getOptional("priority") /** * The datetime when the rule was last updated. @@ -146,8 +141,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun updatedAt(): Optional = - Optional.ofNullable(updatedAt.getNullable("updated_at")) + fun updatedAt(): Optional = updatedAt.getOptional("updated_at") /** * Returns the raw JSON value of [id]. @@ -513,7 +507,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -771,7 +765,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun field(): Optional = Optional.ofNullable(field.getNullable("field")) + fun field(): Optional = field.getOptional("field") /** * The operator to be used in the rule. @@ -779,7 +773,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) + fun operator(): Optional = operator.getOptional("operator") /** * The value of the field to be checked in the rule. @@ -787,7 +781,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun value(): Optional = Optional.ofNullable(value.getNullable("value")) + fun value(): Optional = value.getOptional("value") /** * Returns the raw JSON value of [field]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleDeleteResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleDeleteResponse.kt index b82c564b..00f8fca9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleDeleteResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleDeleteResponse.kt @@ -83,7 +83,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * Specifies the fields to be applied when the condition is met. @@ -91,15 +91,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun attributes(): Optional = - Optional.ofNullable(attributes.getNullable("attributes")) + fun attributes(): Optional = attributes.getOptional("attributes") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun conditions(): Optional> = - Optional.ofNullable(conditions.getNullable("conditions")) + fun conditions(): Optional> = conditions.getOptional("conditions") /** * The datetime when the rule was created. @@ -107,8 +105,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun createdAt(): Optional = - Optional.ofNullable(createdAt.getNullable("created_at")) + fun createdAt(): Optional = createdAt.getOptional("created_at") /** * The datetime when the rule was deleted. @@ -116,8 +113,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun deletedAt(): Optional = - Optional.ofNullable(deletedAt.getNullable("deleted_at")) + fun deletedAt(): Optional = deletedAt.getOptional("deleted_at") /** * Specifies when the rules should stop applying rules based on the date. @@ -125,8 +121,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun effectiveEndDate(): Optional = - Optional.ofNullable(effectiveEndDate.getNullable("effective_end_date")) + fun effectiveEndDate(): Optional = effectiveEndDate.getOptional("effective_end_date") /** * Specifies when the rule should begin applying based on the date. @@ -135,7 +130,7 @@ private constructor( * server responded with an unexpected value). */ fun effectiveStartDate(): Optional = - Optional.ofNullable(effectiveStartDate.getNullable("effective_start_date")) + effectiveStartDate.getOptional("effective_start_date") /** * The entity type to which the rule is applied. @@ -143,8 +138,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun entityType(): Optional = - Optional.ofNullable(entityType.getNullable("entity_type")) + fun entityType(): Optional = entityType.getOptional("entity_type") /** * The priority of the rule. @@ -152,7 +146,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun priority(): Optional = Optional.ofNullable(priority.getNullable("priority")) + fun priority(): Optional = priority.getOptional("priority") /** * The datetime when the rule was last updated. @@ -160,8 +154,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun updatedAt(): Optional = - Optional.ofNullable(updatedAt.getNullable("updated_at")) + fun updatedAt(): Optional = updatedAt.getOptional("updated_at") /** * Returns the raw JSON value of [id]. @@ -553,7 +546,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -811,7 +804,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun field(): Optional = Optional.ofNullable(field.getNullable("field")) + fun field(): Optional = field.getOptional("field") /** * The operator to be used in the rule. @@ -819,7 +812,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) + fun operator(): Optional = operator.getOptional("operator") /** * The value of the field to be checked in the rule. @@ -827,7 +820,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun value(): Optional = Optional.ofNullable(value.getNullable("value")) + fun value(): Optional = value.getOptional("value") /** * Returns the raw JSON value of [field]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleListResponse.kt index 21295a5d..512f1b09 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleListResponse.kt @@ -78,7 +78,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * Specifies the fields to be applied when the condition is met. @@ -86,15 +86,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun attributes(): Optional = - Optional.ofNullable(attributes.getNullable("attributes")) + fun attributes(): Optional = attributes.getOptional("attributes") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun conditions(): Optional> = - Optional.ofNullable(conditions.getNullable("conditions")) + fun conditions(): Optional> = conditions.getOptional("conditions") /** * The datetime when the rule was created. @@ -102,8 +100,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun createdAt(): Optional = - Optional.ofNullable(createdAt.getNullable("created_at")) + fun createdAt(): Optional = createdAt.getOptional("created_at") /** * Specifies when the rules should stop applying rules based on the date. @@ -111,8 +108,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun effectiveEndDate(): Optional = - Optional.ofNullable(effectiveEndDate.getNullable("effective_end_date")) + fun effectiveEndDate(): Optional = effectiveEndDate.getOptional("effective_end_date") /** * Specifies when the rule should begin applying based on the date. @@ -121,7 +117,7 @@ private constructor( * server responded with an unexpected value). */ fun effectiveStartDate(): Optional = - Optional.ofNullable(effectiveStartDate.getNullable("effective_start_date")) + effectiveStartDate.getOptional("effective_start_date") /** * The entity type to which the rule is applied. @@ -129,8 +125,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun entityType(): Optional = - Optional.ofNullable(entityType.getNullable("entity_type")) + fun entityType(): Optional = entityType.getOptional("entity_type") /** * The priority of the rule. @@ -138,7 +133,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun priority(): Optional = Optional.ofNullable(priority.getNullable("priority")) + fun priority(): Optional = priority.getOptional("priority") /** * The datetime when the rule was last updated. @@ -146,8 +141,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun updatedAt(): Optional = - Optional.ofNullable(updatedAt.getNullable("updated_at")) + fun updatedAt(): Optional = updatedAt.getOptional("updated_at") /** * Returns the raw JSON value of [id]. @@ -513,7 +507,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -771,7 +765,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun field(): Optional = Optional.ofNullable(field.getNullable("field")) + fun field(): Optional = field.getOptional("field") /** * The operator to be used in the rule. @@ -779,7 +773,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) + fun operator(): Optional = operator.getOptional("operator") /** * The value of the field to be checked in the rule. @@ -787,7 +781,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun value(): Optional = Optional.ofNullable(value.getNullable("value")) + fun value(): Optional = value.getOptional("value") /** * Returns the raw JSON value of [field]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleUpdateResponse.kt index ab9209fe..d8735c62 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RuleUpdateResponse.kt @@ -78,7 +78,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * Specifies the fields to be applied when the condition is met. @@ -86,15 +86,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun attributes(): Optional = - Optional.ofNullable(attributes.getNullable("attributes")) + fun attributes(): Optional = attributes.getOptional("attributes") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun conditions(): Optional> = - Optional.ofNullable(conditions.getNullable("conditions")) + fun conditions(): Optional> = conditions.getOptional("conditions") /** * The datetime when the rule was created. @@ -102,8 +100,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun createdAt(): Optional = - Optional.ofNullable(createdAt.getNullable("created_at")) + fun createdAt(): Optional = createdAt.getOptional("created_at") /** * Specifies when the rules should stop applying rules based on the date. @@ -111,8 +108,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun effectiveEndDate(): Optional = - Optional.ofNullable(effectiveEndDate.getNullable("effective_end_date")) + fun effectiveEndDate(): Optional = effectiveEndDate.getOptional("effective_end_date") /** * Specifies when the rule should begin applying based on the date. @@ -121,7 +117,7 @@ private constructor( * server responded with an unexpected value). */ fun effectiveStartDate(): Optional = - Optional.ofNullable(effectiveStartDate.getNullable("effective_start_date")) + effectiveStartDate.getOptional("effective_start_date") /** * The entity type to which the rule is applied. @@ -129,8 +125,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun entityType(): Optional = - Optional.ofNullable(entityType.getNullable("entity_type")) + fun entityType(): Optional = entityType.getOptional("entity_type") /** * The priority of the rule. @@ -138,7 +133,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun priority(): Optional = Optional.ofNullable(priority.getNullable("priority")) + fun priority(): Optional = priority.getOptional("priority") /** * The datetime when the rule was last updated. @@ -146,8 +141,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun updatedAt(): Optional = - Optional.ofNullable(updatedAt.getNullable("updated_at")) + fun updatedAt(): Optional = updatedAt.getOptional("updated_at") /** * Returns the raw JSON value of [id]. @@ -513,7 +507,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -771,7 +765,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun field(): Optional = Optional.ofNullable(field.getNullable("field")) + fun field(): Optional = field.getOptional("field") /** * The operator to be used in the rule. @@ -779,7 +773,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) + fun operator(): Optional = operator.getOptional("operator") /** * The value of the field to be checked in the rule. @@ -787,7 +781,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun value(): Optional = Optional.ofNullable(value.getNullable("value")) + fun value(): Optional = value.getOptional("value") /** * Returns the raw JSON value of [field]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt index 3563e3b0..4c71017d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt @@ -559,8 +559,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun accounts(): Optional> = - Optional.ofNullable(accounts.getNullable("accounts")) + fun accounts(): Optional> = accounts.getOptional("accounts") /** * The array of company departments. @@ -568,8 +567,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun departments(): Optional> = - Optional.ofNullable(departments.getNullable("departments")) + fun departments(): Optional> = departments.getOptional("departments") /** * The employer identification number. @@ -577,7 +575,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun ein(): Optional = Optional.ofNullable(ein.getNullable("ein")) + fun ein(): Optional = ein.getOptional("ein") /** * The entity type object. @@ -585,7 +583,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun entity(): Optional = Optional.ofNullable(entity.getNullable("entity")) + fun entity(): Optional = entity.getOptional("entity") /** * The legal name of the company. @@ -593,14 +591,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun legalName(): Optional = Optional.ofNullable(legalName.getNullable("legal_name")) + fun legalName(): Optional = legalName.getOptional("legal_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun locations(): Optional> = - Optional.ofNullable(locations.getNullable("locations")) + fun locations(): Optional> = locations.getOptional("locations") /** * The email of the main administrator on the account. @@ -608,8 +605,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun primaryEmail(): Optional = - Optional.ofNullable(primaryEmail.getNullable("primary_email")) + fun primaryEmail(): Optional = primaryEmail.getOptional("primary_email") /** * The phone number of the main administrator on the account. Format: `XXXXXXXXXX` @@ -618,7 +614,7 @@ private constructor( * server responded with an unexpected value). */ fun primaryPhoneNumber(): Optional = - Optional.ofNullable(primaryPhoneNumber.getNullable("primary_phone_number")) + primaryPhoneNumber.getOptional("primary_phone_number") /** * Returns the raw JSON value of [accounts]. @@ -1075,8 +1071,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun accountName(): Optional = - Optional.ofNullable(accountName.getNullable("account_name")) + fun accountName(): Optional = accountName.getOptional("account_name") /** * 10-12 digit number to specify the bank account @@ -1084,8 +1079,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun accountNumber(): Optional = - Optional.ofNullable(accountNumber.getNullable("account_number")) + fun accountNumber(): Optional = accountNumber.getOptional("account_number") /** * The type of bank account. @@ -1093,8 +1087,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun accountType(): Optional = - Optional.ofNullable(accountType.getNullable("account_type")) + fun accountType(): Optional = accountType.getOptional("account_type") /** * Name of the banking institution. @@ -1102,8 +1095,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun institutionName(): Optional = - Optional.ofNullable(institutionName.getNullable("institution_name")) + fun institutionName(): Optional = institutionName.getOptional("institution_name") /** * A nine-digit code that's based on the U.S. Bank location where your account was opened. @@ -1111,8 +1103,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun routingNumber(): Optional = - Optional.ofNullable(routingNumber.getNullable("routing_number")) + fun routingNumber(): Optional = routingNumber.getOptional("routing_number") /** * Returns the raw JSON value of [accountName]. @@ -1537,7 +1528,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * The parent department, if present. @@ -1545,7 +1536,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun parent(): Optional = Optional.ofNullable(parent.getNullable("parent")) + fun parent(): Optional = parent.getOptional("parent") /** * Returns the raw JSON value of [name]. @@ -1699,7 +1690,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Returns the raw JSON value of [name]. @@ -1866,7 +1857,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) + fun subtype(): Optional = subtype.getOptional("subtype") /** * The tax payer type of the company. @@ -1874,7 +1865,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [subtype]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt index 8814939a..18a7ccc0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt @@ -389,7 +389,7 @@ private constructor( * server responded with an unexpected value). */ fun authenticationType(): Optional = - Optional.ofNullable(authenticationType.getNullable("authentication_type")) + authenticationType.getOptional("authentication_type") /** * Optional, defaults to Organization products (`company`, `directory`, `employment`, @@ -398,8 +398,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun products(): Optional> = - Optional.ofNullable(products.getNullable("products")) + fun products(): Optional> = products.getOptional("products") /** * Returns the raw JSON value of [companyId]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt index 3db0a451..815ad542 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt @@ -258,7 +258,7 @@ private constructor( * server responded with an unexpected value). */ fun connectionStatus(): Optional = - Optional.ofNullable(connectionStatus.getNullable("connection_status")) + connectionStatus.getOptional("connection_status") /** * Returns the raw JSON value of [connectionStatus]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt index 435cb20c..3b877625 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt @@ -380,7 +380,7 @@ private constructor( * server responded with an unexpected value). */ fun authenticationType(): Optional = - Optional.ofNullable(authenticationType.getNullable("authentication_type")) + authenticationType.getOptional("authentication_type") /** * Optional: the size of the employer to be created with this connection. Defaults to 20. @@ -390,15 +390,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun employeeSize(): Optional = - Optional.ofNullable(employeeSize.getNullable("employee_size")) + fun employeeSize(): Optional = employeeSize.getOptional("employee_size") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun products(): Optional> = - Optional.ofNullable(products.getNullable("products")) + fun products(): Optional> = products.getOptional("products") /** * Returns the raw JSON value of [providerId]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt index a3bcfec2..e13ee7ac 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt @@ -251,7 +251,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun classCode(): Optional = Optional.ofNullable(classCode.getNullable("class_code")) + fun classCode(): Optional = classCode.getOptional("class_code") /** * Custom fields for the individual. These are fields which are defined by the employer in @@ -260,8 +260,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun customFields(): Optional> = - Optional.ofNullable(customFields.getNullable("custom_fields")) + fun customFields(): Optional> = customFields.getOptional("custom_fields") /** * The department object. @@ -269,20 +268,19 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun department(): Optional = - Optional.ofNullable(department.getNullable("department")) + fun department(): Optional = department.getOptional("department") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) + fun dob(): Optional = dob.getOptional("dob") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun emails(): Optional> = Optional.ofNullable(emails.getNullable("emails")) + fun emails(): Optional> = emails.getOptional("emails") /** * The employment object. @@ -290,8 +288,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun employment(): Optional = - Optional.ofNullable(employment.getNullable("employment")) + fun employment(): Optional = employment.getOptional("employment") /** * The detailed employment status of the individual. @@ -300,7 +297,7 @@ private constructor( * server responded with an unexpected value). */ fun employmentStatus(): Optional = - Optional.ofNullable(employmentStatus.getNullable("employment_status")) + employmentStatus.getOptional("employment_status") /** * Social Security Number of the individual in **encrypted** format. This field is only @@ -310,14 +307,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun encryptedSsn(): Optional = - Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) + fun encryptedSsn(): Optional = encryptedSsn.getOptional("encrypted_ssn") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + fun endDate(): Optional = endDate.getOptional("end_date") /** * The EEOC-defined ethnicity of the individual. @@ -325,8 +321,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun ethnicity(): Optional = - Optional.ofNullable(ethnicity.getNullable("ethnicity")) + fun ethnicity(): Optional = ethnicity.getOptional("ethnicity") /** * The legal first name of the individual. @@ -334,7 +329,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) + fun firstName(): Optional = firstName.getOptional("first_name") /** * The gender of the individual. @@ -342,7 +337,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun gender(): Optional = Optional.ofNullable(gender.getNullable("gender")) + fun gender(): Optional = gender.getOptional("gender") /** * The employee's income as reported by the provider. This may not always be annualized @@ -352,7 +347,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun income(): Optional = Optional.ofNullable(income.getNullable("income")) + fun income(): Optional = income.getOptional("income") /** * The array of income history. @@ -360,8 +355,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun incomeHistory(): Optional> = - Optional.ofNullable(incomeHistory.getNullable("income_history")) + fun incomeHistory(): Optional> = incomeHistory.getOptional("income_history") /** * `true` if the individual an an active employee or contractor at the company. @@ -369,7 +363,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) + fun isActive(): Optional = isActive.getOptional("is_active") /** * The legal last name of the individual. @@ -377,20 +371,20 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + fun lastName(): Optional = lastName.getOptional("last_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ fun latestRehireDate(): Optional = - Optional.ofNullable(latestRehireDate.getNullable("latest_rehire_date")) + latestRehireDate.getOptional("latest_rehire_date") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun location(): Optional = Optional.ofNullable(location.getNullable("location")) + fun location(): Optional = location.getOptional("location") /** * The manager object representing the manager of the individual within the org. @@ -398,7 +392,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) + fun manager(): Optional = manager.getOptional("manager") /** * The legal middle name of the individual. @@ -406,15 +400,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun middleName(): Optional = - Optional.ofNullable(middleName.getNullable("middle_name")) + fun middleName(): Optional = middleName.getOptional("middle_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun phoneNumbers(): Optional> = - Optional.ofNullable(phoneNumbers.getNullable("phone_numbers")) + fun phoneNumbers(): Optional> = phoneNumbers.getOptional("phone_numbers") /** * The preferred name of the individual. @@ -422,15 +414,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun preferredName(): Optional = - Optional.ofNullable(preferredName.getNullable("preferred_name")) + fun preferredName(): Optional = preferredName.getOptional("preferred_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun residence(): Optional = - Optional.ofNullable(residence.getNullable("residence")) + fun residence(): Optional = residence.getOptional("residence") /** * The source system's unique employment identifier for this individual @@ -438,7 +428,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun sourceId(): Optional = Optional.ofNullable(sourceId.getNullable("source_id")) + fun sourceId(): Optional = sourceId.getOptional("source_id") /** * Social Security Number of the individual. This field is only available with the `ssn` @@ -448,13 +438,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) + fun ssn(): Optional = ssn.getOptional("ssn") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) + fun startDate(): Optional = startDate.getOptional("start_date") /** * The current title of the individual. @@ -462,7 +452,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun title(): Optional = Optional.ofNullable(title.getNullable("title")) + fun title(): Optional = title.getOptional("title") /** * Returns the raw JSON value of [classCode]. @@ -1388,7 +1378,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value @@ -1541,7 +1531,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Returns the raw JSON value of [name]. @@ -1687,13 +1677,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [data]. @@ -1998,7 +1988,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) + fun subtype(): Optional = subtype.getOptional("subtype") /** * The main employment type of the individual. @@ -2006,7 +1996,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [subtype]. @@ -2951,7 +2941,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * Returns the raw JSON value of [id]. @@ -3093,13 +3083,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [data]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt index 2ba0991f..ef2be056 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt @@ -905,7 +905,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun classCode(): Optional = Optional.ofNullable(classCode.getNullable("class_code")) + fun classCode(): Optional = classCode.getOptional("class_code") /** * Custom fields for the individual. These are fields which are defined by the employer in @@ -914,8 +914,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun customFields(): Optional> = - Optional.ofNullable(customFields.getNullable("custom_fields")) + fun customFields(): Optional> = customFields.getOptional("custom_fields") /** * The department object. @@ -923,8 +922,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun department(): Optional = - Optional.ofNullable(department.getNullable("department")) + fun department(): Optional = department.getOptional("department") /** * The employment object. @@ -932,8 +930,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun employment(): Optional = - Optional.ofNullable(employment.getNullable("employment")) + fun employment(): Optional = employment.getOptional("employment") /** * The detailed employment status of the individual. @@ -942,13 +939,13 @@ private constructor( * server responded with an unexpected value). */ fun employmentStatus(): Optional = - Optional.ofNullable(employmentStatus.getNullable("employment_status")) + employmentStatus.getOptional("employment_status") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + fun endDate(): Optional = endDate.getOptional("end_date") /** * The legal first name of the individual. @@ -956,7 +953,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) + fun firstName(): Optional = firstName.getOptional("first_name") /** * The employee's income as reported by the provider. This may not always be annualized @@ -966,7 +963,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun income(): Optional = Optional.ofNullable(income.getNullable("income")) + fun income(): Optional = income.getOptional("income") /** * The array of income history. @@ -974,8 +971,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun incomeHistory(): Optional> = - Optional.ofNullable(incomeHistory.getNullable("income_history")) + fun incomeHistory(): Optional> = incomeHistory.getOptional("income_history") /** * `true` if the individual an an active employee or contractor at the company. @@ -983,7 +979,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) + fun isActive(): Optional = isActive.getOptional("is_active") /** * The legal last name of the individual. @@ -991,20 +987,20 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + fun lastName(): Optional = lastName.getOptional("last_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ fun latestRehireDate(): Optional = - Optional.ofNullable(latestRehireDate.getNullable("latest_rehire_date")) + latestRehireDate.getOptional("latest_rehire_date") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun location(): Optional = Optional.ofNullable(location.getNullable("location")) + fun location(): Optional = location.getOptional("location") /** * The manager object representing the manager of the individual within the org. @@ -1012,7 +1008,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) + fun manager(): Optional = manager.getOptional("manager") /** * The legal middle name of the individual. @@ -1020,8 +1016,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun middleName(): Optional = - Optional.ofNullable(middleName.getNullable("middle_name")) + fun middleName(): Optional = middleName.getOptional("middle_name") /** * The source system's unique employment identifier for this individual @@ -1029,13 +1024,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun sourceId(): Optional = Optional.ofNullable(sourceId.getNullable("source_id")) + fun sourceId(): Optional = sourceId.getOptional("source_id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) + fun startDate(): Optional = startDate.getOptional("start_date") /** * The current title of the individual. @@ -1043,7 +1038,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun title(): Optional = Optional.ofNullable(title.getNullable("title")) + fun title(): Optional = title.getOptional("title") /** * Returns the raw JSON value of [classCode]. @@ -1721,7 +1716,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value @@ -1870,7 +1865,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Returns the raw JSON value of [name]. @@ -2017,7 +2012,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) + fun subtype(): Optional = subtype.getOptional("subtype") /** * The main employment type of the individual. @@ -2025,7 +2020,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [subtype]. @@ -2645,7 +2640,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun id(): Optional = id.getOptional("id") /** * Returns the raw JSON value of [id]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt index 0267c1d0..8349ea86 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt @@ -687,13 +687,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) + fun dob(): Optional = dob.getOptional("dob") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun emails(): Optional> = Optional.ofNullable(emails.getNullable("emails")) + fun emails(): Optional> = emails.getOptional("emails") /** * Social Security Number of the individual in **encrypted** format. This field is only @@ -703,8 +703,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun encryptedSsn(): Optional = - Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) + fun encryptedSsn(): Optional = encryptedSsn.getOptional("encrypted_ssn") /** * The EEOC-defined ethnicity of the individual. @@ -712,8 +711,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun ethnicity(): Optional = - Optional.ofNullable(ethnicity.getNullable("ethnicity")) + fun ethnicity(): Optional = ethnicity.getOptional("ethnicity") /** * The legal first name of the individual. @@ -721,7 +719,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) + fun firstName(): Optional = firstName.getOptional("first_name") /** * The gender of the individual. @@ -729,7 +727,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun gender(): Optional = Optional.ofNullable(gender.getNullable("gender")) + fun gender(): Optional = gender.getOptional("gender") /** * The legal last name of the individual. @@ -737,7 +735,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + fun lastName(): Optional = lastName.getOptional("last_name") /** * The legal middle name of the individual. @@ -745,15 +743,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun middleName(): Optional = - Optional.ofNullable(middleName.getNullable("middle_name")) + fun middleName(): Optional = middleName.getOptional("middle_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun phoneNumbers(): Optional> = - Optional.ofNullable(phoneNumbers.getNullable("phone_numbers")) + fun phoneNumbers(): Optional> = phoneNumbers.getOptional("phone_numbers") /** * The preferred name of the individual. @@ -761,15 +757,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun preferredName(): Optional = - Optional.ofNullable(preferredName.getNullable("preferred_name")) + fun preferredName(): Optional = preferredName.getOptional("preferred_name") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun residence(): Optional = - Optional.ofNullable(residence.getNullable("residence")) + fun residence(): Optional = residence.getOptional("residence") /** * Social Security Number of the individual. This field is only available with the `ssn` @@ -779,7 +773,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) + fun ssn(): Optional = ssn.getOptional("ssn") /** * Returns the raw JSON value of [dob]. @@ -1280,13 +1274,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [data]. @@ -1879,13 +1873,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [data]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt index c38c97ee..480911e5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt @@ -320,20 +320,20 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + fun endDate(): Optional = endDate.getOptional("end_date") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ fun payStatements(): Optional> = - Optional.ofNullable(payStatements.getNullable("pay_statements")) + payStatements.getOptional("pay_statements") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) + fun startDate(): Optional = startDate.getOptional("start_date") /** * Returns the raw JSON value of [endDate]. @@ -586,8 +586,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun earnings(): Optional> = - Optional.ofNullable(earnings.getNullable("earnings")) + fun earnings(): Optional> = earnings.getOptional("earnings") /** * The array of deductions objects associated with this pay statement. @@ -596,20 +595,20 @@ private constructor( * server responded with an unexpected value). */ fun employeeDeductions(): Optional> = - Optional.ofNullable(employeeDeductions.getNullable("employee_deductions")) + employeeDeductions.getOptional("employee_deductions") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ fun employerContributions(): Optional> = - Optional.ofNullable(employerContributions.getNullable("employer_contributions")) + employerContributions.getOptional("employer_contributions") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun grossPay(): Optional = Optional.ofNullable(grossPay.getNullable("gross_pay")) + fun grossPay(): Optional = grossPay.getOptional("gross_pay") /** * A stable Finch `id` (UUID v4) for an individual in the company @@ -617,14 +616,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun individualId(): Optional = individualId.getOptional("individual_id") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun netPay(): Optional = Optional.ofNullable(netPay.getNullable("net_pay")) + fun netPay(): Optional = netPay.getOptional("net_pay") /** * The payment method. @@ -632,8 +630,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun paymentMethod(): Optional = - Optional.ofNullable(paymentMethod.getNullable("payment_method")) + fun paymentMethod(): Optional = paymentMethod.getOptional("payment_method") /** * The array of taxes objects associated with this pay statement. @@ -641,7 +638,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun taxes(): Optional> = Optional.ofNullable(taxes.getNullable("taxes")) + fun taxes(): Optional> = taxes.getOptional("taxes") /** * The number of hours worked for this pay period @@ -649,8 +646,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun totalHours(): Optional = - Optional.ofNullable(totalHours.getNullable("total_hours")) + fun totalHours(): Optional = totalHours.getOptional("total_hours") /** * The type of the payment associated with the pay statement. @@ -658,7 +654,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [earnings]. @@ -1143,14 +1139,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun attributes(): Optional = - Optional.ofNullable(attributes.getNullable("attributes")) + fun attributes(): Optional = attributes.getOptional("attributes") /** * The earnings currency code. @@ -1158,7 +1153,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * The number of hours associated with this earning. (For salaried employees, this could @@ -1167,7 +1162,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun hours(): Optional = Optional.ofNullable(hours.getNullable("hours")) + fun hours(): Optional = hours.getOptional("hours") /** * The exact name of the deduction from the pay statement. @@ -1175,7 +1170,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * The type of earning. @@ -1183,7 +1178,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [amount]. @@ -1476,8 +1471,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun metadata(): Optional = - Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -1610,8 +1604,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun metadata(): Optional = - Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -2136,14 +2129,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun attributes(): Optional = - Optional.ofNullable(attributes.getNullable("attributes")) + fun attributes(): Optional = attributes.getOptional("attributes") /** * The deduction currency. @@ -2151,7 +2143,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * The deduction name from the pay statement. @@ -2159,7 +2151,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Boolean indicating if the deduction is pre-tax. @@ -2167,7 +2159,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun preTax(): Optional = Optional.ofNullable(preTax.getNullable("pre_tax")) + fun preTax(): Optional = preTax.getOptional("pre_tax") /** * Type of benefit. @@ -2175,7 +2167,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [amount]. @@ -2467,8 +2459,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun metadata(): Optional = - Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -2601,8 +2592,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun metadata(): Optional = - Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -2926,14 +2916,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun attributes(): Optional = - Optional.ofNullable(attributes.getNullable("attributes")) + fun attributes(): Optional = attributes.getOptional("attributes") /** * The contribution currency. @@ -2941,7 +2930,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * The contribution name from the pay statement. @@ -2949,7 +2938,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Type of benefit. @@ -2957,7 +2946,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [amount]. @@ -3215,8 +3204,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun metadata(): Optional = - Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -3349,8 +3337,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun metadata(): Optional = - Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -3808,14 +3795,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + fun amount(): Optional = amount.getOptional("amount") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun attributes(): Optional = - Optional.ofNullable(attributes.getNullable("attributes")) + fun attributes(): Optional = attributes.getOptional("attributes") /** * The currency code. @@ -3823,7 +3809,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + fun currency(): Optional = currency.getOptional("currency") /** * `true` if the amount is paid by the employers. @@ -3831,8 +3817,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun employer(): Optional = - Optional.ofNullable(employer.getNullable("employer")) + fun employer(): Optional = employer.getOptional("employer") /** * The exact name of tax from the pay statement. @@ -3840,7 +3825,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * The type of taxes. @@ -3848,7 +3833,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [amount]. @@ -4139,8 +4124,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun metadata(): Optional = - Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -4273,8 +4257,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun metadata(): Optional = - Optional.ofNullable(metadata.getNullable("metadata")) + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt index d9ec9ee6..03902715 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt @@ -38,14 +38,14 @@ private constructor( * server responded with an unexpected value). */ fun companyBenefits(): Optional = - Optional.ofNullable(companyBenefits.getNullable("company_benefits")) + companyBenefits.getOptional("company_benefits") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ fun individualBenefits(): Optional = - Optional.ofNullable(individualBenefits.getNullable("individual_benefits")) + individualBenefits.getOptional("individual_benefits") /** * Returns the raw JSON value of [companyBenefits]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt index e27d7fe1..f16b14b7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt @@ -72,8 +72,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun annualMaximum(): Optional = - Optional.ofNullable(annualMaximum.getNullable("annual_maximum")) + fun annualMaximum(): Optional = annualMaximum.getOptional("annual_maximum") /** * Whether the provider supports catch up for this benefit. This field will only be true for @@ -82,7 +81,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun catchUp(): Optional = Optional.ofNullable(catchUp.getNullable("catch_up")) + fun catchUp(): Optional = catchUp.getOptional("catch_up") /** * Supported contribution types. An empty array indicates contributions are not supported. @@ -91,14 +90,13 @@ private constructor( * server responded with an unexpected value). */ fun companyContribution(): Optional> = - Optional.ofNullable(companyContribution.getNullable("company_contribution")) + 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 = - Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = description.getOptional("description") /** * Supported deduction types. An empty array indicates deductions are not supported. @@ -107,7 +105,7 @@ private constructor( * server responded with an unexpected value). */ fun employeeDeduction(): Optional> = - Optional.ofNullable(employeeDeduction.getNullable("employee_deduction")) + employeeDeduction.getOptional("employee_deduction") /** * The list of frequencies supported by the provider for this benefit @@ -115,8 +113,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun frequencies(): Optional> = - Optional.ofNullable(frequencies.getNullable("frequencies")) + fun frequencies(): Optional> = frequencies.getOptional("frequencies") /** * Whether the provider supports HSA contribution limits. Empty if this feature is not supported @@ -126,7 +123,7 @@ private constructor( * server responded with an unexpected value). */ fun hsaContributionLimit(): Optional> = - Optional.ofNullable(hsaContributionLimit.getNullable("hsa_contribution_limit")) + hsaContributionLimit.getOptional("hsa_contribution_limit") /** * Type of benefit. @@ -134,7 +131,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * Returns the raw JSON value of [annualMaximum]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt index 9c35bffe..2ced037c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt @@ -37,7 +37,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun body(): Optional = Optional.ofNullable(body.getNullable("body")) + fun body(): Optional = body.getOptional("body") /** * HTTP status code @@ -45,14 +45,13 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun code(): Optional = Optional.ofNullable(code.getNullable("code")) + 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 = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun individualId(): Optional = individualId.getOptional("individual_id") /** * Returns the raw JSON value of [body]. @@ -228,7 +227,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun finchCode(): Optional = Optional.ofNullable(finchCode.getNullable("finch_code")) + fun finchCode(): Optional = finchCode.getOptional("finch_code") /** * Short description in English that provides more information about the response. @@ -236,7 +235,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun message(): Optional = Optional.ofNullable(message.getNullable("message")) + fun message(): Optional = message.getOptional("message") /** * Identifier indicating whether the benefit was newly enrolled or updated. @@ -244,7 +243,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + fun name(): Optional = name.getOptional("name") /** * Returns the raw JSON value of [finchCode]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt index 4542936f..84e386cd 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt @@ -42,7 +42,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * Specifies the form type, indicating that this document is a 2005 W4 form. @@ -50,7 +50,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * The tax year this W4 document applies to. @@ -58,7 +58,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun year(): Optional = Optional.ofNullable(year.getNullable("year")) + fun year(): Optional = year.getOptional("year") /** * Returns the raw JSON value of [data]. @@ -261,7 +261,7 @@ private constructor( * server responded with an unexpected value). */ fun additionalWithholding(): Optional = - Optional.ofNullable(additionalWithholding.getNullable("additional_withholding")) + additionalWithholding.getOptional("additional_withholding") /** * Indicates exemption status from federal tax withholding. @@ -269,8 +269,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun exemption(): Optional = - Optional.ofNullable(exemption.getNullable("exemption")) + fun exemption(): Optional = exemption.getOptional("exemption") /** * The individual's filing status for tax purposes. @@ -278,8 +277,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun filingStatus(): Optional = - Optional.ofNullable(filingStatus.getNullable("filing_status")) + fun filingStatus(): Optional = filingStatus.getOptional("filing_status") /** * The unique identifier for the individual associated with this 2005 W4 form. @@ -287,8 +285,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun individualId(): Optional = individualId.getOptional("individual_id") /** * Total number of allowances claimed (in cents). @@ -297,7 +294,7 @@ private constructor( * server responded with an unexpected value). */ fun totalNumberOfAllowances(): Optional = - Optional.ofNullable(totalNumberOfAllowances.getNullable("total_number_of_allowances")) + totalNumberOfAllowances.getOptional("total_number_of_allowances") /** * Returns the raw JSON value of [additionalWithholding]. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt index e2c50e18..b6eeffd2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt @@ -42,7 +42,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + fun data(): Optional = data.getOptional("data") /** * Specifies the form type, indicating that this document is a 2020 W4 form. @@ -50,7 +50,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun type(): Optional = type.getOptional("type") /** * The tax year this W4 document applies to. @@ -58,7 +58,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun year(): Optional = Optional.ofNullable(year.getNullable("year")) + fun year(): Optional = year.getOptional("year") /** * Returns the raw JSON value of [data]. @@ -276,7 +276,7 @@ private constructor( * server responded with an unexpected value). */ fun amountForOtherDependents(): Optional = - Optional.ofNullable(amountForOtherDependents.getNullable("amount_for_other_dependents")) + amountForOtherDependents.getOptional("amount_for_other_dependents") /** * Amount claimed for dependents under 17 years old (in cents). @@ -285,10 +285,8 @@ private constructor( * server responded with an unexpected value). */ fun amountForQualifyingChildrenUnder17(): Optional = - Optional.ofNullable( - amountForQualifyingChildrenUnder17.getNullable( - "amount_for_qualifying_children_under_17" - ) + amountForQualifyingChildrenUnder17.getOptional( + "amount_for_qualifying_children_under_17" ) /** @@ -297,7 +295,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun deductions(): Optional = Optional.ofNullable(deductions.getNullable("deductions")) + fun deductions(): Optional = deductions.getOptional("deductions") /** * Additional withholding amount (in cents). @@ -305,8 +303,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun extraWithholding(): Optional = - Optional.ofNullable(extraWithholding.getNullable("extra_withholding")) + fun extraWithholding(): Optional = extraWithholding.getOptional("extra_withholding") /** * The individual's filing status for tax purposes. @@ -314,8 +311,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun filingStatus(): Optional = - Optional.ofNullable(filingStatus.getNullable("filing_status")) + fun filingStatus(): Optional = filingStatus.getOptional("filing_status") /** * The unique identifier for the individual associated with this document. @@ -323,8 +319,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun individualId(): Optional = individualId.getOptional("individual_id") /** * Additional income from sources outside of primary employment (in cents). @@ -332,8 +327,7 @@ private constructor( * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun otherIncome(): Optional = - Optional.ofNullable(otherIncome.getNullable("other_income")) + fun otherIncome(): Optional = otherIncome.getOptional("other_income") /** * Total amount claimed for dependents and other credits (in cents). @@ -342,10 +336,8 @@ private constructor( * server responded with an unexpected value). */ fun totalClaimDependentAndOtherCredits(): Optional = - Optional.ofNullable( - totalClaimDependentAndOtherCredits.getNullable( - "total_claim_dependent_and_other_credits" - ) + totalClaimDependentAndOtherCredits.getOptional( + "total_claim_dependent_and_other_credits" ) /** From 8b601dc398296e351a1f0590ef858063fec9f48a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 4 Apr 2025 21:16:50 +0000 Subject: [PATCH 59/65] fix(client): return `Optional` instead of `Optional` (#529) docs: add comments to `JsonField` classes --- .../kotlin/com/tryfinch/api/core/Values.kt | 237 ++++++++++++++++-- 1 file changed, 218 insertions(+), 19 deletions(-) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt index c6a96ebd..82a56e0e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt @@ -29,30 +29,51 @@ import java.io.InputStream import java.util.Objects import java.util.Optional +/** + * A class representing a serializable JSON field. + * + * It can either be a [KnownValue] value of type [T], matching the type the SDK expects, or an + * arbitrary JSON value that bypasses the type system (via [JsonValue]). + */ @JsonDeserialize(using = JsonField.Deserializer::class) sealed class JsonField { + /** + * Returns whether this field is missing, which means it will be omitted from the serialized + * JSON entirely. + */ fun isMissing(): Boolean = this is JsonMissing + /** Whether this field is explicitly set to `null`. */ fun isNull(): Boolean = this is JsonNull - fun asKnown(): Optional = - when (this) { - is KnownValue -> Optional.of(value) - else -> Optional.empty() - } + /** + * Returns an [Optional] containing this field's "known" value, meaning it matches the type the + * SDK expects, or an empty [Optional] if this field contains an arbitrary [JsonValue]. + * + * This is the opposite of [asUnknown]. + */ + fun asKnown(): + Optional< + // Safe because `Optional` is effectively covariant, but Kotlin doesn't know that. + @UnsafeVariance + T + > = Optional.ofNullable((this as? KnownValue)?.value) /** - * If the "known" value (i.e. matching the type that the SDK expects) is returned by the API - * then this method will return an empty `Optional`, otherwise the returned `Optional` is given - * a `JsonValue`. + * Returns an [Optional] containing this field's arbitrary [JsonValue], meaning it mismatches + * the type the SDK expects, or an empty [Optional] if this field contains a "known" value. + * + * This is the opposite of [asKnown]. */ - fun asUnknown(): Optional = - when (this) { - is JsonValue -> Optional.of(this) - else -> Optional.empty() - } + fun asUnknown(): Optional = Optional.ofNullable(this as? JsonValue) + /** + * Returns an [Optional] containing this field's boolean value, or an empty [Optional] if it + * doesn't contain a boolean. + * + * This method checks for both a [KnownValue] containing a boolean and for [JsonBoolean]. + */ fun asBoolean(): Optional = when (this) { is JsonBoolean -> Optional.of(value) @@ -60,6 +81,12 @@ sealed class JsonField { else -> Optional.empty() } + /** + * Returns an [Optional] containing this field's numerical value, or an empty [Optional] if it + * doesn't contain a number. + * + * This method checks for both a [KnownValue] containing a number and for [JsonNumber]. + */ fun asNumber(): Optional = when (this) { is JsonNumber -> Optional.of(value) @@ -67,6 +94,12 @@ sealed class JsonField { else -> Optional.empty() } + /** + * Returns an [Optional] containing this field's string value, or an empty [Optional] if it + * doesn't contain a string. + * + * This method checks for both a [KnownValue] containing a string and for [JsonString]. + */ fun asString(): Optional = when (this) { is JsonString -> Optional.of(value) @@ -77,6 +110,12 @@ sealed class JsonField { fun asStringOrThrow(): String = asString().orElseThrow { FinchInvalidDataException("Value is not a string") } + /** + * Returns an [Optional] containing this field's list value, or an empty [Optional] if it + * doesn't contain a list. + * + * This method checks for both a [KnownValue] containing a list and for [JsonArray]. + */ fun asArray(): Optional> = when (this) { is JsonArray -> Optional.of(values) @@ -95,6 +134,12 @@ sealed class JsonField { else -> Optional.empty() } + /** + * Returns an [Optional] containing this field's map value, or an empty [Optional] if it doesn't + * contain a map. + * + * This method checks for both a [KnownValue] containing a map and for [JsonObject]. + */ fun asObject(): Optional> = when (this) { is JsonObject -> Optional.of(values) @@ -132,7 +177,13 @@ sealed class JsonField { } @JvmSynthetic - internal fun getOptional(name: String): Optional<@UnsafeVariance T> = + internal fun getOptional( + name: String + ): Optional< + // Safe because `Optional` is effectively covariant, but Kotlin doesn't know that. + @UnsafeVariance + T + > = when (this) { is KnownValue -> Optional.of(value) is JsonMissing, @@ -147,21 +198,33 @@ sealed class JsonField { is JsonValue -> this } - @JvmSynthetic fun accept(consume: (T) -> Unit) = asKnown().ifPresent(consume) + @JvmSynthetic internal fun accept(consume: (T) -> Unit) = asKnown().ifPresent(consume) + /** Returns the result of calling the [visitor] method corresponding to this field's state. */ fun accept(visitor: Visitor): R = when (this) { is KnownValue -> visitor.visitKnown(value) is JsonValue -> accept(visitor as JsonValue.Visitor) } + /** + * An interface that defines how to map each possible state of a `JsonField` to a value of + * type [R]. + */ interface Visitor : JsonValue.Visitor { + fun visitKnown(value: T): R = visitDefault() } companion object { + + /** Returns a [JsonField] containing the given "known" [value]. */ @JvmStatic fun of(value: T): JsonField = KnownValue.of(value) + /** + * Returns a [JsonField] containing the given "known" [value], or [JsonNull] if [value] is + * null. + */ @JvmStatic fun ofNullable(value: T?): JsonField = when (value) { @@ -176,6 +239,7 @@ sealed class JsonField { * annotation. */ class IsMissing { + override fun equals(other: Any?): Boolean = other is JsonMissing override fun hashCode(): Int = Objects.hash() @@ -197,6 +261,12 @@ sealed class JsonField { } } +/** + * A class representing an arbitrary JSON value. + * + * It is immutable and assignable to any [JsonField], regardless of its expected type (i.e. its + * generic type argument). + */ @JsonDeserialize(using = JsonValue.Deserializer::class) sealed class JsonValue : JsonField() { @@ -204,6 +274,7 @@ sealed class JsonValue : JsonField() { fun convert(type: Class): R? = JSON_MAPPER.convertValue(this, type) + /** Returns the result of calling the [visitor] method corresponding to this value's variant. */ fun accept(visitor: Visitor): R = when (this) { is JsonMissing -> visitor.visitMissing() @@ -215,7 +286,12 @@ sealed class JsonValue : JsonField() { is JsonObject -> visitor.visitObject(values) } + /** + * An interface that defines how to map each variant state of a [JsonValue] to a value of type + * [R]. + */ interface Visitor { + fun visitNull(): R = visitDefault() fun visitMissing(): R = visitDefault() @@ -230,15 +306,52 @@ sealed class JsonValue : JsonField() { fun visitObject(values: Map): R = visitDefault() - fun visitDefault(): R { - throw RuntimeException("Unexpected value") - } + /** + * The default implementation for unimplemented visitor methods. + * + * @throws IllegalArgumentException in the default implementation. + */ + fun visitDefault(): R = throw IllegalArgumentException("Unexpected value") } companion object { private val JSON_MAPPER = jsonMapper() + /** + * Converts the given [value] to a [JsonValue]. + * + * This method works best on primitive types, [List] values, [Map] values, and nested + * combinations of these. For example: + * ```java + * // Create primitive JSON values + * JsonValue nullValue = JsonValue.from(null); + * JsonValue booleanValue = JsonValue.from(true); + * JsonValue numberValue = JsonValue.from(42); + * JsonValue stringValue = JsonValue.from("Hello World!"); + * + * // Create a JSON array value equivalent to `["Hello", "World"]` + * JsonValue arrayValue = JsonValue.from(List.of("Hello", "World")); + * + * // Create a JSON object value equivalent to `{ "a": 1, "b": 2 }` + * JsonValue objectValue = JsonValue.from(Map.of( + * "a", 1, + * "b", 2 + * )); + * + * // Create an arbitrarily nested JSON equivalent to: + * // { + * // "a": [1, 2], + * // "b": [3, 4] + * // } + * JsonValue complexValue = JsonValue.from(Map.of( + * "a", List.of(1, 2), + * "b", List.of(3, 4) + * )); + * ``` + * + * @throws IllegalArgumentException if [value] is not JSON serializable. + */ @JvmStatic fun from(value: Any?): JsonValue = when (value) { @@ -247,6 +360,11 @@ sealed class JsonValue : JsonField() { else -> JSON_MAPPER.convertValue(value, JsonValue::class.java) } + /** + * Returns a [JsonValue] converted from the given Jackson [JsonNode]. + * + * @throws IllegalStateException for unsupported node types. + */ @JvmStatic fun fromJsonNode(node: JsonNode): JsonValue = when (node.nodeType) { @@ -268,12 +386,19 @@ sealed class JsonValue : JsonField() { } class Deserializer : BaseDeserializer(JsonValue::class) { + override fun ObjectCodec.deserialize(node: JsonNode): JsonValue = fromJsonNode(node) override fun getNullValue(context: DeserializationContext?): JsonValue = JsonNull.of() } } +/** + * A class representing a "known" JSON serializable value of type [T], matching the type the SDK + * expects. + * + * It is assignable to `JsonField`. + */ class KnownValue private constructor( @com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: T @@ -292,44 +417,59 @@ private constructor( override fun toString() = value.contentToString() companion object { + + /** Returns a [KnownValue] containing the given [value]. */ @JsonCreator @JvmStatic fun of(value: T) = KnownValue(value) } } +/** + * A [JsonValue] representing an omitted JSON field. + * + * An instance of this class will cause a JSON field to be omitted from the serialized JSON + * entirely. + */ @JsonSerialize(using = JsonMissing.Serializer::class) class JsonMissing : JsonValue() { override fun toString() = "" companion object { + private val INSTANCE: JsonMissing = JsonMissing() + /** Returns the singleton instance of [JsonMissing]. */ @JvmStatic fun of() = INSTANCE } class Serializer : BaseSerializer(JsonMissing::class) { + override fun serialize( value: JsonMissing, generator: JsonGenerator, provider: SerializerProvider, ) { - throw RuntimeException("JsonMissing cannot be serialized") + throw IllegalStateException("JsonMissing cannot be serialized") } } } +/** A [JsonValue] representing a JSON `null` value. */ @JsonSerialize(using = NullSerializer::class) class JsonNull : JsonValue() { override fun toString() = "null" companion object { + private val INSTANCE: JsonNull = JsonNull() + /** Returns the singleton instance of [JsonMissing]. */ @JsonCreator @JvmStatic fun of() = INSTANCE } } +/** A [JsonValue] representing a JSON boolean value. */ class JsonBoolean private constructor( @get:com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: Boolean @@ -348,14 +488,18 @@ private constructor( override fun toString() = value.toString() companion object { + + /** Returns a [JsonBoolean] containing the given [value]. */ @JsonCreator @JvmStatic fun of(value: Boolean) = JsonBoolean(value) } } +/** A [JsonValue] representing a JSON number value. */ class JsonNumber private constructor( @get:com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: Number ) : JsonValue() { + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -369,10 +513,13 @@ private constructor( override fun toString() = value.toString() companion object { + + /** Returns a [JsonNumber] containing the given [value]. */ @JsonCreator @JvmStatic fun of(value: Number) = JsonNumber(value) } } +/** A [JsonValue] representing a JSON string value. */ class JsonString private constructor( @get:com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: String @@ -391,10 +538,13 @@ private constructor( override fun toString() = value companion object { + + /** Returns a [JsonString] containing the given [value]. */ @JsonCreator @JvmStatic fun of(value: String) = JsonString(value) } } +/** A [JsonValue] representing a JSON array value. */ class JsonArray private constructor( @get:com.fasterxml.jackson.annotation.JsonValue @@ -415,10 +565,13 @@ private constructor( override fun toString() = values.toString() companion object { + + /** Returns a [JsonArray] containing the given [values]. */ @JsonCreator @JvmStatic fun of(values: List) = JsonArray(values.toImmutable()) } } +/** A [JsonValue] representing a JSON object value. */ class JsonObject private constructor( @get:com.fasterxml.jackson.annotation.JsonValue @@ -439,32 +592,62 @@ private constructor( override fun toString() = values.toString() companion object { + + /** Returns a [JsonObject] containing the given [values]. */ @JsonCreator @JvmStatic fun of(values: Map) = JsonObject(values.toImmutable()) } } +/** A Jackson annotation for excluding fields set to [JsonMissing] from the serialized JSON. */ @JacksonAnnotationsInside @JsonInclude(JsonInclude.Include.CUSTOM, valueFilter = JsonField.IsMissing::class) annotation class ExcludeMissing +/** A class representing a field in a `multipart/form-data` request. */ class MultipartField private constructor( + /** A [JsonField] value, which will be serialized to zero or more parts. */ @get:com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: JsonField, + /** A content type for the serialized parts. */ @get:JvmName("contentType") val contentType: String, private val filename: String?, ) { companion object { + /** + * Returns a [MultipartField] containing the given [value] as a [KnownValue]. + * + * [contentType] will be set to `application/octet-stream` if [value] is binary data, or + * `text/plain; charset=utf-8` otherwise. + */ @JvmStatic fun of(value: T?) = builder().value(value).build() + /** + * Returns a [MultipartField] containing the given [value]. + * + * [contentType] will be set to `application/octet-stream` if [value] is binary data, or + * `text/plain; charset=utf-8` otherwise. + */ @JvmStatic fun of(value: JsonField) = builder().value(value).build() + /** + * Returns a mutable builder for constructing an instance of [MultipartField]. + * + * The following fields are required: + * ```java + * .value() + * ``` + * + * If [contentType] is unset, then it will be set to `application/octet-stream` if [value] + * is binary data, or `text/plain; charset=utf-8` otherwise. + */ @JvmStatic fun builder() = Builder() } + /** Returns the filename directive that will be included in the serialized field. */ fun filename(): Optional = Optional.ofNullable(filename) @JvmSynthetic @@ -486,8 +669,24 @@ private constructor( fun filename(filename: String?) = apply { this.filename = filename } + /** Alias for calling [Builder.filename] with `filename.orElse(null)`. */ fun filename(filename: Optional) = filename(filename.orElse(null)) + /** + * Returns an immutable instance of [MultipartField]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .value() + * ``` + * + * If [contentType] is unset, then it will be set to `application/octet-stream` if [value] + * is binary data, or `text/plain; charset=utf-8` otherwise. + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): MultipartField { val value = checkRequired("value", value) return MultipartField( From 7989f32f6893b9374514ccda99c88d8ab093bf11 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 4 Apr 2025 21:26:48 +0000 Subject: [PATCH 60/65] docs: swap examples used in readme (#530) docs: document how to forcibly omit required field --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 72ced69a..8ec3f795 100644 --- a/README.md +++ b/README.md @@ -439,6 +439,20 @@ JsonValue complexValue = JsonValue.from(Map.of( )); ``` +Normally a `Builder` class's `build` method will throw [`IllegalStateException`](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html) if any required parameter or property is unset. + +To forcibly omit a required parameter or property, pass [`JsonMissing`](finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt): + +```java +import com.tryfinch.api.core.JsonMissing; +import com.tryfinch.api.models.AccessTokenCreateParams; +import com.tryfinch.api.models.HrisDirectoryListParams; + +HrisDirectoryListParams params = AccessTokenCreateParams.builder() + .code(JsonMissing.of()) + .build(); +``` + ### Response properties To access undocumented response properties, call the `_additionalProperties()` method: From 433f15ad426ef4e24d4ca9c0bf7254d2b6a859bc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 4 Apr 2025 21:28:58 +0000 Subject: [PATCH 61/65] chore(internal): codegen related update (#531) --- .../api/models/HrisDirectoryListIndividualsPage.kt | 12 ++++++------ .../models/HrisDirectoryListIndividualsPageAsync.kt | 12 ++++++------ .../com/tryfinch/api/models/HrisDirectoryListPage.kt | 12 ++++++------ .../api/models/HrisDirectoryListPageAsync.kt | 12 ++++++------ 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt index 99eda4a8..3e7dd7da 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt @@ -32,7 +32,7 @@ private constructor( fun individuals(): List = response().individuals() - fun paging(): Optional = response().paging() + fun paging(): Paging = response().paging() override fun equals(other: Any?): Boolean { if (this === other) { @@ -52,8 +52,8 @@ private constructor( return false } - return paging().flatMap { it.offset() }.orElse(0) + individuals().count() < - paging().flatMap { it.count() }.orElse(Long.MAX_VALUE) + return paging().offset().orElse(0) + individuals().count() < + paging().count().orElse(Long.MAX_VALUE) } fun getNextPageParams(): Optional { @@ -64,7 +64,7 @@ private constructor( return Optional.of( HrisDirectoryListIndividualsParams.builder() .from(params) - .offset(paging().flatMap { it.offset() }.orElse(0) + individuals().count()) + .offset(paging().offset().orElse(0) + individuals().count()) .build() ) } @@ -101,7 +101,7 @@ private constructor( fun individuals(): List = individuals.getOptional("individuals").getOrNull() ?: listOf() - fun paging(): Optional = paging.getOptional("paging") + fun paging(): Paging = paging.getRequired("paging") @JsonProperty("individuals") fun _individuals(): Optional>> = @@ -128,7 +128,7 @@ private constructor( } individuals().map { it.validate() } - paging().ifPresent { it.validate() } + paging().validate() validated = true } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt index ba0af1df..cf3abdf6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt @@ -33,7 +33,7 @@ private constructor( fun individuals(): List = response().individuals() - fun paging(): Optional = response().paging() + fun paging(): Paging = response().paging() override fun equals(other: Any?): Boolean { if (this === other) { @@ -53,8 +53,8 @@ private constructor( return false } - return paging().flatMap { it.offset() }.orElse(0) + individuals().count() < - paging().flatMap { it.count() }.orElse(Long.MAX_VALUE) + return paging().offset().orElse(0) + individuals().count() < + paging().count().orElse(Long.MAX_VALUE) } fun getNextPageParams(): Optional { @@ -65,7 +65,7 @@ private constructor( return Optional.of( HrisDirectoryListIndividualsParams.builder() .from(params) - .offset(paging().flatMap { it.offset() }.orElse(0) + individuals().count()) + .offset(paging().offset().orElse(0) + individuals().count()) .build() ) } @@ -104,7 +104,7 @@ private constructor( fun individuals(): List = individuals.getOptional("individuals").getOrNull() ?: listOf() - fun paging(): Optional = paging.getOptional("paging") + fun paging(): Paging = paging.getRequired("paging") @JsonProperty("individuals") fun _individuals(): Optional>> = @@ -131,7 +131,7 @@ private constructor( } individuals().map { it.validate() } - paging().ifPresent { it.validate() } + paging().validate() validated = true } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt index 66637674..7f5dcd14 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt @@ -31,7 +31,7 @@ private constructor( fun individuals(): List = response().individuals() - fun paging(): Optional = response().paging() + fun paging(): Paging = response().paging() override fun equals(other: Any?): Boolean { if (this === other) { @@ -51,8 +51,8 @@ private constructor( return false } - return paging().flatMap { it.offset() }.orElse(0) + individuals().count() < - paging().flatMap { it.count() }.orElse(Long.MAX_VALUE) + return paging().offset().orElse(0) + individuals().count() < + paging().count().orElse(Long.MAX_VALUE) } fun getNextPageParams(): Optional { @@ -63,7 +63,7 @@ private constructor( return Optional.of( HrisDirectoryListParams.builder() .from(params) - .offset(paging().flatMap { it.offset() }.orElse(0) + individuals().count()) + .offset(paging().offset().orElse(0) + individuals().count()) .build() ) } @@ -100,7 +100,7 @@ private constructor( fun individuals(): List = individuals.getOptional("individuals").getOrNull() ?: listOf() - fun paging(): Optional = paging.getOptional("paging") + fun paging(): Paging = paging.getRequired("paging") @JsonProperty("individuals") fun _individuals(): Optional>> = @@ -127,7 +127,7 @@ private constructor( } individuals().map { it.validate() } - paging().ifPresent { it.validate() } + paging().validate() validated = true } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt index edb31921..44ea4e6e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt @@ -32,7 +32,7 @@ private constructor( fun individuals(): List = response().individuals() - fun paging(): Optional = response().paging() + fun paging(): Paging = response().paging() override fun equals(other: Any?): Boolean { if (this === other) { @@ -52,8 +52,8 @@ private constructor( return false } - return paging().flatMap { it.offset() }.orElse(0) + individuals().count() < - paging().flatMap { it.count() }.orElse(Long.MAX_VALUE) + return paging().offset().orElse(0) + individuals().count() < + paging().count().orElse(Long.MAX_VALUE) } fun getNextPageParams(): Optional { @@ -64,7 +64,7 @@ private constructor( return Optional.of( HrisDirectoryListParams.builder() .from(params) - .offset(paging().flatMap { it.offset() }.orElse(0) + individuals().count()) + .offset(paging().offset().orElse(0) + individuals().count()) .build() ) } @@ -103,7 +103,7 @@ private constructor( fun individuals(): List = individuals.getOptional("individuals").getOrNull() ?: listOf() - fun paging(): Optional = paging.getOptional("paging") + fun paging(): Paging = paging.getRequired("paging") @JsonProperty("individuals") fun _individuals(): Optional>> = @@ -130,7 +130,7 @@ private constructor( } individuals().map { it.validate() } - paging().ifPresent { it.validate() } + paging().validate() validated = true } From ecf62d02d2712f1107034ab0c5dfb6cb3d87e78e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 04:34:34 +0000 Subject: [PATCH 62/65] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 34a10d13..e3e52833 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: 2bca9e6b32f742acb077cf8822ec9e23 +config_hash: ce10384813f68ba3fed61c7b601b396b From 775392dc621cd9a1f297897b00aba7264c294e2a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 14:25:19 +0000 Subject: [PATCH 63/65] chore(tests): improve enum examples (#532) --- .../api/models/SandboxConnectionAccountUpdateParamsTest.kt | 6 +++--- .../async/sandbox/connections/AccountServiceAsyncTest.kt | 2 +- .../blocking/sandbox/connections/AccountServiceTest.kt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt index f7037d5f..702e7b3d 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt @@ -10,7 +10,7 @@ internal class SandboxConnectionAccountUpdateParamsTest { @Test fun create() { SandboxConnectionAccountUpdateParams.builder() - .connectionStatus(ConnectionStatusType.PENDING) + .connectionStatus(ConnectionStatusType.REAUTH) .build() } @@ -18,12 +18,12 @@ internal class SandboxConnectionAccountUpdateParamsTest { fun body() { val params = SandboxConnectionAccountUpdateParams.builder() - .connectionStatus(ConnectionStatusType.PENDING) + .connectionStatus(ConnectionStatusType.REAUTH) .build() val body = params._body() - assertThat(body.connectionStatus()).contains(ConnectionStatusType.PENDING) + assertThat(body.connectionStatus()).contains(ConnectionStatusType.REAUTH) } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncTest.kt index ade78aae..c45deebb 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncTest.kt @@ -50,7 +50,7 @@ internal class AccountServiceAsyncTest { val accountFuture = accountServiceAsync.update( SandboxConnectionAccountUpdateParams.builder() - .connectionStatus(ConnectionStatusType.PENDING) + .connectionStatus(ConnectionStatusType.REAUTH) .build() ) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceTest.kt index 487cbb79..5cf6c67d 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceTest.kt @@ -49,7 +49,7 @@ internal class AccountServiceTest { val account = accountService.update( SandboxConnectionAccountUpdateParams.builder() - .connectionStatus(ConnectionStatusType.PENDING) + .connectionStatus(ConnectionStatusType.REAUTH) .build() ) From 3ccd785da8291d41d74aa71bfaa604b5a38295b6 Mon Sep 17 00:00:00 2001 From: Samuel El-Borai Date: Tue, 8 Apr 2025 18:42:40 +0200 Subject: [PATCH 64/65] fix(tests): fix jackson attributes --- .../api/client/FinchClientAsyncImpl.kt | 22 +++++++++---------- .../tryfinch/api/client/FinchClientImpl.kt | 22 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsyncImpl.kt index 17dc6f2b..23a0f4e0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsyncImpl.kt @@ -178,20 +178,20 @@ class FinchClientAsyncImpl(private val clientOptions: ClientOptions) : FinchClie } private data class GetAccessTokenParams( - @JsonProperty("client_id") val clientId: String, - @JsonProperty("client_secret") val clientSecret: String, - @JsonProperty("code") val code: String, - @JsonProperty("redirect_uri") val redirectUri: String?, + @get:JsonProperty("client_id") val clientId: String, + @get:JsonProperty("client_secret") val clientSecret: String, + @get:JsonProperty("code") val code: String, + @get:JsonProperty("redirect_uri") val redirectUri: String?, ) private data class GetAccessTokenResponse( - @JsonProperty("access_token") val accessToken: String, - @JsonProperty("account_id") val accountId: String, - @JsonProperty("client_type") val clientType: String, - @JsonProperty("company_id") val companyId: String, - @JsonProperty("connection_type") val connectionType: String, - @JsonProperty("products") val products: List, - @JsonProperty("provider_id") val providerId: String, + @get:JsonProperty("access_token") val accessToken: String, + @get:JsonProperty("account_id") val accountId: String, + @get:JsonProperty("client_type") val clientType: String, + @get:JsonProperty("company_id") val companyId: String, + @get:JsonProperty("connection_type") val connectionType: String, + @get:JsonProperty("products") val products: List, + @get:JsonProperty("provider_id") val providerId: String, ) override fun close() = clientOptions.httpClient.close() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt index aa2b5c8d..766d1631 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt @@ -167,20 +167,20 @@ class FinchClientImpl(private val clientOptions: ClientOptions) : FinchClient { } private data class GetAccessTokenParams( - @JsonProperty("client_id") val clientId: String, - @JsonProperty("client_secret") val clientSecret: String, - @JsonProperty("code") val code: String, - @JsonProperty("redirect_uri") val redirectUri: String?, + @get:JsonProperty("client_id") val clientId: String, + @get:JsonProperty("client_secret") val clientSecret: String, + @get:JsonProperty("code") val code: String, + @get:JsonProperty("redirect_uri") val redirectUri: String?, ) private data class GetAccessTokenResponse( - @JsonProperty("access_token") val accessToken: String, - @JsonProperty("account_id") val accountId: String, - @JsonProperty("client_type") val clientType: String, - @JsonProperty("company_id") val companyId: String, - @JsonProperty("connection_type") val connectionType: String, - @JsonProperty("products") val products: List, - @JsonProperty("provider_id") val providerId: String, + @get:JsonProperty("access_token") val accessToken: String, + @get:JsonProperty("account_id") val accountId: String, + @get:JsonProperty("client_type") val clientType: String, + @get:JsonProperty("company_id") val companyId: String, + @get:JsonProperty("connection_type") val connectionType: String, + @get:JsonProperty("products") val products: List, + @get:JsonProperty("provider_id") val providerId: String, ) override fun close() = clientOptions.httpClient.close() From 1654b6db975e8c282d84186cf9dfae71d7af6986 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 16:46:58 +0000 Subject: [PATCH 65/65] release: 5.0.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 102 ++++++++++++++++++++++++++++++++++ README.md | 10 ++-- build.gradle.kts | 2 +- 4 files changed, 109 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index bd7f3844..8e76abb5 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.2.0" + ".": "5.0.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a4a094f3..be5fb27e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,107 @@ # Changelog +## 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) + +### ⚠ BREAKING CHANGES + +* **client:** refactor exception structure and methods ([#505](https://github.com/Finch-API/finch-api-java/issues/505)) +* **client:** refactor multipart formdata impl ([#473](https://github.com/Finch-API/finch-api-java/issues/473)) + +### Features + +* **api:** add new endpoints for pay statement items ([#526](https://github.com/Finch-API/finch-api-java/issues/526)) ([1ab19a3](https://github.com/Finch-API/finch-api-java/commit/1ab19a34148407ce143df4d49697af386e17f560)) +* **api:** api update ([#513](https://github.com/Finch-API/finch-api-java/issues/513)) ([5849824](https://github.com/Finch-API/finch-api-java/commit/5849824f4a7704255935cd6e13c1761427b8ca62)) +* **api:** api update ([#515](https://github.com/Finch-API/finch-api-java/issues/515)) ([dffd823](https://github.com/Finch-API/finch-api-java/commit/dffd823f5649b18ca44e06d5f0f8bcb68ba43879)) +* **api:** api update ([#517](https://github.com/Finch-API/finch-api-java/issues/517)) ([0123042](https://github.com/Finch-API/finch-api-java/commit/01230422dedfd1f4432fc84e4ed517eaf31319a9)) +* **api:** api update ([#520](https://github.com/Finch-API/finch-api-java/issues/520)) ([a6b3092](https://github.com/Finch-API/finch-api-java/commit/a6b3092d8ce9e17f78f267d36467ca2057e6ac1f)) +* **api:** api update ([#523](https://github.com/Finch-API/finch-api-java/issues/523)) ([842bb3f](https://github.com/Finch-API/finch-api-java/commit/842bb3fa15300004eea197bb5a8f57365f1eee78)) +* **api:** manual updates ([#477](https://github.com/Finch-API/finch-api-java/issues/477)) ([83f00bd](https://github.com/Finch-API/finch-api-java/commit/83f00bd2aadd9049da1d8365dfa9bdd03d52a159)) +* **api:** manual updates ([#527](https://github.com/Finch-API/finch-api-java/issues/527)) ([b5a2343](https://github.com/Finch-API/finch-api-java/commit/b5a2343b89278949689abdfb5b1303713ac57fbf)) +* **client:** accept `InputStream` and `Path` for file params ([#479](https://github.com/Finch-API/finch-api-java/issues/479)) ([721cd2c](https://github.com/Finch-API/finch-api-java/commit/721cd2c2696a8929f3b7bbe27ba5df82f872df4f)) +* **client:** add enum validation method ([1bd0c25](https://github.com/Finch-API/finch-api-java/commit/1bd0c2538ce50578fcd7ae51c944cdfb0736aa9b)) +* **client:** allow configuring timeouts granularly ([#470](https://github.com/Finch-API/finch-api-java/issues/470)) ([4d3b414](https://github.com/Finch-API/finch-api-java/commit/4d3b414c120045834dc829e12cbc185c88fe2764)) +* **client:** detect binary incompatible jackson versions ([#480](https://github.com/Finch-API/finch-api-java/issues/480)) ([fcf521a](https://github.com/Finch-API/finch-api-java/commit/fcf521a7e262ad96d7f3703114b221a4d2622d50)) +* **client:** expose request body setter and getter ([#524](https://github.com/Finch-API/finch-api-java/issues/524)) ([1b97fe6](https://github.com/Finch-API/finch-api-java/commit/1b97fe6e3dc9b0e83c9f267fd37e985258b958e5)) +* **client:** make datetime deserialization more lenient ([#522](https://github.com/Finch-API/finch-api-java/issues/522)) ([c7265b7](https://github.com/Finch-API/finch-api-java/commit/c7265b7fec4baacc24dba2415a9bb734731a46e3)) +* **client:** make union deserialization more robust ([#521](https://github.com/Finch-API/finch-api-java/issues/521)) ([1bd0c25](https://github.com/Finch-API/finch-api-java/commit/1bd0c2538ce50578fcd7ae51c944cdfb0736aa9b)) +* **client:** support a lower jackson version ([#512](https://github.com/Finch-API/finch-api-java/issues/512)) ([2897011](https://github.com/Finch-API/finch-api-java/commit/289701192191a42ca4f28eabb6ac73651f7d9909)) +* **client:** support raw response access ([#471](https://github.com/Finch-API/finch-api-java/issues/471)) ([481c99c](https://github.com/Finch-API/finch-api-java/commit/481c99cf2bc062b137c99a69bfce289c3e570a5a)) +* **client:** throw on incompatible jackson version ([2897011](https://github.com/Finch-API/finch-api-java/commit/289701192191a42ca4f28eabb6ac73651f7d9909)) +* generate and publish docs ([#481](https://github.com/Finch-API/finch-api-java/issues/481)) ([c5c4196](https://github.com/Finch-API/finch-api-java/commit/c5c4196d609a6db22887e580ad14323506f0aa2a)) + + +### Bug Fixes + +* **client:** don't call `validate()` during deserialization if we don't have to ([#516](https://github.com/Finch-API/finch-api-java/issues/516)) ([e988e9d](https://github.com/Finch-API/finch-api-java/commit/e988e9da5f57c5d201021842312fd60ae4c41ae1)) +* **client:** limit json deserialization coercion ([#518](https://github.com/Finch-API/finch-api-java/issues/518)) ([0bd7dd5](https://github.com/Finch-API/finch-api-java/commit/0bd7dd5974c4d30f0adc02b6af1f4f227d2c743e)) +* **client:** map deserialization bug ([8d03e6d](https://github.com/Finch-API/finch-api-java/commit/8d03e6dd61fa910bcd9788a58ad4cbd0141356ac)) +* **client:** return `Optional<T>` instead of `Optional` ([#529](https://github.com/Finch-API/finch-api-java/issues/529)) ([8b601dc](https://github.com/Finch-API/finch-api-java/commit/8b601dc398296e351a1f0590ef858063fec9f48a)) +* **client:** support kotlin 1.8 runtime ([#502](https://github.com/Finch-API/finch-api-java/issues/502)) ([0fb2cbc](https://github.com/Finch-API/finch-api-java/commit/0fb2cbc5711394b6f823e5e9c985cd64b11bbc21)) +* compilation error ([ebc6f30](https://github.com/Finch-API/finch-api-java/commit/ebc6f30543123460b1c6f297c6c1ad32453ff77c)) +* pluralize `list` response variables ([#519](https://github.com/Finch-API/finch-api-java/issues/519)) ([17c4e8f](https://github.com/Finch-API/finch-api-java/commit/17c4e8fbbf4698f67ddcfedb383d677e5e5a9d1d)) +* **tests:** fix jackson attributes ([3ccd785](https://github.com/Finch-API/finch-api-java/commit/3ccd785da8291d41d74aa71bfaa604b5a38295b6)) + + +### Performance Improvements + +* **client:** cached parsed type in `HttpResponseFor` ([#525](https://github.com/Finch-API/finch-api-java/issues/525)) ([16616bf](https://github.com/Finch-API/finch-api-java/commit/16616bf6a5dab5996375d41d9b8404fb2928ac89)) + + +### Chores + +* **client:** expose `Optional`, not nullable, from `ClientOptions` ([#476](https://github.com/Finch-API/finch-api-java/issues/476)) ([fc827bc](https://github.com/Finch-API/finch-api-java/commit/fc827bc6bd38e80bf7f09b241e559e46d7adcf2a)) +* **client:** refactor exception structure and methods ([#505](https://github.com/Finch-API/finch-api-java/issues/505)) ([4be4f06](https://github.com/Finch-API/finch-api-java/commit/4be4f068408cf19a55f8fcc1b64aac6fc24fd73d)) +* **client:** refactor multipart formdata impl ([#473](https://github.com/Finch-API/finch-api-java/issues/473)) ([7cb2a7f](https://github.com/Finch-API/finch-api-java/commit/7cb2a7f642d7bcaf67deec5d5f355682fe9b8e3e)) +* **client:** remove unnecessary json state from some query param classes ([1bd0c25](https://github.com/Finch-API/finch-api-java/commit/1bd0c2538ce50578fcd7ae51c944cdfb0736aa9b)) +* **internal:** add `.kotlin` to `.gitignore` ([#483](https://github.com/Finch-API/finch-api-java/issues/483)) ([473058a](https://github.com/Finch-API/finch-api-java/commit/473058a82d86a318c3c467d60e6cedfcd416fb22)) +* **internal:** add generated comment ([#496](https://github.com/Finch-API/finch-api-java/issues/496)) ([9543169](https://github.com/Finch-API/finch-api-java/commit/9543169b8b1af2c39666c6be1df6ea40f0e1a67f)) +* **internal:** add invalid json deserialization tests ([1bd0c25](https://github.com/Finch-API/finch-api-java/commit/1bd0c2538ce50578fcd7ae51c944cdfb0736aa9b)) +* **internal:** add json roundtripping tests ([1bd0c25](https://github.com/Finch-API/finch-api-java/commit/1bd0c2538ce50578fcd7ae51c944cdfb0736aa9b)) +* **internal:** add some tests for union classes ([#501](https://github.com/Finch-API/finch-api-java/issues/501)) ([4aff498](https://github.com/Finch-API/finch-api-java/commit/4aff4981754d9336e20b29713c5b95a03819dfec)) +* **internal:** codegen related update ([60e5c13](https://github.com/Finch-API/finch-api-java/commit/60e5c131ff4b41265efd39bff4c29a6c1a4df442)) +* **internal:** codegen related update ([#469](https://github.com/Finch-API/finch-api-java/issues/469)) ([a308954](https://github.com/Finch-API/finch-api-java/commit/a3089549cd0743446d2b906db5fcd830f579ddd8)) +* **internal:** codegen related update ([#488](https://github.com/Finch-API/finch-api-java/issues/488)) ([5742de2](https://github.com/Finch-API/finch-api-java/commit/5742de269c36314324b0fb8f4214efb87af09dff)) +* **internal:** codegen related update ([#504](https://github.com/Finch-API/finch-api-java/issues/504)) ([9be38e0](https://github.com/Finch-API/finch-api-java/commit/9be38e0fce500731d023902658ec0fa8926b27e1)) +* **internal:** codegen related update ([#531](https://github.com/Finch-API/finch-api-java/issues/531)) ([433f15a](https://github.com/Finch-API/finch-api-java/commit/433f15ad426ef4e24d4ca9c0bf7254d2b6a859bc)) +* **internal:** delete duplicate tests ([d1b1bd2](https://github.com/Finch-API/finch-api-java/commit/d1b1bd2847f0ffa069f9d9bce5702f093b129797)) +* **internal:** delete unused methods and annotations ([#514](https://github.com/Finch-API/finch-api-java/issues/514)) ([8d03e6d](https://github.com/Finch-API/finch-api-java/commit/8d03e6dd61fa910bcd9788a58ad4cbd0141356ac)) +* **internal:** don't use `JvmOverloads` in interfaces ([0d38744](https://github.com/Finch-API/finch-api-java/commit/0d387447276d8cbe1dad8c4ab69fc6d72e5b36d6)) +* **internal:** fix example formatting ([#508](https://github.com/Finch-API/finch-api-java/issues/508)) ([89c25c1](https://github.com/Finch-API/finch-api-java/commit/89c25c19eca3db5ef766e64e605291d6dad69d05)) +* **internal:** generate more tests ([35fd786](https://github.com/Finch-API/finch-api-java/commit/35fd7864ce86a276116c74475f5654579f5fd7a2)) +* **internal:** make multipart assertions more robust ([f0417a8](https://github.com/Finch-API/finch-api-java/commit/f0417a891f12e01d7040af3ccb07e13f07ca8034)) +* **internal:** make test classes internal ([#495](https://github.com/Finch-API/finch-api-java/issues/495)) ([2048a6a](https://github.com/Finch-API/finch-api-java/commit/2048a6a29711b2436894c0498bcd97c89ce7ac4c)) +* **internal:** reenable warnings as errors ([#485](https://github.com/Finch-API/finch-api-java/issues/485)) ([0d38744](https://github.com/Finch-API/finch-api-java/commit/0d387447276d8cbe1dad8c4ab69fc6d72e5b36d6)) +* **internal:** refactor enum query param serialization ([#503](https://github.com/Finch-API/finch-api-java/issues/503)) ([8894d83](https://github.com/Finch-API/finch-api-java/commit/8894d8307db6b7bdc92319b6f356addec96c64a5)) +* **internal:** refactor query param serialization impl and tests ([#498](https://github.com/Finch-API/finch-api-java/issues/498)) ([6da412b](https://github.com/Finch-API/finch-api-java/commit/6da412b3e388bc9034c4ec7bdfd5579657b39a47)) +* **internal:** refactor some test assertions ([d1b1bd2](https://github.com/Finch-API/finch-api-java/commit/d1b1bd2847f0ffa069f9d9bce5702f093b129797)) +* **internal:** reformat some tests ([#500](https://github.com/Finch-API/finch-api-java/issues/500)) ([35fd786](https://github.com/Finch-API/finch-api-java/commit/35fd7864ce86a276116c74475f5654579f5fd7a2)) +* **internal:** remove unnecessary `assertNotNull` calls ([f0417a8](https://github.com/Finch-API/finch-api-java/commit/f0417a891f12e01d7040af3ccb07e13f07ca8034)) +* **internal:** remove unnecessary import ([#509](https://github.com/Finch-API/finch-api-java/issues/509)) ([4b12e68](https://github.com/Finch-API/finch-api-java/commit/4b12e6826583668726201f446ccb63bd4e97d51c)) +* **internal:** rename `getPathParam` ([#499](https://github.com/Finch-API/finch-api-java/issues/499)) ([d1b1bd2](https://github.com/Finch-API/finch-api-java/commit/d1b1bd2847f0ffa069f9d9bce5702f093b129797)) +* **internal:** reorder some params methodsc ([d1b1bd2](https://github.com/Finch-API/finch-api-java/commit/d1b1bd2847f0ffa069f9d9bce5702f093b129797)) +* **internal:** swap from `getNullable` to `getOptional` ([#528](https://github.com/Finch-API/finch-api-java/issues/528)) ([70033bd](https://github.com/Finch-API/finch-api-java/commit/70033bd2f85bbb1cccefbff8eb86193f912e92c2)) +* **internal:** use `getOrNull` instead of `orElse(null)` ([#484](https://github.com/Finch-API/finch-api-java/issues/484)) ([9c0806b](https://github.com/Finch-API/finch-api-java/commit/9c0806b3134e745134ee74cbeda97d2e80584c57)) +* **tests:** improve enum examples ([#532](https://github.com/Finch-API/finch-api-java/issues/532)) ([775392d](https://github.com/Finch-API/finch-api-java/commit/775392dc621cd9a1f297897b00aba7264c294e2a)) + + +### Documentation + +* add `build` method comments ([#497](https://github.com/Finch-API/finch-api-java/issues/497)) ([d199989](https://github.com/Finch-API/finch-api-java/commit/d199989894e98456e329085b6904bc58f889bae6)) +* add comments to `JsonField` classes ([8b601dc](https://github.com/Finch-API/finch-api-java/commit/8b601dc398296e351a1f0590ef858063fec9f48a)) +* add raw response readme documentation ([#474](https://github.com/Finch-API/finch-api-java/issues/474)) ([81a5824](https://github.com/Finch-API/finch-api-java/commit/81a5824dbff19ae8328a747aed49dc5ea1fbc2c8)) +* deduplicate and refine comments ([#494](https://github.com/Finch-API/finch-api-java/issues/494)) ([651b10e](https://github.com/Finch-API/finch-api-java/commit/651b10e981e1c1e182fce79205176e637930473b)) +* document `JsonValue` construction in readme ([#487](https://github.com/Finch-API/finch-api-java/issues/487)) ([e790ad5](https://github.com/Finch-API/finch-api-java/commit/e790ad57e21491a0edcada3ae2d544f3ae7eb35e)) +* document how to forcibly omit required field ([7989f32](https://github.com/Finch-API/finch-api-java/commit/7989f32f6893b9374514ccda99c88d8ab093bf11)) +* minor readme tweak ([#511](https://github.com/Finch-API/finch-api-java/issues/511)) ([12e8d47](https://github.com/Finch-API/finch-api-java/commit/12e8d474f44c2e32c74eed6beb57a8fa2080de03)) +* note required fields in `builder` javadoc ([#475](https://github.com/Finch-API/finch-api-java/issues/475)) ([2d0c4c8](https://github.com/Finch-API/finch-api-java/commit/2d0c4c8f7d3b629db18937db95415474b10f8bc9)) +* refine comments on multipart params ([#507](https://github.com/Finch-API/finch-api-java/issues/507)) ([f0417a8](https://github.com/Finch-API/finch-api-java/commit/f0417a891f12e01d7040af3ccb07e13f07ca8034)) +* revise readme docs about nested params ([#486](https://github.com/Finch-API/finch-api-java/issues/486)) ([3682e62](https://github.com/Finch-API/finch-api-java/commit/3682e62316dcbac48b8c2a7e3b1df8f19ae5d96e)) +* swap examples used in readme ([#530](https://github.com/Finch-API/finch-api-java/issues/530)) ([7989f32](https://github.com/Finch-API/finch-api-java/commit/7989f32f6893b9374514ccda99c88d8ab093bf11)) +* update readme exception docs ([#510](https://github.com/Finch-API/finch-api-java/issues/510)) ([949341a](https://github.com/Finch-API/finch-api-java/commit/949341a607502df838f4c062d4a4afaaa4bdf2b8)) +* update URLs from stainlessapi.com to stainless.com ([#467](https://github.com/Finch-API/finch-api-java/issues/467)) ([238b853](https://github.com/Finch-API/finch-api-java/commit/238b853b930f203759499a7d9540c35b586a3915)) + ## 4.2.0 (2025-02-27) Full Changelog: [v4.1.0...v4.2.0](https://github.com/Finch-API/finch-api-java/compare/v4.1.0...v4.2.0) diff --git a/README.md b/README.md index 8ec3f795..e0b9c13b 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.tryfinch.api/finch-java)](https://central.sonatype.com/artifact/com.tryfinch.api/finch-java/4.2.0) -[![javadoc](https://javadoc.io/badge2/com.tryfinch.api/finch-java/4.2.0/javadoc.svg)](https://javadoc.io/doc/com.tryfinch.api/finch-java/4.2.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.tryfinch.api/finch-java)](https://central.sonatype.com/artifact/com.tryfinch.api/finch-java/5.0.0) +[![javadoc](https://javadoc.io/badge2/com.tryfinch.api/finch-java/5.0.0/javadoc.svg)](https://javadoc.io/doc/com.tryfinch.api/finch-java/5.0.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/4.2.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.0.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:4.2.0") +implementation("com.tryfinch.api:finch-java:5.0.0") ``` ### Maven @@ -35,7 +35,7 @@ implementation("com.tryfinch.api:finch-java:4.2.0") com.tryfinch.api finch-java - 4.2.0 + 5.0.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index a42af4d0..371fde06 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.tryfinch.api" - version = "4.2.0" // x-release-please-version + version = "5.0.0" // x-release-please-version } subprojects {