From 8ba4535d9e306abefab77119e6795f848567056e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 14 Jan 2025 04:19:51 +0000 Subject: [PATCH] chore(internal): extract a `checkRequired` function --- .../kotlin/com/tryfinch/api/core/Check.kt | 7 ++++ .../com/tryfinch/api/core/ClientOptions.kt | 2 +- .../api/models/AccessTokenCreateParams.kt | 3 +- .../api/models/AccountCreateResponse.kt | 18 ++++----- .../tryfinch/api/models/AccountUpdateEvent.kt | 15 ++++--- .../api/models/AccountUpdateResponse.kt | 14 +++---- .../tryfinch/api/models/AutomatedAsyncJob.kt | 17 ++++---- .../api/models/AutomatedCreateResponse.kt | 11 +++--- .../tryfinch/api/models/BaseWebhookEvent.kt | 5 ++- .../kotlin/com/tryfinch/api/models/Company.kt | 24 +++++------- .../com/tryfinch/api/models/CompanyBenefit.kt | 9 +++-- .../com/tryfinch/api/models/CompanyEvent.kt | 5 ++- .../api/models/CompanyUpdateResponse.kt | 22 +++++------ .../api/models/ConnectSessionNewParams.kt | 8 ++-- .../ConnectSessionReauthenticateParams.kt | 3 +- .../api/models/ConnectionCreateResponse.kt | 18 ++++----- .../api/models/CreateAccessTokenResponse.kt | 18 ++++----- .../models/CreateCompanyBenefitsResponse.kt | 3 +- .../com/tryfinch/api/models/DirectoryEvent.kt | 5 ++- .../tryfinch/api/models/DisconnectResponse.kt | 6 +-- .../api/models/DocumentListResponse.kt | 6 +-- .../tryfinch/api/models/EmploymentEvent.kt | 5 ++- .../HrisBenefitIndividualEnrolledIdsParams.kt | 3 +- ...fitIndividualRetrieveManyBenefitsParams.kt | 3 +- ...HrisBenefitIndividualUnenrollManyParams.kt | 3 +- .../api/models/HrisBenefitRetrieveParams.kt | 3 +- .../api/models/HrisBenefitUpdateParams.kt | 3 +- .../api/models/HrisDocumentRetreiveParams.kt | 3 +- .../HrisEmploymentRetrieveManyParams.kt | 6 +-- .../HrisPayStatementRetrieveManyParams.kt | 6 +-- .../api/models/HrisPaymentListParams.kt | 5 ++- .../models/IndividualEnrolledIdsResponse.kt | 6 +-- .../tryfinch/api/models/IndividualEvent.kt | 5 ++- .../com/tryfinch/api/models/Introspection.kt | 39 +++++++++---------- .../api/models/JobAutomatedCreateParams.kt | 10 ++--- .../api/models/JobAutomatedRetrieveParams.kt | 3 +- .../tryfinch/api/models/JobCompletionEvent.kt | 9 +++-- .../tryfinch/api/models/JobCreateResponse.kt | 11 +++--- .../api/models/JobManualRetrieveParams.kt | 3 +- .../com/tryfinch/api/models/ManualAsyncJob.kt | 8 ++-- .../api/models/PayGroupRetrieveResponse.kt | 11 +++--- .../tryfinch/api/models/PayStatementEvent.kt | 5 ++- .../api/models/PaymentCreateResponse.kt | 5 ++- .../com/tryfinch/api/models/PaymentEvent.kt | 9 +++-- .../models/PayrollPayGroupRetrieveParams.kt | 3 +- .../com/tryfinch/api/models/Provider.kt | 5 ++- .../models/RequestForwardingForwardParams.kt | 5 ++- .../RequestForwardingForwardResponse.kt | 19 ++++----- .../api/models/SandboxCompanyUpdateParams.kt | 22 +++++------ .../SandboxConnectionAccountCreateParams.kt | 5 ++- .../models/SandboxConnectionCreateParams.kt | 3 +- .../models/SandboxDirectoryCreateParams.kt | 3 +- .../models/SandboxEmploymentUpdateParams.kt | 3 +- .../models/SandboxIndividualUpdateParams.kt | 3 +- .../api/models/SandboxJobConfiguration.kt | 5 ++- .../SandboxJobConfigurationUpdateParams.kt | 7 ++-- .../api/models/SandboxJobCreateParams.kt | 3 +- .../tryfinch/api/models/SessionNewResponse.kt | 5 ++- .../models/SessionReauthenticateResponse.kt | 5 ++- .../models/UpdateCompanyBenefitResponse.kt | 3 +- 60 files changed, 248 insertions(+), 234 deletions(-) create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/core/Check.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 new file mode 100644 index 00000000..c9ed2c9e --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Check.kt @@ -0,0 +1,7 @@ +@file:JvmName("Check") + +package com.tryfinch.api.core + +@JvmSynthetic +internal fun checkRequired(name: String, value: T?): T = + checkNotNull(value) { "`$name` is required but was not set" } 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 b397c26c..66c4adbf 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 @@ -189,7 +189,7 @@ private constructor( } fun build(): ClientOptions { - checkNotNull(httpClient) { "`httpClient` is required but was not set" } + checkRequired("httpClient", httpClient) val headers = Headers.builder() val queryParams = QueryParams.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 5abaf293..27c72ddf 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 @@ -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.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap @@ -179,7 +180,7 @@ constructor( fun build(): AccessTokenCreateBody = AccessTokenCreateBody( - checkNotNull(code) { "`code` is required but was not set" }, + checkRequired("code", code), clientId, clientSecret, redirectUri, 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 d64a3586..efce62dc 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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -216,16 +217,13 @@ private constructor( fun build(): AccountCreateResponse = AccountCreateResponse( - checkNotNull(accessToken) { "`accessToken` is required but was not set" }, - checkNotNull(accountId) { "`accountId` is required but was not set" }, - checkNotNull(authenticationType) { - "`authenticationType` is required but was not set" - }, - checkNotNull(companyId) { "`companyId` is required but was not set" }, - checkNotNull(connectionId) { "`connectionId` is required but was not set" }, - checkNotNull(products) { "`products` is required but was not set" } - .map { it.toImmutable() }, - checkNotNull(providerId) { "`providerId` is required but was not set" }, + checkRequired("accessToken", accessToken), + checkRequired("accountId", accountId), + checkRequired("authenticationType", authenticationType), + checkRequired("companyId", companyId), + checkRequired("connectionId", connectionId), + checkRequired("products", products).map { it.toImmutable() }, + checkRequired("providerId", providerId), additionalProperties.toImmutable(), ) } 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 1ceaa994..ce76a63b 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -192,8 +193,8 @@ private constructor( fun build(): AccountUpdateEvent = AccountUpdateEvent( - checkNotNull(accountId) { "`accountId` is required but was not set" }, - checkNotNull(companyId) { "`companyId` is required but was not set" }, + checkRequired("accountId", accountId), + checkRequired("companyId", companyId), connectionId, data, eventType, @@ -297,10 +298,8 @@ private constructor( fun build(): Data = Data( - checkNotNull(authenticationMethod) { - "`authenticationMethod` is required but was not set" - }, - checkNotNull(status) { "`status` is required but was not set" }, + checkRequired("authenticationMethod", authenticationMethod), + checkRequired("status", status), additionalProperties.toImmutable(), ) } @@ -4443,8 +4442,8 @@ private constructor( fun build(): Paging = Paging( - checkNotNull(count) { "`count` is required but was not set" }, - checkNotNull(offset) { "`offset` is required but was not set" }, + checkRequired("count", count), + checkRequired("offset", offset), 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 a1dbb439..be41f1f3 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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -202,14 +203,11 @@ private constructor( fun build(): AccountUpdateResponse = AccountUpdateResponse( - checkNotNull(accountId) { "`accountId` is required but was not set" }, - checkNotNull(authenticationType) { - "`authenticationType` is required but was not set" - }, - checkNotNull(companyId) { "`companyId` is required but was not set" }, - checkNotNull(products) { "`products` is required but was not set" } - .map { it.toImmutable() }, - checkNotNull(providerId) { "`providerId` is required but was not set" }, + checkRequired("accountId", accountId), + checkRequired("authenticationType", authenticationType), + checkRequired("companyId", companyId), + checkRequired("products", products).map { it.toImmutable() }, + checkRequired("providerId", providerId), connectionId, additionalProperties.toImmutable(), ) 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 a59d00b6..cf1a2867 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -273,14 +274,14 @@ private constructor( fun build(): AutomatedAsyncJob = AutomatedAsyncJob( - checkNotNull(completedAt) { "`completedAt` is required but was not set" }, - checkNotNull(createdAt) { "`createdAt` is required but was not set" }, - checkNotNull(jobId) { "`jobId` is required but was not set" }, - checkNotNull(jobUrl) { "`jobUrl` is required but was not set" }, - checkNotNull(scheduledAt) { "`scheduledAt` is required but was not set" }, - checkNotNull(startedAt) { "`startedAt` is required but was not set" }, - checkNotNull(status) { "`status` is required but was not set" }, - checkNotNull(type) { "`type` is required but was not set" }, + checkRequired("completedAt", completedAt), + checkRequired("createdAt", createdAt), + checkRequired("jobId", jobId), + checkRequired("jobUrl", jobUrl), + checkRequired("scheduledAt", scheduledAt), + checkRequired("startedAt", startedAt), + checkRequired("status", status), + checkRequired("type", type), 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 92229902..293e6c1a 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects @@ -153,12 +154,10 @@ private constructor( fun build(): AutomatedCreateResponse = AutomatedCreateResponse( - checkNotNull(allowedRefreshes) { "`allowedRefreshes` is required but was not set" }, - checkNotNull(jobId) { "`jobId` is required but was not set" }, - checkNotNull(jobUrl) { "`jobUrl` is required but was not set" }, - checkNotNull(remainingRefreshes) { - "`remainingRefreshes` is required but was not set" - }, + checkRequired("allowedRefreshes", allowedRefreshes), + checkRequired("jobId", jobId), + checkRequired("jobUrl", jobUrl), + checkRequired("remainingRefreshes", remainingRefreshes), additionalProperties.toImmutable(), ) } 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 56f0ffa0..82b53692 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects @@ -157,8 +158,8 @@ private constructor( fun build(): BaseWebhookEvent = BaseWebhookEvent( - checkNotNull(accountId) { "`accountId` is required but was not set" }, - checkNotNull(companyId) { "`companyId` is required but was not set" }, + checkRequired("accountId", accountId), + checkRequired("companyId", companyId), connectionId, additionalProperties.toImmutable(), ) 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 f24527b1..62c19e2a 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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -320,20 +321,15 @@ private constructor( fun build(): Company = Company( - checkNotNull(id) { "`id` is required but was not set" }, - checkNotNull(accounts) { "`accounts` is required but was not set" } - .map { it.toImmutable() }, - checkNotNull(departments) { "`departments` is required but was not set" } - .map { it.toImmutable() }, - checkNotNull(ein) { "`ein` is required but was not set" }, - checkNotNull(entity) { "`entity` is required but was not set" }, - checkNotNull(legalName) { "`legalName` is required but was not set" }, - checkNotNull(locations) { "`locations` is required but was not set" } - .map { it.toImmutable() }, - checkNotNull(primaryEmail) { "`primaryEmail` is required but was not set" }, - checkNotNull(primaryPhoneNumber) { - "`primaryPhoneNumber` is required but was not set" - }, + checkRequired("id", id), + 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(), ) } 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 a24c26fa..381aeb52 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects @@ -145,10 +146,10 @@ private constructor( fun build(): CompanyBenefit = CompanyBenefit( - checkNotNull(benefitId) { "`benefitId` is required but was not set" }, - checkNotNull(description) { "`description` is required but was not set" }, - checkNotNull(frequency) { "`frequency` is required but was not set" }, - checkNotNull(type) { "`type` is required but was not set" }, + checkRequired("benefitId", benefitId), + checkRequired("description", description), + checkRequired("frequency", frequency), + checkRequired("type", type), additionalProperties.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 23900709..e2427d65 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.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 @@ -194,8 +195,8 @@ private constructor( fun build(): CompanyEvent = CompanyEvent( - checkNotNull(accountId) { "`accountId` is required but was not set" }, - checkNotNull(companyId) { "`companyId` is required but was not set" }, + checkRequired("accountId", accountId), + checkRequired("companyId", companyId), connectionId, data, eventType, 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 d2996de6..ad30f63e 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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -304,19 +305,14 @@ private constructor( fun build(): CompanyUpdateResponse = CompanyUpdateResponse( - checkNotNull(accounts) { "`accounts` is required but was not set" } - .map { it.toImmutable() }, - checkNotNull(departments) { "`departments` is required but was not set" } - .map { it.toImmutable() }, - checkNotNull(ein) { "`ein` is required but was not set" }, - checkNotNull(entity) { "`entity` is required but was not set" }, - checkNotNull(legalName) { "`legalName` is required but was not set" }, - checkNotNull(locations) { "`locations` is required but was not set" } - .map { it.toImmutable() }, - checkNotNull(primaryEmail) { "`primaryEmail` is required but was not set" }, - checkNotNull(primaryPhoneNumber) { - "`primaryPhoneNumber` is required but was not set" - }, + 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(), ) } 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 4c08293a..78694de4 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 @@ -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.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap @@ -353,10 +354,9 @@ constructor( fun build(): ConnectSessionNewBody = ConnectSessionNewBody( - checkNotNull(customerId) { "`customerId` is required but was not set" }, - checkNotNull(customerName) { "`customerName` is required but was not set" }, - checkNotNull(products) { "`products` is required but was not set" } - .map { it.toImmutable() }, + checkRequired("customerId", customerId), + checkRequired("customerName", customerName), + checkRequired("products", products).map { it.toImmutable() }, customerEmail, integration, manual, 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 d711a92f..0ca21168 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 @@ -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.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap @@ -263,7 +264,7 @@ constructor( fun build(): ConnectSessionReauthenticateBody = ConnectSessionReauthenticateBody( - checkNotNull(connectionId) { "`connectionId` is required but was not set" }, + checkRequired("connectionId", connectionId), minutesToExpire, (products ?: JsonMissing.of()).map { it.toImmutable() }, redirectUri, 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 24db38fe..5388fa64 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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -231,16 +232,13 @@ private constructor( fun build(): ConnectionCreateResponse = ConnectionCreateResponse( - checkNotNull(accessToken) { "`accessToken` is required but was not set" }, - checkNotNull(accountId) { "`accountId` is required but was not set" }, - checkNotNull(authenticationType) { - "`authenticationType` is required but was not set" - }, - checkNotNull(companyId) { "`companyId` is required but was not set" }, - checkNotNull(connectionId) { "`connectionId` is required but was not set" }, - checkNotNull(products) { "`products` is required but was not set" } - .map { it.toImmutable() }, - checkNotNull(providerId) { "`providerId` is required but was not set" }, + checkRequired("accessToken", accessToken), + checkRequired("accountId", accountId), + checkRequired("authenticationType", authenticationType), + checkRequired("companyId", companyId), + checkRequired("connectionId", connectionId), + checkRequired("products", products).map { it.toImmutable() }, + checkRequired("providerId", providerId), tokenType, additionalProperties.toImmutable(), ) 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 52cd5ae2..8c56f481 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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -327,15 +328,14 @@ private constructor( fun build(): CreateAccessTokenResponse = CreateAccessTokenResponse( - checkNotNull(accessToken) { "`accessToken` is required but was not set" }, - checkNotNull(accountId) { "`accountId` is required but was not set" }, - checkNotNull(clientType) { "`clientType` is required but was not set" }, - checkNotNull(companyId) { "`companyId` is required but was not set" }, - checkNotNull(connectionId) { "`connectionId` is required but was not set" }, - checkNotNull(connectionType) { "`connectionType` is required but was not set" }, - checkNotNull(products) { "`products` is required but was not set" } - .map { it.toImmutable() }, - checkNotNull(providerId) { "`providerId` is required but was not set" }, + checkRequired("accessToken", accessToken), + checkRequired("accountId", accountId), + checkRequired("clientType", clientType), + checkRequired("companyId", companyId), + checkRequired("connectionId", connectionId), + checkRequired("connectionType", connectionType), + checkRequired("products", products).map { it.toImmutable() }, + checkRequired("providerId", providerId), customerId, tokenType, additionalProperties.toImmutable(), 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 898117a4..da7490db 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects @@ -87,7 +88,7 @@ private constructor( fun build(): CreateCompanyBenefitsResponse = CreateCompanyBenefitsResponse( - checkNotNull(benefitId) { "`benefitId` is required but was not set" }, + checkRequired("benefitId", benefitId), additionalProperties.toImmutable() ) } 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 e7f3f0d7..c693180a 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -192,8 +193,8 @@ private constructor( fun build(): DirectoryEvent = DirectoryEvent( - checkNotNull(accountId) { "`accountId` is required but was not set" }, - checkNotNull(companyId) { "`companyId` is required but was not set" }, + checkRequired("accountId", accountId), + checkRequired("companyId", companyId), connectionId, data, eventType, 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 5fc23c15..2ff9bfc4 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects @@ -90,10 +91,7 @@ private constructor( } fun build(): DisconnectResponse = - DisconnectResponse( - checkNotNull(status) { "`status` is required but was not set" }, - additionalProperties.toImmutable() - ) + DisconnectResponse(checkRequired("status", status), additionalProperties.toImmutable()) } 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 62291a63..4ff140ee 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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects @@ -118,9 +119,8 @@ private constructor( fun build(): DocumentListResponse = DocumentListResponse( - checkNotNull(documents) { "`documents` is required but was not set" } - .map { it.toImmutable() }, - checkNotNull(paging) { "`paging` is required but was not set" }, + checkRequired("documents", documents).map { it.toImmutable() }, + checkRequired("paging", paging), 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 c6559f15..6ce4f494 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -192,8 +193,8 @@ private constructor( fun build(): EmploymentEvent = EmploymentEvent( - checkNotNull(accountId) { "`accountId` is required but was not set" }, - checkNotNull(companyId) { "`companyId` is required but was not set" }, + checkRequired("accountId", accountId), + checkRequired("companyId", companyId), connectionId, data, eventType, 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 1b2fd5e8..7f09475f 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 @@ -3,6 +3,7 @@ package com.tryfinch.api.models import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import java.util.Objects @@ -158,7 +159,7 @@ constructor( fun build(): HrisBenefitIndividualEnrolledIdsParams = HrisBenefitIndividualEnrolledIdsParams( - checkNotNull(benefitId) { "`benefitId` is required but was not set" }, + checkRequired("benefitId", benefitId), additionalHeaders.build(), additionalQueryParams.build(), ) 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 c49601d4..75c438f9 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 @@ -3,6 +3,7 @@ package com.tryfinch.api.models import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import java.util.Objects @@ -189,7 +190,7 @@ constructor( fun build(): HrisBenefitIndividualRetrieveManyBenefitsParams = HrisBenefitIndividualRetrieveManyBenefitsParams( - checkNotNull(benefitId) { "`benefitId` is required but was not set" }, + checkRequired("benefitId", benefitId), individualIds, additionalHeaders.build(), additionalQueryParams.build(), 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 07a84050..af928445 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 @@ -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.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap @@ -338,7 +339,7 @@ constructor( fun build(): HrisBenefitIndividualUnenrollManyParams = HrisBenefitIndividualUnenrollManyParams( - checkNotNull(benefitId) { "`benefitId` is required but was not set" }, + checkRequired("benefitId", benefitId), body.build(), additionalHeaders.build(), additionalQueryParams.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 d9f46dfa..04fbb7a0 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 @@ -3,6 +3,7 @@ package com.tryfinch.api.models import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import java.util.Objects @@ -155,7 +156,7 @@ constructor( fun build(): HrisBenefitRetrieveParams = HrisBenefitRetrieveParams( - checkNotNull(benefitId) { "`benefitId` is required but was not set" }, + checkRequired("benefitId", benefitId), additionalHeaders.build(), additionalQueryParams.build(), ) 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 d6faf2b7..6b4f3c67 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 @@ -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.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap @@ -306,7 +307,7 @@ constructor( fun build(): HrisBenefitUpdateParams = HrisBenefitUpdateParams( - checkNotNull(benefitId) { "`benefitId` is required but was not set" }, + checkRequired("benefitId", benefitId), body.build(), additionalHeaders.build(), additionalQueryParams.build(), 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 8b4bdc2d..a49db4ef 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 @@ -3,6 +3,7 @@ package com.tryfinch.api.models import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import java.util.Objects @@ -158,7 +159,7 @@ constructor( fun build(): HrisDocumentRetreiveParams = HrisDocumentRetreiveParams( - checkNotNull(documentId) { "`documentId` is required but was not set" }, + checkRequired("documentId", documentId), additionalHeaders.build(), additionalQueryParams.build(), ) 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 b38f3a04..4e03f950 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 @@ -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.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap @@ -141,8 +142,7 @@ constructor( fun build(): HrisEmploymentRetrieveManyBody = HrisEmploymentRetrieveManyBody( - checkNotNull(requests) { "`requests` is required but was not set" } - .map { it.toImmutable() }, + checkRequired("requests", requests).map { it.toImmutable() }, additionalProperties.toImmutable() ) } @@ -420,7 +420,7 @@ constructor( fun build(): Request = Request( - checkNotNull(individualId) { "`individualId` is required but was not set" }, + checkRequired("individualId", individualId), 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 4a6cb4e4..eccab1d2 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 @@ -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.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap @@ -145,8 +146,7 @@ constructor( fun build(): HrisPayStatementRetrieveManyBody = HrisPayStatementRetrieveManyBody( - checkNotNull(requests) { "`requests` is required but was not set" } - .map { it.toImmutable() }, + checkRequired("requests", requests).map { it.toImmutable() }, additionalProperties.toImmutable() ) } @@ -440,7 +440,7 @@ constructor( fun build(): Request = Request( - checkNotNull(paymentId) { "`paymentId` is required but was not set" }, + checkRequired("paymentId", paymentId), limit, offset, 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 2d372bb9..01635c0c 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 @@ -3,6 +3,7 @@ package com.tryfinch.api.models import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import java.time.LocalDate @@ -167,8 +168,8 @@ constructor( fun build(): HrisPaymentListParams = HrisPaymentListParams( - checkNotNull(endDate) { "`endDate` is required but was not set" }, - checkNotNull(startDate) { "`startDate` is required but was not set" }, + checkRequired("endDate", endDate), + checkRequired("startDate", startDate), additionalHeaders.build(), additionalQueryParams.build(), ) 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 76b076bf..c3839a26 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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects @@ -118,9 +119,8 @@ private constructor( fun build(): IndividualEnrolledIdsResponse = IndividualEnrolledIdsResponse( - checkNotNull(benefitId) { "`benefitId` is required but was not set" }, - checkNotNull(individualIds) { "`individualIds` is required but was not set" } - .map { it.toImmutable() }, + checkRequired("benefitId", benefitId), + checkRequired("individualIds", individualIds).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } 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 955fa1f4..b5ed002c 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -192,8 +193,8 @@ private constructor( fun build(): IndividualEvent = IndividualEvent( - checkNotNull(accountId) { "`accountId` is required but was not set" }, - checkNotNull(companyId) { "`companyId` is required but was not set" }, + checkRequired("accountId", accountId), + checkRequired("companyId", companyId), connectionId, data, eventType, 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 6c7fb3d0..0d895fa3 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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -541,28 +542,24 @@ private constructor( fun build(): Introspection = Introspection( - checkNotNull(accountId) { "`accountId` is required but was not set" }, - checkNotNull(authenticationMethods) { - "`authenticationMethods` is required but was not set" - } - .map { it.toImmutable() }, - checkNotNull(clientId) { "`clientId` is required but was not set" }, - checkNotNull(clientType) { "`clientType` is required but was not set" }, - checkNotNull(companyId) { "`companyId` is required but was not set" }, - checkNotNull(connectionId) { "`connectionId` is required but was not set" }, - checkNotNull(connectionStatus) { "`connectionStatus` is required but was not set" }, - checkNotNull(connectionType) { "`connectionType` is required but was not set" }, - checkNotNull(customerEmail) { "`customerEmail` is required but was not set" }, - checkNotNull(customerId) { "`customerId` is required but was not set" }, - checkNotNull(customerName) { "`customerName` is required but was not set" }, - checkNotNull(manual) { "`manual` is required but was not set" }, - checkNotNull(payrollProviderId) { - "`payrollProviderId` is required but was not set" + checkRequired("accountId", accountId), + checkRequired("authenticationMethods", authenticationMethods).map { + it.toImmutable() }, - checkNotNull(products) { "`products` is required but was not set" } - .map { it.toImmutable() }, - checkNotNull(providerId) { "`providerId` is required but was not set" }, - checkNotNull(username) { "`username` is required but was not set" }, + checkRequired("clientId", clientId), + checkRequired("clientType", clientType), + checkRequired("companyId", companyId), + checkRequired("connectionId", connectionId), + checkRequired("connectionStatus", connectionStatus), + checkRequired("connectionType", connectionType), + checkRequired("customerEmail", customerEmail), + checkRequired("customerId", customerId), + checkRequired("customerName", customerName), + checkRequired("manual", manual), + checkRequired("payrollProviderId", payrollProviderId), + checkRequired("products", products).map { it.toImmutable() }, + checkRequired("providerId", providerId), + checkRequired("username", username), 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 0f378e5c..40d37449 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 @@ -21,6 +21,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.checkRequired import com.tryfinch.api.core.getOrThrow import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams @@ -392,10 +393,7 @@ constructor( } fun build(): DataSyncAll = - DataSyncAll( - checkNotNull(type) { "`type` is required but was not set" }, - additionalProperties.toImmutable() - ) + DataSyncAll(checkRequired("type", type), additionalProperties.toImmutable()) } class Type @@ -564,8 +562,8 @@ constructor( fun build(): W4FormEmployeeSync = W4FormEmployeeSync( - checkNotNull(individualId) { "`individualId` is required but was not set" }, - checkNotNull(type) { "`type` is required but was not set" }, + checkRequired("individualId", individualId), + checkRequired("type", type), additionalProperties.toImmutable(), ) } 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 1291d0a0..f813df98 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 @@ -3,6 +3,7 @@ package com.tryfinch.api.models import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import java.util.Objects @@ -155,7 +156,7 @@ constructor( fun build(): JobAutomatedRetrieveParams = JobAutomatedRetrieveParams( - checkNotNull(jobId) { "`jobId` is required but was not set" }, + checkRequired("jobId", jobId), additionalHeaders.build(), additionalQueryParams.build(), ) 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 72e8e56b..41c67607 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -192,8 +193,8 @@ private constructor( fun build(): JobCompletionEvent = JobCompletionEvent( - checkNotNull(accountId) { "`accountId` is required but was not set" }, - checkNotNull(companyId) { "`companyId` is required but was not set" }, + checkRequired("accountId", accountId), + checkRequired("companyId", companyId), connectionId, data, eventType, @@ -296,8 +297,8 @@ private constructor( fun build(): Data = Data( - checkNotNull(jobId) { "`jobId` is required but was not set" }, - checkNotNull(jobUrl) { "`jobUrl` is required but was not set" }, + checkRequired("jobId", jobId), + checkRequired("jobUrl", jobUrl), additionalProperties.toImmutable(), ) } 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 53762ca1..7504491e 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects @@ -153,12 +154,10 @@ private constructor( fun build(): JobCreateResponse = JobCreateResponse( - checkNotNull(allowedRefreshes) { "`allowedRefreshes` is required but was not set" }, - checkNotNull(jobId) { "`jobId` is required but was not set" }, - checkNotNull(jobUrl) { "`jobUrl` is required but was not set" }, - checkNotNull(remainingRefreshes) { - "`remainingRefreshes` is required but was not set" - }, + checkRequired("allowedRefreshes", allowedRefreshes), + checkRequired("jobId", jobId), + checkRequired("jobUrl", jobUrl), + checkRequired("remainingRefreshes", remainingRefreshes), additionalProperties.toImmutable(), ) } 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 fdab14f7..55f75456 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 @@ -3,6 +3,7 @@ package com.tryfinch.api.models import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import java.util.Objects @@ -158,7 +159,7 @@ constructor( fun build(): JobManualRetrieveParams = JobManualRetrieveParams( - checkNotNull(jobId) { "`jobId` is required but was not set" }, + checkRequired("jobId", jobId), additionalHeaders.build(), additionalQueryParams.build(), ) 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 aacdf0d4..09fb403b 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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -139,10 +140,9 @@ private constructor( fun build(): ManualAsyncJob = ManualAsyncJob( - checkNotNull(body) { "`body` is required but was not set" } - .map { it.toImmutable() }, - checkNotNull(jobId) { "`jobId` is required but was not set" }, - checkNotNull(status) { "`status` is required but was not set" }, + checkRequired("body", body).map { it.toImmutable() }, + checkRequired("jobId", jobId), + checkRequired("status", status), additionalProperties.toImmutable(), ) } 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 84610199..b5b3dfeb 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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -175,12 +176,10 @@ private constructor( fun build(): PayGroupRetrieveResponse = PayGroupRetrieveResponse( - checkNotNull(id) { "`id` is required but was not set" }, - checkNotNull(individualIds) { "`individualIds` is required but was not set" } - .map { it.toImmutable() }, - checkNotNull(name) { "`name` is required but was not set" }, - checkNotNull(payFrequencies) { "`payFrequencies` is required but was not set" } - .map { it.toImmutable() }, + checkRequired("id", id), + checkRequired("individualIds", individualIds).map { it.toImmutable() }, + checkRequired("name", name), + checkRequired("payFrequencies", payFrequencies).map { it.toImmutable() }, 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 4bd724fc..c3f914ec 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -192,8 +193,8 @@ private constructor( fun build(): PayStatementEvent = PayStatementEvent( - checkNotNull(accountId) { "`accountId` is required but was not set" }, - checkNotNull(companyId) { "`companyId` is required but was not set" }, + checkRequired("accountId", accountId), + checkRequired("companyId", companyId), connectionId, data, eventType, 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 ab46011a..d3727c4e 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects @@ -109,8 +110,8 @@ private constructor( fun build(): PaymentCreateResponse = PaymentCreateResponse( - checkNotNull(payDate) { "`payDate` is required but was not set" }, - checkNotNull(paymentId) { "`paymentId` is required but was not set" }, + checkRequired("payDate", payDate), + checkRequired("paymentId", paymentId), additionalProperties.toImmutable(), ) } 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 2724e13c..9ad66bb5 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -194,8 +195,8 @@ private constructor( fun build(): PaymentEvent = PaymentEvent( - checkNotNull(accountId) { "`accountId` is required but was not set" }, - checkNotNull(companyId) { "`companyId` is required but was not set" }, + checkRequired("accountId", accountId), + checkRequired("companyId", companyId), connectionId, data, eventType, @@ -298,8 +299,8 @@ private constructor( fun build(): PaymentIdentifiers = PaymentIdentifiers( - checkNotNull(payDate) { "`payDate` is required but was not set" }, - checkNotNull(paymentId) { "`paymentId` is required but was not set" }, + checkRequired("payDate", payDate), + checkRequired("paymentId", paymentId), additionalProperties.toImmutable(), ) } 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 b355cb27..4078307d 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 @@ -3,6 +3,7 @@ package com.tryfinch.api.models import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import java.util.Objects @@ -155,7 +156,7 @@ constructor( fun build(): PayrollPayGroupRetrieveParams = PayrollPayGroupRetrieveParams( - checkNotNull(payGroupId) { "`payGroupId` is required but was not set" }, + checkRequired("payGroupId", payGroupId), additionalHeaders.build(), additionalQueryParams.build(), ) 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 baf139c6..19d9ece5 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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -4327,8 +4328,8 @@ private constructor( fun build(): Paging = Paging( - checkNotNull(count) { "`count` is required but was not set" }, - checkNotNull(offset) { "`offset` is required but was not set" }, + checkRequired("count", count), + checkRequired("offset", offset), additionalProperties.toImmutable(), ) } 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 ad5e0e4b..f2061a30 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 @@ -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.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap @@ -282,8 +283,8 @@ constructor( fun build(): RequestForwardingForwardBody = RequestForwardingForwardBody( - checkNotNull(method) { "`method` is required but was not set" }, - checkNotNull(route) { "`route` is required but was not set" }, + checkRequired("method", method), + checkRequired("route", route), data, headers, params, 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 c61c487b..b3b783c3 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects @@ -188,10 +189,10 @@ private constructor( fun build(): RequestForwardingForwardResponse = RequestForwardingForwardResponse( - checkNotNull(data) { "`data` is required but was not set" }, - checkNotNull(headers) { "`headers` is required but was not set" }, - checkNotNull(request) { "`request` is required but was not set" }, - checkNotNull(statusCode) { "`statusCode` is required but was not set" }, + checkRequired("data", data), + checkRequired("headers", headers), + checkRequired("request", request), + checkRequired("statusCode", statusCode), additionalProperties.toImmutable(), ) } @@ -377,11 +378,11 @@ private constructor( fun build(): Request = Request( - checkNotNull(data) { "`data` is required but was not set" }, - checkNotNull(headers) { "`headers` is required but was not set" }, - checkNotNull(method) { "`method` is required but was not set" }, - checkNotNull(params) { "`params` is required but was not set" }, - checkNotNull(route) { "`route` is required but was not set" }, + checkRequired("data", data), + checkRequired("headers", headers), + checkRequired("method", method), + checkRequired("params", params), + checkRequired("route", route), additionalProperties.toImmutable(), ) } 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 07f3c130..2bcc7513 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 @@ -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.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap @@ -378,19 +379,14 @@ constructor( fun build(): SandboxCompanyUpdateBody = SandboxCompanyUpdateBody( - checkNotNull(accounts) { "`accounts` is required but was not set" } - .map { it.toImmutable() }, - checkNotNull(departments) { "`departments` is required but was not set" } - .map { it.toImmutable() }, - checkNotNull(ein) { "`ein` is required but was not set" }, - checkNotNull(entity) { "`entity` is required but was not set" }, - checkNotNull(legalName) { "`legalName` is required but was not set" }, - checkNotNull(locations) { "`locations` is required but was not set" } - .map { it.toImmutable() }, - checkNotNull(primaryEmail) { "`primaryEmail` is required but was not set" }, - checkNotNull(primaryPhoneNumber) { - "`primaryPhoneNumber` is required but was not set" - }, + 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(), ) } 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 173b9615..72cf592b 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 @@ -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.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap @@ -234,8 +235,8 @@ constructor( fun build(): SandboxConnectionAccountCreateBody = SandboxConnectionAccountCreateBody( - checkNotNull(companyId) { "`companyId` is required but was not set" }, - checkNotNull(providerId) { "`providerId` is required but was not set" }, + checkRequired("companyId", companyId), + checkRequired("providerId", providerId), authenticationType, (products ?: JsonMissing.of()).map { it.toImmutable() }, additionalProperties.toImmutable(), 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 bf15bea7..65bbd888 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 @@ -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.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap @@ -239,7 +240,7 @@ constructor( fun build(): SandboxConnectionCreateBody = SandboxConnectionCreateBody( - checkNotNull(providerId) { "`providerId` is required but was not set" }, + checkRequired("providerId", providerId), authenticationType, employeeSize, (products ?: JsonMissing.of()).map { it.toImmutable() }, 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 72e5a6f3..7bec20b3 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 @@ -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.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap @@ -179,7 +180,7 @@ constructor( fun build(): SandboxDirectoryCreateParams = SandboxDirectoryCreateParams( - checkNotNull(body) { "`body` is required but was not set" }.toImmutable(), + checkRequired("body", body).toImmutable(), additionalHeaders.build(), additionalQueryParams.build(), ) 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 2b12efbd..5129afb8 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 @@ -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.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap @@ -1062,7 +1063,7 @@ constructor( fun build(): SandboxEmploymentUpdateParams = SandboxEmploymentUpdateParams( - checkNotNull(individualId) { "`individualId` is required but was not set" }, + checkRequired("individualId", individualId), body.build(), additionalHeaders.build(), additionalQueryParams.build(), 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 dba02e18..41638d12 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 @@ -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.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap @@ -827,7 +828,7 @@ constructor( fun build(): SandboxIndividualUpdateParams = SandboxIndividualUpdateParams( - checkNotNull(individualId) { "`individualId` is required but was not set" }, + checkRequired("individualId", individualId), body.build(), additionalHeaders.build(), additionalQueryParams.build(), 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 ddfed32d..0cced1e8 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException @@ -106,8 +107,8 @@ private constructor( fun build(): SandboxJobConfiguration = SandboxJobConfiguration( - checkNotNull(completionStatus) { "`completionStatus` is required but was not set" }, - checkNotNull(type) { "`type` is required but was not set" }, + checkRequired("completionStatus", completionStatus), + checkRequired("type", type), additionalProperties.toImmutable(), ) } 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 26edbfbe..26ddf678 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 @@ -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.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap @@ -140,10 +141,8 @@ constructor( fun build(): SandboxJobConfigurationUpdateBody = SandboxJobConfigurationUpdateBody( - checkNotNull(completionStatus) { - "`completionStatus` is required but was not set" - }, - checkNotNull(type) { "`type` is required but was not set" }, + checkRequired("completionStatus", completionStatus), + checkRequired("type", type), additionalProperties.toImmutable(), ) } 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 619e4bf1..66371e56 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 @@ -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.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.immutableEmptyMap @@ -120,7 +121,7 @@ constructor( fun build(): SandboxJobCreateBody = SandboxJobCreateBody( - checkNotNull(type) { "`type` is required but was not set" }, + checkRequired("type", type), 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 95fa86b7..a7219aa5 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects @@ -109,8 +110,8 @@ private constructor( fun build(): SessionNewResponse = SessionNewResponse( - checkNotNull(connectUrl) { "`connectUrl` is required but was not set" }, - checkNotNull(sessionId) { "`sessionId` is required but was not set" }, + checkRequired("connectUrl", connectUrl), + checkRequired("sessionId", sessionId), additionalProperties.toImmutable(), ) } 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 9bca88da..6f7d216a 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects @@ -109,8 +110,8 @@ private constructor( fun build(): SessionReauthenticateResponse = SessionReauthenticateResponse( - checkNotNull(connectUrl) { "`connectUrl` is required but was not set" }, - checkNotNull(sessionId) { "`sessionId` is required but was not set" }, + checkRequired("connectUrl", connectUrl), + checkRequired("sessionId", sessionId), 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 e27b92d8..ac680027 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 @@ -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.checkRequired import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects @@ -87,7 +88,7 @@ private constructor( fun build(): UpdateCompanyBenefitResponse = UpdateCompanyBenefitResponse( - checkNotNull(benefitId) { "`benefitId` is required but was not set" }, + checkRequired("benefitId", benefitId), additionalProperties.toImmutable() ) }