From 121f7f9ffe98731113aecda46effa52976c2ee62 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Tue, 2 Jan 2024 05:36:57 -0500 Subject: [PATCH 1/5] chore(internal): bump license (#123) --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 6e22ceda..1dac0f68 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2023 Finch + Copyright 2024 Finch Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From b456bdee9ae7effecb7a1c4c1a7faacd6b26c335 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Fri, 5 Jan 2024 20:01:06 -0500 Subject: [PATCH 2/5] feat(api): add method to create access token (#125) --- .stats.yml | 2 +- .../com/tryfinch/api/client/FinchClient.kt | 4 + .../tryfinch/api/client/FinchClientAsync.kt | 4 + .../api/client/FinchClientAsyncImpl.kt | 23 ++ .../tryfinch/api/client/FinchClientImpl.kt | 21 ++ .../api/models/AccessTokenCreateParams.kt | 303 ++++++++++++++++++ .../api/models/CreateAccessTokenResponse.kt | 105 ++++++ .../services/async/AccessTokenServiceAsync.kt | 20 ++ .../async/AccessTokenServiceAsyncImpl.kt | 55 ++++ .../services/blocking/AccessTokenService.kt | 19 ++ .../blocking/AccessTokenServiceImpl.kt | 53 +++ .../api/models/AccessTokenCreateParamsTest.kt | 54 ++++ .../models/CreateAccessTokenResponseTest.kt | 17 + .../blocking/AccessTokenServiceTest.kt | 34 ++ 14 files changed, 713 insertions(+), 1 deletion(-) create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsync.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenService.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccessTokenCreateParamsTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateAccessTokenResponseTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceTest.kt diff --git a/.stats.yml b/.stats.yml index 67256046..c125dfb2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 22 +configured_endpoints: 23 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 f8459c0c..95abd05f 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 @@ -12,6 +12,8 @@ interface FinchClient { fun async(): FinchClientAsync + fun accessTokens(): AccessTokenService + fun hris(): HrisService fun providers(): ProviderService @@ -33,6 +35,8 @@ interface FinchClient { fun getAuthUrl(products: String, redirectUri: String, sandbox: Boolean): String + fun withAccessToken(accessToken: String): FinchClient + private data class GetAccessTokenParams( @JsonProperty("client_id") val clientId: String, @JsonProperty("client_secret") val clientSecret: String, 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 6eb28260..4dfa4cbf 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 @@ -13,6 +13,8 @@ interface FinchClientAsync { fun sync(): FinchClient + fun accessTokens(): AccessTokenServiceAsync + fun hris(): HrisServiceAsync fun providers(): ProviderServiceAsync @@ -34,6 +36,8 @@ interface FinchClientAsync { fun getAuthUrl(products: String, redirectUri: String, sandbox: Boolean): String + fun withAccessToken(accessToken: String): FinchClientAsync + private data class GetAccessTokenParams( @JsonProperty("client_id") val clientId: String, @JsonProperty("client_secret") val clientSecret: String, 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 3a12f906..3170abcf 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 @@ -27,6 +27,10 @@ constructor( private val sync: FinchClient by lazy { FinchClientImpl(clientOptions) } + private val accessTokens: AccessTokenServiceAsync by lazy { + AccessTokenServiceAsyncImpl(clientOptions) + } + private val hris: HrisServiceAsync by lazy { HrisServiceAsyncImpl(clientOptions) } private val providers: ProviderServiceAsync by lazy { ProviderServiceAsyncImpl(clientOptions) } @@ -46,6 +50,8 @@ constructor( override fun sync(): FinchClient = sync + override fun accessTokens(): AccessTokenServiceAsync = accessTokens + override fun hris(): HrisServiceAsync = hris override fun providers(): ProviderServiceAsync = providers @@ -102,6 +108,23 @@ constructor( "&sandbox=${if (sandbox) "true" else "false"}" } + override fun withAccessToken(accessToken: String): FinchClientAsync { + return FinchClientAsyncImpl( + ClientOptions.builder() + .httpClient(clientOptions.httpClient) + .jsonMapper(clientOptions.jsonMapper) + .clock(clientOptions.clock) + .baseUrl(clientOptions.baseUrl) + .accessToken(accessToken) + .clientId(clientOptions.clientId) + .clientSecret(clientOptions.clientSecret) + .webhookSecret(clientOptions.webhookSecret) + .headers(clientOptions.headers.asMap()) + .responseValidation(clientOptions.responseValidation) + .build() + ) + } + private data class GetAccessTokenParams( @JsonProperty("client_id") val clientId: String, @JsonProperty("client_secret") val clientSecret: String, 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 4954ad33..805de0c9 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 @@ -26,6 +26,8 @@ constructor( private val async: FinchClientAsync by lazy { FinchClientAsyncImpl(clientOptions) } + private val accessTokens: AccessTokenService by lazy { AccessTokenServiceImpl(clientOptions) } + private val hris: HrisService by lazy { HrisServiceImpl(clientOptions) } private val providers: ProviderService by lazy { ProviderServiceImpl(clientOptions) } @@ -45,6 +47,8 @@ constructor( override fun async(): FinchClientAsync = async + override fun accessTokens(): AccessTokenService = accessTokens + override fun hris(): HrisService = hris override fun providers(): ProviderService = providers @@ -101,6 +105,23 @@ constructor( "&sandbox=${if (sandbox) "true" else "false"}" } + override fun withAccessToken(accessToken: String): FinchClient { + return FinchClientImpl( + ClientOptions.builder() + .httpClient(clientOptions.httpClient) + .jsonMapper(clientOptions.jsonMapper) + .clock(clientOptions.clock) + .baseUrl(clientOptions.baseUrl) + .accessToken(accessToken) + .clientId(clientOptions.clientId) + .clientSecret(clientOptions.clientSecret) + .webhookSecret(clientOptions.webhookSecret) + .headers(clientOptions.headers.asMap()) + .responseValidation(clientOptions.responseValidation) + .build() + ) + } + private data class GetAccessTokenParams( @JsonProperty("client_id") val clientId: String, @JsonProperty("client_secret") val clientSecret: String, 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 new file mode 100644 index 00000000..16a17c91 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt @@ -0,0 +1,303 @@ +// 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.JsonProperty +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.tryfinch.api.core.ExcludeMissing +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.toUnmodifiable +import com.tryfinch.api.models.* +import java.util.Objects + +class AccessTokenCreateParams +constructor( + private val clientId: String, + private val clientSecret: String, + private val code: String, + private val redirectUri: String, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun clientId(): String = clientId + + fun clientSecret(): String = clientSecret + + fun code(): String = code + + fun redirectUri(): String = redirectUri + + @JvmSynthetic + internal fun getBody(): AccessTokenCreateBody { + return AccessTokenCreateBody( + clientId, + clientSecret, + code, + redirectUri, + additionalBodyProperties, + ) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + @JsonDeserialize(builder = AccessTokenCreateBody.Builder::class) + @NoAutoDetect + class AccessTokenCreateBody + internal constructor( + private val clientId: String?, + private val clientSecret: String?, + private val code: String?, + private val redirectUri: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("client_id") fun clientId(): String? = clientId + + @JsonProperty("client_secret") fun clientSecret(): String? = clientSecret + + @JsonProperty("code") fun code(): String? = code + + @JsonProperty("redirect_uri") fun redirectUri(): String? = redirectUri + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AccessTokenCreateBody && + this.clientId == other.clientId && + this.clientSecret == other.clientSecret && + this.code == other.code && + this.redirectUri == other.redirectUri && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + clientId, + clientSecret, + code, + redirectUri, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "AccessTokenCreateBody{clientId=$clientId, clientSecret=$clientSecret, code=$code, redirectUri=$redirectUri, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var clientId: String? = null + private var clientSecret: String? = null + private var code: String? = null + private var redirectUri: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(accessTokenCreateBody: AccessTokenCreateBody) = apply { + this.clientId = accessTokenCreateBody.clientId + this.clientSecret = accessTokenCreateBody.clientSecret + this.code = accessTokenCreateBody.code + this.redirectUri = accessTokenCreateBody.redirectUri + additionalProperties(accessTokenCreateBody.additionalProperties) + } + + @JsonProperty("client_id") + fun clientId(clientId: String) = apply { this.clientId = clientId } + + @JsonProperty("client_secret") + fun clientSecret(clientSecret: String) = apply { this.clientSecret = clientSecret } + + @JsonProperty("code") fun code(code: String) = apply { this.code = code } + + @JsonProperty("redirect_uri") + fun redirectUri(redirectUri: String) = apply { this.redirectUri = redirectUri } + + 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(): AccessTokenCreateBody = + AccessTokenCreateBody( + checkNotNull(clientId) { "`clientId` is required but was not set" }, + checkNotNull(clientSecret) { "`clientSecret` is required but was not set" }, + checkNotNull(code) { "`code` is required but was not set" }, + checkNotNull(redirectUri) { "`redirectUri` is required but was not set" }, + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AccessTokenCreateParams && + this.clientId == other.clientId && + this.clientSecret == other.clientSecret && + this.code == other.code && + this.redirectUri == other.redirectUri && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + clientId, + clientSecret, + code, + redirectUri, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "AccessTokenCreateParams{clientId=$clientId, clientSecret=$clientSecret, code=$code, redirectUri=$redirectUri, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var clientId: String? = null + private var clientSecret: String? = null + private var code: String? = null + private var redirectUri: String? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(accessTokenCreateParams: AccessTokenCreateParams) = apply { + this.clientId = accessTokenCreateParams.clientId + this.clientSecret = accessTokenCreateParams.clientSecret + this.code = accessTokenCreateParams.code + this.redirectUri = accessTokenCreateParams.redirectUri + additionalQueryParams(accessTokenCreateParams.additionalQueryParams) + additionalHeaders(accessTokenCreateParams.additionalHeaders) + additionalBodyProperties(accessTokenCreateParams.additionalBodyProperties) + } + + fun clientId(clientId: String) = apply { this.clientId = clientId } + + fun clientSecret(clientSecret: String) = apply { this.clientSecret = clientSecret } + + fun code(code: String) = apply { this.code = code } + + fun redirectUri(redirectUri: String) = apply { this.redirectUri = redirectUri } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): AccessTokenCreateParams = + AccessTokenCreateParams( + checkNotNull(clientId) { "`clientId` is required but was not set" }, + checkNotNull(clientSecret) { "`clientSecret` is required but was not set" }, + checkNotNull(code) { "`code` is required but was not set" }, + checkNotNull(redirectUri) { "`redirectUri` is required but was not set" }, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } +} 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 new file mode 100644 index 00000000..fa4c81ab --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt @@ -0,0 +1,105 @@ +// 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.JsonProperty +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +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.toUnmodifiable +import java.util.Objects + +@JsonDeserialize(builder = CreateAccessTokenResponse.Builder::class) +@NoAutoDetect +class CreateAccessTokenResponse +private constructor( + private val accessToken: JsonField, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun accessToken(): String = accessToken.getRequired("access_token") + + @JsonProperty("access_token") @ExcludeMissing fun _accessToken() = accessToken + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): CreateAccessTokenResponse = apply { + if (!validated) { + accessToken() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CreateAccessTokenResponse && + this.accessToken == other.accessToken && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(accessToken, additionalProperties) + } + return hashCode + } + + override fun toString() = + "CreateAccessTokenResponse{accessToken=$accessToken, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var accessToken: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(createAccessTokenResponse: CreateAccessTokenResponse) = apply { + this.accessToken = createAccessTokenResponse.accessToken + additionalProperties(createAccessTokenResponse.additionalProperties) + } + + fun accessToken(accessToken: String) = accessToken(JsonField.of(accessToken)) + + @JsonProperty("access_token") + @ExcludeMissing + fun accessToken(accessToken: JsonField) = apply { this.accessToken = accessToken } + + 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(): CreateAccessTokenResponse = + CreateAccessTokenResponse(accessToken, additionalProperties.toUnmodifiable()) + } +} 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 new file mode 100644 index 00000000..a335874c --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsync.kt @@ -0,0 +1,20 @@ +// 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.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.AccessTokenCreateParams +import com.tryfinch.api.models.CreateAccessTokenResponse +import java.util.concurrent.CompletableFuture + +interface AccessTokenServiceAsync { + + /** Exchange the authorization code for an access token */ + @JvmOverloads + 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 new file mode 100644 index 00000000..1cd2ebf6 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +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.errors.FinchError +import com.tryfinch.api.models.AccessTokenCreateParams +import com.tryfinch.api.models.CreateAccessTokenResponse +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture + +class AccessTokenServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : AccessTokenServiceAsync { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Exchange the authorization code for an access token */ + override fun create( + params: AccessTokenCreateParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("auth", "token") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 new file mode 100644 index 00000000..ad4b8e53 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenService.kt @@ -0,0 +1,19 @@ +// 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.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.AccessTokenCreateParams +import com.tryfinch.api.models.CreateAccessTokenResponse + +interface AccessTokenService { + + /** Exchange the authorization code for an access token */ + @JvmOverloads + fun create( + params: AccessTokenCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CreateAccessTokenResponse +} 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 new file mode 100644 index 00000000..ebdda6bf --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +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.errors.FinchError +import com.tryfinch.api.models.AccessTokenCreateParams +import com.tryfinch.api.models.CreateAccessTokenResponse +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler + +class AccessTokenServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : AccessTokenService { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Exchange the authorization code for an access token */ + override fun create( + params: AccessTokenCreateParams, + requestOptions: RequestOptions + ): CreateAccessTokenResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("auth", "token") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } +} 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 new file mode 100644 index 00000000..a228de36 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccessTokenCreateParamsTest.kt @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class AccessTokenCreateParamsTest { + + @Test + fun createAccessTokenCreateParams() { + AccessTokenCreateParams.builder() + .clientId("") + .clientSecret("") + .code("") + .redirectUri("https://example.com") + .build() + } + + @Test + fun getBody() { + val params = + AccessTokenCreateParams.builder() + .clientId("") + .clientSecret("") + .code("") + .redirectUri("https://example.com") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.clientId()).isEqualTo("") + assertThat(body.clientSecret()).isEqualTo("") + assertThat(body.code()).isEqualTo("") + assertThat(body.redirectUri()).isEqualTo("https://example.com") + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = + AccessTokenCreateParams.builder() + .clientId("") + .clientSecret("") + .code("") + .redirectUri("https://example.com") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.clientId()).isEqualTo("") + assertThat(body.clientSecret()).isEqualTo("") + assertThat(body.code()).isEqualTo("") + assertThat(body.redirectUri()).isEqualTo("https://example.com") + } +} 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 new file mode 100644 index 00000000..5a5390c8 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CreateAccessTokenResponseTest.kt @@ -0,0 +1,17 @@ +// 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 + +class CreateAccessTokenResponseTest { + + @Test + fun createCreateAccessTokenResponse() { + val createAccessTokenResponse = + CreateAccessTokenResponse.builder().accessToken("string").build() + assertThat(createAccessTokenResponse).isNotNull + assertThat(createAccessTokenResponse.accessToken()).isEqualTo("string") + } +} 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 new file mode 100644 index 00000000..e065b812 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceTest.kt @@ -0,0 +1,34 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClient +import com.tryfinch.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class AccessTokenServiceTest { + + @Test + fun callCreate() { + val client = + FinchOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val accessTokenService = client.accessTokens() + val createAccessTokenResponse = + accessTokenService.create( + AccessTokenCreateParams.builder() + .clientId("") + .clientSecret("") + .code("") + .redirectUri("https://example.com") + .build() + ) + println(createAccessTokenResponse) + createAccessTokenResponse.validate() + } +} From 98b8b4a234444abe4dd136931524ee22df2aa2d1 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Mon, 8 Jan 2024 15:28:06 -0500 Subject: [PATCH 3/5] chore: add .keep files for examples and custom code directories (#126) --- examples/.keep | 4 ++++ finch-java-lib/.keep | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 examples/.keep create mode 100644 finch-java-lib/.keep diff --git a/examples/.keep b/examples/.keep new file mode 100644 index 00000000..d8c73e93 --- /dev/null +++ b/examples/.keep @@ -0,0 +1,4 @@ +File generated from our OpenAPI spec by Stainless. + +This directory can be used to store example files demonstrating usage of this SDK. +It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. \ No newline at end of file diff --git a/finch-java-lib/.keep b/finch-java-lib/.keep new file mode 100644 index 00000000..5e2c99fd --- /dev/null +++ b/finch-java-lib/.keep @@ -0,0 +1,4 @@ +File generated from our OpenAPI spec by Stainless. + +This directory can be used to store custom files to expand the SDK. +It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. \ No newline at end of file From 44671e666b645dac5d43e499d29531f0b88dc34a Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Mon, 8 Jan 2024 19:44:22 -0500 Subject: [PATCH 4/5] feat(api): add sandbox APIs (#127) --- .stats.yml | 2 +- .../com/tryfinch/api/client/FinchClient.kt | 4 + .../tryfinch/api/client/FinchClientAsync.kt | 4 + .../api/client/FinchClientAsyncImpl.kt | 8 + .../tryfinch/api/client/FinchClientImpl.kt | 8 + .../api/models/AccountCreateResponse.kt | 274 +++ .../api/models/AccountUpdateResponse.kt | 257 +++ .../api/models/AuthCreateTokenParams.kt | 303 +++ .../api/models/CompanyUpdateResponse.kt | 1033 +++++++++++ .../api/models/ConnectionCreateResponse.kt | 274 +++ .../api/models/EmploymentUpdateResponse.kt | 1046 +++++++++++ .../api/models/IndividualUpdateResponse.kt | 899 +++++++++ .../IntrospectResponseConnectionStatus.kt | 96 + .../com/tryfinch/api/models/Introspection.kt | 265 ++- .../api/models/PaymentCreateResponse.kt | 137 ++ .../api/models/SandboxCompanyUpdateParams.kt | 1061 +++++++++++ .../SandboxConnectionAccountCreateParams.kt | 407 ++++ .../SandboxConnectionAccountUpdateParams.kt | 242 +++ .../models/SandboxConnectionCreateParams.kt | 392 ++++ .../models/SandboxDirectoryCreateParams.kt | 1629 +++++++++++++++++ .../models/SandboxEmploymentUpdateParams.kt | 1155 ++++++++++++ .../models/SandboxIndividualUpdateParams.kt | 1019 +++++++++++ .../api/models/SandboxJobConfiguration.kt | 254 +++ .../SandboxJobConfigurationRetrieveParams.kt | 108 ++ .../SandboxJobConfigurationUpdateParams.kt | 393 ++++ .../api/models/SandboxPaymentCreateParams.kt | 1344 ++++++++++++++ .../api/services/async/AuthServiceAsync.kt | 20 + .../services/async/AuthServiceAsyncImpl.kt | 55 + .../api/services/async/SandboxServiceAsync.kt | 30 + .../services/async/SandboxServiceAsyncImpl.kt | 66 + .../async/sandbox/CompanyServiceAsync.kt | 20 + .../async/sandbox/CompanyServiceAsyncImpl.kt | 54 + .../async/sandbox/ConnectionServiceAsync.kt | 23 + .../sandbox/ConnectionServiceAsyncImpl.kt | 61 + .../async/sandbox/DirectoryServiceAsync.kt | 20 + .../sandbox/DirectoryServiceAsyncImpl.kt | 48 + .../async/sandbox/EmploymentServiceAsync.kt | 20 + .../sandbox/EmploymentServiceAsyncImpl.kt | 55 + .../async/sandbox/IndividualServiceAsync.kt | 20 + .../sandbox/IndividualServiceAsyncImpl.kt | 55 + .../services/async/sandbox/JobServiceAsync.kt | 12 + .../async/sandbox/JobServiceAsyncImpl.kt | 24 + .../async/sandbox/PaymentServiceAsync.kt | 20 + .../async/sandbox/PaymentServiceAsyncImpl.kt | 54 + .../connections/AccountServiceAsync.kt | 32 + .../connections/AccountServiceAsyncImpl.kt | 88 + .../sandbox/jobs/ConfigurationServiceAsync.kt | 28 + .../jobs/ConfigurationServiceAsyncImpl.kt | 85 + .../api/services/blocking/AuthService.kt | 19 + .../api/services/blocking/AuthServiceImpl.kt | 53 + .../api/services/blocking/SandboxService.kt | 30 + .../services/blocking/SandboxServiceImpl.kt | 58 + .../blocking/sandbox/CompanyService.kt | 19 + .../blocking/sandbox/CompanyServiceImpl.kt | 52 + .../blocking/sandbox/ConnectionService.kt | 22 + .../blocking/sandbox/ConnectionServiceImpl.kt | 59 + .../blocking/sandbox/DirectoryService.kt | 19 + .../blocking/sandbox/DirectoryServiceImpl.kt | 46 + .../blocking/sandbox/EmploymentService.kt | 19 + .../blocking/sandbox/EmploymentServiceImpl.kt | 53 + .../blocking/sandbox/IndividualService.kt | 19 + .../blocking/sandbox/IndividualServiceImpl.kt | 53 + .../services/blocking/sandbox/JobService.kt | 12 + .../blocking/sandbox/JobServiceImpl.kt | 24 + .../blocking/sandbox/PaymentService.kt | 19 + .../blocking/sandbox/PaymentServiceImpl.kt | 52 + .../sandbox/connections/AccountService.kt | 31 + .../sandbox/connections/AccountServiceImpl.kt | 85 + .../sandbox/jobs/ConfigurationService.kt | 27 + .../sandbox/jobs/ConfigurationServiceImpl.kt | 82 + .../api/models/AccountCreateResponseTest.kt | 33 + .../api/models/AccountUpdateResponseTest.kt | 29 + .../api/models/AuthCreateTokenParamsTest.kt | 54 + .../api/models/CompanyUpdateResponseTest.kt | 107 ++ .../models/ConnectionCreateResponseTest.kt | 34 + .../api/models/EmploymentDataResponseTest.kt | 12 +- .../tryfinch/api/models/EmploymentDataTest.kt | 10 +- .../models/EmploymentUpdateResponseTest.kt | 133 ++ .../HrisPayStatementRetrieveManyParamsTest.kt | 12 +- .../api/models/IndividualInDirectoryTest.kt | 12 +- .../models/IndividualUpdateResponseTest.kt | 94 + .../tryfinch/api/models/IntrospectionTest.kt | 23 + .../api/models/PaymentCreateResponseTest.kt | 18 + .../com/tryfinch/api/models/PaymentTest.kt | 9 +- .../models/SandboxCompanyUpdateParamsTest.kt | 177 ++ ...andboxConnectionAccountCreateParamsTest.kt | 53 + ...andboxConnectionAccountUpdateParamsTest.kt | 35 + .../SandboxConnectionCreateParamsTest.kt | 46 + .../SandboxDirectoryCreateParamsTest.kt | 422 +++++ .../SandboxEmploymentUpdateParamsTest.kt | 219 +++ .../SandboxIndividualUpdateParamsTest.kt | 158 ++ ...ndboxJobConfigurationRetrieveParamsTest.kt | 14 + .../api/models/SandboxJobConfigurationTest.kt | 23 + ...SandboxJobConfigurationUpdateParamsTest.kt | 46 + .../models/SandboxPaymentCreateParamsTest.kt | 219 +++ .../api/services/ServiceParamsTest.kt | 6 +- .../api/services/blocking/AuthServiceTest.kt | 34 + .../services/blocking/SandboxServiceTest.kt | 9 + .../blocking/hris/PayStatementServiceTest.kt | 2 +- .../blocking/sandbox/CompanyServiceTest.kt | 79 + .../blocking/sandbox/ConnectionServiceTest.kt | 36 + .../blocking/sandbox/DirectoryServiceTest.kt | 167 ++ .../blocking/sandbox/EmploymentServiceTest.kt | 89 + .../blocking/sandbox/IndividualServiceTest.kt | 68 + .../blocking/sandbox/JobServiceTest.kt | 9 + .../blocking/sandbox/PaymentServiceTest.kt | 97 + .../sandbox/connections/AccountServiceTest.kt | 54 + .../sandbox/jobs/ConfigurationServiceTest.kt | 48 + 108 files changed, 16999 insertions(+), 48 deletions(-) create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/AuthCreateTokenParams.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/IntrospectResponseConnectionStatus.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AuthServiceAsync.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AuthServiceAsyncImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/SandboxServiceAsync.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/SandboxServiceAsyncImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsync.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsync.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsync.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsync.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsync.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsync.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsync.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsync.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AuthService.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AuthServiceImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/SandboxService.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/SandboxServiceImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyService.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionService.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentService.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualService.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobService.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentService.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountService.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationService.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountCreateResponseTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateResponseTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/AuthCreateTokenParamsTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectionCreateResponseTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentCreateResponseTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParamsTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParamsTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParamsTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AuthServiceTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/SandboxServiceTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceTest.kt diff --git a/.stats.yml b/.stats.yml index c125dfb2..f6819ec3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 23 +configured_endpoints: 33 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 95abd05f..2e07bb4d 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 @@ -26,6 +26,10 @@ interface FinchClient { fun jobs(): JobService + fun auth(): AuthService + + fun sandbox(): SandboxService + fun getAccessToken( clientId: String, clientSecret: String, 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 4dfa4cbf..7cf05106 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 @@ -27,6 +27,10 @@ interface FinchClientAsync { fun jobs(): JobServiceAsync + fun auth(): AuthServiceAsync + + fun sandbox(): SandboxServiceAsync + fun getAccessToken( clientId: String, clientSecret: String, 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 3170abcf..c2b3033d 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 @@ -45,6 +45,10 @@ constructor( private val jobs: JobServiceAsync by lazy { JobServiceAsyncImpl(clientOptions) } + private val auth: AuthServiceAsync by lazy { AuthServiceAsyncImpl(clientOptions) } + + private val sandbox: SandboxServiceAsync by lazy { SandboxServiceAsyncImpl(clientOptions) } + private val getAccessTokenHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -64,6 +68,10 @@ constructor( override fun jobs(): JobServiceAsync = jobs + override fun auth(): AuthServiceAsync = auth + + override fun sandbox(): SandboxServiceAsync = sandbox + override fun getAccessToken( clientId: String, clientSecret: String, 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 805de0c9..09430114 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 @@ -42,6 +42,10 @@ constructor( private val jobs: JobService by lazy { JobServiceImpl(clientOptions) } + private val auth: AuthService by lazy { AuthServiceImpl(clientOptions) } + + private val sandbox: SandboxService by lazy { SandboxServiceImpl(clientOptions) } + private val getAccessTokenHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -61,6 +65,10 @@ constructor( override fun jobs(): JobService = jobs + override fun auth(): AuthService = auth + + override fun sandbox(): SandboxService = sandbox + override fun getAccessToken( clientId: String, clientSecret: String, 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 new file mode 100644 index 00000000..b3f52134 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt @@ -0,0 +1,274 @@ +// 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.fasterxml.jackson.databind.annotation.JsonDeserialize +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.toUnmodifiable +import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Objects + +@JsonDeserialize(builder = AccountCreateResponse.Builder::class) +@NoAutoDetect +class AccountCreateResponse +private constructor( + private val companyId: JsonField, + private val providerId: JsonField, + private val accountId: JsonField, + private val authenticationType: JsonField, + private val products: JsonField>, + private val accessToken: JsonField, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun companyId(): String = companyId.getRequired("company_id") + + fun providerId(): String = providerId.getRequired("provider_id") + + fun accountId(): String = accountId.getRequired("account_id") + + fun authenticationType(): AuthenticationType = + authenticationType.getRequired("authentication_type") + + fun products(): List = products.getRequired("products") + + fun accessToken(): String = accessToken.getRequired("access_token") + + @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId + + @JsonProperty("provider_id") @ExcludeMissing fun _providerId() = providerId + + @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId + + @JsonProperty("authentication_type") + @ExcludeMissing + fun _authenticationType() = authenticationType + + @JsonProperty("products") @ExcludeMissing fun _products() = products + + @JsonProperty("access_token") @ExcludeMissing fun _accessToken() = accessToken + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): AccountCreateResponse = apply { + if (!validated) { + companyId() + providerId() + accountId() + authenticationType() + products() + accessToken() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AccountCreateResponse && + this.companyId == other.companyId && + this.providerId == other.providerId && + this.accountId == other.accountId && + this.authenticationType == other.authenticationType && + this.products == other.products && + this.accessToken == other.accessToken && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + companyId, + providerId, + accountId, + authenticationType, + products, + accessToken, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "AccountCreateResponse{companyId=$companyId, providerId=$providerId, accountId=$accountId, authenticationType=$authenticationType, products=$products, accessToken=$accessToken, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var companyId: JsonField = JsonMissing.of() + private var providerId: JsonField = JsonMissing.of() + private var accountId: JsonField = JsonMissing.of() + private var authenticationType: JsonField = JsonMissing.of() + private var products: JsonField> = JsonMissing.of() + private var accessToken: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(accountCreateResponse: AccountCreateResponse) = apply { + this.companyId = accountCreateResponse.companyId + this.providerId = accountCreateResponse.providerId + this.accountId = accountCreateResponse.accountId + this.authenticationType = accountCreateResponse.authenticationType + this.products = accountCreateResponse.products + this.accessToken = accountCreateResponse.accessToken + additionalProperties(accountCreateResponse.additionalProperties) + } + + fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + + @JsonProperty("company_id") + @ExcludeMissing + fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + + fun providerId(providerId: String) = providerId(JsonField.of(providerId)) + + @JsonProperty("provider_id") + @ExcludeMissing + fun providerId(providerId: JsonField) = apply { this.providerId = providerId } + + fun accountId(accountId: String) = accountId(JsonField.of(accountId)) + + @JsonProperty("account_id") + @ExcludeMissing + fun accountId(accountId: JsonField) = apply { this.accountId = accountId } + + fun authenticationType(authenticationType: AuthenticationType) = + authenticationType(JsonField.of(authenticationType)) + + @JsonProperty("authentication_type") + @ExcludeMissing + fun authenticationType(authenticationType: JsonField) = apply { + this.authenticationType = authenticationType + } + + fun products(products: List) = products(JsonField.of(products)) + + @JsonProperty("products") + @ExcludeMissing + fun products(products: JsonField>) = apply { this.products = products } + + fun accessToken(accessToken: String) = accessToken(JsonField.of(accessToken)) + + @JsonProperty("access_token") + @ExcludeMissing + fun accessToken(accessToken: JsonField) = apply { this.accessToken = accessToken } + + 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(): AccountCreateResponse = + AccountCreateResponse( + companyId, + providerId, + accountId, + authenticationType, + products.map { it.toUnmodifiable() }, + accessToken, + additionalProperties.toUnmodifiable(), + ) + } + + class AuthenticationType + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AuthenticationType && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val CREDENTIALS = AuthenticationType(JsonField.of("credentials")) + + @JvmField val API_TOKEN = AuthenticationType(JsonField.of("api_token")) + + @JvmField val OAUTH = AuthenticationType(JsonField.of("oauth")) + + @JvmField val ASSISTED = AuthenticationType(JsonField.of("assisted")) + + @JvmStatic fun of(value: String) = AuthenticationType(JsonField.of(value)) + } + + enum class Known { + CREDENTIALS, + API_TOKEN, + OAUTH, + ASSISTED, + } + + enum class Value { + CREDENTIALS, + API_TOKEN, + OAUTH, + ASSISTED, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + CREDENTIALS -> Value.CREDENTIALS + API_TOKEN -> Value.API_TOKEN + OAUTH -> Value.OAUTH + ASSISTED -> Value.ASSISTED + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + CREDENTIALS -> Known.CREDENTIALS + API_TOKEN -> Known.API_TOKEN + OAUTH -> Known.OAUTH + ASSISTED -> Known.ASSISTED + else -> throw FinchInvalidDataException("Unknown AuthenticationType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } +} 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 new file mode 100644 index 00000000..eb273f6c --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt @@ -0,0 +1,257 @@ +// 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.fasterxml.jackson.databind.annotation.JsonDeserialize +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.toUnmodifiable +import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Objects + +@JsonDeserialize(builder = AccountUpdateResponse.Builder::class) +@NoAutoDetect +class AccountUpdateResponse +private constructor( + private val accountId: JsonField, + private val authenticationType: JsonField, + private val companyId: JsonField, + private val providerId: JsonField, + private val products: JsonField>, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun accountId(): String = accountId.getRequired("account_id") + + fun authenticationType(): AuthenticationType = + authenticationType.getRequired("authentication_type") + + fun companyId(): String = companyId.getRequired("company_id") + + fun providerId(): String = providerId.getRequired("provider_id") + + fun products(): List = products.getRequired("products") + + @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId + + @JsonProperty("authentication_type") + @ExcludeMissing + fun _authenticationType() = authenticationType + + @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId + + @JsonProperty("provider_id") @ExcludeMissing fun _providerId() = providerId + + @JsonProperty("products") @ExcludeMissing fun _products() = products + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): AccountUpdateResponse = apply { + if (!validated) { + accountId() + authenticationType() + companyId() + providerId() + products() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AccountUpdateResponse && + this.accountId == other.accountId && + this.authenticationType == other.authenticationType && + this.companyId == other.companyId && + this.providerId == other.providerId && + this.products == other.products && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + accountId, + authenticationType, + companyId, + providerId, + products, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "AccountUpdateResponse{accountId=$accountId, authenticationType=$authenticationType, companyId=$companyId, providerId=$providerId, products=$products, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var accountId: JsonField = JsonMissing.of() + private var authenticationType: JsonField = JsonMissing.of() + private var companyId: JsonField = JsonMissing.of() + private var providerId: JsonField = JsonMissing.of() + private var products: JsonField> = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(accountUpdateResponse: AccountUpdateResponse) = apply { + this.accountId = accountUpdateResponse.accountId + this.authenticationType = accountUpdateResponse.authenticationType + this.companyId = accountUpdateResponse.companyId + this.providerId = accountUpdateResponse.providerId + this.products = accountUpdateResponse.products + additionalProperties(accountUpdateResponse.additionalProperties) + } + + fun accountId(accountId: String) = accountId(JsonField.of(accountId)) + + @JsonProperty("account_id") + @ExcludeMissing + fun accountId(accountId: JsonField) = apply { this.accountId = accountId } + + fun authenticationType(authenticationType: AuthenticationType) = + authenticationType(JsonField.of(authenticationType)) + + @JsonProperty("authentication_type") + @ExcludeMissing + fun authenticationType(authenticationType: JsonField) = apply { + this.authenticationType = authenticationType + } + + fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + + @JsonProperty("company_id") + @ExcludeMissing + fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + + fun providerId(providerId: String) = providerId(JsonField.of(providerId)) + + @JsonProperty("provider_id") + @ExcludeMissing + fun providerId(providerId: JsonField) = apply { this.providerId = providerId } + + fun products(products: List) = products(JsonField.of(products)) + + @JsonProperty("products") + @ExcludeMissing + fun products(products: JsonField>) = apply { this.products = products } + + 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(): AccountUpdateResponse = + AccountUpdateResponse( + accountId, + authenticationType, + companyId, + providerId, + products.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) + } + + class AuthenticationType + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AuthenticationType && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val CREDENTIALS = AuthenticationType(JsonField.of("credentials")) + + @JvmField val API_TOKEN = AuthenticationType(JsonField.of("api_token")) + + @JvmField val OAUTH = AuthenticationType(JsonField.of("oauth")) + + @JvmField val ASSISTED = AuthenticationType(JsonField.of("assisted")) + + @JvmStatic fun of(value: String) = AuthenticationType(JsonField.of(value)) + } + + enum class Known { + CREDENTIALS, + API_TOKEN, + OAUTH, + ASSISTED, + } + + enum class Value { + CREDENTIALS, + API_TOKEN, + OAUTH, + ASSISTED, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + CREDENTIALS -> Value.CREDENTIALS + API_TOKEN -> Value.API_TOKEN + OAUTH -> Value.OAUTH + ASSISTED -> Value.ASSISTED + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + CREDENTIALS -> Known.CREDENTIALS + API_TOKEN -> Known.API_TOKEN + OAUTH -> Known.OAUTH + ASSISTED -> Known.ASSISTED + else -> throw FinchInvalidDataException("Unknown AuthenticationType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AuthCreateTokenParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AuthCreateTokenParams.kt new file mode 100644 index 00000000..056d206c --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AuthCreateTokenParams.kt @@ -0,0 +1,303 @@ +// 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.JsonProperty +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.tryfinch.api.core.ExcludeMissing +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.toUnmodifiable +import com.tryfinch.api.models.* +import java.util.Objects + +class AuthCreateTokenParams +constructor( + private val clientId: String, + private val clientSecret: String, + private val code: String, + private val redirectUri: String, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun clientId(): String = clientId + + fun clientSecret(): String = clientSecret + + fun code(): String = code + + fun redirectUri(): String = redirectUri + + @JvmSynthetic + internal fun getBody(): AuthCreateTokenBody { + return AuthCreateTokenBody( + clientId, + clientSecret, + code, + redirectUri, + additionalBodyProperties, + ) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + @JsonDeserialize(builder = AuthCreateTokenBody.Builder::class) + @NoAutoDetect + class AuthCreateTokenBody + internal constructor( + private val clientId: String?, + private val clientSecret: String?, + private val code: String?, + private val redirectUri: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("client_id") fun clientId(): String? = clientId + + @JsonProperty("client_secret") fun clientSecret(): String? = clientSecret + + @JsonProperty("code") fun code(): String? = code + + @JsonProperty("redirect_uri") fun redirectUri(): String? = redirectUri + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AuthCreateTokenBody && + this.clientId == other.clientId && + this.clientSecret == other.clientSecret && + this.code == other.code && + this.redirectUri == other.redirectUri && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + clientId, + clientSecret, + code, + redirectUri, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "AuthCreateTokenBody{clientId=$clientId, clientSecret=$clientSecret, code=$code, redirectUri=$redirectUri, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var clientId: String? = null + private var clientSecret: String? = null + private var code: String? = null + private var redirectUri: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(authCreateTokenBody: AuthCreateTokenBody) = apply { + this.clientId = authCreateTokenBody.clientId + this.clientSecret = authCreateTokenBody.clientSecret + this.code = authCreateTokenBody.code + this.redirectUri = authCreateTokenBody.redirectUri + additionalProperties(authCreateTokenBody.additionalProperties) + } + + @JsonProperty("client_id") + fun clientId(clientId: String) = apply { this.clientId = clientId } + + @JsonProperty("client_secret") + fun clientSecret(clientSecret: String) = apply { this.clientSecret = clientSecret } + + @JsonProperty("code") fun code(code: String) = apply { this.code = code } + + @JsonProperty("redirect_uri") + fun redirectUri(redirectUri: String) = apply { this.redirectUri = redirectUri } + + 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(): AuthCreateTokenBody = + AuthCreateTokenBody( + checkNotNull(clientId) { "`clientId` is required but was not set" }, + checkNotNull(clientSecret) { "`clientSecret` is required but was not set" }, + checkNotNull(code) { "`code` is required but was not set" }, + checkNotNull(redirectUri) { "`redirectUri` is required but was not set" }, + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AuthCreateTokenParams && + this.clientId == other.clientId && + this.clientSecret == other.clientSecret && + this.code == other.code && + this.redirectUri == other.redirectUri && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + clientId, + clientSecret, + code, + redirectUri, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "AuthCreateTokenParams{clientId=$clientId, clientSecret=$clientSecret, code=$code, redirectUri=$redirectUri, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var clientId: String? = null + private var clientSecret: String? = null + private var code: String? = null + private var redirectUri: String? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(authCreateTokenParams: AuthCreateTokenParams) = apply { + this.clientId = authCreateTokenParams.clientId + this.clientSecret = authCreateTokenParams.clientSecret + this.code = authCreateTokenParams.code + this.redirectUri = authCreateTokenParams.redirectUri + additionalQueryParams(authCreateTokenParams.additionalQueryParams) + additionalHeaders(authCreateTokenParams.additionalHeaders) + additionalBodyProperties(authCreateTokenParams.additionalBodyProperties) + } + + fun clientId(clientId: String) = apply { this.clientId = clientId } + + fun clientSecret(clientSecret: String) = apply { this.clientSecret = clientSecret } + + fun code(code: String) = apply { this.code = code } + + fun redirectUri(redirectUri: String) = apply { this.redirectUri = redirectUri } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): AuthCreateTokenParams = + AuthCreateTokenParams( + checkNotNull(clientId) { "`clientId` is required but was not set" }, + checkNotNull(clientSecret) { "`clientSecret` is required but was not set" }, + checkNotNull(code) { "`code` is required but was not set" }, + checkNotNull(redirectUri) { "`redirectUri` is required but was not set" }, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } +} 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 new file mode 100644 index 00000000..004172ae --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt @@ -0,0 +1,1033 @@ +// 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.fasterxml.jackson.databind.annotation.JsonDeserialize +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.toUnmodifiable +import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Objects +import java.util.Optional + +@JsonDeserialize(builder = CompanyUpdateResponse.Builder::class) +@NoAutoDetect +class CompanyUpdateResponse +private constructor( + private val legalName: JsonField, + private val entity: JsonField, + private val primaryEmail: JsonField, + private val primaryPhoneNumber: JsonField, + private val departments: JsonField>, + private val ein: JsonField, + private val locations: JsonField>, + private val accounts: JsonField>, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The legal name of the company. */ + fun legalName(): Optional = Optional.ofNullable(legalName.getNullable("legal_name")) + + /** The entity type object. */ + fun entity(): Optional = Optional.ofNullable(entity.getNullable("entity")) + + /** The email of the main administrator on the account. */ + fun primaryEmail(): Optional = + Optional.ofNullable(primaryEmail.getNullable("primary_email")) + + /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + fun primaryPhoneNumber(): Optional = + Optional.ofNullable(primaryPhoneNumber.getNullable("primary_phone_number")) + + /** The array of company departments. */ + fun departments(): Optional> = + Optional.ofNullable(departments.getNullable("departments")) + + /** The employer identification number. */ + fun ein(): Optional = Optional.ofNullable(ein.getNullable("ein")) + + fun locations(): Optional> = + Optional.ofNullable(locations.getNullable("locations")) + + /** An array of bank account objects associated with the payroll/HRIS system. */ + fun accounts(): Optional> = Optional.ofNullable(accounts.getNullable("accounts")) + + /** The legal name of the company. */ + @JsonProperty("legal_name") @ExcludeMissing fun _legalName() = legalName + + /** The entity type object. */ + @JsonProperty("entity") @ExcludeMissing fun _entity() = entity + + /** The email of the main administrator on the account. */ + @JsonProperty("primary_email") @ExcludeMissing fun _primaryEmail() = primaryEmail + + /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + @JsonProperty("primary_phone_number") + @ExcludeMissing + fun _primaryPhoneNumber() = primaryPhoneNumber + + /** The array of company departments. */ + @JsonProperty("departments") @ExcludeMissing fun _departments() = departments + + /** The employer identification number. */ + @JsonProperty("ein") @ExcludeMissing fun _ein() = ein + + @JsonProperty("locations") @ExcludeMissing fun _locations() = locations + + /** An array of bank account objects associated with the payroll/HRIS system. */ + @JsonProperty("accounts") @ExcludeMissing fun _accounts() = accounts + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): CompanyUpdateResponse = apply { + if (!validated) { + legalName() + entity().map { it.validate() } + primaryEmail() + primaryPhoneNumber() + departments().map { it.forEach { it.validate() } } + ein() + locations().map { it.forEach { it.validate() } } + accounts().map { it.forEach { it.validate() } } + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CompanyUpdateResponse && + this.legalName == other.legalName && + this.entity == other.entity && + this.primaryEmail == other.primaryEmail && + this.primaryPhoneNumber == other.primaryPhoneNumber && + this.departments == other.departments && + this.ein == other.ein && + this.locations == other.locations && + this.accounts == other.accounts && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + legalName, + entity, + primaryEmail, + primaryPhoneNumber, + departments, + ein, + locations, + accounts, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "CompanyUpdateResponse{legalName=$legalName, entity=$entity, primaryEmail=$primaryEmail, primaryPhoneNumber=$primaryPhoneNumber, departments=$departments, ein=$ein, locations=$locations, accounts=$accounts, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var legalName: JsonField = JsonMissing.of() + private var entity: JsonField = JsonMissing.of() + private var primaryEmail: JsonField = JsonMissing.of() + private var primaryPhoneNumber: JsonField = JsonMissing.of() + private var departments: JsonField> = JsonMissing.of() + private var ein: JsonField = JsonMissing.of() + private var locations: JsonField> = JsonMissing.of() + private var accounts: JsonField> = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(companyUpdateResponse: CompanyUpdateResponse) = apply { + this.legalName = companyUpdateResponse.legalName + this.entity = companyUpdateResponse.entity + this.primaryEmail = companyUpdateResponse.primaryEmail + this.primaryPhoneNumber = companyUpdateResponse.primaryPhoneNumber + this.departments = companyUpdateResponse.departments + this.ein = companyUpdateResponse.ein + this.locations = companyUpdateResponse.locations + this.accounts = companyUpdateResponse.accounts + additionalProperties(companyUpdateResponse.additionalProperties) + } + + /** The legal name of the company. */ + fun legalName(legalName: String) = legalName(JsonField.of(legalName)) + + /** The legal name of the company. */ + @JsonProperty("legal_name") + @ExcludeMissing + fun legalName(legalName: JsonField) = apply { this.legalName = legalName } + + /** The entity type object. */ + fun entity(entity: Entity) = entity(JsonField.of(entity)) + + /** The entity type object. */ + @JsonProperty("entity") + @ExcludeMissing + fun entity(entity: JsonField) = apply { this.entity = entity } + + /** The email of the main administrator on the account. */ + fun primaryEmail(primaryEmail: String) = primaryEmail(JsonField.of(primaryEmail)) + + /** The email of the main administrator on the account. */ + @JsonProperty("primary_email") + @ExcludeMissing + 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.of(primaryPhoneNumber)) + + /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + @JsonProperty("primary_phone_number") + @ExcludeMissing + fun primaryPhoneNumber(primaryPhoneNumber: JsonField) = apply { + this.primaryPhoneNumber = primaryPhoneNumber + } + + /** The array of company departments. */ + fun departments(departments: List) = departments(JsonField.of(departments)) + + /** The array of company departments. */ + @JsonProperty("departments") + @ExcludeMissing + fun departments(departments: JsonField>) = apply { + this.departments = departments + } + + /** The employer identification number. */ + fun ein(ein: String) = ein(JsonField.of(ein)) + + /** The employer identification number. */ + @JsonProperty("ein") + @ExcludeMissing + fun ein(ein: JsonField) = apply { this.ein = ein } + + fun locations(locations: List) = locations(JsonField.of(locations)) + + @JsonProperty("locations") + @ExcludeMissing + fun locations(locations: JsonField>) = apply { this.locations = locations } + + /** An array of bank account objects associated with the payroll/HRIS system. */ + fun accounts(accounts: List) = accounts(JsonField.of(accounts)) + + /** An array of bank account objects associated with the payroll/HRIS system. */ + @JsonProperty("accounts") + @ExcludeMissing + fun accounts(accounts: JsonField>) = apply { this.accounts = accounts } + + 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(): CompanyUpdateResponse = + CompanyUpdateResponse( + legalName, + entity, + primaryEmail, + primaryPhoneNumber, + departments.map { it.toUnmodifiable() }, + ein, + locations.map { it.toUnmodifiable() }, + accounts.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Account.Builder::class) + @NoAutoDetect + class Account + private constructor( + private val routingNumber: JsonField, + private val accountName: JsonField, + private val institutionName: JsonField, + private val accountType: JsonField, + private val accountNumber: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** + * A nine-digit code that's based on the U.S. Bank location where your account was opened. + */ + fun routingNumber(): Optional = + Optional.ofNullable(routingNumber.getNullable("routing_number")) + + /** The name of the bank associated in the payroll/HRIS system. */ + fun accountName(): Optional = + Optional.ofNullable(accountName.getNullable("account_name")) + + /** Name of the banking institution. */ + fun institutionName(): Optional = + Optional.ofNullable(institutionName.getNullable("institution_name")) + + /** The type of bank account. */ + fun accountType(): Optional = + Optional.ofNullable(accountType.getNullable("account_type")) + + /** 10-12 digit number to specify the bank account */ + fun accountNumber(): Optional = + Optional.ofNullable(accountNumber.getNullable("account_number")) + + /** + * A nine-digit code that's based on the U.S. Bank location where your account was opened. + */ + @JsonProperty("routing_number") @ExcludeMissing fun _routingNumber() = routingNumber + + /** The name of the bank associated in the payroll/HRIS system. */ + @JsonProperty("account_name") @ExcludeMissing fun _accountName() = accountName + + /** Name of the banking institution. */ + @JsonProperty("institution_name") @ExcludeMissing fun _institutionName() = institutionName + + /** The type of bank account. */ + @JsonProperty("account_type") @ExcludeMissing fun _accountType() = accountType + + /** 10-12 digit number to specify the bank account */ + @JsonProperty("account_number") @ExcludeMissing fun _accountNumber() = accountNumber + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Account = apply { + if (!validated) { + routingNumber() + accountName() + institutionName() + accountType() + accountNumber() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Account && + this.routingNumber == other.routingNumber && + this.accountName == other.accountName && + this.institutionName == other.institutionName && + this.accountType == other.accountType && + this.accountNumber == other.accountNumber && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + routingNumber, + accountName, + institutionName, + accountType, + accountNumber, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Account{routingNumber=$routingNumber, accountName=$accountName, institutionName=$institutionName, accountType=$accountType, accountNumber=$accountNumber, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var routingNumber: JsonField = JsonMissing.of() + private var accountName: JsonField = JsonMissing.of() + private var institutionName: JsonField = JsonMissing.of() + private var accountType: JsonField = JsonMissing.of() + private var accountNumber: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(account: Account) = apply { + this.routingNumber = account.routingNumber + this.accountName = account.accountName + this.institutionName = account.institutionName + this.accountType = account.accountType + this.accountNumber = account.accountNumber + additionalProperties(account.additionalProperties) + } + + /** + * A nine-digit code that's based on the U.S. Bank location where your account was + * opened. + */ + fun routingNumber(routingNumber: String) = routingNumber(JsonField.of(routingNumber)) + + /** + * A nine-digit code that's based on the U.S. Bank location where your account was + * opened. + */ + @JsonProperty("routing_number") + @ExcludeMissing + fun routingNumber(routingNumber: JsonField) = apply { + this.routingNumber = routingNumber + } + + /** The name of the bank associated in the payroll/HRIS system. */ + fun accountName(accountName: String) = accountName(JsonField.of(accountName)) + + /** The name of the bank associated in the payroll/HRIS system. */ + @JsonProperty("account_name") + @ExcludeMissing + fun accountName(accountName: JsonField) = apply { + this.accountName = accountName + } + + /** Name of the banking institution. */ + fun institutionName(institutionName: String) = + institutionName(JsonField.of(institutionName)) + + /** Name of the banking institution. */ + @JsonProperty("institution_name") + @ExcludeMissing + fun institutionName(institutionName: JsonField) = apply { + this.institutionName = institutionName + } + + /** The type of bank account. */ + fun accountType(accountType: AccountType) = accountType(JsonField.of(accountType)) + + /** The type of bank account. */ + @JsonProperty("account_type") + @ExcludeMissing + fun accountType(accountType: JsonField) = apply { + this.accountType = accountType + } + + /** 10-12 digit number to specify the bank account */ + fun accountNumber(accountNumber: String) = accountNumber(JsonField.of(accountNumber)) + + /** 10-12 digit number to specify the bank account */ + @JsonProperty("account_number") + @ExcludeMissing + fun accountNumber(accountNumber: JsonField) = apply { + this.accountNumber = accountNumber + } + + 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(): Account = + Account( + routingNumber, + accountName, + institutionName, + accountType, + accountNumber, + additionalProperties.toUnmodifiable(), + ) + } + + class AccountType + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AccountType && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val CHECKING = AccountType(JsonField.of("checking")) + + @JvmField val SAVINGS = AccountType(JsonField.of("savings")) + + @JvmStatic fun of(value: String) = AccountType(JsonField.of(value)) + } + + enum class Known { + CHECKING, + SAVINGS, + } + + enum class Value { + CHECKING, + SAVINGS, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + CHECKING -> Value.CHECKING + SAVINGS -> Value.SAVINGS + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + CHECKING -> Known.CHECKING + SAVINGS -> Known.SAVINGS + else -> throw FinchInvalidDataException("Unknown AccountType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + } + + @JsonDeserialize(builder = Department.Builder::class) + @NoAutoDetect + class Department + private constructor( + private val name: JsonField, + private val parent: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The department name. */ + fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + + /** The parent department, if present. */ + fun parent(): Optional = Optional.ofNullable(parent.getNullable("parent")) + + /** The department name. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** The parent department, if present. */ + @JsonProperty("parent") @ExcludeMissing fun _parent() = parent + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Department = apply { + if (!validated) { + name() + parent().map { it.validate() } + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Department && + this.name == other.name && + this.parent == other.parent && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + name, + parent, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Department{name=$name, parent=$parent, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var name: JsonField = JsonMissing.of() + private var parent: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(department: Department) = apply { + this.name = department.name + this.parent = department.parent + additionalProperties(department.additionalProperties) + } + + /** The department name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The department name. */ + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + /** The parent department, if present. */ + fun parent(parent: Parent) = parent(JsonField.of(parent)) + + /** The parent department, if present. */ + @JsonProperty("parent") + @ExcludeMissing + fun parent(parent: JsonField) = apply { this.parent = parent } + + 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(): Department = + Department( + name, + parent, + additionalProperties.toUnmodifiable(), + ) + } + + /** The parent department, if present. */ + @JsonDeserialize(builder = Parent.Builder::class) + @NoAutoDetect + class Parent + private constructor( + private val name: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The parent department's name. */ + fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + + /** The parent department's name. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Parent = apply { + if (!validated) { + name() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Parent && + this.name == other.name && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(name, additionalProperties) + } + return hashCode + } + + override fun toString() = + "Parent{name=$name, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(parent: Parent) = apply { + this.name = parent.name + additionalProperties(parent.additionalProperties) + } + + /** The parent department's name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The parent department's name. */ + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + 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(): Parent = Parent(name, additionalProperties.toUnmodifiable()) + } + } + } + + /** The entity type object. */ + @JsonDeserialize(builder = Entity.Builder::class) + @NoAutoDetect + class Entity + private constructor( + private val type: JsonField, + private val subtype: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The tax payer type of the company. */ + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + + /** The tax payer subtype of the company. */ + fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) + + /** The tax payer type of the company. */ + @JsonProperty("type") @ExcludeMissing fun _type() = type + + /** The tax payer subtype of the company. */ + @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Entity = apply { + if (!validated) { + type() + subtype() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Entity && + this.type == other.type && + this.subtype == other.subtype && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + type, + subtype, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Entity{type=$type, subtype=$subtype, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var type: JsonField = JsonMissing.of() + private var subtype: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(entity: Entity) = apply { + this.type = entity.type + this.subtype = entity.subtype + additionalProperties(entity.additionalProperties) + } + + /** The tax payer type of the company. */ + fun type(type: Type) = type(JsonField.of(type)) + + /** The tax payer type of the company. */ + @JsonProperty("type") + @ExcludeMissing + fun type(type: JsonField) = apply { this.type = type } + + /** The tax payer subtype of the company. */ + fun subtype(subtype: Subtype) = subtype(JsonField.of(subtype)) + + /** The tax payer subtype of the company. */ + @JsonProperty("subtype") + @ExcludeMissing + fun subtype(subtype: JsonField) = apply { this.subtype = subtype } + + 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(): Entity = + Entity( + type, + subtype, + additionalProperties.toUnmodifiable(), + ) + } + + class Subtype + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Subtype && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val S_CORPORATION = Subtype(JsonField.of("s_corporation")) + + @JvmField val C_CORPORATION = Subtype(JsonField.of("c_corporation")) + + @JvmField val B_CORPORATION = Subtype(JsonField.of("b_corporation")) + + @JvmStatic fun of(value: String) = Subtype(JsonField.of(value)) + } + + enum class Known { + S_CORPORATION, + C_CORPORATION, + B_CORPORATION, + } + + enum class Value { + S_CORPORATION, + C_CORPORATION, + B_CORPORATION, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + S_CORPORATION -> Value.S_CORPORATION + C_CORPORATION -> Value.C_CORPORATION + B_CORPORATION -> Value.B_CORPORATION + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + S_CORPORATION -> Known.S_CORPORATION + C_CORPORATION -> Known.C_CORPORATION + B_CORPORATION -> Known.B_CORPORATION + else -> throw FinchInvalidDataException("Unknown Subtype: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val LLC = Type(JsonField.of("llc")) + + @JvmField val LP = Type(JsonField.of("lp")) + + @JvmField val CORPORATION = Type(JsonField.of("corporation")) + + @JvmField val SOLE_PROPRIETOR = Type(JsonField.of("sole_proprietor")) + + @JvmField val NON_PROFIT = Type(JsonField.of("non_profit")) + + @JvmField val PARTNERSHIP = Type(JsonField.of("partnership")) + + @JvmField val COOPERATIVE = Type(JsonField.of("cooperative")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + LLC, + LP, + CORPORATION, + SOLE_PROPRIETOR, + NON_PROFIT, + PARTNERSHIP, + COOPERATIVE, + } + + enum class Value { + LLC, + LP, + CORPORATION, + SOLE_PROPRIETOR, + NON_PROFIT, + PARTNERSHIP, + COOPERATIVE, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + LLC -> Value.LLC + LP -> Value.LP + CORPORATION -> Value.CORPORATION + SOLE_PROPRIETOR -> Value.SOLE_PROPRIETOR + NON_PROFIT -> Value.NON_PROFIT + PARTNERSHIP -> Value.PARTNERSHIP + COOPERATIVE -> Value.COOPERATIVE + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + LLC -> Known.LLC + LP -> Known.LP + CORPORATION -> Known.CORPORATION + SOLE_PROPRIETOR -> Known.SOLE_PROPRIETOR + NON_PROFIT -> Known.NON_PROFIT + PARTNERSHIP -> Known.PARTNERSHIP + COOPERATIVE -> Known.COOPERATIVE + else -> throw FinchInvalidDataException("Unknown Type: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + } +} 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 new file mode 100644 index 00000000..307ad373 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt @@ -0,0 +1,274 @@ +// 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.fasterxml.jackson.databind.annotation.JsonDeserialize +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.toUnmodifiable +import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Objects + +@JsonDeserialize(builder = ConnectionCreateResponse.Builder::class) +@NoAutoDetect +class ConnectionCreateResponse +private constructor( + private val companyId: JsonField, + private val providerId: JsonField, + private val accountId: JsonField, + private val authenticationType: JsonField, + private val products: JsonField>, + private val accessToken: JsonField, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun companyId(): String = companyId.getRequired("company_id") + + fun providerId(): String = providerId.getRequired("provider_id") + + fun accountId(): String = accountId.getRequired("account_id") + + fun authenticationType(): AuthenticationType = + authenticationType.getRequired("authentication_type") + + fun products(): List = products.getRequired("products") + + fun accessToken(): String = accessToken.getRequired("access_token") + + @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId + + @JsonProperty("provider_id") @ExcludeMissing fun _providerId() = providerId + + @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId + + @JsonProperty("authentication_type") + @ExcludeMissing + fun _authenticationType() = authenticationType + + @JsonProperty("products") @ExcludeMissing fun _products() = products + + @JsonProperty("access_token") @ExcludeMissing fun _accessToken() = accessToken + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): ConnectionCreateResponse = apply { + if (!validated) { + companyId() + providerId() + accountId() + authenticationType() + products() + accessToken() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ConnectionCreateResponse && + this.companyId == other.companyId && + this.providerId == other.providerId && + this.accountId == other.accountId && + this.authenticationType == other.authenticationType && + this.products == other.products && + this.accessToken == other.accessToken && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + companyId, + providerId, + accountId, + authenticationType, + products, + accessToken, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "ConnectionCreateResponse{companyId=$companyId, providerId=$providerId, accountId=$accountId, authenticationType=$authenticationType, products=$products, accessToken=$accessToken, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var companyId: JsonField = JsonMissing.of() + private var providerId: JsonField = JsonMissing.of() + private var accountId: JsonField = JsonMissing.of() + private var authenticationType: JsonField = JsonMissing.of() + private var products: JsonField> = JsonMissing.of() + private var accessToken: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(connectionCreateResponse: ConnectionCreateResponse) = apply { + this.companyId = connectionCreateResponse.companyId + this.providerId = connectionCreateResponse.providerId + this.accountId = connectionCreateResponse.accountId + this.authenticationType = connectionCreateResponse.authenticationType + this.products = connectionCreateResponse.products + this.accessToken = connectionCreateResponse.accessToken + additionalProperties(connectionCreateResponse.additionalProperties) + } + + fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + + @JsonProperty("company_id") + @ExcludeMissing + fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + + fun providerId(providerId: String) = providerId(JsonField.of(providerId)) + + @JsonProperty("provider_id") + @ExcludeMissing + fun providerId(providerId: JsonField) = apply { this.providerId = providerId } + + fun accountId(accountId: String) = accountId(JsonField.of(accountId)) + + @JsonProperty("account_id") + @ExcludeMissing + fun accountId(accountId: JsonField) = apply { this.accountId = accountId } + + fun authenticationType(authenticationType: AuthenticationType) = + authenticationType(JsonField.of(authenticationType)) + + @JsonProperty("authentication_type") + @ExcludeMissing + fun authenticationType(authenticationType: JsonField) = apply { + this.authenticationType = authenticationType + } + + fun products(products: List) = products(JsonField.of(products)) + + @JsonProperty("products") + @ExcludeMissing + fun products(products: JsonField>) = apply { this.products = products } + + fun accessToken(accessToken: String) = accessToken(JsonField.of(accessToken)) + + @JsonProperty("access_token") + @ExcludeMissing + fun accessToken(accessToken: JsonField) = apply { this.accessToken = accessToken } + + 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(): ConnectionCreateResponse = + ConnectionCreateResponse( + companyId, + providerId, + accountId, + authenticationType, + products.map { it.toUnmodifiable() }, + accessToken, + additionalProperties.toUnmodifiable(), + ) + } + + class AuthenticationType + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AuthenticationType && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val CREDENTIALS = AuthenticationType(JsonField.of("credentials")) + + @JvmField val API_TOKEN = AuthenticationType(JsonField.of("api_token")) + + @JvmField val OAUTH = AuthenticationType(JsonField.of("oauth")) + + @JvmField val ASSISTED = AuthenticationType(JsonField.of("assisted")) + + @JvmStatic fun of(value: String) = AuthenticationType(JsonField.of(value)) + } + + enum class Known { + CREDENTIALS, + API_TOKEN, + OAUTH, + ASSISTED, + } + + enum class Value { + CREDENTIALS, + API_TOKEN, + OAUTH, + ASSISTED, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + CREDENTIALS -> Value.CREDENTIALS + API_TOKEN -> Value.API_TOKEN + OAUTH -> Value.OAUTH + ASSISTED -> Value.ASSISTED + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + CREDENTIALS -> Known.CREDENTIALS + API_TOKEN -> Known.API_TOKEN + OAUTH -> Known.OAUTH + ASSISTED -> Known.ASSISTED + else -> throw FinchInvalidDataException("Unknown AuthenticationType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } +} 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 new file mode 100644 index 00000000..b30f7604 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt @@ -0,0 +1,1046 @@ +// 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.fasterxml.jackson.databind.annotation.JsonDeserialize +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.toUnmodifiable +import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Objects +import java.util.Optional + +@JsonDeserialize(builder = EmploymentUpdateResponse.Builder::class) +@NoAutoDetect +class EmploymentUpdateResponse +private constructor( + private val firstName: JsonField, + private val middleName: JsonField, + private val lastName: JsonField, + private val title: JsonField, + private val manager: JsonField, + private val department: JsonField, + private val employment: JsonField, + private val startDate: JsonField, + private val endDate: JsonField, + private val isActive: JsonField, + private val classCode: JsonField, + private val location: JsonField, + private val income: JsonField, + private val incomeHistory: JsonField>, + private val customFields: JsonField>, + private val sourceId: JsonField, + private val id: JsonField, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The legal first name of the individual. */ + fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) + + /** The legal middle name of the individual. */ + fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) + + /** The legal last name of the individual. */ + fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + + /** The current title of the individual. */ + fun title(): Optional = Optional.ofNullable(title.getNullable("title")) + + /** The manager object representing the manager of the individual within the org. */ + fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) + + /** The department object. */ + fun department(): Optional = + Optional.ofNullable(department.getNullable("department")) + + /** The employment object. */ + fun employment(): Optional = + Optional.ofNullable(employment.getNullable("employment")) + + fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) + + fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + + /** `true` if the individual an an active employee or contractor at the company. */ + fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) + + /** Worker's compensation classification code for this employee */ + fun classCode(): Optional = Optional.ofNullable(classCode.getNullable("class_code")) + + fun location(): Optional = Optional.ofNullable(location.getNullable("location")) + + /** + * 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(): Optional = Optional.ofNullable(income.getNullable("income")) + + /** The array of income history. */ + fun incomeHistory(): Optional> = + Optional.ofNullable(incomeHistory.getNullable("income_history")) + + /** + * 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(): Optional> = + Optional.ofNullable(customFields.getNullable("custom_fields")) + + /** The source system's unique employment identifier for this individual */ + fun sourceId(): Optional = Optional.ofNullable(sourceId.getNullable("source_id")) + + /** A stable Finch `id` (UUID v4) for an individual in the company. */ + fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + + /** The legal first name of the individual. */ + @JsonProperty("first_name") @ExcludeMissing fun _firstName() = firstName + + /** The legal middle name of the individual. */ + @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName + + /** The legal last name of the individual. */ + @JsonProperty("last_name") @ExcludeMissing fun _lastName() = lastName + + /** The current title of the individual. */ + @JsonProperty("title") @ExcludeMissing fun _title() = title + + /** The manager object representing the manager of the individual within the org. */ + @JsonProperty("manager") @ExcludeMissing fun _manager() = manager + + /** The department object. */ + @JsonProperty("department") @ExcludeMissing fun _department() = department + + /** The employment object. */ + @JsonProperty("employment") @ExcludeMissing fun _employment() = employment + + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** `true` if the individual an an active employee or contractor at the company. */ + @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive + + /** Worker's compensation classification code for this employee */ + @JsonProperty("class_code") @ExcludeMissing fun _classCode() = classCode + + @JsonProperty("location") @ExcludeMissing fun _location() = location + + /** + * 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. + */ + @JsonProperty("income") @ExcludeMissing fun _income() = income + + /** The array of income history. */ + @JsonProperty("income_history") @ExcludeMissing fun _incomeHistory() = incomeHistory + + /** + * 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. + */ + @JsonProperty("custom_fields") @ExcludeMissing fun _customFields() = customFields + + /** The source system's unique employment identifier for this individual */ + @JsonProperty("source_id") @ExcludeMissing fun _sourceId() = sourceId + + /** A stable Finch `id` (UUID v4) for an individual in the company. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): EmploymentUpdateResponse = apply { + if (!validated) { + firstName() + middleName() + lastName() + title() + manager().map { it.validate() } + department().map { it.validate() } + employment().map { it.validate() } + startDate() + endDate() + isActive() + classCode() + location().map { it.validate() } + income().map { it.validate() } + incomeHistory().map { it.forEach { it.validate() } } + customFields().map { it.forEach { it.validate() } } + sourceId() + id() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is EmploymentUpdateResponse && + this.firstName == other.firstName && + this.middleName == other.middleName && + this.lastName == other.lastName && + this.title == other.title && + this.manager == other.manager && + this.department == other.department && + this.employment == other.employment && + this.startDate == other.startDate && + this.endDate == other.endDate && + this.isActive == other.isActive && + this.classCode == other.classCode && + this.location == other.location && + this.income == other.income && + this.incomeHistory == other.incomeHistory && + this.customFields == other.customFields && + this.sourceId == other.sourceId && + this.id == other.id && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + firstName, + middleName, + lastName, + title, + manager, + department, + employment, + startDate, + endDate, + isActive, + classCode, + location, + income, + incomeHistory, + customFields, + sourceId, + id, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "EmploymentUpdateResponse{firstName=$firstName, middleName=$middleName, lastName=$lastName, title=$title, manager=$manager, department=$department, employment=$employment, startDate=$startDate, endDate=$endDate, isActive=$isActive, classCode=$classCode, location=$location, income=$income, incomeHistory=$incomeHistory, customFields=$customFields, sourceId=$sourceId, id=$id, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var firstName: JsonField = JsonMissing.of() + private var middleName: JsonField = JsonMissing.of() + private var lastName: JsonField = JsonMissing.of() + private var title: JsonField = JsonMissing.of() + private var manager: JsonField = JsonMissing.of() + private var department: JsonField = JsonMissing.of() + private var employment: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var isActive: JsonField = JsonMissing.of() + private var classCode: JsonField = JsonMissing.of() + private var location: JsonField = JsonMissing.of() + private var income: JsonField = JsonMissing.of() + private var incomeHistory: JsonField> = JsonMissing.of() + private var customFields: JsonField> = JsonMissing.of() + private var sourceId: JsonField = JsonMissing.of() + private var id: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(employmentUpdateResponse: EmploymentUpdateResponse) = apply { + this.firstName = employmentUpdateResponse.firstName + this.middleName = employmentUpdateResponse.middleName + this.lastName = employmentUpdateResponse.lastName + this.title = employmentUpdateResponse.title + this.manager = employmentUpdateResponse.manager + this.department = employmentUpdateResponse.department + this.employment = employmentUpdateResponse.employment + this.startDate = employmentUpdateResponse.startDate + this.endDate = employmentUpdateResponse.endDate + this.isActive = employmentUpdateResponse.isActive + this.classCode = employmentUpdateResponse.classCode + this.location = employmentUpdateResponse.location + this.income = employmentUpdateResponse.income + this.incomeHistory = employmentUpdateResponse.incomeHistory + this.customFields = employmentUpdateResponse.customFields + this.sourceId = employmentUpdateResponse.sourceId + this.id = employmentUpdateResponse.id + additionalProperties(employmentUpdateResponse.additionalProperties) + } + + /** The legal first name of the individual. */ + fun firstName(firstName: String) = firstName(JsonField.of(firstName)) + + /** The legal first name of the individual. */ + @JsonProperty("first_name") + @ExcludeMissing + fun firstName(firstName: JsonField) = apply { this.firstName = firstName } + + /** The legal middle name of the individual. */ + fun middleName(middleName: String) = middleName(JsonField.of(middleName)) + + /** The legal middle name of the individual. */ + @JsonProperty("middle_name") + @ExcludeMissing + fun middleName(middleName: JsonField) = apply { this.middleName = middleName } + + /** The legal last name of the individual. */ + fun lastName(lastName: String) = lastName(JsonField.of(lastName)) + + /** The legal last name of the individual. */ + @JsonProperty("last_name") + @ExcludeMissing + fun lastName(lastName: JsonField) = apply { this.lastName = lastName } + + /** The current title of the individual. */ + fun title(title: String) = title(JsonField.of(title)) + + /** The current title of the individual. */ + @JsonProperty("title") + @ExcludeMissing + fun title(title: JsonField) = apply { this.title = title } + + /** The manager object representing the manager of the individual within the org. */ + fun manager(manager: Manager) = manager(JsonField.of(manager)) + + /** The manager object representing the manager of the individual within the org. */ + @JsonProperty("manager") + @ExcludeMissing + fun manager(manager: JsonField) = apply { this.manager = manager } + + /** The department object. */ + fun department(department: Department) = department(JsonField.of(department)) + + /** The department object. */ + @JsonProperty("department") + @ExcludeMissing + fun department(department: JsonField) = apply { this.department = department } + + /** The employment object. */ + fun employment(employment: Employment) = employment(JsonField.of(employment)) + + /** The employment object. */ + @JsonProperty("employment") + @ExcludeMissing + fun employment(employment: JsonField) = apply { this.employment = employment } + + fun startDate(startDate: String) = startDate(JsonField.of(startDate)) + + @JsonProperty("start_date") + @ExcludeMissing + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } + + fun endDate(endDate: String) = endDate(JsonField.of(endDate)) + + @JsonProperty("end_date") + @ExcludeMissing + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** `true` if the individual an an active employee or contractor at the company. */ + fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) + + /** `true` if the individual an an active employee or contractor at the company. */ + @JsonProperty("is_active") + @ExcludeMissing + fun isActive(isActive: JsonField) = apply { this.isActive = isActive } + + /** Worker's compensation classification code for this employee */ + fun classCode(classCode: String) = classCode(JsonField.of(classCode)) + + /** Worker's compensation classification code for this employee */ + @JsonProperty("class_code") + @ExcludeMissing + fun classCode(classCode: JsonField) = apply { this.classCode = classCode } + + fun location(location: Location) = location(JsonField.of(location)) + + @JsonProperty("location") + @ExcludeMissing + fun location(location: JsonField) = apply { this.location = location } + + /** + * 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.of(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. + */ + @JsonProperty("income") + @ExcludeMissing + fun income(income: JsonField) = apply { this.income = income } + + /** The array of income history. */ + fun incomeHistory(incomeHistory: List) = incomeHistory(JsonField.of(incomeHistory)) + + /** The array of income history. */ + @JsonProperty("income_history") + @ExcludeMissing + fun incomeHistory(incomeHistory: JsonField>) = apply { + this.incomeHistory = incomeHistory + } + + /** + * 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)) + + /** + * 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. + */ + @JsonProperty("custom_fields") + @ExcludeMissing + fun customFields(customFields: JsonField>) = apply { + this.customFields = customFields + } + + /** 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 */ + @JsonProperty("source_id") + @ExcludeMissing + fun sourceId(sourceId: JsonField) = apply { this.sourceId = sourceId } + + /** 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. */ + @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + + 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(): EmploymentUpdateResponse = + EmploymentUpdateResponse( + firstName, + middleName, + lastName, + title, + manager, + department, + employment, + startDate, + endDate, + isActive, + classCode, + location, + income, + incomeHistory.map { it.toUnmodifiable() }, + customFields.map { it.toUnmodifiable() }, + sourceId, + id, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = CustomField.Builder::class) + @NoAutoDetect + class CustomField + private constructor( + private val name: JsonField, + private val value: JsonValue, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonProperty("value") @ExcludeMissing fun _value() = value + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): CustomField = apply { + if (!validated) { + name() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CustomField && + this.name == other.name && + this.value == other.value && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + name, + value, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "CustomField{name=$name, value=$value, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var name: JsonField = JsonMissing.of() + private var value: JsonValue = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(customField: CustomField) = apply { + this.name = customField.name + this.value = customField.value + additionalProperties(customField.additionalProperties) + } + + fun name(name: String) = name(JsonField.of(name)) + + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + @JsonProperty("value") + @ExcludeMissing + fun value(value: JsonValue) = apply { this.value = value } + + 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(): CustomField = + CustomField( + name, + value, + additionalProperties.toUnmodifiable(), + ) + } + } + + /** The department object. */ + @JsonDeserialize(builder = Department.Builder::class) + @NoAutoDetect + class Department + private constructor( + private val name: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The name of the department associated with the individual. */ + fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + + /** The name of the department associated with the individual. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Department = apply { + if (!validated) { + name() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Department && + this.name == other.name && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(name, additionalProperties) + } + return hashCode + } + + override fun toString() = + "Department{name=$name, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(department: Department) = apply { + this.name = department.name + additionalProperties(department.additionalProperties) + } + + /** The name of the department associated with the individual. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name of the department associated with the individual. */ + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + 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(): Department = Department(name, additionalProperties.toUnmodifiable()) + } + } + + /** The employment object. */ + @JsonDeserialize(builder = Employment.Builder::class) + @NoAutoDetect + class Employment + private constructor( + private val type: JsonField, + private val subtype: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The main employment type of the individual. */ + 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`. + */ + fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) + + /** The main employment type of the individual. */ + @JsonProperty("type") @ExcludeMissing fun _type() = type + + /** + * The secondary employment type of the individual. Options: `full_time`, `part_time`, + * `intern`, `temp`, `seasonal` and `individual_contractor`. + */ + @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Employment = apply { + if (!validated) { + type() + subtype() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Employment && + this.type == other.type && + this.subtype == other.subtype && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + type, + subtype, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Employment{type=$type, subtype=$subtype, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var type: JsonField = JsonMissing.of() + private var subtype: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(employment: Employment) = apply { + this.type = employment.type + this.subtype = employment.subtype + additionalProperties(employment.additionalProperties) + } + + /** The main employment type of the individual. */ + fun type(type: Type) = type(JsonField.of(type)) + + /** The main employment type of the individual. */ + @JsonProperty("type") + @ExcludeMissing + fun type(type: JsonField) = apply { this.type = type } + + /** + * The secondary employment type of the individual. Options: `full_time`, `part_time`, + * `intern`, `temp`, `seasonal` and `individual_contractor`. + */ + fun subtype(subtype: Subtype) = subtype(JsonField.of(subtype)) + + /** + * The secondary employment type of the individual. Options: `full_time`, `part_time`, + * `intern`, `temp`, `seasonal` and `individual_contractor`. + */ + @JsonProperty("subtype") + @ExcludeMissing + fun subtype(subtype: JsonField) = apply { this.subtype = subtype } + + 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(): Employment = + Employment( + type, + subtype, + additionalProperties.toUnmodifiable(), + ) + } + + class Subtype + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Subtype && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val FULL_TIME = Subtype(JsonField.of("full_time")) + + @JvmField val INTERN = Subtype(JsonField.of("intern")) + + @JvmField val PART_TIME = Subtype(JsonField.of("part_time")) + + @JvmField val TEMP = Subtype(JsonField.of("temp")) + + @JvmField val SEASONAL = Subtype(JsonField.of("seasonal")) + + @JvmField val INDIVIDUAL_CONTRACTOR = Subtype(JsonField.of("individual_contractor")) + + @JvmStatic fun of(value: String) = Subtype(JsonField.of(value)) + } + + enum class Known { + FULL_TIME, + INTERN, + PART_TIME, + TEMP, + SEASONAL, + INDIVIDUAL_CONTRACTOR, + } + + enum class Value { + FULL_TIME, + INTERN, + PART_TIME, + TEMP, + SEASONAL, + INDIVIDUAL_CONTRACTOR, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + FULL_TIME -> Value.FULL_TIME + INTERN -> Value.INTERN + PART_TIME -> Value.PART_TIME + TEMP -> Value.TEMP + SEASONAL -> Value.SEASONAL + INDIVIDUAL_CONTRACTOR -> Value.INDIVIDUAL_CONTRACTOR + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + FULL_TIME -> Known.FULL_TIME + INTERN -> Known.INTERN + PART_TIME -> Known.PART_TIME + TEMP -> Known.TEMP + SEASONAL -> Known.SEASONAL + INDIVIDUAL_CONTRACTOR -> Known.INDIVIDUAL_CONTRACTOR + else -> throw FinchInvalidDataException("Unknown Subtype: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val EMPLOYEE = Type(JsonField.of("employee")) + + @JvmField val CONTRACTOR = Type(JsonField.of("contractor")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + EMPLOYEE, + CONTRACTOR, + } + + enum class Value { + EMPLOYEE, + CONTRACTOR, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + EMPLOYEE -> Value.EMPLOYEE + CONTRACTOR -> Value.CONTRACTOR + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + EMPLOYEE -> Known.EMPLOYEE + CONTRACTOR -> Known.CONTRACTOR + else -> throw FinchInvalidDataException("Unknown Type: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + } + + /** The manager object representing the manager of the individual within the org. */ + @JsonDeserialize(builder = Manager.Builder::class) + @NoAutoDetect + class Manager + private constructor( + private val id: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** A stable Finch `id` (UUID v4) for an individual in the company. */ + fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + + /** A stable Finch `id` (UUID v4) for an individual in the company. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Manager = apply { + if (!validated) { + id() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Manager && + this.id == other.id && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(id, additionalProperties) + } + return hashCode + } + + override fun toString() = "Manager{id=$id, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(manager: Manager) = apply { + this.id = manager.id + additionalProperties(manager.additionalProperties) + } + + /** 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. */ + @JsonProperty("id") + @ExcludeMissing + fun id(id: JsonField) = apply { this.id = id } + + 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(): Manager = Manager(id, additionalProperties.toUnmodifiable()) + } + } +} 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 new file mode 100644 index 00000000..bf367d8a --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt @@ -0,0 +1,899 @@ +// 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.fasterxml.jackson.databind.annotation.JsonDeserialize +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.toUnmodifiable +import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Objects +import java.util.Optional + +@JsonDeserialize(builder = IndividualUpdateResponse.Builder::class) +@NoAutoDetect +class IndividualUpdateResponse +private constructor( + private val firstName: JsonField, + private val middleName: JsonField, + private val lastName: JsonField, + private val preferredName: JsonField, + private val emails: JsonField>, + private val phoneNumbers: JsonField>, + private val gender: JsonField, + private val ethnicity: JsonField, + private val dob: JsonField, + private val ssn: JsonField, + private val encryptedSsn: JsonField, + private val residence: JsonField, + private val id: JsonField, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The legal first name of the individual. */ + fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) + + /** The legal middle name of the individual. */ + fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) + + /** The legal last name of the individual. */ + fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + + /** The preferred name of the individual. */ + fun preferredName(): Optional = + Optional.ofNullable(preferredName.getNullable("preferred_name")) + + fun emails(): Optional> = Optional.ofNullable(emails.getNullable("emails")) + + fun phoneNumbers(): Optional> = + Optional.ofNullable(phoneNumbers.getNullable("phone_numbers")) + + /** The gender of the individual. */ + fun gender(): Optional = Optional.ofNullable(gender.getNullable("gender")) + + /** The EEOC-defined ethnicity of the individual. */ + fun ethnicity(): Optional = Optional.ofNullable(ethnicity.getNullable("ethnicity")) + + fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) + + /** + * 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. + */ + fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) + + /** + * 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(): Optional = + Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) + + fun residence(): Optional = Optional.ofNullable(residence.getNullable("residence")) + + /** A stable Finch `id` (UUID v4) for an individual in the company. */ + fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + + /** The legal first name of the individual. */ + @JsonProperty("first_name") @ExcludeMissing fun _firstName() = firstName + + /** The legal middle name of the individual. */ + @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName + + /** The legal last name of the individual. */ + @JsonProperty("last_name") @ExcludeMissing fun _lastName() = lastName + + /** The preferred name of the individual. */ + @JsonProperty("preferred_name") @ExcludeMissing fun _preferredName() = preferredName + + @JsonProperty("emails") @ExcludeMissing fun _emails() = emails + + @JsonProperty("phone_numbers") @ExcludeMissing fun _phoneNumbers() = phoneNumbers + + /** The gender of the individual. */ + @JsonProperty("gender") @ExcludeMissing fun _gender() = gender + + /** The EEOC-defined ethnicity of the individual. */ + @JsonProperty("ethnicity") @ExcludeMissing fun _ethnicity() = ethnicity + + @JsonProperty("dob") @ExcludeMissing fun _dob() = dob + + /** + * 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. + */ + @JsonProperty("ssn") @ExcludeMissing fun _ssn() = ssn + + /** + * 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. + */ + @JsonProperty("encrypted_ssn") @ExcludeMissing fun _encryptedSsn() = encryptedSsn + + @JsonProperty("residence") @ExcludeMissing fun _residence() = residence + + /** A stable Finch `id` (UUID v4) for an individual in the company. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): IndividualUpdateResponse = apply { + if (!validated) { + firstName() + middleName() + lastName() + preferredName() + emails().map { it.forEach { it.validate() } } + phoneNumbers().map { it.forEach { it.validate() } } + gender() + ethnicity() + dob() + ssn() + encryptedSsn() + residence().map { it.validate() } + id() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is IndividualUpdateResponse && + this.firstName == other.firstName && + this.middleName == other.middleName && + this.lastName == other.lastName && + this.preferredName == other.preferredName && + this.emails == other.emails && + this.phoneNumbers == other.phoneNumbers && + this.gender == other.gender && + this.ethnicity == other.ethnicity && + this.dob == other.dob && + this.ssn == other.ssn && + this.encryptedSsn == other.encryptedSsn && + this.residence == other.residence && + this.id == other.id && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + firstName, + middleName, + lastName, + preferredName, + emails, + phoneNumbers, + gender, + ethnicity, + dob, + ssn, + encryptedSsn, + residence, + id, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "IndividualUpdateResponse{firstName=$firstName, middleName=$middleName, lastName=$lastName, preferredName=$preferredName, emails=$emails, phoneNumbers=$phoneNumbers, gender=$gender, ethnicity=$ethnicity, dob=$dob, ssn=$ssn, encryptedSsn=$encryptedSsn, residence=$residence, id=$id, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var firstName: JsonField = JsonMissing.of() + private var middleName: JsonField = JsonMissing.of() + private var lastName: JsonField = JsonMissing.of() + private var preferredName: JsonField = JsonMissing.of() + private var emails: JsonField> = JsonMissing.of() + private var phoneNumbers: JsonField> = JsonMissing.of() + private var gender: JsonField = JsonMissing.of() + private var ethnicity: JsonField = JsonMissing.of() + private var dob: JsonField = JsonMissing.of() + private var ssn: JsonField = JsonMissing.of() + private var encryptedSsn: JsonField = JsonMissing.of() + private var residence: JsonField = JsonMissing.of() + private var id: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(individualUpdateResponse: IndividualUpdateResponse) = apply { + this.firstName = individualUpdateResponse.firstName + this.middleName = individualUpdateResponse.middleName + this.lastName = individualUpdateResponse.lastName + this.preferredName = individualUpdateResponse.preferredName + this.emails = individualUpdateResponse.emails + this.phoneNumbers = individualUpdateResponse.phoneNumbers + this.gender = individualUpdateResponse.gender + this.ethnicity = individualUpdateResponse.ethnicity + this.dob = individualUpdateResponse.dob + this.ssn = individualUpdateResponse.ssn + this.encryptedSsn = individualUpdateResponse.encryptedSsn + this.residence = individualUpdateResponse.residence + this.id = individualUpdateResponse.id + additionalProperties(individualUpdateResponse.additionalProperties) + } + + /** The legal first name of the individual. */ + fun firstName(firstName: String) = firstName(JsonField.of(firstName)) + + /** The legal first name of the individual. */ + @JsonProperty("first_name") + @ExcludeMissing + fun firstName(firstName: JsonField) = apply { this.firstName = firstName } + + /** The legal middle name of the individual. */ + fun middleName(middleName: String) = middleName(JsonField.of(middleName)) + + /** The legal middle name of the individual. */ + @JsonProperty("middle_name") + @ExcludeMissing + fun middleName(middleName: JsonField) = apply { this.middleName = middleName } + + /** The legal last name of the individual. */ + fun lastName(lastName: String) = lastName(JsonField.of(lastName)) + + /** The legal last name of the individual. */ + @JsonProperty("last_name") + @ExcludeMissing + fun lastName(lastName: JsonField) = apply { this.lastName = lastName } + + /** The preferred name of the individual. */ + fun preferredName(preferredName: String) = preferredName(JsonField.of(preferredName)) + + /** The preferred name of the individual. */ + @JsonProperty("preferred_name") + @ExcludeMissing + fun preferredName(preferredName: JsonField) = apply { + this.preferredName = preferredName + } + + fun emails(emails: List) = emails(JsonField.of(emails)) + + @JsonProperty("emails") + @ExcludeMissing + fun emails(emails: JsonField>) = apply { this.emails = emails } + + fun phoneNumbers(phoneNumbers: List) = phoneNumbers(JsonField.of(phoneNumbers)) + + @JsonProperty("phone_numbers") + @ExcludeMissing + fun phoneNumbers(phoneNumbers: JsonField>) = apply { + this.phoneNumbers = phoneNumbers + } + + /** The gender of the individual. */ + fun gender(gender: Gender) = gender(JsonField.of(gender)) + + /** The gender of the individual. */ + @JsonProperty("gender") + @ExcludeMissing + fun gender(gender: JsonField) = apply { this.gender = gender } + + /** The EEOC-defined ethnicity of the individual. */ + fun ethnicity(ethnicity: Ethnicity) = ethnicity(JsonField.of(ethnicity)) + + /** The EEOC-defined ethnicity of the individual. */ + @JsonProperty("ethnicity") + @ExcludeMissing + fun ethnicity(ethnicity: JsonField) = apply { this.ethnicity = ethnicity } + + fun dob(dob: String) = dob(JsonField.of(dob)) + + @JsonProperty("dob") + @ExcludeMissing + fun dob(dob: JsonField) = apply { this.dob = dob } + + /** + * 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. + */ + fun ssn(ssn: String) = ssn(JsonField.of(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. + */ + @JsonProperty("ssn") + @ExcludeMissing + fun ssn(ssn: JsonField) = apply { this.ssn = ssn } + + /** + * 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.of(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. + */ + @JsonProperty("encrypted_ssn") + @ExcludeMissing + fun encryptedSsn(encryptedSsn: JsonField) = apply { + this.encryptedSsn = encryptedSsn + } + + fun residence(residence: Location) = residence(JsonField.of(residence)) + + @JsonProperty("residence") + @ExcludeMissing + fun residence(residence: JsonField) = apply { this.residence = residence } + + /** 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. */ + @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + + 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(): IndividualUpdateResponse = + IndividualUpdateResponse( + firstName, + middleName, + lastName, + preferredName, + emails.map { it.toUnmodifiable() }, + phoneNumbers.map { it.toUnmodifiable() }, + gender, + ethnicity, + dob, + ssn, + encryptedSsn, + residence, + id, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Email.Builder::class) + @NoAutoDetect + class Email + private constructor( + private val data: JsonField, + private val type: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + + @JsonProperty("data") @ExcludeMissing fun _data() = data + + @JsonProperty("type") @ExcludeMissing fun _type() = type + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Email = apply { + if (!validated) { + data() + type() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Email && + this.data == other.data && + this.type == other.type && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + data, + type, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Email{data=$data, type=$type, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var data: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(email: Email) = apply { + this.data = email.data + this.type = email.type + additionalProperties(email.additionalProperties) + } + + fun data(data: String) = data(JsonField.of(data)) + + @JsonProperty("data") + @ExcludeMissing + fun data(data: JsonField) = apply { this.data = data } + + fun type(type: Type) = type(JsonField.of(type)) + + @JsonProperty("type") + @ExcludeMissing + fun type(type: JsonField) = apply { this.type = type } + + 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(): Email = + Email( + data, + type, + additionalProperties.toUnmodifiable(), + ) + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val WORK = Type(JsonField.of("work")) + + @JvmField val PERSONAL = Type(JsonField.of("personal")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + WORK, + PERSONAL, + } + + enum class Value { + WORK, + PERSONAL, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + WORK -> Value.WORK + PERSONAL -> Value.PERSONAL + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + WORK -> Known.WORK + PERSONAL -> Known.PERSONAL + else -> throw FinchInvalidDataException("Unknown Type: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + } + + class Ethnicity + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Ethnicity && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val ASIAN = Ethnicity(JsonField.of("asian")) + + @JvmField val WHITE = Ethnicity(JsonField.of("white")) + + @JvmField + val BLACK_OR_AFRICAN_AMERICAN = Ethnicity(JsonField.of("black_or_african_american")) + + @JvmField + val NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER = + Ethnicity(JsonField.of("native_hawaiian_or_pacific_islander")) + + @JvmField + val AMERICAN_INDIAN_OR_ALASKA_NATIVE = + Ethnicity(JsonField.of("american_indian_or_alaska_native")) + + @JvmField val HISPANIC_OR_LATINO = Ethnicity(JsonField.of("hispanic_or_latino")) + + @JvmField val TWO_OR_MORE_RACES = Ethnicity(JsonField.of("two_or_more_races")) + + @JvmField val DECLINE_TO_SPECIFY = Ethnicity(JsonField.of("decline_to_specify")) + + @JvmStatic fun of(value: String) = Ethnicity(JsonField.of(value)) + } + + enum class Known { + ASIAN, + WHITE, + BLACK_OR_AFRICAN_AMERICAN, + NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER, + AMERICAN_INDIAN_OR_ALASKA_NATIVE, + HISPANIC_OR_LATINO, + TWO_OR_MORE_RACES, + DECLINE_TO_SPECIFY, + } + + enum class Value { + ASIAN, + WHITE, + BLACK_OR_AFRICAN_AMERICAN, + NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER, + AMERICAN_INDIAN_OR_ALASKA_NATIVE, + HISPANIC_OR_LATINO, + TWO_OR_MORE_RACES, + DECLINE_TO_SPECIFY, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + ASIAN -> Value.ASIAN + WHITE -> Value.WHITE + BLACK_OR_AFRICAN_AMERICAN -> Value.BLACK_OR_AFRICAN_AMERICAN + NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER -> Value.NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER + AMERICAN_INDIAN_OR_ALASKA_NATIVE -> Value.AMERICAN_INDIAN_OR_ALASKA_NATIVE + HISPANIC_OR_LATINO -> Value.HISPANIC_OR_LATINO + TWO_OR_MORE_RACES -> Value.TWO_OR_MORE_RACES + DECLINE_TO_SPECIFY -> Value.DECLINE_TO_SPECIFY + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + ASIAN -> Known.ASIAN + WHITE -> Known.WHITE + BLACK_OR_AFRICAN_AMERICAN -> Known.BLACK_OR_AFRICAN_AMERICAN + NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER -> Known.NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER + AMERICAN_INDIAN_OR_ALASKA_NATIVE -> Known.AMERICAN_INDIAN_OR_ALASKA_NATIVE + HISPANIC_OR_LATINO -> Known.HISPANIC_OR_LATINO + TWO_OR_MORE_RACES -> Known.TWO_OR_MORE_RACES + DECLINE_TO_SPECIFY -> Known.DECLINE_TO_SPECIFY + else -> throw FinchInvalidDataException("Unknown Ethnicity: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class Gender + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Gender && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val FEMALE = Gender(JsonField.of("female")) + + @JvmField val MALE = Gender(JsonField.of("male")) + + @JvmField val OTHER = Gender(JsonField.of("other")) + + @JvmField val DECLINE_TO_SPECIFY = Gender(JsonField.of("decline_to_specify")) + + @JvmStatic fun of(value: String) = Gender(JsonField.of(value)) + } + + enum class Known { + FEMALE, + MALE, + OTHER, + DECLINE_TO_SPECIFY, + } + + enum class Value { + FEMALE, + MALE, + OTHER, + DECLINE_TO_SPECIFY, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + FEMALE -> Value.FEMALE + MALE -> Value.MALE + OTHER -> Value.OTHER + DECLINE_TO_SPECIFY -> Value.DECLINE_TO_SPECIFY + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + FEMALE -> Known.FEMALE + MALE -> Known.MALE + OTHER -> Known.OTHER + DECLINE_TO_SPECIFY -> Known.DECLINE_TO_SPECIFY + else -> throw FinchInvalidDataException("Unknown Gender: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + @JsonDeserialize(builder = PhoneNumber.Builder::class) + @NoAutoDetect + class PhoneNumber + private constructor( + private val data: JsonField, + private val type: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + + @JsonProperty("data") @ExcludeMissing fun _data() = data + + @JsonProperty("type") @ExcludeMissing fun _type() = type + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): PhoneNumber = apply { + if (!validated) { + data() + type() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PhoneNumber && + this.data == other.data && + this.type == other.type && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + data, + type, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "PhoneNumber{data=$data, type=$type, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var data: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(phoneNumber: PhoneNumber) = apply { + this.data = phoneNumber.data + this.type = phoneNumber.type + additionalProperties(phoneNumber.additionalProperties) + } + + fun data(data: String) = data(JsonField.of(data)) + + @JsonProperty("data") + @ExcludeMissing + fun data(data: JsonField) = apply { this.data = data } + + fun type(type: Type) = type(JsonField.of(type)) + + @JsonProperty("type") + @ExcludeMissing + fun type(type: JsonField) = apply { this.type = type } + + 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(): PhoneNumber = + PhoneNumber( + data, + type, + additionalProperties.toUnmodifiable(), + ) + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val WORK = Type(JsonField.of("work")) + + @JvmField val PERSONAL = Type(JsonField.of("personal")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + WORK, + PERSONAL, + } + + enum class Value { + WORK, + PERSONAL, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + WORK -> Value.WORK + PERSONAL -> Value.PERSONAL + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + WORK -> Known.WORK + PERSONAL -> Known.PERSONAL + else -> throw FinchInvalidDataException("Unknown Type: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IntrospectResponseConnectionStatus.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IntrospectResponseConnectionStatus.kt new file mode 100644 index 00000000..ea97a242 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IntrospectResponseConnectionStatus.kt @@ -0,0 +1,96 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.fasterxml.jackson.annotation.JsonCreator +import com.tryfinch.api.core.JsonField +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.errors.FinchInvalidDataException + +class IntrospectResponseConnectionStatus +@JsonCreator +private constructor( + private val value: JsonField, +) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is IntrospectResponseConnectionStatus && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val PENDING = IntrospectResponseConnectionStatus(JsonField.of("pending")) + + @JvmField val PROCESSING = IntrospectResponseConnectionStatus(JsonField.of("processing")) + + @JvmField val CONNECTED = IntrospectResponseConnectionStatus(JsonField.of("connected")) + + @JvmField + val ERROR_NO_ACCOUNT_SETUP = + IntrospectResponseConnectionStatus(JsonField.of("error_no_account_setup")) + + @JvmField + val ERROR_PERMISSIONS = + IntrospectResponseConnectionStatus(JsonField.of("error_permissions")) + + @JvmField val REAUTH = IntrospectResponseConnectionStatus(JsonField.of("reauth")) + + @JvmStatic fun of(value: String) = IntrospectResponseConnectionStatus(JsonField.of(value)) + } + + enum class Known { + PENDING, + PROCESSING, + CONNECTED, + ERROR_NO_ACCOUNT_SETUP, + ERROR_PERMISSIONS, + REAUTH, + } + + enum class Value { + PENDING, + PROCESSING, + CONNECTED, + ERROR_NO_ACCOUNT_SETUP, + ERROR_PERMISSIONS, + REAUTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + PENDING -> Value.PENDING + PROCESSING -> Value.PROCESSING + CONNECTED -> Value.CONNECTED + ERROR_NO_ACCOUNT_SETUP -> Value.ERROR_NO_ACCOUNT_SETUP + ERROR_PERMISSIONS -> Value.ERROR_PERMISSIONS + REAUTH -> Value.REAUTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + PENDING -> Known.PENDING + PROCESSING -> Known.PROCESSING + CONNECTED -> Known.CONNECTED + ERROR_NO_ACCOUNT_SETUP -> Known.ERROR_NO_ACCOUNT_SETUP + ERROR_PERMISSIONS -> Known.ERROR_PERMISSIONS + REAUTH -> Known.REAUTH + else -> + throw FinchInvalidDataException( + "Unknown IntrospectResponseConnectionStatus: $value" + ) + } + + fun asString(): String = _value().asStringOrThrow() +} 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 82995dc5..13feb925 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.NoAutoDetect import com.tryfinch.api.core.toUnmodifiable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects +import java.util.Optional @JsonDeserialize(builder = Introspection.Builder::class) @NoAutoDetect @@ -25,6 +26,7 @@ private constructor( private val connectionType: JsonField, private val companyId: JsonField, private val accountId: JsonField, + private val authenticationMethods: JsonField, private val products: JsonField>, private val username: JsonField, private val payrollProviderId: JsonField, @@ -57,6 +59,9 @@ private constructor( /** The Finch uuid of the account used to connect this company. */ fun accountId(): String = accountId.getRequired("account_id") + fun authenticationMethods(): AuthenticationMethods = + authenticationMethods.getRequired("authentication_methods") + /** An array of the authorized products associated with the `access_token`. */ fun products(): List = products.getRequired("products") @@ -93,6 +98,10 @@ private constructor( /** The Finch uuid of the account used to connect this company. */ @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId + @JsonProperty("authentication_methods") + @ExcludeMissing + fun _authenticationMethods() = authenticationMethods + /** An array of the authorized products associated with the `access_token`. */ @JsonProperty("products") @ExcludeMissing fun _products() = products @@ -121,6 +130,7 @@ private constructor( connectionType() companyId() accountId() + authenticationMethods().validate() products() username() payrollProviderId() @@ -142,6 +152,7 @@ private constructor( this.connectionType == other.connectionType && this.companyId == other.companyId && this.accountId == other.accountId && + this.authenticationMethods == other.authenticationMethods && this.products == other.products && this.username == other.username && this.payrollProviderId == other.payrollProviderId && @@ -158,6 +169,7 @@ private constructor( connectionType, companyId, accountId, + authenticationMethods, products, username, payrollProviderId, @@ -169,7 +181,7 @@ private constructor( } override fun toString() = - "Introspection{clientId=$clientId, clientType=$clientType, connectionType=$connectionType, companyId=$companyId, accountId=$accountId, products=$products, username=$username, payrollProviderId=$payrollProviderId, manual=$manual, additionalProperties=$additionalProperties}" + "Introspection{clientId=$clientId, clientType=$clientType, connectionType=$connectionType, companyId=$companyId, accountId=$accountId, authenticationMethods=$authenticationMethods, products=$products, username=$username, payrollProviderId=$payrollProviderId, manual=$manual, additionalProperties=$additionalProperties}" companion object { @@ -183,6 +195,7 @@ private constructor( private var connectionType: JsonField = JsonMissing.of() private var companyId: JsonField = JsonMissing.of() private var accountId: JsonField = JsonMissing.of() + private var authenticationMethods: JsonField = JsonMissing.of() private var products: JsonField> = JsonMissing.of() private var username: JsonField = JsonMissing.of() private var payrollProviderId: JsonField = JsonMissing.of() @@ -196,6 +209,7 @@ private constructor( this.connectionType = introspection.connectionType this.companyId = introspection.companyId this.accountId = introspection.accountId + this.authenticationMethods = introspection.authenticationMethods this.products = introspection.products this.username = introspection.username this.payrollProviderId = introspection.payrollProviderId @@ -258,6 +272,15 @@ private constructor( @ExcludeMissing fun accountId(accountId: JsonField) = apply { this.accountId = accountId } + fun authenticationMethods(authenticationMethods: AuthenticationMethods) = + authenticationMethods(JsonField.of(authenticationMethods)) + + @JsonProperty("authentication_methods") + @ExcludeMissing + fun authenticationMethods(authenticationMethods: JsonField) = apply { + this.authenticationMethods = authenticationMethods + } + /** An array of the authorized products associated with the `access_token`. */ fun products(products: List) = products(JsonField.of(products)) @@ -320,6 +343,7 @@ private constructor( connectionType, companyId, accountId, + authenticationMethods, products.map { it.toUnmodifiable() }, username, payrollProviderId, @@ -328,6 +352,245 @@ private constructor( ) } + @JsonDeserialize(builder = AuthenticationMethods.Builder::class) + @NoAutoDetect + class AuthenticationMethods + private constructor( + private val type: JsonField, + private val connectionStatus: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + + fun connectionStatus(): Optional = + Optional.ofNullable(connectionStatus.getNullable("connection_status")) + + @JsonProperty("type") @ExcludeMissing fun _type() = type + + @JsonProperty("connection_status") + @ExcludeMissing + fun _connectionStatus() = connectionStatus + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): AuthenticationMethods = apply { + if (!validated) { + type() + connectionStatus().map { it.validate() } + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AuthenticationMethods && + this.type == other.type && + this.connectionStatus == other.connectionStatus && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + type, + connectionStatus, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "AuthenticationMethods{type=$type, connectionStatus=$connectionStatus, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var type: JsonField = JsonMissing.of() + private var connectionStatus: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(authenticationMethods: AuthenticationMethods) = apply { + this.type = authenticationMethods.type + this.connectionStatus = authenticationMethods.connectionStatus + additionalProperties(authenticationMethods.additionalProperties) + } + + fun type(type: String) = type(JsonField.of(type)) + + @JsonProperty("type") + @ExcludeMissing + fun type(type: JsonField) = apply { this.type = type } + + fun connectionStatus(connectionStatus: ConnectionStatus) = + connectionStatus(JsonField.of(connectionStatus)) + + @JsonProperty("connection_status") + @ExcludeMissing + fun connectionStatus(connectionStatus: JsonField) = apply { + this.connectionStatus = connectionStatus + } + + 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(): AuthenticationMethods = + AuthenticationMethods( + type, + connectionStatus, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = ConnectionStatus.Builder::class) + @NoAutoDetect + class ConnectionStatus + private constructor( + private val status: JsonField, + private val message: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun status(): Optional = + Optional.ofNullable(status.getNullable("status")) + + fun message(): Optional = Optional.ofNullable(message.getNullable("message")) + + @JsonProperty("status") @ExcludeMissing fun _status() = status + + @JsonProperty("message") @ExcludeMissing fun _message() = message + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): ConnectionStatus = apply { + if (!validated) { + status() + message() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ConnectionStatus && + this.status == other.status && + this.message == other.message && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + status, + message, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "ConnectionStatus{status=$status, message=$message, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var status: JsonField = JsonMissing.of() + private var message: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(connectionStatus: ConnectionStatus) = apply { + this.status = connectionStatus.status + this.message = connectionStatus.message + additionalProperties(connectionStatus.additionalProperties) + } + + fun status(status: IntrospectResponseConnectionStatus) = + status(JsonField.of(status)) + + @JsonProperty("status") + @ExcludeMissing + fun status(status: JsonField) = apply { + this.status = status + } + + fun message(message: String) = message(JsonField.of(message)) + + @JsonProperty("message") + @ExcludeMissing + fun message(message: JsonField) = apply { this.message = message } + + 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(): ConnectionStatus = + ConnectionStatus( + status, + message, + additionalProperties.toUnmodifiable(), + ) + } + } + } + class ClientType @JsonCreator private constructor( 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 new file mode 100644 index 00000000..3d33e442 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt @@ -0,0 +1,137 @@ +// 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.JsonProperty +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +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.toUnmodifiable +import java.util.Objects + +@JsonDeserialize(builder = PaymentCreateResponse.Builder::class) +@NoAutoDetect +class PaymentCreateResponse +private constructor( + private val paymentId: JsonField, + private val payDate: JsonField, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The ID of the payment. */ + fun paymentId(): String = paymentId.getRequired("payment_id") + + /** The date of the payment. */ + fun payDate(): String = payDate.getRequired("pay_date") + + /** The ID of the payment. */ + @JsonProperty("payment_id") @ExcludeMissing fun _paymentId() = paymentId + + /** The date of the payment. */ + @JsonProperty("pay_date") @ExcludeMissing fun _payDate() = payDate + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): PaymentCreateResponse = apply { + if (!validated) { + paymentId() + payDate() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PaymentCreateResponse && + this.paymentId == other.paymentId && + this.payDate == other.payDate && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + paymentId, + payDate, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "PaymentCreateResponse{paymentId=$paymentId, payDate=$payDate, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var paymentId: JsonField = JsonMissing.of() + private var payDate: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(paymentCreateResponse: PaymentCreateResponse) = apply { + this.paymentId = paymentCreateResponse.paymentId + this.payDate = paymentCreateResponse.payDate + additionalProperties(paymentCreateResponse.additionalProperties) + } + + /** The ID of the payment. */ + fun paymentId(paymentId: String) = paymentId(JsonField.of(paymentId)) + + /** The ID of the payment. */ + @JsonProperty("payment_id") + @ExcludeMissing + fun paymentId(paymentId: JsonField) = apply { this.paymentId = paymentId } + + /** The date of the payment. */ + fun payDate(payDate: String) = payDate(JsonField.of(payDate)) + + /** The date of the payment. */ + @JsonProperty("pay_date") + @ExcludeMissing + fun payDate(payDate: JsonField) = apply { this.payDate = payDate } + + 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(): PaymentCreateResponse = + PaymentCreateResponse( + paymentId, + payDate, + additionalProperties.toUnmodifiable(), + ) + } +} 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 new file mode 100644 index 00000000..14cb203d --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt @@ -0,0 +1,1061 @@ +// 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.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.tryfinch.api.core.ExcludeMissing +import com.tryfinch.api.core.JsonField +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.toUnmodifiable +import com.tryfinch.api.errors.FinchInvalidDataException +import com.tryfinch.api.models.* +import java.util.Objects +import java.util.Optional + +class SandboxCompanyUpdateParams +constructor( + private val accounts: List?, + private val departments: List?, + private val ein: String?, + private val entity: Entity?, + private val legalName: String?, + private val locations: List?, + private val primaryEmail: String?, + private val primaryPhoneNumber: String?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun accounts(): Optional> = Optional.ofNullable(accounts) + + fun departments(): Optional> = Optional.ofNullable(departments) + + fun ein(): Optional = Optional.ofNullable(ein) + + fun entity(): Optional = Optional.ofNullable(entity) + + fun legalName(): Optional = Optional.ofNullable(legalName) + + fun locations(): Optional> = Optional.ofNullable(locations) + + fun primaryEmail(): Optional = Optional.ofNullable(primaryEmail) + + fun primaryPhoneNumber(): Optional = Optional.ofNullable(primaryPhoneNumber) + + @JvmSynthetic + internal fun getBody(): SandboxCompanyUpdateBody { + return SandboxCompanyUpdateBody( + accounts, + departments, + ein, + entity, + legalName, + locations, + primaryEmail, + primaryPhoneNumber, + additionalBodyProperties, + ) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + @JsonDeserialize(builder = SandboxCompanyUpdateBody.Builder::class) + @NoAutoDetect + class SandboxCompanyUpdateBody + internal constructor( + private val accounts: List?, + private val departments: List?, + private val ein: String?, + private val entity: Entity?, + private val legalName: String?, + private val locations: List?, + private val primaryEmail: String?, + private val primaryPhoneNumber: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** An array of bank account objects associated with the payroll/HRIS system. */ + @JsonProperty("accounts") fun accounts(): List? = accounts + + /** The array of company departments. */ + @JsonProperty("departments") fun departments(): List? = departments + + /** The employer identification number. */ + @JsonProperty("ein") fun ein(): String? = ein + + /** The entity type object. */ + @JsonProperty("entity") fun entity(): Entity? = entity + + /** The legal name of the company. */ + @JsonProperty("legal_name") fun legalName(): String? = legalName + + @JsonProperty("locations") fun locations(): List? = locations + + /** The email of the main administrator on the account. */ + @JsonProperty("primary_email") fun primaryEmail(): String? = primaryEmail + + /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + @JsonProperty("primary_phone_number") fun primaryPhoneNumber(): String? = primaryPhoneNumber + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxCompanyUpdateBody && + this.accounts == other.accounts && + this.departments == other.departments && + this.ein == other.ein && + this.entity == other.entity && + this.legalName == other.legalName && + this.locations == other.locations && + this.primaryEmail == other.primaryEmail && + this.primaryPhoneNumber == other.primaryPhoneNumber && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + accounts, + departments, + ein, + entity, + legalName, + locations, + primaryEmail, + primaryPhoneNumber, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "SandboxCompanyUpdateBody{accounts=$accounts, departments=$departments, ein=$ein, entity=$entity, legalName=$legalName, locations=$locations, primaryEmail=$primaryEmail, primaryPhoneNumber=$primaryPhoneNumber, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var accounts: List? = null + private var departments: List? = null + private var ein: String? = null + private var entity: Entity? = null + private var legalName: String? = null + private var locations: List? = null + private var primaryEmail: String? = null + private var primaryPhoneNumber: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sandboxCompanyUpdateBody: SandboxCompanyUpdateBody) = apply { + this.accounts = sandboxCompanyUpdateBody.accounts + this.departments = sandboxCompanyUpdateBody.departments + this.ein = sandboxCompanyUpdateBody.ein + this.entity = sandboxCompanyUpdateBody.entity + this.legalName = sandboxCompanyUpdateBody.legalName + this.locations = sandboxCompanyUpdateBody.locations + this.primaryEmail = sandboxCompanyUpdateBody.primaryEmail + this.primaryPhoneNumber = sandboxCompanyUpdateBody.primaryPhoneNumber + additionalProperties(sandboxCompanyUpdateBody.additionalProperties) + } + + /** An array of bank account objects associated with the payroll/HRIS system. */ + @JsonProperty("accounts") + fun accounts(accounts: List) = apply { this.accounts = accounts } + + /** The array of company departments. */ + @JsonProperty("departments") + fun departments(departments: List) = apply { + this.departments = departments + } + + /** The employer identification number. */ + @JsonProperty("ein") fun ein(ein: String) = apply { this.ein = ein } + + /** The entity type object. */ + @JsonProperty("entity") fun entity(entity: Entity) = apply { this.entity = entity } + + /** The legal name of the company. */ + @JsonProperty("legal_name") + fun legalName(legalName: String) = apply { this.legalName = legalName } + + @JsonProperty("locations") + fun locations(locations: List) = apply { this.locations = locations } + + /** The email of the main administrator on the account. */ + @JsonProperty("primary_email") + fun primaryEmail(primaryEmail: String) = apply { this.primaryEmail = primaryEmail } + + /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + @JsonProperty("primary_phone_number") + fun primaryPhoneNumber(primaryPhoneNumber: String) = apply { + this.primaryPhoneNumber = primaryPhoneNumber + } + + 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(): SandboxCompanyUpdateBody = + SandboxCompanyUpdateBody( + accounts?.toUnmodifiable(), + departments?.toUnmodifiable(), + ein, + entity, + legalName, + locations?.toUnmodifiable(), + primaryEmail, + primaryPhoneNumber, + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxCompanyUpdateParams && + this.accounts == other.accounts && + this.departments == other.departments && + this.ein == other.ein && + this.entity == other.entity && + this.legalName == other.legalName && + this.locations == other.locations && + this.primaryEmail == other.primaryEmail && + this.primaryPhoneNumber == other.primaryPhoneNumber && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + accounts, + departments, + ein, + entity, + legalName, + locations, + primaryEmail, + primaryPhoneNumber, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "SandboxCompanyUpdateParams{accounts=$accounts, departments=$departments, ein=$ein, entity=$entity, legalName=$legalName, locations=$locations, primaryEmail=$primaryEmail, primaryPhoneNumber=$primaryPhoneNumber, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var accounts: MutableList = mutableListOf() + private var departments: MutableList = mutableListOf() + private var ein: String? = null + private var entity: Entity? = null + private var legalName: String? = null + private var locations: MutableList = mutableListOf() + private var primaryEmail: String? = null + private var primaryPhoneNumber: String? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sandboxCompanyUpdateParams: SandboxCompanyUpdateParams) = apply { + this.accounts(sandboxCompanyUpdateParams.accounts ?: listOf()) + this.departments(sandboxCompanyUpdateParams.departments ?: listOf()) + this.ein = sandboxCompanyUpdateParams.ein + this.entity = sandboxCompanyUpdateParams.entity + this.legalName = sandboxCompanyUpdateParams.legalName + this.locations(sandboxCompanyUpdateParams.locations ?: listOf()) + this.primaryEmail = sandboxCompanyUpdateParams.primaryEmail + this.primaryPhoneNumber = sandboxCompanyUpdateParams.primaryPhoneNumber + additionalQueryParams(sandboxCompanyUpdateParams.additionalQueryParams) + additionalHeaders(sandboxCompanyUpdateParams.additionalHeaders) + additionalBodyProperties(sandboxCompanyUpdateParams.additionalBodyProperties) + } + + /** An array of bank account objects associated with the payroll/HRIS system. */ + fun accounts(accounts: List) = apply { + this.accounts.clear() + this.accounts.addAll(accounts) + } + + /** An array of bank account objects associated with the payroll/HRIS system. */ + fun addAccount(account: Account) = apply { this.accounts.add(account) } + + /** The array of company departments. */ + fun departments(departments: List) = apply { + this.departments.clear() + this.departments.addAll(departments) + } + + /** The array of company departments. */ + fun addDepartment(department: Department) = apply { this.departments.add(department) } + + /** The employer identification number. */ + fun ein(ein: String) = apply { this.ein = ein } + + /** The entity type object. */ + fun entity(entity: Entity) = apply { this.entity = entity } + + /** The legal name of the company. */ + fun legalName(legalName: String) = apply { this.legalName = legalName } + + fun locations(locations: List) = apply { + this.locations.clear() + this.locations.addAll(locations) + } + + fun addLocation(location: Location) = apply { this.locations.add(location) } + + /** The email of the main administrator on the account. */ + fun primaryEmail(primaryEmail: String) = apply { this.primaryEmail = primaryEmail } + + /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + fun primaryPhoneNumber(primaryPhoneNumber: String) = apply { + this.primaryPhoneNumber = primaryPhoneNumber + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): SandboxCompanyUpdateParams = + SandboxCompanyUpdateParams( + if (accounts.size == 0) null else accounts.toUnmodifiable(), + if (departments.size == 0) null else departments.toUnmodifiable(), + ein, + entity, + legalName, + if (locations.size == 0) null else locations.toUnmodifiable(), + primaryEmail, + primaryPhoneNumber, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Account.Builder::class) + @NoAutoDetect + class Account + private constructor( + private val routingNumber: String?, + private val accountName: String?, + private val institutionName: String?, + private val accountType: AccountType?, + private val accountNumber: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** + * A nine-digit code that's based on the U.S. Bank location where your account was opened. + */ + @JsonProperty("routing_number") fun routingNumber(): String? = routingNumber + + /** The name of the bank associated in the payroll/HRIS system. */ + @JsonProperty("account_name") fun accountName(): String? = accountName + + /** Name of the banking institution. */ + @JsonProperty("institution_name") fun institutionName(): String? = institutionName + + /** The type of bank account. */ + @JsonProperty("account_type") fun accountType(): AccountType? = accountType + + /** 10-12 digit number to specify the bank account */ + @JsonProperty("account_number") fun accountNumber(): String? = accountNumber + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Account && + this.routingNumber == other.routingNumber && + this.accountName == other.accountName && + this.institutionName == other.institutionName && + this.accountType == other.accountType && + this.accountNumber == other.accountNumber && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + routingNumber, + accountName, + institutionName, + accountType, + accountNumber, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Account{routingNumber=$routingNumber, accountName=$accountName, institutionName=$institutionName, accountType=$accountType, accountNumber=$accountNumber, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var routingNumber: String? = null + private var accountName: String? = null + private var institutionName: String? = null + private var accountType: AccountType? = null + private var accountNumber: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(account: Account) = apply { + this.routingNumber = account.routingNumber + this.accountName = account.accountName + this.institutionName = account.institutionName + this.accountType = account.accountType + this.accountNumber = account.accountNumber + additionalProperties(account.additionalProperties) + } + + /** + * A nine-digit code that's based on the U.S. Bank location where your account was + * opened. + */ + @JsonProperty("routing_number") + fun routingNumber(routingNumber: String) = apply { this.routingNumber = routingNumber } + + /** The name of the bank associated in the payroll/HRIS system. */ + @JsonProperty("account_name") + fun accountName(accountName: String) = apply { this.accountName = accountName } + + /** Name of the banking institution. */ + @JsonProperty("institution_name") + fun institutionName(institutionName: String) = apply { + this.institutionName = institutionName + } + + /** The type of bank account. */ + @JsonProperty("account_type") + fun accountType(accountType: AccountType) = apply { this.accountType = accountType } + + /** 10-12 digit number to specify the bank account */ + @JsonProperty("account_number") + fun accountNumber(accountNumber: String) = apply { this.accountNumber = accountNumber } + + 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(): Account = + Account( + routingNumber, + accountName, + institutionName, + accountType, + accountNumber, + additionalProperties.toUnmodifiable(), + ) + } + + class AccountType + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AccountType && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val CHECKING = AccountType(JsonField.of("checking")) + + @JvmField val SAVINGS = AccountType(JsonField.of("savings")) + + @JvmStatic fun of(value: String) = AccountType(JsonField.of(value)) + } + + enum class Known { + CHECKING, + SAVINGS, + } + + enum class Value { + CHECKING, + SAVINGS, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + CHECKING -> Value.CHECKING + SAVINGS -> Value.SAVINGS + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + CHECKING -> Known.CHECKING + SAVINGS -> Known.SAVINGS + else -> throw FinchInvalidDataException("Unknown AccountType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + } + + @JsonDeserialize(builder = Department.Builder::class) + @NoAutoDetect + class Department + private constructor( + private val name: String?, + private val parent: Parent?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** The department name. */ + @JsonProperty("name") fun name(): String? = name + + /** The parent department, if present. */ + @JsonProperty("parent") fun parent(): Parent? = parent + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Department && + this.name == other.name && + this.parent == other.parent && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + name, + parent, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Department{name=$name, parent=$parent, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var name: String? = null + private var parent: Parent? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(department: Department) = apply { + this.name = department.name + this.parent = department.parent + additionalProperties(department.additionalProperties) + } + + /** The department name. */ + @JsonProperty("name") fun name(name: String) = apply { this.name = name } + + /** The parent department, if present. */ + @JsonProperty("parent") fun parent(parent: Parent) = apply { this.parent = parent } + + 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(): Department = + Department( + name, + parent, + additionalProperties.toUnmodifiable(), + ) + } + + /** The parent department, if present. */ + @JsonDeserialize(builder = Parent.Builder::class) + @NoAutoDetect + class Parent + private constructor( + private val name: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** The parent department's name. */ + @JsonProperty("name") fun name(): String? = name + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Parent && + this.name == other.name && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(name, additionalProperties) + } + return hashCode + } + + override fun toString() = + "Parent{name=$name, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var name: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(parent: Parent) = apply { + this.name = parent.name + additionalProperties(parent.additionalProperties) + } + + /** The parent department's name. */ + @JsonProperty("name") fun name(name: String) = apply { this.name = name } + + 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(): Parent = Parent(name, additionalProperties.toUnmodifiable()) + } + } + } + + /** The entity type object. */ + @JsonDeserialize(builder = Entity.Builder::class) + @NoAutoDetect + class Entity + private constructor( + private val type: Type?, + private val subtype: Subtype?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** The tax payer type of the company. */ + @JsonProperty("type") fun type(): Type? = type + + /** The tax payer subtype of the company. */ + @JsonProperty("subtype") fun subtype(): Subtype? = subtype + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Entity && + this.type == other.type && + this.subtype == other.subtype && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + type, + subtype, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Entity{type=$type, subtype=$subtype, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var type: Type? = null + private var subtype: Subtype? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(entity: Entity) = apply { + this.type = entity.type + this.subtype = entity.subtype + additionalProperties(entity.additionalProperties) + } + + /** The tax payer type of the company. */ + @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + + /** The tax payer subtype of the company. */ + @JsonProperty("subtype") + fun subtype(subtype: Subtype) = apply { this.subtype = subtype } + + 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(): Entity = + Entity( + type, + subtype, + additionalProperties.toUnmodifiable(), + ) + } + + class Subtype + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Subtype && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val S_CORPORATION = Subtype(JsonField.of("s_corporation")) + + @JvmField val C_CORPORATION = Subtype(JsonField.of("c_corporation")) + + @JvmField val B_CORPORATION = Subtype(JsonField.of("b_corporation")) + + @JvmStatic fun of(value: String) = Subtype(JsonField.of(value)) + } + + enum class Known { + S_CORPORATION, + C_CORPORATION, + B_CORPORATION, + } + + enum class Value { + S_CORPORATION, + C_CORPORATION, + B_CORPORATION, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + S_CORPORATION -> Value.S_CORPORATION + C_CORPORATION -> Value.C_CORPORATION + B_CORPORATION -> Value.B_CORPORATION + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + S_CORPORATION -> Known.S_CORPORATION + C_CORPORATION -> Known.C_CORPORATION + B_CORPORATION -> Known.B_CORPORATION + else -> throw FinchInvalidDataException("Unknown Subtype: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val LLC = Type(JsonField.of("llc")) + + @JvmField val LP = Type(JsonField.of("lp")) + + @JvmField val CORPORATION = Type(JsonField.of("corporation")) + + @JvmField val SOLE_PROPRIETOR = Type(JsonField.of("sole_proprietor")) + + @JvmField val NON_PROFIT = Type(JsonField.of("non_profit")) + + @JvmField val PARTNERSHIP = Type(JsonField.of("partnership")) + + @JvmField val COOPERATIVE = Type(JsonField.of("cooperative")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + LLC, + LP, + CORPORATION, + SOLE_PROPRIETOR, + NON_PROFIT, + PARTNERSHIP, + COOPERATIVE, + } + + enum class Value { + LLC, + LP, + CORPORATION, + SOLE_PROPRIETOR, + NON_PROFIT, + PARTNERSHIP, + COOPERATIVE, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + LLC -> Value.LLC + LP -> Value.LP + CORPORATION -> Value.CORPORATION + SOLE_PROPRIETOR -> Value.SOLE_PROPRIETOR + NON_PROFIT -> Value.NON_PROFIT + PARTNERSHIP -> Value.PARTNERSHIP + COOPERATIVE -> Value.COOPERATIVE + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + LLC -> Known.LLC + LP -> Known.LP + CORPORATION -> Known.CORPORATION + SOLE_PROPRIETOR -> Known.SOLE_PROPRIETOR + NON_PROFIT -> Known.NON_PROFIT + PARTNERSHIP -> Known.PARTNERSHIP + COOPERATIVE -> Known.COOPERATIVE + else -> throw FinchInvalidDataException("Unknown Type: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + } +} 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 new file mode 100644 index 00000000..8ce56672 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt @@ -0,0 +1,407 @@ +// 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.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.tryfinch.api.core.ExcludeMissing +import com.tryfinch.api.core.JsonField +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.toUnmodifiable +import com.tryfinch.api.errors.FinchInvalidDataException +import com.tryfinch.api.models.* +import java.util.Objects +import java.util.Optional + +class SandboxConnectionAccountCreateParams +constructor( + private val companyId: String, + private val providerId: String, + private val authenticationType: AuthenticationType?, + private val products: List?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun companyId(): String = companyId + + fun providerId(): String = providerId + + fun authenticationType(): Optional = Optional.ofNullable(authenticationType) + + fun products(): Optional> = Optional.ofNullable(products) + + @JvmSynthetic + internal fun getBody(): SandboxConnectionAccountCreateBody { + return SandboxConnectionAccountCreateBody( + companyId, + providerId, + authenticationType, + products, + additionalBodyProperties, + ) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + @JsonDeserialize(builder = SandboxConnectionAccountCreateBody.Builder::class) + @NoAutoDetect + class SandboxConnectionAccountCreateBody + internal constructor( + private val companyId: String?, + private val providerId: String?, + private val authenticationType: AuthenticationType?, + private val products: List?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("company_id") fun companyId(): String? = companyId + + @JsonProperty("provider_id") fun providerId(): String? = providerId + + @JsonProperty("authentication_type") + fun authenticationType(): AuthenticationType? = authenticationType + + /** + * Optional, defaults to Organization products (`company`, `directory`, `employment`, + * `individual`) + */ + @JsonProperty("products") fun products(): List? = products + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxConnectionAccountCreateBody && + this.companyId == other.companyId && + this.providerId == other.providerId && + this.authenticationType == other.authenticationType && + this.products == other.products && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + companyId, + providerId, + authenticationType, + products, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "SandboxConnectionAccountCreateBody{companyId=$companyId, providerId=$providerId, authenticationType=$authenticationType, products=$products, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var companyId: String? = null + private var providerId: String? = null + private var authenticationType: AuthenticationType? = null + private var products: List? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + sandboxConnectionAccountCreateBody: SandboxConnectionAccountCreateBody + ) = apply { + this.companyId = sandboxConnectionAccountCreateBody.companyId + this.providerId = sandboxConnectionAccountCreateBody.providerId + this.authenticationType = sandboxConnectionAccountCreateBody.authenticationType + this.products = sandboxConnectionAccountCreateBody.products + additionalProperties(sandboxConnectionAccountCreateBody.additionalProperties) + } + + @JsonProperty("company_id") + fun companyId(companyId: String) = apply { this.companyId = companyId } + + @JsonProperty("provider_id") + fun providerId(providerId: String) = apply { this.providerId = providerId } + + @JsonProperty("authentication_type") + fun authenticationType(authenticationType: AuthenticationType) = apply { + this.authenticationType = authenticationType + } + + /** + * Optional, defaults to Organization products (`company`, `directory`, `employment`, + * `individual`) + */ + @JsonProperty("products") + fun products(products: List) = apply { this.products = products } + + 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(): SandboxConnectionAccountCreateBody = + SandboxConnectionAccountCreateBody( + checkNotNull(companyId) { "`companyId` is required but was not set" }, + checkNotNull(providerId) { "`providerId` is required but was not set" }, + authenticationType, + products?.toUnmodifiable(), + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxConnectionAccountCreateParams && + this.companyId == other.companyId && + this.providerId == other.providerId && + this.authenticationType == other.authenticationType && + this.products == other.products && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + companyId, + providerId, + authenticationType, + products, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "SandboxConnectionAccountCreateParams{companyId=$companyId, providerId=$providerId, authenticationType=$authenticationType, products=$products, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var companyId: String? = null + private var providerId: String? = null + private var authenticationType: AuthenticationType? = null + private var products: MutableList = mutableListOf() + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + sandboxConnectionAccountCreateParams: SandboxConnectionAccountCreateParams + ) = apply { + this.companyId = sandboxConnectionAccountCreateParams.companyId + this.providerId = sandboxConnectionAccountCreateParams.providerId + this.authenticationType = sandboxConnectionAccountCreateParams.authenticationType + this.products(sandboxConnectionAccountCreateParams.products ?: listOf()) + additionalQueryParams(sandboxConnectionAccountCreateParams.additionalQueryParams) + additionalHeaders(sandboxConnectionAccountCreateParams.additionalHeaders) + additionalBodyProperties(sandboxConnectionAccountCreateParams.additionalBodyProperties) + } + + fun companyId(companyId: String) = apply { this.companyId = companyId } + + fun providerId(providerId: String) = apply { this.providerId = providerId } + + fun authenticationType(authenticationType: AuthenticationType) = apply { + this.authenticationType = authenticationType + } + + /** + * Optional, defaults to Organization products (`company`, `directory`, `employment`, + * `individual`) + */ + fun products(products: List) = apply { + this.products.clear() + this.products.addAll(products) + } + + /** + * Optional, defaults to Organization products (`company`, `directory`, `employment`, + * `individual`) + */ + fun addProduct(product: String) = apply { this.products.add(product) } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): SandboxConnectionAccountCreateParams = + SandboxConnectionAccountCreateParams( + checkNotNull(companyId) { "`companyId` is required but was not set" }, + checkNotNull(providerId) { "`providerId` is required but was not set" }, + authenticationType, + if (products.size == 0) null else products.toUnmodifiable(), + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + class AuthenticationType + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AuthenticationType && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val CREDENTIALS = AuthenticationType(JsonField.of("credentials")) + + @JvmField val API_TOKEN = AuthenticationType(JsonField.of("api_token")) + + @JvmField val OAUTH = AuthenticationType(JsonField.of("oauth")) + + @JvmField val ASSISTED = AuthenticationType(JsonField.of("assisted")) + + @JvmStatic fun of(value: String) = AuthenticationType(JsonField.of(value)) + } + + enum class Known { + CREDENTIALS, + API_TOKEN, + OAUTH, + ASSISTED, + } + + enum class Value { + CREDENTIALS, + API_TOKEN, + OAUTH, + ASSISTED, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + CREDENTIALS -> Value.CREDENTIALS + API_TOKEN -> Value.API_TOKEN + OAUTH -> Value.OAUTH + ASSISTED -> Value.ASSISTED + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + CREDENTIALS -> Known.CREDENTIALS + API_TOKEN -> Known.API_TOKEN + OAUTH -> Known.OAUTH + ASSISTED -> Known.ASSISTED + else -> throw FinchInvalidDataException("Unknown AuthenticationType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } +} 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 new file mode 100644 index 00000000..9ba16a8b --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt @@ -0,0 +1,242 @@ +// 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.JsonProperty +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.tryfinch.api.core.ExcludeMissing +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.toUnmodifiable +import com.tryfinch.api.models.* +import java.util.Objects +import java.util.Optional + +class SandboxConnectionAccountUpdateParams +constructor( + private val connectionStatus: IntrospectResponseConnectionStatus?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun connectionStatus(): Optional = + Optional.ofNullable(connectionStatus) + + @JvmSynthetic + internal fun getBody(): SandboxConnectionAccountUpdateBody { + return SandboxConnectionAccountUpdateBody(connectionStatus, additionalBodyProperties) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + @JsonDeserialize(builder = SandboxConnectionAccountUpdateBody.Builder::class) + @NoAutoDetect + class SandboxConnectionAccountUpdateBody + internal constructor( + private val connectionStatus: IntrospectResponseConnectionStatus?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("connection_status") + fun connectionStatus(): IntrospectResponseConnectionStatus? = connectionStatus + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxConnectionAccountUpdateBody && + this.connectionStatus == other.connectionStatus && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(connectionStatus, additionalProperties) + } + return hashCode + } + + override fun toString() = + "SandboxConnectionAccountUpdateBody{connectionStatus=$connectionStatus, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var connectionStatus: IntrospectResponseConnectionStatus? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + sandboxConnectionAccountUpdateBody: SandboxConnectionAccountUpdateBody + ) = apply { + this.connectionStatus = sandboxConnectionAccountUpdateBody.connectionStatus + additionalProperties(sandboxConnectionAccountUpdateBody.additionalProperties) + } + + @JsonProperty("connection_status") + fun connectionStatus(connectionStatus: IntrospectResponseConnectionStatus) = apply { + this.connectionStatus = connectionStatus + } + + 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(): SandboxConnectionAccountUpdateBody = + SandboxConnectionAccountUpdateBody( + connectionStatus, + additionalProperties.toUnmodifiable() + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxConnectionAccountUpdateParams && + this.connectionStatus == other.connectionStatus && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + connectionStatus, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "SandboxConnectionAccountUpdateParams{connectionStatus=$connectionStatus, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var connectionStatus: IntrospectResponseConnectionStatus? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + sandboxConnectionAccountUpdateParams: SandboxConnectionAccountUpdateParams + ) = apply { + this.connectionStatus = sandboxConnectionAccountUpdateParams.connectionStatus + additionalQueryParams(sandboxConnectionAccountUpdateParams.additionalQueryParams) + additionalHeaders(sandboxConnectionAccountUpdateParams.additionalHeaders) + additionalBodyProperties(sandboxConnectionAccountUpdateParams.additionalBodyProperties) + } + + fun connectionStatus(connectionStatus: IntrospectResponseConnectionStatus) = apply { + this.connectionStatus = connectionStatus + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): SandboxConnectionAccountUpdateParams = + SandboxConnectionAccountUpdateParams( + connectionStatus, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } +} 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 new file mode 100644 index 00000000..cd9faf93 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt @@ -0,0 +1,392 @@ +// 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.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.tryfinch.api.core.ExcludeMissing +import com.tryfinch.api.core.JsonField +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.toUnmodifiable +import com.tryfinch.api.errors.FinchInvalidDataException +import com.tryfinch.api.models.* +import java.util.Objects +import java.util.Optional + +class SandboxConnectionCreateParams +constructor( + private val providerId: String, + private val authenticationType: AuthenticationType?, + private val employerSize: Long?, + private val products: List?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun providerId(): String = providerId + + fun authenticationType(): Optional = Optional.ofNullable(authenticationType) + + fun employerSize(): Optional = Optional.ofNullable(employerSize) + + fun products(): Optional> = Optional.ofNullable(products) + + @JvmSynthetic + internal fun getBody(): SandboxConnectionCreateBody { + return SandboxConnectionCreateBody( + providerId, + authenticationType, + employerSize, + products, + additionalBodyProperties, + ) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + @JsonDeserialize(builder = SandboxConnectionCreateBody.Builder::class) + @NoAutoDetect + class SandboxConnectionCreateBody + internal constructor( + private val providerId: String?, + private val authenticationType: AuthenticationType?, + private val employerSize: Long?, + private val products: List?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("provider_id") fun providerId(): String? = providerId + + @JsonProperty("authentication_type") + fun authenticationType(): AuthenticationType? = authenticationType + + /** Optional: the size of the employer to be created with this connection. Defaults to 20 */ + @JsonProperty("employer_size") fun employerSize(): Long? = employerSize + + @JsonProperty("products") fun products(): List? = products + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxConnectionCreateBody && + this.providerId == other.providerId && + this.authenticationType == other.authenticationType && + this.employerSize == other.employerSize && + this.products == other.products && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + providerId, + authenticationType, + employerSize, + products, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "SandboxConnectionCreateBody{providerId=$providerId, authenticationType=$authenticationType, employerSize=$employerSize, products=$products, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var providerId: String? = null + private var authenticationType: AuthenticationType? = null + private var employerSize: Long? = null + private var products: List? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sandboxConnectionCreateBody: SandboxConnectionCreateBody) = apply { + this.providerId = sandboxConnectionCreateBody.providerId + this.authenticationType = sandboxConnectionCreateBody.authenticationType + this.employerSize = sandboxConnectionCreateBody.employerSize + this.products = sandboxConnectionCreateBody.products + additionalProperties(sandboxConnectionCreateBody.additionalProperties) + } + + @JsonProperty("provider_id") + fun providerId(providerId: String) = apply { this.providerId = providerId } + + @JsonProperty("authentication_type") + fun authenticationType(authenticationType: AuthenticationType) = apply { + this.authenticationType = authenticationType + } + + /** + * Optional: the size of the employer to be created with this connection. Defaults to 20 + */ + @JsonProperty("employer_size") + fun employerSize(employerSize: Long) = apply { this.employerSize = employerSize } + + @JsonProperty("products") + fun products(products: List) = apply { this.products = products } + + 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(): SandboxConnectionCreateBody = + SandboxConnectionCreateBody( + checkNotNull(providerId) { "`providerId` is required but was not set" }, + authenticationType, + employerSize, + products?.toUnmodifiable(), + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxConnectionCreateParams && + this.providerId == other.providerId && + this.authenticationType == other.authenticationType && + this.employerSize == other.employerSize && + this.products == other.products && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + providerId, + authenticationType, + employerSize, + products, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "SandboxConnectionCreateParams{providerId=$providerId, authenticationType=$authenticationType, employerSize=$employerSize, products=$products, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var providerId: String? = null + private var authenticationType: AuthenticationType? = null + private var employerSize: Long? = null + private var products: MutableList = mutableListOf() + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sandboxConnectionCreateParams: SandboxConnectionCreateParams) = apply { + this.providerId = sandboxConnectionCreateParams.providerId + this.authenticationType = sandboxConnectionCreateParams.authenticationType + this.employerSize = sandboxConnectionCreateParams.employerSize + this.products(sandboxConnectionCreateParams.products ?: listOf()) + additionalQueryParams(sandboxConnectionCreateParams.additionalQueryParams) + additionalHeaders(sandboxConnectionCreateParams.additionalHeaders) + additionalBodyProperties(sandboxConnectionCreateParams.additionalBodyProperties) + } + + fun providerId(providerId: String) = apply { this.providerId = providerId } + + fun authenticationType(authenticationType: AuthenticationType) = apply { + this.authenticationType = authenticationType + } + + /** Optional: the size of the employer to be created with this connection. Defaults to 20 */ + fun employerSize(employerSize: Long) = apply { this.employerSize = employerSize } + + fun products(products: List) = apply { + this.products.clear() + this.products.addAll(products) + } + + fun addProduct(product: String) = apply { this.products.add(product) } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): SandboxConnectionCreateParams = + SandboxConnectionCreateParams( + checkNotNull(providerId) { "`providerId` is required but was not set" }, + authenticationType, + employerSize, + if (products.size == 0) null else products.toUnmodifiable(), + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + class AuthenticationType + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AuthenticationType && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val CREDENTIALS = AuthenticationType(JsonField.of("credentials")) + + @JvmField val API_TOKEN = AuthenticationType(JsonField.of("api_token")) + + @JvmField val OAUTH = AuthenticationType(JsonField.of("oauth")) + + @JvmField val ASSISTED = AuthenticationType(JsonField.of("assisted")) + + @JvmStatic fun of(value: String) = AuthenticationType(JsonField.of(value)) + } + + enum class Known { + CREDENTIALS, + API_TOKEN, + OAUTH, + ASSISTED, + } + + enum class Value { + CREDENTIALS, + API_TOKEN, + OAUTH, + ASSISTED, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + CREDENTIALS -> Value.CREDENTIALS + API_TOKEN -> Value.API_TOKEN + OAUTH -> Value.OAUTH + ASSISTED -> Value.ASSISTED + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + CREDENTIALS -> Known.CREDENTIALS + API_TOKEN -> Known.API_TOKEN + OAUTH -> Known.OAUTH + ASSISTED -> Known.ASSISTED + else -> throw FinchInvalidDataException("Unknown AuthenticationType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } +} 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 new file mode 100644 index 00000000..ef5ff693 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt @@ -0,0 +1,1629 @@ +// 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.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.tryfinch.api.core.ExcludeMissing +import com.tryfinch.api.core.JsonField +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.toUnmodifiable +import com.tryfinch.api.errors.FinchInvalidDataException +import com.tryfinch.api.models.* +import java.util.Objects + +class SandboxDirectoryCreateParams +constructor( + private val body: List, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun body(): List = body + + @JvmSynthetic + internal fun getBody(): SandboxDirectoryCreateBody { + return SandboxDirectoryCreateBody(body, additionalBodyProperties) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + /** + * Array of individuals to create. Takes all combined fields from `/individual` and + * `/employment` endpoints. All fields are optional. + */ + @JsonDeserialize(builder = SandboxDirectoryCreateBody.Builder::class) + @NoAutoDetect + class SandboxDirectoryCreateBody + internal constructor( + private val body: List?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** + * Array of individuals to create. Takes all combined fields from `/individual` and + * `/employment` endpoints. All fields are optional. + */ + @JsonProperty("body") fun body(): List? = body + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxDirectoryCreateBody && + this.body == other.body && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(body, additionalProperties) + } + return hashCode + } + + override fun toString() = + "SandboxDirectoryCreateBody{body=$body, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var body: List? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sandboxDirectoryCreateBody: SandboxDirectoryCreateBody) = apply { + this.body = sandboxDirectoryCreateBody.body + additionalProperties(sandboxDirectoryCreateBody.additionalProperties) + } + + /** + * Array of individuals to create. Takes all combined fields from `/individual` and + * `/employment` endpoints. All fields are optional. + */ + @JsonProperty("body") + fun body(body: List) = apply { this.body = body } + + 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(): SandboxDirectoryCreateBody = + SandboxDirectoryCreateBody( + checkNotNull(body) { "`body` is required but was not set" }.toUnmodifiable(), + additionalProperties.toUnmodifiable() + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxDirectoryCreateParams && + this.body == other.body && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + body, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "SandboxDirectoryCreateParams{body=$body, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var body: MutableList = mutableListOf() + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sandboxDirectoryCreateParams: SandboxDirectoryCreateParams) = apply { + this.body(sandboxDirectoryCreateParams.body) + additionalQueryParams(sandboxDirectoryCreateParams.additionalQueryParams) + additionalHeaders(sandboxDirectoryCreateParams.additionalHeaders) + additionalBodyProperties(sandboxDirectoryCreateParams.additionalBodyProperties) + } + + /** + * 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.clear() + this.body.addAll(body) + } + + /** + * Array of individuals to create. Takes all combined fields from `/individual` and + * `/employment` endpoints. All fields are optional. + */ + fun addBody(body: IndividualOrEmployment) = apply { this.body.add(body) } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): SandboxDirectoryCreateParams = + SandboxDirectoryCreateParams( + checkNotNull(body) { "`body` is required but was not set" }.toUnmodifiable(), + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = IndividualOrEmployment.Builder::class) + @NoAutoDetect + class IndividualOrEmployment + private constructor( + private val firstName: String?, + private val middleName: String?, + private val lastName: String?, + private val preferredName: String?, + private val emails: List?, + private val phoneNumbers: List?, + private val gender: Gender?, + private val ethnicity: Ethnicity?, + private val dob: String?, + private val ssn: String?, + private val encryptedSsn: String?, + private val residence: Location?, + private val title: String?, + private val manager: Manager?, + private val department: Department?, + private val employment: Employment?, + private val startDate: String?, + private val endDate: String?, + private val isActive: Boolean?, + private val classCode: String?, + private val location: Location?, + private val income: Income?, + private val incomeHistory: List?, + private val customFields: List?, + private val sourceId: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** The legal first name of the individual. */ + @JsonProperty("first_name") fun firstName(): String? = firstName + + /** The legal middle name of the individual. */ + @JsonProperty("middle_name") fun middleName(): String? = middleName + + /** The legal last name of the individual. */ + @JsonProperty("last_name") fun lastName(): String? = lastName + + /** The preferred name of the individual. */ + @JsonProperty("preferred_name") fun preferredName(): String? = preferredName + + @JsonProperty("emails") fun emails(): List? = emails + + @JsonProperty("phone_numbers") fun phoneNumbers(): List? = phoneNumbers + + /** The gender of the individual. */ + @JsonProperty("gender") fun gender(): Gender? = gender + + /** The EEOC-defined ethnicity of the individual. */ + @JsonProperty("ethnicity") fun ethnicity(): Ethnicity? = ethnicity + + @JsonProperty("dob") fun dob(): String? = dob + + /** + * 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. + */ + @JsonProperty("ssn") fun ssn(): String? = ssn + + /** + * 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. + */ + @JsonProperty("encrypted_ssn") fun encryptedSsn(): String? = encryptedSsn + + @JsonProperty("residence") fun residence(): Location? = residence + + /** The current title of the individual. */ + @JsonProperty("title") fun title(): String? = title + + /** The manager object representing the manager of the individual within the org. */ + @JsonProperty("manager") fun manager(): Manager? = manager + + /** The department object. */ + @JsonProperty("department") fun department(): Department? = department + + /** The employment object. */ + @JsonProperty("employment") fun employment(): Employment? = employment + + @JsonProperty("start_date") fun startDate(): String? = startDate + + @JsonProperty("end_date") fun endDate(): String? = endDate + + /** `true` if the individual an an active employee or contractor at the company. */ + @JsonProperty("is_active") fun isActive(): Boolean? = isActive + + /** Worker's compensation classification code for this employee */ + @JsonProperty("class_code") fun classCode(): String? = classCode + + @JsonProperty("location") fun location(): Location? = location + + /** + * 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. + */ + @JsonProperty("income") fun income(): Income? = income + + /** The array of income history. */ + @JsonProperty("income_history") fun incomeHistory(): List? = incomeHistory + + /** + * 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. + */ + @JsonProperty("custom_fields") fun customFields(): List? = customFields + + /** The source system's unique employment identifier for this individual */ + @JsonProperty("source_id") fun sourceId(): String? = sourceId + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is IndividualOrEmployment && + this.firstName == other.firstName && + this.middleName == other.middleName && + this.lastName == other.lastName && + this.preferredName == other.preferredName && + this.emails == other.emails && + this.phoneNumbers == other.phoneNumbers && + this.gender == other.gender && + this.ethnicity == other.ethnicity && + this.dob == other.dob && + this.ssn == other.ssn && + this.encryptedSsn == other.encryptedSsn && + this.residence == other.residence && + this.title == other.title && + this.manager == other.manager && + this.department == other.department && + this.employment == other.employment && + this.startDate == other.startDate && + this.endDate == other.endDate && + this.isActive == other.isActive && + this.classCode == other.classCode && + this.location == other.location && + this.income == other.income && + this.incomeHistory == other.incomeHistory && + this.customFields == other.customFields && + this.sourceId == other.sourceId && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + firstName, + middleName, + lastName, + preferredName, + emails, + phoneNumbers, + gender, + ethnicity, + dob, + ssn, + encryptedSsn, + residence, + title, + manager, + department, + employment, + startDate, + endDate, + isActive, + classCode, + location, + income, + incomeHistory, + customFields, + sourceId, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "IndividualOrEmployment{firstName=$firstName, middleName=$middleName, lastName=$lastName, preferredName=$preferredName, emails=$emails, phoneNumbers=$phoneNumbers, gender=$gender, ethnicity=$ethnicity, dob=$dob, ssn=$ssn, encryptedSsn=$encryptedSsn, residence=$residence, title=$title, manager=$manager, department=$department, employment=$employment, startDate=$startDate, endDate=$endDate, isActive=$isActive, classCode=$classCode, location=$location, income=$income, incomeHistory=$incomeHistory, customFields=$customFields, sourceId=$sourceId, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var firstName: String? = null + private var middleName: String? = null + private var lastName: String? = null + private var preferredName: String? = null + private var emails: List? = null + private var phoneNumbers: List? = null + private var gender: Gender? = null + private var ethnicity: Ethnicity? = null + private var dob: String? = null + private var ssn: String? = null + private var encryptedSsn: String? = null + private var residence: Location? = null + private var title: String? = null + private var manager: Manager? = null + private var department: Department? = null + private var employment: Employment? = null + private var startDate: String? = null + private var endDate: String? = null + private var isActive: Boolean? = null + private var classCode: String? = null + private var location: Location? = null + private var income: Income? = null + private var incomeHistory: List? = null + private var customFields: List? = null + private var sourceId: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(individualOrEmployment: IndividualOrEmployment) = apply { + this.firstName = individualOrEmployment.firstName + this.middleName = individualOrEmployment.middleName + this.lastName = individualOrEmployment.lastName + this.preferredName = individualOrEmployment.preferredName + this.emails = individualOrEmployment.emails + this.phoneNumbers = individualOrEmployment.phoneNumbers + this.gender = individualOrEmployment.gender + this.ethnicity = individualOrEmployment.ethnicity + this.dob = individualOrEmployment.dob + this.ssn = individualOrEmployment.ssn + this.encryptedSsn = individualOrEmployment.encryptedSsn + this.residence = individualOrEmployment.residence + this.title = individualOrEmployment.title + this.manager = individualOrEmployment.manager + this.department = individualOrEmployment.department + this.employment = individualOrEmployment.employment + this.startDate = individualOrEmployment.startDate + this.endDate = individualOrEmployment.endDate + this.isActive = individualOrEmployment.isActive + this.classCode = individualOrEmployment.classCode + this.location = individualOrEmployment.location + this.income = individualOrEmployment.income + this.incomeHistory = individualOrEmployment.incomeHistory + this.customFields = individualOrEmployment.customFields + this.sourceId = individualOrEmployment.sourceId + additionalProperties(individualOrEmployment.additionalProperties) + } + + /** The legal first name of the individual. */ + @JsonProperty("first_name") + fun firstName(firstName: String) = apply { this.firstName = firstName } + + /** The legal middle name of the individual. */ + @JsonProperty("middle_name") + fun middleName(middleName: String) = apply { this.middleName = middleName } + + /** The legal last name of the individual. */ + @JsonProperty("last_name") + fun lastName(lastName: String) = apply { this.lastName = lastName } + + /** The preferred name of the individual. */ + @JsonProperty("preferred_name") + fun preferredName(preferredName: String) = apply { this.preferredName = preferredName } + + @JsonProperty("emails") fun emails(emails: List) = apply { this.emails = emails } + + @JsonProperty("phone_numbers") + fun phoneNumbers(phoneNumbers: List) = apply { + this.phoneNumbers = phoneNumbers + } + + /** The gender of the individual. */ + @JsonProperty("gender") fun gender(gender: Gender) = apply { this.gender = gender } + + /** The EEOC-defined ethnicity of the individual. */ + @JsonProperty("ethnicity") + fun ethnicity(ethnicity: Ethnicity) = apply { this.ethnicity = ethnicity } + + @JsonProperty("dob") fun dob(dob: String) = apply { this.dob = dob } + + /** + * 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. + */ + @JsonProperty("ssn") fun ssn(ssn: String) = apply { this.ssn = ssn } + + /** + * 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. + */ + @JsonProperty("encrypted_ssn") + fun encryptedSsn(encryptedSsn: String) = apply { this.encryptedSsn = encryptedSsn } + + @JsonProperty("residence") + fun residence(residence: Location) = apply { this.residence = residence } + + /** The current title of the individual. */ + @JsonProperty("title") fun title(title: String) = apply { this.title = title } + + /** The manager object representing the manager of the individual within the org. */ + @JsonProperty("manager") + fun manager(manager: Manager) = apply { this.manager = manager } + + /** The department object. */ + @JsonProperty("department") + fun department(department: Department) = apply { this.department = department } + + /** The employment object. */ + @JsonProperty("employment") + fun employment(employment: Employment) = apply { this.employment = employment } + + @JsonProperty("start_date") + fun startDate(startDate: String) = apply { this.startDate = startDate } + + @JsonProperty("end_date") + fun endDate(endDate: String) = apply { this.endDate = endDate } + + /** `true` if the individual an an active employee or contractor at the company. */ + @JsonProperty("is_active") + fun isActive(isActive: Boolean) = apply { this.isActive = isActive } + + /** Worker's compensation classification code for this employee */ + @JsonProperty("class_code") + fun classCode(classCode: String) = apply { this.classCode = classCode } + + @JsonProperty("location") + fun location(location: Location) = apply { this.location = location } + + /** + * 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. + */ + @JsonProperty("income") fun income(income: Income) = apply { this.income = income } + + /** The array of income history. */ + @JsonProperty("income_history") + fun incomeHistory(incomeHistory: List) = apply { + this.incomeHistory = incomeHistory + } + + /** + * 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. + */ + @JsonProperty("custom_fields") + fun customFields(customFields: List) = apply { + this.customFields = customFields + } + + /** The source system's unique employment identifier for this individual */ + @JsonProperty("source_id") + fun sourceId(sourceId: String) = apply { this.sourceId = sourceId } + + 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(): IndividualOrEmployment = + IndividualOrEmployment( + firstName, + middleName, + lastName, + preferredName, + emails?.toUnmodifiable(), + phoneNumbers?.toUnmodifiable(), + gender, + ethnicity, + dob, + ssn, + encryptedSsn, + residence, + title, + manager, + department, + employment, + startDate, + endDate, + isActive, + classCode, + location, + income, + incomeHistory?.toUnmodifiable(), + customFields?.toUnmodifiable(), + sourceId, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = CustomField.Builder::class) + @NoAutoDetect + class CustomField + private constructor( + private val name: String?, + private val value: JsonValue?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("name") fun name(): String? = name + + @JsonProperty("value") fun value(): JsonValue? = value + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CustomField && + this.name == other.name && + this.value == other.value && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + name, + value, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "CustomField{name=$name, value=$value, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var name: String? = null + private var value: JsonValue? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(customField: CustomField) = apply { + this.name = customField.name + this.value = customField.value + additionalProperties(customField.additionalProperties) + } + + @JsonProperty("name") fun name(name: String) = apply { this.name = name } + + @JsonProperty("value") fun value(value: JsonValue) = apply { this.value = value } + + 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(): CustomField = + CustomField( + name, + value, + additionalProperties.toUnmodifiable(), + ) + } + } + + /** The department object. */ + @JsonDeserialize(builder = Department.Builder::class) + @NoAutoDetect + class Department + private constructor( + private val name: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** The name of the department associated with the individual. */ + @JsonProperty("name") fun name(): String? = name + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Department && + this.name == other.name && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(name, additionalProperties) + } + return hashCode + } + + override fun toString() = + "Department{name=$name, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var name: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(department: Department) = apply { + this.name = department.name + additionalProperties(department.additionalProperties) + } + + /** The name of the department associated with the individual. */ + @JsonProperty("name") fun name(name: String) = apply { this.name = name } + + 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(): Department = Department(name, additionalProperties.toUnmodifiable()) + } + } + + @JsonDeserialize(builder = Email.Builder::class) + @NoAutoDetect + class Email + private constructor( + private val data: String?, + private val type: Type?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("data") fun data(): String? = data + + @JsonProperty("type") fun type(): Type? = type + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Email && + this.data == other.data && + this.type == other.type && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + data, + type, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Email{data=$data, type=$type, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var data: String? = null + private var type: Type? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(email: Email) = apply { + this.data = email.data + this.type = email.type + additionalProperties(email.additionalProperties) + } + + @JsonProperty("data") fun data(data: String) = apply { this.data = data } + + @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + + 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(): Email = + Email( + data, + type, + additionalProperties.toUnmodifiable(), + ) + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val WORK = Type(JsonField.of("work")) + + @JvmField val PERSONAL = Type(JsonField.of("personal")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + WORK, + PERSONAL, + } + + enum class Value { + WORK, + PERSONAL, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + WORK -> Value.WORK + PERSONAL -> Value.PERSONAL + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + WORK -> Known.WORK + PERSONAL -> Known.PERSONAL + else -> throw FinchInvalidDataException("Unknown Type: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + } + + /** The employment object. */ + @JsonDeserialize(builder = Employment.Builder::class) + @NoAutoDetect + class Employment + private constructor( + private val type: Type?, + private val subtype: Subtype?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** The main employment type of the individual. */ + @JsonProperty("type") fun type(): Type? = type + + /** + * The secondary employment type of the individual. Options: `full_time`, `part_time`, + * `intern`, `temp`, `seasonal` and `individual_contractor`. + */ + @JsonProperty("subtype") fun subtype(): Subtype? = subtype + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Employment && + this.type == other.type && + this.subtype == other.subtype && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + type, + subtype, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Employment{type=$type, subtype=$subtype, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var type: Type? = null + private var subtype: Subtype? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(employment: Employment) = apply { + this.type = employment.type + this.subtype = employment.subtype + additionalProperties(employment.additionalProperties) + } + + /** The main employment type of the individual. */ + @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + + /** + * The secondary employment type of the individual. Options: `full_time`, + * `part_time`, `intern`, `temp`, `seasonal` and `individual_contractor`. + */ + @JsonProperty("subtype") + fun subtype(subtype: Subtype) = apply { this.subtype = subtype } + + 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(): Employment = + Employment( + type, + subtype, + additionalProperties.toUnmodifiable(), + ) + } + + class Subtype + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Subtype && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val FULL_TIME = Subtype(JsonField.of("full_time")) + + @JvmField val INTERN = Subtype(JsonField.of("intern")) + + @JvmField val PART_TIME = Subtype(JsonField.of("part_time")) + + @JvmField val TEMP = Subtype(JsonField.of("temp")) + + @JvmField val SEASONAL = Subtype(JsonField.of("seasonal")) + + @JvmField + val INDIVIDUAL_CONTRACTOR = Subtype(JsonField.of("individual_contractor")) + + @JvmStatic fun of(value: String) = Subtype(JsonField.of(value)) + } + + enum class Known { + FULL_TIME, + INTERN, + PART_TIME, + TEMP, + SEASONAL, + INDIVIDUAL_CONTRACTOR, + } + + enum class Value { + FULL_TIME, + INTERN, + PART_TIME, + TEMP, + SEASONAL, + INDIVIDUAL_CONTRACTOR, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + FULL_TIME -> Value.FULL_TIME + INTERN -> Value.INTERN + PART_TIME -> Value.PART_TIME + TEMP -> Value.TEMP + SEASONAL -> Value.SEASONAL + INDIVIDUAL_CONTRACTOR -> Value.INDIVIDUAL_CONTRACTOR + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + FULL_TIME -> Known.FULL_TIME + INTERN -> Known.INTERN + PART_TIME -> Known.PART_TIME + TEMP -> Known.TEMP + SEASONAL -> Known.SEASONAL + INDIVIDUAL_CONTRACTOR -> Known.INDIVIDUAL_CONTRACTOR + else -> throw FinchInvalidDataException("Unknown Subtype: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val EMPLOYEE = Type(JsonField.of("employee")) + + @JvmField val CONTRACTOR = Type(JsonField.of("contractor")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + EMPLOYEE, + CONTRACTOR, + } + + enum class Value { + EMPLOYEE, + CONTRACTOR, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + EMPLOYEE -> Value.EMPLOYEE + CONTRACTOR -> Value.CONTRACTOR + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + EMPLOYEE -> Known.EMPLOYEE + CONTRACTOR -> Known.CONTRACTOR + else -> throw FinchInvalidDataException("Unknown Type: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + } + + class Ethnicity + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Ethnicity && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val ASIAN = Ethnicity(JsonField.of("asian")) + + @JvmField val WHITE = Ethnicity(JsonField.of("white")) + + @JvmField + val BLACK_OR_AFRICAN_AMERICAN = Ethnicity(JsonField.of("black_or_african_american")) + + @JvmField + val NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER = + Ethnicity(JsonField.of("native_hawaiian_or_pacific_islander")) + + @JvmField + val AMERICAN_INDIAN_OR_ALASKA_NATIVE = + Ethnicity(JsonField.of("american_indian_or_alaska_native")) + + @JvmField val HISPANIC_OR_LATINO = Ethnicity(JsonField.of("hispanic_or_latino")) + + @JvmField val TWO_OR_MORE_RACES = Ethnicity(JsonField.of("two_or_more_races")) + + @JvmField val DECLINE_TO_SPECIFY = Ethnicity(JsonField.of("decline_to_specify")) + + @JvmStatic fun of(value: String) = Ethnicity(JsonField.of(value)) + } + + enum class Known { + ASIAN, + WHITE, + BLACK_OR_AFRICAN_AMERICAN, + NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER, + AMERICAN_INDIAN_OR_ALASKA_NATIVE, + HISPANIC_OR_LATINO, + TWO_OR_MORE_RACES, + DECLINE_TO_SPECIFY, + } + + enum class Value { + ASIAN, + WHITE, + BLACK_OR_AFRICAN_AMERICAN, + NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER, + AMERICAN_INDIAN_OR_ALASKA_NATIVE, + HISPANIC_OR_LATINO, + TWO_OR_MORE_RACES, + DECLINE_TO_SPECIFY, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + ASIAN -> Value.ASIAN + WHITE -> Value.WHITE + BLACK_OR_AFRICAN_AMERICAN -> Value.BLACK_OR_AFRICAN_AMERICAN + NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER -> Value.NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER + AMERICAN_INDIAN_OR_ALASKA_NATIVE -> Value.AMERICAN_INDIAN_OR_ALASKA_NATIVE + HISPANIC_OR_LATINO -> Value.HISPANIC_OR_LATINO + TWO_OR_MORE_RACES -> Value.TWO_OR_MORE_RACES + DECLINE_TO_SPECIFY -> Value.DECLINE_TO_SPECIFY + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + ASIAN -> Known.ASIAN + WHITE -> Known.WHITE + BLACK_OR_AFRICAN_AMERICAN -> Known.BLACK_OR_AFRICAN_AMERICAN + NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER -> Known.NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER + AMERICAN_INDIAN_OR_ALASKA_NATIVE -> Known.AMERICAN_INDIAN_OR_ALASKA_NATIVE + HISPANIC_OR_LATINO -> Known.HISPANIC_OR_LATINO + TWO_OR_MORE_RACES -> Known.TWO_OR_MORE_RACES + DECLINE_TO_SPECIFY -> Known.DECLINE_TO_SPECIFY + else -> throw FinchInvalidDataException("Unknown Ethnicity: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class Gender + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Gender && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val FEMALE = Gender(JsonField.of("female")) + + @JvmField val MALE = Gender(JsonField.of("male")) + + @JvmField val OTHER = Gender(JsonField.of("other")) + + @JvmField val DECLINE_TO_SPECIFY = Gender(JsonField.of("decline_to_specify")) + + @JvmStatic fun of(value: String) = Gender(JsonField.of(value)) + } + + enum class Known { + FEMALE, + MALE, + OTHER, + DECLINE_TO_SPECIFY, + } + + enum class Value { + FEMALE, + MALE, + OTHER, + DECLINE_TO_SPECIFY, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + FEMALE -> Value.FEMALE + MALE -> Value.MALE + OTHER -> Value.OTHER + DECLINE_TO_SPECIFY -> Value.DECLINE_TO_SPECIFY + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + FEMALE -> Known.FEMALE + MALE -> Known.MALE + OTHER -> Known.OTHER + DECLINE_TO_SPECIFY -> Known.DECLINE_TO_SPECIFY + else -> throw FinchInvalidDataException("Unknown Gender: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + /** The manager object representing the manager of the individual within the org. */ + @JsonDeserialize(builder = Manager.Builder::class) + @NoAutoDetect + class Manager + private constructor( + private val id: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** A stable Finch `id` (UUID v4) for an individual in the company. */ + @JsonProperty("id") fun id(): String? = id + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Manager && + this.id == other.id && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(id, additionalProperties) + } + return hashCode + } + + override fun toString() = "Manager{id=$id, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(manager: Manager) = apply { + this.id = manager.id + additionalProperties(manager.additionalProperties) + } + + /** A stable Finch `id` (UUID v4) for an individual in the company. */ + @JsonProperty("id") fun id(id: String) = apply { this.id = id } + + 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(): Manager = Manager(id, additionalProperties.toUnmodifiable()) + } + } + + @JsonDeserialize(builder = PhoneNumber.Builder::class) + @NoAutoDetect + class PhoneNumber + private constructor( + private val data: String?, + private val type: Type?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("data") fun data(): String? = data + + @JsonProperty("type") fun type(): Type? = type + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PhoneNumber && + this.data == other.data && + this.type == other.type && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + data, + type, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "PhoneNumber{data=$data, type=$type, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var data: String? = null + private var type: Type? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(phoneNumber: PhoneNumber) = apply { + this.data = phoneNumber.data + this.type = phoneNumber.type + additionalProperties(phoneNumber.additionalProperties) + } + + @JsonProperty("data") fun data(data: String) = apply { this.data = data } + + @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + + 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(): PhoneNumber = + PhoneNumber( + data, + type, + additionalProperties.toUnmodifiable(), + ) + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val WORK = Type(JsonField.of("work")) + + @JvmField val PERSONAL = Type(JsonField.of("personal")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + WORK, + PERSONAL, + } + + enum class Value { + WORK, + PERSONAL, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + WORK -> Value.WORK + PERSONAL -> Value.PERSONAL + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + WORK -> Known.WORK + PERSONAL -> Known.PERSONAL + else -> throw FinchInvalidDataException("Unknown Type: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + } + } +} 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 new file mode 100644 index 00000000..3c988335 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt @@ -0,0 +1,1155 @@ +// 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.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.tryfinch.api.core.ExcludeMissing +import com.tryfinch.api.core.JsonField +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.toUnmodifiable +import com.tryfinch.api.errors.FinchInvalidDataException +import com.tryfinch.api.models.* +import java.util.Objects +import java.util.Optional + +class SandboxEmploymentUpdateParams +constructor( + private val individualId: String, + private val classCode: String?, + private val customFields: List?, + private val department: Department?, + private val employment: Employment?, + private val endDate: String?, + private val firstName: String?, + private val income: Income?, + private val incomeHistory: List?, + private val isActive: Boolean?, + private val lastName: String?, + private val location: Location?, + private val manager: Manager?, + private val middleName: String?, + private val sourceId: String?, + private val startDate: String?, + private val title: String?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun individualId(): String = individualId + + fun classCode(): Optional = Optional.ofNullable(classCode) + + fun customFields(): Optional> = Optional.ofNullable(customFields) + + fun department(): Optional = Optional.ofNullable(department) + + fun employment(): Optional = Optional.ofNullable(employment) + + fun endDate(): Optional = Optional.ofNullable(endDate) + + fun firstName(): Optional = Optional.ofNullable(firstName) + + fun income(): Optional = Optional.ofNullable(income) + + fun incomeHistory(): Optional> = Optional.ofNullable(incomeHistory) + + fun isActive(): Optional = Optional.ofNullable(isActive) + + fun lastName(): Optional = Optional.ofNullable(lastName) + + fun location(): Optional = Optional.ofNullable(location) + + fun manager(): Optional = Optional.ofNullable(manager) + + fun middleName(): Optional = Optional.ofNullable(middleName) + + fun sourceId(): Optional = Optional.ofNullable(sourceId) + + fun startDate(): Optional = Optional.ofNullable(startDate) + + fun title(): Optional = Optional.ofNullable(title) + + @JvmSynthetic + internal fun getBody(): SandboxEmploymentUpdateBody { + return SandboxEmploymentUpdateBody( + classCode, + customFields, + department, + employment, + endDate, + firstName, + income, + incomeHistory, + isActive, + lastName, + location, + manager, + middleName, + sourceId, + startDate, + title, + additionalBodyProperties, + ) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> individualId + else -> "" + } + } + + @JsonDeserialize(builder = SandboxEmploymentUpdateBody.Builder::class) + @NoAutoDetect + class SandboxEmploymentUpdateBody + internal constructor( + private val classCode: String?, + private val customFields: List?, + private val department: Department?, + private val employment: Employment?, + private val endDate: String?, + private val firstName: String?, + private val income: Income?, + private val incomeHistory: List?, + private val isActive: Boolean?, + private val lastName: String?, + private val location: Location?, + private val manager: Manager?, + private val middleName: String?, + private val sourceId: String?, + private val startDate: String?, + private val title: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** Worker's compensation classification code for this employee */ + @JsonProperty("class_code") fun classCode(): String? = 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. + */ + @JsonProperty("custom_fields") fun customFields(): List? = customFields + + /** The department object. */ + @JsonProperty("department") fun department(): Department? = department + + /** The employment object. */ + @JsonProperty("employment") fun employment(): Employment? = employment + + @JsonProperty("end_date") fun endDate(): String? = endDate + + /** The legal first name of the individual. */ + @JsonProperty("first_name") fun firstName(): String? = 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. + */ + @JsonProperty("income") fun income(): Income? = income + + /** The array of income history. */ + @JsonProperty("income_history") fun incomeHistory(): List? = incomeHistory + + /** `true` if the individual an an active employee or contractor at the company. */ + @JsonProperty("is_active") fun isActive(): Boolean? = isActive + + /** The legal last name of the individual. */ + @JsonProperty("last_name") fun lastName(): String? = lastName + + @JsonProperty("location") fun location(): Location? = location + + /** The manager object representing the manager of the individual within the org. */ + @JsonProperty("manager") fun manager(): Manager? = manager + + /** The legal middle name of the individual. */ + @JsonProperty("middle_name") fun middleName(): String? = middleName + + /** The source system's unique employment identifier for this individual */ + @JsonProperty("source_id") fun sourceId(): String? = sourceId + + @JsonProperty("start_date") fun startDate(): String? = startDate + + /** The current title of the individual. */ + @JsonProperty("title") fun title(): String? = title + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxEmploymentUpdateBody && + this.classCode == other.classCode && + this.customFields == other.customFields && + this.department == other.department && + this.employment == other.employment && + this.endDate == other.endDate && + this.firstName == other.firstName && + this.income == other.income && + this.incomeHistory == other.incomeHistory && + this.isActive == other.isActive && + this.lastName == other.lastName && + this.location == other.location && + this.manager == other.manager && + this.middleName == other.middleName && + this.sourceId == other.sourceId && + this.startDate == other.startDate && + this.title == other.title && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + classCode, + customFields, + department, + employment, + endDate, + firstName, + income, + incomeHistory, + isActive, + lastName, + location, + manager, + middleName, + sourceId, + startDate, + title, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "SandboxEmploymentUpdateBody{classCode=$classCode, customFields=$customFields, department=$department, employment=$employment, endDate=$endDate, firstName=$firstName, income=$income, incomeHistory=$incomeHistory, isActive=$isActive, lastName=$lastName, location=$location, manager=$manager, middleName=$middleName, sourceId=$sourceId, startDate=$startDate, title=$title, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var classCode: String? = null + private var customFields: List? = null + private var department: Department? = null + private var employment: Employment? = null + private var endDate: String? = null + private var firstName: String? = null + private var income: Income? = null + private var incomeHistory: List? = null + private var isActive: Boolean? = null + private var lastName: String? = null + private var location: Location? = null + private var manager: Manager? = null + private var middleName: String? = null + private var sourceId: String? = null + private var startDate: String? = null + private var title: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sandboxEmploymentUpdateBody: SandboxEmploymentUpdateBody) = apply { + this.classCode = sandboxEmploymentUpdateBody.classCode + this.customFields = sandboxEmploymentUpdateBody.customFields + this.department = sandboxEmploymentUpdateBody.department + this.employment = sandboxEmploymentUpdateBody.employment + this.endDate = sandboxEmploymentUpdateBody.endDate + this.firstName = sandboxEmploymentUpdateBody.firstName + this.income = sandboxEmploymentUpdateBody.income + this.incomeHistory = sandboxEmploymentUpdateBody.incomeHistory + this.isActive = sandboxEmploymentUpdateBody.isActive + this.lastName = sandboxEmploymentUpdateBody.lastName + this.location = sandboxEmploymentUpdateBody.location + this.manager = sandboxEmploymentUpdateBody.manager + this.middleName = sandboxEmploymentUpdateBody.middleName + this.sourceId = sandboxEmploymentUpdateBody.sourceId + this.startDate = sandboxEmploymentUpdateBody.startDate + this.title = sandboxEmploymentUpdateBody.title + additionalProperties(sandboxEmploymentUpdateBody.additionalProperties) + } + + /** Worker's compensation classification code for this employee */ + @JsonProperty("class_code") + fun classCode(classCode: String) = 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. + */ + @JsonProperty("custom_fields") + fun customFields(customFields: List) = apply { + this.customFields = customFields + } + + /** The department object. */ + @JsonProperty("department") + fun department(department: Department) = apply { this.department = department } + + /** The employment object. */ + @JsonProperty("employment") + fun employment(employment: Employment) = apply { this.employment = employment } + + @JsonProperty("end_date") + fun endDate(endDate: String) = apply { this.endDate = endDate } + + /** The legal first name of the individual. */ + @JsonProperty("first_name") + fun firstName(firstName: String) = 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. + */ + @JsonProperty("income") fun income(income: Income) = apply { this.income = income } + + /** The array of income history. */ + @JsonProperty("income_history") + fun incomeHistory(incomeHistory: List) = apply { + this.incomeHistory = incomeHistory + } + + /** `true` if the individual an an active employee or contractor at the company. */ + @JsonProperty("is_active") + fun isActive(isActive: Boolean) = apply { this.isActive = isActive } + + /** The legal last name of the individual. */ + @JsonProperty("last_name") + fun lastName(lastName: String) = apply { this.lastName = lastName } + + @JsonProperty("location") + fun location(location: Location) = apply { this.location = location } + + /** The manager object representing the manager of the individual within the org. */ + @JsonProperty("manager") + fun manager(manager: Manager) = apply { this.manager = manager } + + /** The legal middle name of the individual. */ + @JsonProperty("middle_name") + fun middleName(middleName: String) = apply { this.middleName = middleName } + + /** The source system's unique employment identifier for this individual */ + @JsonProperty("source_id") + fun sourceId(sourceId: String) = apply { this.sourceId = sourceId } + + @JsonProperty("start_date") + fun startDate(startDate: String) = apply { this.startDate = startDate } + + /** The current title of the individual. */ + @JsonProperty("title") fun title(title: String) = apply { this.title = title } + + 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(): SandboxEmploymentUpdateBody = + SandboxEmploymentUpdateBody( + classCode, + customFields?.toUnmodifiable(), + department, + employment, + endDate, + firstName, + income, + incomeHistory?.toUnmodifiable(), + isActive, + lastName, + location, + manager, + middleName, + sourceId, + startDate, + title, + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxEmploymentUpdateParams && + this.individualId == other.individualId && + this.classCode == other.classCode && + this.customFields == other.customFields && + this.department == other.department && + this.employment == other.employment && + this.endDate == other.endDate && + this.firstName == other.firstName && + this.income == other.income && + this.incomeHistory == other.incomeHistory && + this.isActive == other.isActive && + this.lastName == other.lastName && + this.location == other.location && + this.manager == other.manager && + this.middleName == other.middleName && + this.sourceId == other.sourceId && + this.startDate == other.startDate && + this.title == other.title && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + individualId, + classCode, + customFields, + department, + employment, + endDate, + firstName, + income, + incomeHistory, + isActive, + lastName, + location, + manager, + middleName, + sourceId, + startDate, + title, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "SandboxEmploymentUpdateParams{individualId=$individualId, classCode=$classCode, customFields=$customFields, department=$department, employment=$employment, endDate=$endDate, firstName=$firstName, income=$income, incomeHistory=$incomeHistory, isActive=$isActive, lastName=$lastName, location=$location, manager=$manager, middleName=$middleName, sourceId=$sourceId, startDate=$startDate, title=$title, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var individualId: String? = null + private var classCode: String? = null + private var customFields: MutableList = mutableListOf() + private var department: Department? = null + private var employment: Employment? = null + private var endDate: String? = null + private var firstName: String? = null + private var income: Income? = null + private var incomeHistory: MutableList = mutableListOf() + private var isActive: Boolean? = null + private var lastName: String? = null + private var location: Location? = null + private var manager: Manager? = null + private var middleName: String? = null + private var sourceId: String? = null + private var startDate: String? = null + private var title: String? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sandboxEmploymentUpdateParams: SandboxEmploymentUpdateParams) = apply { + this.individualId = sandboxEmploymentUpdateParams.individualId + this.classCode = sandboxEmploymentUpdateParams.classCode + this.customFields(sandboxEmploymentUpdateParams.customFields ?: listOf()) + this.department = sandboxEmploymentUpdateParams.department + this.employment = sandboxEmploymentUpdateParams.employment + this.endDate = sandboxEmploymentUpdateParams.endDate + this.firstName = sandboxEmploymentUpdateParams.firstName + this.income = sandboxEmploymentUpdateParams.income + this.incomeHistory(sandboxEmploymentUpdateParams.incomeHistory ?: listOf()) + this.isActive = sandboxEmploymentUpdateParams.isActive + this.lastName = sandboxEmploymentUpdateParams.lastName + this.location = sandboxEmploymentUpdateParams.location + this.manager = sandboxEmploymentUpdateParams.manager + this.middleName = sandboxEmploymentUpdateParams.middleName + this.sourceId = sandboxEmploymentUpdateParams.sourceId + this.startDate = sandboxEmploymentUpdateParams.startDate + this.title = sandboxEmploymentUpdateParams.title + additionalQueryParams(sandboxEmploymentUpdateParams.additionalQueryParams) + additionalHeaders(sandboxEmploymentUpdateParams.additionalHeaders) + additionalBodyProperties(sandboxEmploymentUpdateParams.additionalBodyProperties) + } + + fun individualId(individualId: String) = apply { this.individualId = individualId } + + /** Worker's compensation classification code for this employee */ + fun classCode(classCode: String) = 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) = apply { + this.customFields.clear() + this.customFields.addAll(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. + */ + fun addCustomField(customField: CustomField) = apply { this.customFields.add(customField) } + + /** The department object. */ + fun department(department: Department) = apply { this.department = department } + + /** The employment object. */ + fun employment(employment: Employment) = apply { this.employment = employment } + + fun endDate(endDate: String) = apply { this.endDate = endDate } + + /** The legal first name of the individual. */ + fun firstName(firstName: String) = 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) = apply { this.income = income } + + /** The array of income history. */ + fun incomeHistory(incomeHistory: List) = apply { + this.incomeHistory.clear() + this.incomeHistory.addAll(incomeHistory) + } + + /** The array of income history. */ + fun addIncomeHistory(incomeHistory: Income) = apply { + this.incomeHistory.add(incomeHistory) + } + + /** `true` if the individual an an active employee or contractor at the company. */ + fun isActive(isActive: Boolean) = apply { this.isActive = isActive } + + /** The legal last name of the individual. */ + fun lastName(lastName: String) = apply { this.lastName = lastName } + + fun location(location: Location) = apply { this.location = location } + + /** The manager object representing the manager of the individual within the org. */ + fun manager(manager: Manager) = apply { this.manager = manager } + + /** The legal middle name of the individual. */ + fun middleName(middleName: String) = apply { this.middleName = middleName } + + /** The source system's unique employment identifier for this individual */ + fun sourceId(sourceId: String) = apply { this.sourceId = sourceId } + + fun startDate(startDate: String) = apply { this.startDate = startDate } + + /** The current title of the individual. */ + fun title(title: String) = apply { this.title = title } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): SandboxEmploymentUpdateParams = + SandboxEmploymentUpdateParams( + checkNotNull(individualId) { "`individualId` is required but was not set" }, + classCode, + if (customFields.size == 0) null else customFields.toUnmodifiable(), + department, + employment, + endDate, + firstName, + income, + if (incomeHistory.size == 0) null else incomeHistory.toUnmodifiable(), + isActive, + lastName, + location, + manager, + middleName, + sourceId, + startDate, + title, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = CustomField.Builder::class) + @NoAutoDetect + class CustomField + private constructor( + private val name: String?, + private val value: JsonValue?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("name") fun name(): String? = name + + @JsonProperty("value") fun value(): JsonValue? = value + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CustomField && + this.name == other.name && + this.value == other.value && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + name, + value, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "CustomField{name=$name, value=$value, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var name: String? = null + private var value: JsonValue? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(customField: CustomField) = apply { + this.name = customField.name + this.value = customField.value + additionalProperties(customField.additionalProperties) + } + + @JsonProperty("name") fun name(name: String) = apply { this.name = name } + + @JsonProperty("value") fun value(value: JsonValue) = apply { this.value = value } + + 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(): CustomField = + CustomField( + name, + value, + additionalProperties.toUnmodifiable(), + ) + } + } + + /** The department object. */ + @JsonDeserialize(builder = Department.Builder::class) + @NoAutoDetect + class Department + private constructor( + private val name: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** The name of the department associated with the individual. */ + @JsonProperty("name") fun name(): String? = name + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Department && + this.name == other.name && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(name, additionalProperties) + } + return hashCode + } + + override fun toString() = + "Department{name=$name, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var name: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(department: Department) = apply { + this.name = department.name + additionalProperties(department.additionalProperties) + } + + /** The name of the department associated with the individual. */ + @JsonProperty("name") fun name(name: String) = apply { this.name = name } + + 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(): Department = Department(name, additionalProperties.toUnmodifiable()) + } + } + + /** The employment object. */ + @JsonDeserialize(builder = Employment.Builder::class) + @NoAutoDetect + class Employment + private constructor( + private val type: Type?, + private val subtype: Subtype?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** The main employment type of the individual. */ + @JsonProperty("type") fun type(): Type? = type + + /** + * The secondary employment type of the individual. Options: `full_time`, `part_time`, + * `intern`, `temp`, `seasonal` and `individual_contractor`. + */ + @JsonProperty("subtype") fun subtype(): Subtype? = subtype + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Employment && + this.type == other.type && + this.subtype == other.subtype && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + type, + subtype, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Employment{type=$type, subtype=$subtype, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var type: Type? = null + private var subtype: Subtype? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(employment: Employment) = apply { + this.type = employment.type + this.subtype = employment.subtype + additionalProperties(employment.additionalProperties) + } + + /** The main employment type of the individual. */ + @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + + /** + * The secondary employment type of the individual. Options: `full_time`, `part_time`, + * `intern`, `temp`, `seasonal` and `individual_contractor`. + */ + @JsonProperty("subtype") + fun subtype(subtype: Subtype) = apply { this.subtype = subtype } + + 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(): Employment = + Employment( + type, + subtype, + additionalProperties.toUnmodifiable(), + ) + } + + class Subtype + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Subtype && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val FULL_TIME = Subtype(JsonField.of("full_time")) + + @JvmField val INTERN = Subtype(JsonField.of("intern")) + + @JvmField val PART_TIME = Subtype(JsonField.of("part_time")) + + @JvmField val TEMP = Subtype(JsonField.of("temp")) + + @JvmField val SEASONAL = Subtype(JsonField.of("seasonal")) + + @JvmField val INDIVIDUAL_CONTRACTOR = Subtype(JsonField.of("individual_contractor")) + + @JvmStatic fun of(value: String) = Subtype(JsonField.of(value)) + } + + enum class Known { + FULL_TIME, + INTERN, + PART_TIME, + TEMP, + SEASONAL, + INDIVIDUAL_CONTRACTOR, + } + + enum class Value { + FULL_TIME, + INTERN, + PART_TIME, + TEMP, + SEASONAL, + INDIVIDUAL_CONTRACTOR, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + FULL_TIME -> Value.FULL_TIME + INTERN -> Value.INTERN + PART_TIME -> Value.PART_TIME + TEMP -> Value.TEMP + SEASONAL -> Value.SEASONAL + INDIVIDUAL_CONTRACTOR -> Value.INDIVIDUAL_CONTRACTOR + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + FULL_TIME -> Known.FULL_TIME + INTERN -> Known.INTERN + PART_TIME -> Known.PART_TIME + TEMP -> Known.TEMP + SEASONAL -> Known.SEASONAL + INDIVIDUAL_CONTRACTOR -> Known.INDIVIDUAL_CONTRACTOR + else -> throw FinchInvalidDataException("Unknown Subtype: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val EMPLOYEE = Type(JsonField.of("employee")) + + @JvmField val CONTRACTOR = Type(JsonField.of("contractor")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + EMPLOYEE, + CONTRACTOR, + } + + enum class Value { + EMPLOYEE, + CONTRACTOR, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + EMPLOYEE -> Value.EMPLOYEE + CONTRACTOR -> Value.CONTRACTOR + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + EMPLOYEE -> Known.EMPLOYEE + CONTRACTOR -> Known.CONTRACTOR + else -> throw FinchInvalidDataException("Unknown Type: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + } + + /** The manager object representing the manager of the individual within the org. */ + @JsonDeserialize(builder = Manager.Builder::class) + @NoAutoDetect + class Manager + private constructor( + private val id: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** A stable Finch `id` (UUID v4) for an individual in the company. */ + @JsonProperty("id") fun id(): String? = id + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Manager && + this.id == other.id && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(id, additionalProperties) + } + return hashCode + } + + override fun toString() = "Manager{id=$id, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(manager: Manager) = apply { + this.id = manager.id + additionalProperties(manager.additionalProperties) + } + + /** A stable Finch `id` (UUID v4) for an individual in the company. */ + @JsonProperty("id") fun id(id: String) = apply { this.id = id } + + 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(): Manager = Manager(id, additionalProperties.toUnmodifiable()) + } + } +} 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 new file mode 100644 index 00000000..32b83520 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt @@ -0,0 +1,1019 @@ +// 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.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.tryfinch.api.core.ExcludeMissing +import com.tryfinch.api.core.JsonField +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.toUnmodifiable +import com.tryfinch.api.errors.FinchInvalidDataException +import com.tryfinch.api.models.* +import java.util.Objects +import java.util.Optional + +class SandboxIndividualUpdateParams +constructor( + private val individualId: String, + private val dob: String?, + private val emails: List?, + private val encryptedSsn: String?, + private val ethnicity: Ethnicity?, + private val firstName: String?, + private val gender: Gender?, + private val lastName: String?, + private val middleName: String?, + private val phoneNumbers: List?, + private val preferredName: String?, + private val residence: Location?, + private val ssn: String?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun individualId(): String = individualId + + fun dob(): Optional = Optional.ofNullable(dob) + + fun emails(): Optional> = Optional.ofNullable(emails) + + fun encryptedSsn(): Optional = Optional.ofNullable(encryptedSsn) + + fun ethnicity(): Optional = Optional.ofNullable(ethnicity) + + fun firstName(): Optional = Optional.ofNullable(firstName) + + fun gender(): Optional = Optional.ofNullable(gender) + + fun lastName(): Optional = Optional.ofNullable(lastName) + + fun middleName(): Optional = Optional.ofNullable(middleName) + + fun phoneNumbers(): Optional> = Optional.ofNullable(phoneNumbers) + + fun preferredName(): Optional = Optional.ofNullable(preferredName) + + fun residence(): Optional = Optional.ofNullable(residence) + + fun ssn(): Optional = Optional.ofNullable(ssn) + + @JvmSynthetic + internal fun getBody(): SandboxIndividualUpdateBody { + return SandboxIndividualUpdateBody( + dob, + emails, + encryptedSsn, + ethnicity, + firstName, + gender, + lastName, + middleName, + phoneNumbers, + preferredName, + residence, + ssn, + additionalBodyProperties, + ) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> individualId + else -> "" + } + } + + @JsonDeserialize(builder = SandboxIndividualUpdateBody.Builder::class) + @NoAutoDetect + class SandboxIndividualUpdateBody + internal constructor( + private val dob: String?, + private val emails: List?, + private val encryptedSsn: String?, + private val ethnicity: Ethnicity?, + private val firstName: String?, + private val gender: Gender?, + private val lastName: String?, + private val middleName: String?, + private val phoneNumbers: List?, + private val preferredName: String?, + private val residence: Location?, + private val ssn: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("dob") fun dob(): String? = dob + + @JsonProperty("emails") fun emails(): List? = 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. + */ + @JsonProperty("encrypted_ssn") fun encryptedSsn(): String? = encryptedSsn + + /** The EEOC-defined ethnicity of the individual. */ + @JsonProperty("ethnicity") fun ethnicity(): Ethnicity? = ethnicity + + /** The legal first name of the individual. */ + @JsonProperty("first_name") fun firstName(): String? = firstName + + /** The gender of the individual. */ + @JsonProperty("gender") fun gender(): Gender? = gender + + /** The legal last name of the individual. */ + @JsonProperty("last_name") fun lastName(): String? = lastName + + /** The legal middle name of the individual. */ + @JsonProperty("middle_name") fun middleName(): String? = middleName + + @JsonProperty("phone_numbers") fun phoneNumbers(): List? = phoneNumbers + + /** The preferred name of the individual. */ + @JsonProperty("preferred_name") fun preferredName(): String? = preferredName + + @JsonProperty("residence") fun residence(): Location? = 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. + */ + @JsonProperty("ssn") fun ssn(): String? = ssn + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxIndividualUpdateBody && + this.dob == other.dob && + this.emails == other.emails && + this.encryptedSsn == other.encryptedSsn && + this.ethnicity == other.ethnicity && + this.firstName == other.firstName && + this.gender == other.gender && + this.lastName == other.lastName && + this.middleName == other.middleName && + this.phoneNumbers == other.phoneNumbers && + this.preferredName == other.preferredName && + this.residence == other.residence && + this.ssn == other.ssn && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + dob, + emails, + encryptedSsn, + ethnicity, + firstName, + gender, + lastName, + middleName, + phoneNumbers, + preferredName, + residence, + ssn, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "SandboxIndividualUpdateBody{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}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var dob: String? = null + private var emails: List? = null + private var encryptedSsn: String? = null + private var ethnicity: Ethnicity? = null + private var firstName: String? = null + private var gender: Gender? = null + private var lastName: String? = null + private var middleName: String? = null + private var phoneNumbers: List? = null + private var preferredName: String? = null + private var residence: Location? = null + private var ssn: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sandboxIndividualUpdateBody: SandboxIndividualUpdateBody) = apply { + this.dob = sandboxIndividualUpdateBody.dob + this.emails = sandboxIndividualUpdateBody.emails + this.encryptedSsn = sandboxIndividualUpdateBody.encryptedSsn + this.ethnicity = sandboxIndividualUpdateBody.ethnicity + this.firstName = sandboxIndividualUpdateBody.firstName + this.gender = sandboxIndividualUpdateBody.gender + this.lastName = sandboxIndividualUpdateBody.lastName + this.middleName = sandboxIndividualUpdateBody.middleName + this.phoneNumbers = sandboxIndividualUpdateBody.phoneNumbers + this.preferredName = sandboxIndividualUpdateBody.preferredName + this.residence = sandboxIndividualUpdateBody.residence + this.ssn = sandboxIndividualUpdateBody.ssn + additionalProperties(sandboxIndividualUpdateBody.additionalProperties) + } + + @JsonProperty("dob") fun dob(dob: String) = apply { this.dob = dob } + + @JsonProperty("emails") fun emails(emails: List) = apply { this.emails = 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. + */ + @JsonProperty("encrypted_ssn") + fun encryptedSsn(encryptedSsn: String) = apply { this.encryptedSsn = encryptedSsn } + + /** The EEOC-defined ethnicity of the individual. */ + @JsonProperty("ethnicity") + fun ethnicity(ethnicity: Ethnicity) = apply { this.ethnicity = ethnicity } + + /** The legal first name of the individual. */ + @JsonProperty("first_name") + fun firstName(firstName: String) = apply { this.firstName = firstName } + + /** The gender of the individual. */ + @JsonProperty("gender") fun gender(gender: Gender) = apply { this.gender = gender } + + /** The legal last name of the individual. */ + @JsonProperty("last_name") + fun lastName(lastName: String) = apply { this.lastName = lastName } + + /** The legal middle name of the individual. */ + @JsonProperty("middle_name") + fun middleName(middleName: String) = apply { this.middleName = middleName } + + @JsonProperty("phone_numbers") + fun phoneNumbers(phoneNumbers: List) = apply { + this.phoneNumbers = phoneNumbers + } + + /** The preferred name of the individual. */ + @JsonProperty("preferred_name") + fun preferredName(preferredName: String) = apply { this.preferredName = preferredName } + + @JsonProperty("residence") + fun residence(residence: Location) = apply { this.residence = 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. + */ + @JsonProperty("ssn") fun ssn(ssn: String) = apply { this.ssn = ssn } + + 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(): SandboxIndividualUpdateBody = + SandboxIndividualUpdateBody( + dob, + emails?.toUnmodifiable(), + encryptedSsn, + ethnicity, + firstName, + gender, + lastName, + middleName, + phoneNumbers?.toUnmodifiable(), + preferredName, + residence, + ssn, + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxIndividualUpdateParams && + this.individualId == other.individualId && + this.dob == other.dob && + this.emails == other.emails && + this.encryptedSsn == other.encryptedSsn && + this.ethnicity == other.ethnicity && + this.firstName == other.firstName && + this.gender == other.gender && + this.lastName == other.lastName && + this.middleName == other.middleName && + this.phoneNumbers == other.phoneNumbers && + this.preferredName == other.preferredName && + this.residence == other.residence && + this.ssn == other.ssn && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + individualId, + dob, + emails, + encryptedSsn, + ethnicity, + firstName, + gender, + lastName, + middleName, + phoneNumbers, + preferredName, + residence, + ssn, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "SandboxIndividualUpdateParams{individualId=$individualId, dob=$dob, emails=$emails, encryptedSsn=$encryptedSsn, ethnicity=$ethnicity, firstName=$firstName, gender=$gender, lastName=$lastName, middleName=$middleName, phoneNumbers=$phoneNumbers, preferredName=$preferredName, residence=$residence, ssn=$ssn, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var individualId: String? = null + private var dob: String? = null + private var emails: MutableList = mutableListOf() + private var encryptedSsn: String? = null + private var ethnicity: Ethnicity? = null + private var firstName: String? = null + private var gender: Gender? = null + private var lastName: String? = null + private var middleName: String? = null + private var phoneNumbers: MutableList = mutableListOf() + private var preferredName: String? = null + private var residence: Location? = null + private var ssn: String? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sandboxIndividualUpdateParams: SandboxIndividualUpdateParams) = apply { + this.individualId = sandboxIndividualUpdateParams.individualId + this.dob = sandboxIndividualUpdateParams.dob + this.emails(sandboxIndividualUpdateParams.emails ?: listOf()) + this.encryptedSsn = sandboxIndividualUpdateParams.encryptedSsn + this.ethnicity = sandboxIndividualUpdateParams.ethnicity + this.firstName = sandboxIndividualUpdateParams.firstName + this.gender = sandboxIndividualUpdateParams.gender + this.lastName = sandboxIndividualUpdateParams.lastName + this.middleName = sandboxIndividualUpdateParams.middleName + this.phoneNumbers(sandboxIndividualUpdateParams.phoneNumbers ?: listOf()) + this.preferredName = sandboxIndividualUpdateParams.preferredName + this.residence = sandboxIndividualUpdateParams.residence + this.ssn = sandboxIndividualUpdateParams.ssn + additionalQueryParams(sandboxIndividualUpdateParams.additionalQueryParams) + additionalHeaders(sandboxIndividualUpdateParams.additionalHeaders) + additionalBodyProperties(sandboxIndividualUpdateParams.additionalBodyProperties) + } + + fun individualId(individualId: String) = apply { this.individualId = individualId } + + fun dob(dob: String) = apply { this.dob = dob } + + fun emails(emails: List) = apply { + this.emails.clear() + this.emails.addAll(emails) + } + + fun addEmail(email: Email) = apply { this.emails.add(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. + */ + fun encryptedSsn(encryptedSsn: String) = apply { this.encryptedSsn = encryptedSsn } + + /** The EEOC-defined ethnicity of the individual. */ + fun ethnicity(ethnicity: Ethnicity) = apply { this.ethnicity = ethnicity } + + /** The legal first name of the individual. */ + fun firstName(firstName: String) = apply { this.firstName = firstName } + + /** The gender of the individual. */ + fun gender(gender: Gender) = apply { this.gender = gender } + + /** The legal last name of the individual. */ + fun lastName(lastName: String) = apply { this.lastName = lastName } + + /** The legal middle name of the individual. */ + fun middleName(middleName: String) = apply { this.middleName = middleName } + + fun phoneNumbers(phoneNumbers: List) = apply { + this.phoneNumbers.clear() + this.phoneNumbers.addAll(phoneNumbers) + } + + fun addPhoneNumber(phoneNumber: PhoneNumber) = apply { this.phoneNumbers.add(phoneNumber) } + + /** The preferred name of the individual. */ + fun preferredName(preferredName: String) = apply { this.preferredName = preferredName } + + fun residence(residence: Location) = apply { this.residence = 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. + */ + fun ssn(ssn: String) = apply { this.ssn = ssn } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): SandboxIndividualUpdateParams = + SandboxIndividualUpdateParams( + checkNotNull(individualId) { "`individualId` is required but was not set" }, + dob, + if (emails.size == 0) null else emails.toUnmodifiable(), + encryptedSsn, + ethnicity, + firstName, + gender, + lastName, + middleName, + if (phoneNumbers.size == 0) null else phoneNumbers.toUnmodifiable(), + preferredName, + residence, + ssn, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Email.Builder::class) + @NoAutoDetect + class Email + private constructor( + private val data: String?, + private val type: Type?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("data") fun data(): String? = data + + @JsonProperty("type") fun type(): Type? = type + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Email && + this.data == other.data && + this.type == other.type && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + data, + type, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Email{data=$data, type=$type, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var data: String? = null + private var type: Type? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(email: Email) = apply { + this.data = email.data + this.type = email.type + additionalProperties(email.additionalProperties) + } + + @JsonProperty("data") fun data(data: String) = apply { this.data = data } + + @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + + 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(): Email = + Email( + data, + type, + additionalProperties.toUnmodifiable(), + ) + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val WORK = Type(JsonField.of("work")) + + @JvmField val PERSONAL = Type(JsonField.of("personal")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + WORK, + PERSONAL, + } + + enum class Value { + WORK, + PERSONAL, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + WORK -> Value.WORK + PERSONAL -> Value.PERSONAL + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + WORK -> Known.WORK + PERSONAL -> Known.PERSONAL + else -> throw FinchInvalidDataException("Unknown Type: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + } + + class Ethnicity + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Ethnicity && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val ASIAN = Ethnicity(JsonField.of("asian")) + + @JvmField val WHITE = Ethnicity(JsonField.of("white")) + + @JvmField + val BLACK_OR_AFRICAN_AMERICAN = Ethnicity(JsonField.of("black_or_african_american")) + + @JvmField + val NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER = + Ethnicity(JsonField.of("native_hawaiian_or_pacific_islander")) + + @JvmField + val AMERICAN_INDIAN_OR_ALASKA_NATIVE = + Ethnicity(JsonField.of("american_indian_or_alaska_native")) + + @JvmField val HISPANIC_OR_LATINO = Ethnicity(JsonField.of("hispanic_or_latino")) + + @JvmField val TWO_OR_MORE_RACES = Ethnicity(JsonField.of("two_or_more_races")) + + @JvmField val DECLINE_TO_SPECIFY = Ethnicity(JsonField.of("decline_to_specify")) + + @JvmStatic fun of(value: String) = Ethnicity(JsonField.of(value)) + } + + enum class Known { + ASIAN, + WHITE, + BLACK_OR_AFRICAN_AMERICAN, + NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER, + AMERICAN_INDIAN_OR_ALASKA_NATIVE, + HISPANIC_OR_LATINO, + TWO_OR_MORE_RACES, + DECLINE_TO_SPECIFY, + } + + enum class Value { + ASIAN, + WHITE, + BLACK_OR_AFRICAN_AMERICAN, + NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER, + AMERICAN_INDIAN_OR_ALASKA_NATIVE, + HISPANIC_OR_LATINO, + TWO_OR_MORE_RACES, + DECLINE_TO_SPECIFY, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + ASIAN -> Value.ASIAN + WHITE -> Value.WHITE + BLACK_OR_AFRICAN_AMERICAN -> Value.BLACK_OR_AFRICAN_AMERICAN + NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER -> Value.NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER + AMERICAN_INDIAN_OR_ALASKA_NATIVE -> Value.AMERICAN_INDIAN_OR_ALASKA_NATIVE + HISPANIC_OR_LATINO -> Value.HISPANIC_OR_LATINO + TWO_OR_MORE_RACES -> Value.TWO_OR_MORE_RACES + DECLINE_TO_SPECIFY -> Value.DECLINE_TO_SPECIFY + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + ASIAN -> Known.ASIAN + WHITE -> Known.WHITE + BLACK_OR_AFRICAN_AMERICAN -> Known.BLACK_OR_AFRICAN_AMERICAN + NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER -> Known.NATIVE_HAWAIIAN_OR_PACIFIC_ISLANDER + AMERICAN_INDIAN_OR_ALASKA_NATIVE -> Known.AMERICAN_INDIAN_OR_ALASKA_NATIVE + HISPANIC_OR_LATINO -> Known.HISPANIC_OR_LATINO + TWO_OR_MORE_RACES -> Known.TWO_OR_MORE_RACES + DECLINE_TO_SPECIFY -> Known.DECLINE_TO_SPECIFY + else -> throw FinchInvalidDataException("Unknown Ethnicity: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class Gender + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Gender && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val FEMALE = Gender(JsonField.of("female")) + + @JvmField val MALE = Gender(JsonField.of("male")) + + @JvmField val OTHER = Gender(JsonField.of("other")) + + @JvmField val DECLINE_TO_SPECIFY = Gender(JsonField.of("decline_to_specify")) + + @JvmStatic fun of(value: String) = Gender(JsonField.of(value)) + } + + enum class Known { + FEMALE, + MALE, + OTHER, + DECLINE_TO_SPECIFY, + } + + enum class Value { + FEMALE, + MALE, + OTHER, + DECLINE_TO_SPECIFY, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + FEMALE -> Value.FEMALE + MALE -> Value.MALE + OTHER -> Value.OTHER + DECLINE_TO_SPECIFY -> Value.DECLINE_TO_SPECIFY + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + FEMALE -> Known.FEMALE + MALE -> Known.MALE + OTHER -> Known.OTHER + DECLINE_TO_SPECIFY -> Known.DECLINE_TO_SPECIFY + else -> throw FinchInvalidDataException("Unknown Gender: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + @JsonDeserialize(builder = PhoneNumber.Builder::class) + @NoAutoDetect + class PhoneNumber + private constructor( + private val data: String?, + private val type: Type?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("data") fun data(): String? = data + + @JsonProperty("type") fun type(): Type? = type + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PhoneNumber && + this.data == other.data && + this.type == other.type && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + data, + type, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "PhoneNumber{data=$data, type=$type, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var data: String? = null + private var type: Type? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(phoneNumber: PhoneNumber) = apply { + this.data = phoneNumber.data + this.type = phoneNumber.type + additionalProperties(phoneNumber.additionalProperties) + } + + @JsonProperty("data") fun data(data: String) = apply { this.data = data } + + @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + + 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(): PhoneNumber = + PhoneNumber( + data, + type, + additionalProperties.toUnmodifiable(), + ) + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val WORK = Type(JsonField.of("work")) + + @JvmField val PERSONAL = Type(JsonField.of("personal")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + WORK, + PERSONAL, + } + + enum class Value { + WORK, + PERSONAL, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + WORK -> Value.WORK + PERSONAL -> Value.PERSONAL + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + WORK -> Known.WORK + PERSONAL -> Known.PERSONAL + else -> throw FinchInvalidDataException("Unknown Type: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + } +} 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 new file mode 100644 index 00000000..07633e2a --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt @@ -0,0 +1,254 @@ +// 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.fasterxml.jackson.databind.annotation.JsonDeserialize +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.toUnmodifiable +import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Objects + +@JsonDeserialize(builder = SandboxJobConfiguration.Builder::class) +@NoAutoDetect +class SandboxJobConfiguration +private constructor( + private val type: JsonField, + private val completionStatus: JsonField, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun type(): Type = type.getRequired("type") + + fun completionStatus(): CompletionStatus = completionStatus.getRequired("completion_status") + + @JsonProperty("type") @ExcludeMissing fun _type() = type + + @JsonProperty("completion_status") @ExcludeMissing fun _completionStatus() = completionStatus + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): SandboxJobConfiguration = apply { + if (!validated) { + type() + completionStatus() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxJobConfiguration && + this.type == other.type && + this.completionStatus == other.completionStatus && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + type, + completionStatus, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "SandboxJobConfiguration{type=$type, completionStatus=$completionStatus, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var type: JsonField = JsonMissing.of() + private var completionStatus: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sandboxJobConfiguration: SandboxJobConfiguration) = apply { + this.type = sandboxJobConfiguration.type + this.completionStatus = sandboxJobConfiguration.completionStatus + additionalProperties(sandboxJobConfiguration.additionalProperties) + } + + fun type(type: Type) = type(JsonField.of(type)) + + @JsonProperty("type") + @ExcludeMissing + fun type(type: JsonField) = apply { this.type = type } + + fun completionStatus(completionStatus: CompletionStatus) = + completionStatus(JsonField.of(completionStatus)) + + @JsonProperty("completion_status") + @ExcludeMissing + fun completionStatus(completionStatus: JsonField) = apply { + this.completionStatus = completionStatus + } + + 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(): SandboxJobConfiguration = + SandboxJobConfiguration( + type, + completionStatus, + additionalProperties.toUnmodifiable(), + ) + } + + class CompletionStatus + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CompletionStatus && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val COMPLETE = CompletionStatus(JsonField.of("complete")) + + @JvmField val REAUTH_ERROR = CompletionStatus(JsonField.of("reauth_error")) + + @JvmField val PERMISSIONS_ERROR = CompletionStatus(JsonField.of("permissions_error")) + + @JvmField val ERROR = CompletionStatus(JsonField.of("error")) + + @JvmStatic fun of(value: String) = CompletionStatus(JsonField.of(value)) + } + + enum class Known { + COMPLETE, + REAUTH_ERROR, + PERMISSIONS_ERROR, + ERROR, + } + + enum class Value { + COMPLETE, + REAUTH_ERROR, + PERMISSIONS_ERROR, + ERROR, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + COMPLETE -> Value.COMPLETE + REAUTH_ERROR -> Value.REAUTH_ERROR + PERMISSIONS_ERROR -> Value.PERMISSIONS_ERROR + ERROR -> Value.ERROR + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + COMPLETE -> Known.COMPLETE + REAUTH_ERROR -> Known.REAUTH_ERROR + PERMISSIONS_ERROR -> Known.PERMISSIONS_ERROR + ERROR -> Known.ERROR + else -> throw FinchInvalidDataException("Unknown CompletionStatus: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val DATA_SYNC_ALL = Type(JsonField.of("data_sync_all")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + DATA_SYNC_ALL, + } + + enum class Value { + DATA_SYNC_ALL, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DATA_SYNC_ALL -> Value.DATA_SYNC_ALL + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DATA_SYNC_ALL -> Known.DATA_SYNC_ALL + else -> throw FinchInvalidDataException("Unknown Type: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } +} 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 new file mode 100644 index 00000000..a3da2e22 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt @@ -0,0 +1,108 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.toUnmodifiable +import com.tryfinch.api.models.* +import java.util.Objects + +class SandboxJobConfigurationRetrieveParams +constructor( + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, +) { + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxJobConfigurationRetrieveParams && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders + } + + override fun hashCode(): Int { + return Objects.hash(additionalQueryParams, additionalHeaders) + } + + override fun toString() = + "SandboxJobConfigurationRetrieveParams{additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + + @JvmSynthetic + internal fun from( + sandboxJobConfigurationRetrieveParams: SandboxJobConfigurationRetrieveParams + ) = apply { + additionalQueryParams(sandboxJobConfigurationRetrieveParams.additionalQueryParams) + additionalHeaders(sandboxJobConfigurationRetrieveParams.additionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun build(): SandboxJobConfigurationRetrieveParams = + SandboxJobConfigurationRetrieveParams( + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable() + ) + } +} 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 new file mode 100644 index 00000000..45bb9614 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt @@ -0,0 +1,393 @@ +// 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.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.tryfinch.api.core.ExcludeMissing +import com.tryfinch.api.core.JsonField +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.toUnmodifiable +import com.tryfinch.api.errors.FinchInvalidDataException +import com.tryfinch.api.models.* +import java.util.Objects + +class SandboxJobConfigurationUpdateParams +constructor( + private val completionStatus: CompletionStatus, + private val type: Type, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun completionStatus(): CompletionStatus = completionStatus + + fun type(): Type = type + + @JvmSynthetic + internal fun getBody(): SandboxJobConfigurationUpdateBody { + return SandboxJobConfigurationUpdateBody( + completionStatus, + type, + additionalBodyProperties, + ) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + @JsonDeserialize(builder = SandboxJobConfigurationUpdateBody.Builder::class) + @NoAutoDetect + class SandboxJobConfigurationUpdateBody + internal constructor( + private val completionStatus: CompletionStatus?, + private val type: Type?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("completion_status") + fun completionStatus(): CompletionStatus? = completionStatus + + @JsonProperty("type") fun type(): Type? = type + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxJobConfigurationUpdateBody && + this.completionStatus == other.completionStatus && + this.type == other.type && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + completionStatus, + type, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "SandboxJobConfigurationUpdateBody{completionStatus=$completionStatus, type=$type, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var completionStatus: CompletionStatus? = null + private var type: Type? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + sandboxJobConfigurationUpdateBody: SandboxJobConfigurationUpdateBody + ) = apply { + this.completionStatus = sandboxJobConfigurationUpdateBody.completionStatus + this.type = sandboxJobConfigurationUpdateBody.type + additionalProperties(sandboxJobConfigurationUpdateBody.additionalProperties) + } + + @JsonProperty("completion_status") + fun completionStatus(completionStatus: CompletionStatus) = apply { + this.completionStatus = completionStatus + } + + @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + + 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(): SandboxJobConfigurationUpdateBody = + SandboxJobConfigurationUpdateBody( + checkNotNull(completionStatus) { + "`completionStatus` is required but was not set" + }, + checkNotNull(type) { "`type` is required but was not set" }, + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxJobConfigurationUpdateParams && + this.completionStatus == other.completionStatus && + this.type == other.type && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + completionStatus, + type, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "SandboxJobConfigurationUpdateParams{completionStatus=$completionStatus, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var completionStatus: CompletionStatus? = null + private var type: Type? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + sandboxJobConfigurationUpdateParams: SandboxJobConfigurationUpdateParams + ) = apply { + this.completionStatus = sandboxJobConfigurationUpdateParams.completionStatus + this.type = sandboxJobConfigurationUpdateParams.type + additionalQueryParams(sandboxJobConfigurationUpdateParams.additionalQueryParams) + additionalHeaders(sandboxJobConfigurationUpdateParams.additionalHeaders) + additionalBodyProperties(sandboxJobConfigurationUpdateParams.additionalBodyProperties) + } + + fun completionStatus(completionStatus: CompletionStatus) = apply { + this.completionStatus = completionStatus + } + + fun type(type: Type) = apply { this.type = type } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): SandboxJobConfigurationUpdateParams = + SandboxJobConfigurationUpdateParams( + checkNotNull(completionStatus) { "`completionStatus` is required but was not set" }, + checkNotNull(type) { "`type` is required but was not set" }, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + class CompletionStatus + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CompletionStatus && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val COMPLETE = CompletionStatus(JsonField.of("complete")) + + @JvmField val REAUTH_ERROR = CompletionStatus(JsonField.of("reauth_error")) + + @JvmField val PERMISSIONS_ERROR = CompletionStatus(JsonField.of("permissions_error")) + + @JvmField val ERROR = CompletionStatus(JsonField.of("error")) + + @JvmStatic fun of(value: String) = CompletionStatus(JsonField.of(value)) + } + + enum class Known { + COMPLETE, + REAUTH_ERROR, + PERMISSIONS_ERROR, + ERROR, + } + + enum class Value { + COMPLETE, + REAUTH_ERROR, + PERMISSIONS_ERROR, + ERROR, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + COMPLETE -> Value.COMPLETE + REAUTH_ERROR -> Value.REAUTH_ERROR + PERMISSIONS_ERROR -> Value.PERMISSIONS_ERROR + ERROR -> Value.ERROR + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + COMPLETE -> Known.COMPLETE + REAUTH_ERROR -> Known.REAUTH_ERROR + PERMISSIONS_ERROR -> Known.PERMISSIONS_ERROR + ERROR -> Known.ERROR + else -> throw FinchInvalidDataException("Unknown CompletionStatus: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val DATA_SYNC_ALL = Type(JsonField.of("data_sync_all")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + DATA_SYNC_ALL, + } + + enum class Value { + DATA_SYNC_ALL, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DATA_SYNC_ALL -> Value.DATA_SYNC_ALL + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DATA_SYNC_ALL -> Known.DATA_SYNC_ALL + else -> throw FinchInvalidDataException("Unknown Type: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } +} 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 new file mode 100644 index 00000000..4209ef17 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt @@ -0,0 +1,1344 @@ +// 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.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.tryfinch.api.core.ExcludeMissing +import com.tryfinch.api.core.JsonField +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.toUnmodifiable +import com.tryfinch.api.errors.FinchInvalidDataException +import com.tryfinch.api.models.* +import java.util.Objects +import java.util.Optional + +class SandboxPaymentCreateParams +constructor( + private val endDate: String?, + private val payStatements: List?, + private val startDate: String?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun endDate(): Optional = Optional.ofNullable(endDate) + + fun payStatements(): Optional> = Optional.ofNullable(payStatements) + + fun startDate(): Optional = Optional.ofNullable(startDate) + + @JvmSynthetic + internal fun getBody(): SandboxPaymentCreateBody { + return SandboxPaymentCreateBody( + endDate, + payStatements, + startDate, + additionalBodyProperties, + ) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + /** + * Fields to configure the payment. Takes all fields from the `/payment` endpoint. All fields + * are optional. + */ + @JsonDeserialize(builder = SandboxPaymentCreateBody.Builder::class) + @NoAutoDetect + class SandboxPaymentCreateBody + internal constructor( + private val endDate: String?, + private val payStatements: List?, + private val startDate: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("end_date") fun endDate(): String? = endDate + + @JsonProperty("pay_statements") fun payStatements(): List? = payStatements + + @JsonProperty("start_date") fun startDate(): String? = startDate + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxPaymentCreateBody && + this.endDate == other.endDate && + this.payStatements == other.payStatements && + this.startDate == other.startDate && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + endDate, + payStatements, + startDate, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "SandboxPaymentCreateBody{endDate=$endDate, payStatements=$payStatements, startDate=$startDate, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var endDate: String? = null + private var payStatements: List? = null + private var startDate: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sandboxPaymentCreateBody: SandboxPaymentCreateBody) = apply { + this.endDate = sandboxPaymentCreateBody.endDate + this.payStatements = sandboxPaymentCreateBody.payStatements + this.startDate = sandboxPaymentCreateBody.startDate + additionalProperties(sandboxPaymentCreateBody.additionalProperties) + } + + @JsonProperty("end_date") + fun endDate(endDate: String) = apply { this.endDate = endDate } + + @JsonProperty("pay_statements") + fun payStatements(payStatements: List) = apply { + this.payStatements = payStatements + } + + @JsonProperty("start_date") + fun startDate(startDate: String) = apply { this.startDate = startDate } + + 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(): SandboxPaymentCreateBody = + SandboxPaymentCreateBody( + endDate, + payStatements?.toUnmodifiable(), + startDate, + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SandboxPaymentCreateParams && + this.endDate == other.endDate && + this.payStatements == other.payStatements && + this.startDate == other.startDate && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + endDate, + payStatements, + startDate, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "SandboxPaymentCreateParams{endDate=$endDate, payStatements=$payStatements, startDate=$startDate, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var endDate: String? = null + private var payStatements: MutableList = mutableListOf() + private var startDate: String? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sandboxPaymentCreateParams: SandboxPaymentCreateParams) = apply { + this.endDate = sandboxPaymentCreateParams.endDate + this.payStatements(sandboxPaymentCreateParams.payStatements ?: listOf()) + this.startDate = sandboxPaymentCreateParams.startDate + additionalQueryParams(sandboxPaymentCreateParams.additionalQueryParams) + additionalHeaders(sandboxPaymentCreateParams.additionalHeaders) + additionalBodyProperties(sandboxPaymentCreateParams.additionalBodyProperties) + } + + fun endDate(endDate: String) = apply { this.endDate = endDate } + + fun payStatements(payStatements: List) = apply { + this.payStatements.clear() + this.payStatements.addAll(payStatements) + } + + fun addPayStatement(payStatement: PayStatement) = apply { + this.payStatements.add(payStatement) + } + + fun startDate(startDate: String) = apply { this.startDate = startDate } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): SandboxPaymentCreateParams = + SandboxPaymentCreateParams( + endDate, + if (payStatements.size == 0) null else payStatements.toUnmodifiable(), + startDate, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = PayStatement.Builder::class) + @NoAutoDetect + class PayStatement + private constructor( + private val individualId: String?, + private val type: Type?, + private val paymentMethod: PaymentMethod?, + private val totalHours: Double?, + private val grossPay: Money?, + private val netPay: Money?, + private val earnings: List?, + private val taxes: List?, + private val employeeDeductions: List?, + private val employerContributions: List?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** A stable Finch `id` (UUID v4) for an individual in the company */ + @JsonProperty("individual_id") fun individualId(): String? = individualId + + /** The type of the payment associated with the pay statement. */ + @JsonProperty("type") fun type(): Type? = type + + /** The payment method. */ + @JsonProperty("payment_method") fun paymentMethod(): PaymentMethod? = paymentMethod + + /** The number of hours worked for this pay period */ + @JsonProperty("total_hours") fun totalHours(): Double? = totalHours + + @JsonProperty("gross_pay") fun grossPay(): Money? = grossPay + + @JsonProperty("net_pay") fun netPay(): Money? = netPay + + /** The array of earnings objects associated with this pay statement */ + @JsonProperty("earnings") fun earnings(): List? = earnings + + /** The array of taxes objects associated with this pay statement. */ + @JsonProperty("taxes") fun taxes(): List? = taxes + + /** The array of deductions objects associated with this pay statement. */ + @JsonProperty("employee_deductions") + fun employeeDeductions(): List? = employeeDeductions + + @JsonProperty("employer_contributions") + fun employerContributions(): List? = employerContributions + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PayStatement && + this.individualId == other.individualId && + this.type == other.type && + this.paymentMethod == other.paymentMethod && + this.totalHours == other.totalHours && + this.grossPay == other.grossPay && + this.netPay == other.netPay && + this.earnings == other.earnings && + this.taxes == other.taxes && + this.employeeDeductions == other.employeeDeductions && + this.employerContributions == other.employerContributions && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + individualId, + type, + paymentMethod, + totalHours, + grossPay, + netPay, + earnings, + taxes, + employeeDeductions, + employerContributions, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "PayStatement{individualId=$individualId, type=$type, paymentMethod=$paymentMethod, totalHours=$totalHours, grossPay=$grossPay, netPay=$netPay, earnings=$earnings, taxes=$taxes, employeeDeductions=$employeeDeductions, employerContributions=$employerContributions, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var individualId: String? = null + private var type: Type? = null + private var paymentMethod: PaymentMethod? = null + private var totalHours: Double? = null + private var grossPay: Money? = null + private var netPay: Money? = null + private var earnings: List? = null + private var taxes: List? = null + private var employeeDeductions: List? = null + private var employerContributions: List? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(payStatement: PayStatement) = apply { + this.individualId = payStatement.individualId + this.type = payStatement.type + this.paymentMethod = payStatement.paymentMethod + this.totalHours = payStatement.totalHours + this.grossPay = payStatement.grossPay + this.netPay = payStatement.netPay + this.earnings = payStatement.earnings + this.taxes = payStatement.taxes + this.employeeDeductions = payStatement.employeeDeductions + this.employerContributions = payStatement.employerContributions + additionalProperties(payStatement.additionalProperties) + } + + /** A stable Finch `id` (UUID v4) for an individual in the company */ + @JsonProperty("individual_id") + fun individualId(individualId: String) = apply { this.individualId = individualId } + + /** The type of the payment associated with the pay statement. */ + @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + + /** The payment method. */ + @JsonProperty("payment_method") + fun paymentMethod(paymentMethod: PaymentMethod) = apply { + this.paymentMethod = paymentMethod + } + + /** The number of hours worked for this pay period */ + @JsonProperty("total_hours") + fun totalHours(totalHours: Double) = apply { this.totalHours = totalHours } + + @JsonProperty("gross_pay") + fun grossPay(grossPay: Money) = apply { this.grossPay = grossPay } + + @JsonProperty("net_pay") fun netPay(netPay: Money) = apply { this.netPay = netPay } + + /** The array of earnings objects associated with this pay statement */ + @JsonProperty("earnings") + fun earnings(earnings: List) = apply { this.earnings = earnings } + + /** The array of taxes objects associated with this pay statement. */ + @JsonProperty("taxes") fun taxes(taxes: List) = apply { this.taxes = taxes } + + /** The array of deductions objects associated with this pay statement. */ + @JsonProperty("employee_deductions") + fun employeeDeductions(employeeDeductions: List) = apply { + this.employeeDeductions = employeeDeductions + } + + @JsonProperty("employer_contributions") + fun employerContributions(employerContributions: List) = apply { + this.employerContributions = employerContributions + } + + 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(): PayStatement = + PayStatement( + individualId, + type, + paymentMethod, + totalHours, + grossPay, + netPay, + earnings?.toUnmodifiable(), + taxes?.toUnmodifiable(), + employeeDeductions?.toUnmodifiable(), + employerContributions?.toUnmodifiable(), + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Earning.Builder::class) + @NoAutoDetect + class Earning + private constructor( + private val type: Type?, + private val name: String?, + private val amount: Long?, + private val currency: String?, + private val hours: Double?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** The type of earning. */ + @JsonProperty("type") fun type(): Type? = type + + /** The exact name of the deduction from the pay statement. */ + @JsonProperty("name") fun name(): String? = name + + /** The earnings amount in cents. */ + @JsonProperty("amount") fun amount(): Long? = amount + + /** The earnings currency code. */ + @JsonProperty("currency") fun currency(): String? = 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). + */ + @JsonProperty("hours") fun hours(): Double? = hours + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Earning && + this.type == other.type && + this.name == other.name && + this.amount == other.amount && + this.currency == other.currency && + this.hours == other.hours && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + type, + name, + amount, + currency, + hours, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Earning{type=$type, name=$name, amount=$amount, currency=$currency, hours=$hours, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var type: Type? = null + private var name: String? = null + private var amount: Long? = null + private var currency: String? = null + private var hours: Double? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(earning: Earning) = apply { + this.type = earning.type + this.name = earning.name + this.amount = earning.amount + this.currency = earning.currency + this.hours = earning.hours + additionalProperties(earning.additionalProperties) + } + + /** The type of earning. */ + @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + + /** The exact name of the deduction from the pay statement. */ + @JsonProperty("name") fun name(name: String) = apply { this.name = name } + + /** The earnings amount in cents. */ + @JsonProperty("amount") fun amount(amount: Long) = apply { this.amount = amount } + + /** The earnings currency code. */ + @JsonProperty("currency") + fun currency(currency: String) = apply { this.currency = 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). + */ + @JsonProperty("hours") fun hours(hours: Double) = apply { this.hours = hours } + + 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(): Earning = + Earning( + type, + name, + amount, + currency, + hours, + additionalProperties.toUnmodifiable(), + ) + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val SALARY = Type(JsonField.of("salary")) + + @JvmField val WAGE = Type(JsonField.of("wage")) + + @JvmField val REIMBURSEMENT = Type(JsonField.of("reimbursement")) + + @JvmField val OVERTIME = Type(JsonField.of("overtime")) + + @JvmField val SEVERANCE = Type(JsonField.of("severance")) + + @JvmField val DOUBLE_OVERTIME = Type(JsonField.of("double_overtime")) + + @JvmField val PTO = Type(JsonField.of("pto")) + + @JvmField val SICK = Type(JsonField.of("sick")) + + @JvmField val BONUS = Type(JsonField.of("bonus")) + + @JvmField val COMMISSION = Type(JsonField.of("commission")) + + @JvmField val TIPS = Type(JsonField.of("tips")) + + @JvmField val _1099 = Type(JsonField.of("1099")) + + @JvmField val OTHER = Type(JsonField.of("other")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + SALARY, + WAGE, + REIMBURSEMENT, + OVERTIME, + SEVERANCE, + DOUBLE_OVERTIME, + PTO, + SICK, + BONUS, + COMMISSION, + TIPS, + _1099, + OTHER, + } + + enum class Value { + SALARY, + WAGE, + REIMBURSEMENT, + OVERTIME, + SEVERANCE, + DOUBLE_OVERTIME, + PTO, + SICK, + BONUS, + COMMISSION, + TIPS, + _1099, + OTHER, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + SALARY -> Value.SALARY + WAGE -> Value.WAGE + REIMBURSEMENT -> Value.REIMBURSEMENT + OVERTIME -> Value.OVERTIME + SEVERANCE -> Value.SEVERANCE + DOUBLE_OVERTIME -> Value.DOUBLE_OVERTIME + PTO -> Value.PTO + SICK -> Value.SICK + BONUS -> Value.BONUS + COMMISSION -> Value.COMMISSION + TIPS -> Value.TIPS + _1099 -> Value._1099 + OTHER -> Value.OTHER + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + SALARY -> Known.SALARY + WAGE -> Known.WAGE + REIMBURSEMENT -> Known.REIMBURSEMENT + OVERTIME -> Known.OVERTIME + SEVERANCE -> Known.SEVERANCE + DOUBLE_OVERTIME -> Known.DOUBLE_OVERTIME + PTO -> Known.PTO + SICK -> Known.SICK + BONUS -> Known.BONUS + COMMISSION -> Known.COMMISSION + TIPS -> Known.TIPS + _1099 -> Known._1099 + OTHER -> Known.OTHER + else -> throw FinchInvalidDataException("Unknown Type: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + } + + @JsonDeserialize(builder = EmployeeDeduction.Builder::class) + @NoAutoDetect + class EmployeeDeduction + private constructor( + private val name: String?, + private val amount: Long?, + private val currency: String?, + private val preTax: Boolean?, + private val type: BenefitType?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** The deduction name from the pay statement. */ + @JsonProperty("name") fun name(): String? = name + + /** The deduction amount in cents. */ + @JsonProperty("amount") fun amount(): Long? = amount + + /** The deduction currency. */ + @JsonProperty("currency") fun currency(): String? = currency + + /** Boolean indicating if the deduction is pre-tax. */ + @JsonProperty("pre_tax") fun preTax(): Boolean? = preTax + + /** Type of benefit. */ + @JsonProperty("type") fun type(): BenefitType? = type + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is EmployeeDeduction && + this.name == other.name && + this.amount == other.amount && + this.currency == other.currency && + this.preTax == other.preTax && + this.type == other.type && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + name, + amount, + currency, + preTax, + type, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "EmployeeDeduction{name=$name, amount=$amount, currency=$currency, preTax=$preTax, type=$type, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var name: String? = null + private var amount: Long? = null + private var currency: String? = null + private var preTax: Boolean? = null + private var type: BenefitType? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(employeeDeduction: EmployeeDeduction) = apply { + this.name = employeeDeduction.name + this.amount = employeeDeduction.amount + this.currency = employeeDeduction.currency + this.preTax = employeeDeduction.preTax + this.type = employeeDeduction.type + additionalProperties(employeeDeduction.additionalProperties) + } + + /** The deduction name from the pay statement. */ + @JsonProperty("name") fun name(name: String) = apply { this.name = name } + + /** The deduction amount in cents. */ + @JsonProperty("amount") fun amount(amount: Long) = apply { this.amount = amount } + + /** The deduction currency. */ + @JsonProperty("currency") + fun currency(currency: String) = apply { this.currency = currency } + + /** Boolean indicating if the deduction is pre-tax. */ + @JsonProperty("pre_tax") + fun preTax(preTax: Boolean) = apply { this.preTax = preTax } + + /** Type of benefit. */ + @JsonProperty("type") fun type(type: BenefitType) = apply { this.type = type } + + 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(): EmployeeDeduction = + EmployeeDeduction( + name, + amount, + currency, + preTax, + type, + additionalProperties.toUnmodifiable(), + ) + } + } + + @JsonDeserialize(builder = EmployerContribution.Builder::class) + @NoAutoDetect + class EmployerContribution + private constructor( + private val name: String?, + private val amount: Long?, + private val currency: String?, + private val type: BenefitType?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** The contribution name from the pay statement. */ + @JsonProperty("name") fun name(): String? = name + + /** The contribution amount in cents. */ + @JsonProperty("amount") fun amount(): Long? = amount + + /** The contribution currency. */ + @JsonProperty("currency") fun currency(): String? = currency + + /** Type of benefit. */ + @JsonProperty("type") fun type(): BenefitType? = type + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is EmployerContribution && + this.name == other.name && + this.amount == other.amount && + this.currency == other.currency && + this.type == other.type && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + name, + amount, + currency, + type, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "EmployerContribution{name=$name, amount=$amount, currency=$currency, type=$type, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var name: String? = null + private var amount: Long? = null + private var currency: String? = null + private var type: BenefitType? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(employerContribution: EmployerContribution) = apply { + this.name = employerContribution.name + this.amount = employerContribution.amount + this.currency = employerContribution.currency + this.type = employerContribution.type + additionalProperties(employerContribution.additionalProperties) + } + + /** The contribution name from the pay statement. */ + @JsonProperty("name") fun name(name: String) = apply { this.name = name } + + /** The contribution amount in cents. */ + @JsonProperty("amount") fun amount(amount: Long) = apply { this.amount = amount } + + /** The contribution currency. */ + @JsonProperty("currency") + fun currency(currency: String) = apply { this.currency = currency } + + /** Type of benefit. */ + @JsonProperty("type") fun type(type: BenefitType) = apply { this.type = type } + + 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(): EmployerContribution = + EmployerContribution( + name, + amount, + currency, + type, + additionalProperties.toUnmodifiable(), + ) + } + } + + class PaymentMethod + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PaymentMethod && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val CHECK = PaymentMethod(JsonField.of("check")) + + @JvmField val DIRECT_DEPOSIT = PaymentMethod(JsonField.of("direct_deposit")) + + @JvmStatic fun of(value: String) = PaymentMethod(JsonField.of(value)) + } + + enum class Known { + CHECK, + DIRECT_DEPOSIT, + } + + enum class Value { + CHECK, + DIRECT_DEPOSIT, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + CHECK -> Value.CHECK + DIRECT_DEPOSIT -> Value.DIRECT_DEPOSIT + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + CHECK -> Known.CHECK + DIRECT_DEPOSIT -> Known.DIRECT_DEPOSIT + else -> throw FinchInvalidDataException("Unknown PaymentMethod: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + @JsonDeserialize(builder = Tax.Builder::class) + @NoAutoDetect + class Tax + private constructor( + private val type: Type?, + private val name: String?, + private val employer: Boolean?, + private val amount: Long?, + private val currency: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** The type of taxes. */ + @JsonProperty("type") fun type(): Type? = type + + /** The exact name of tax from the pay statement. */ + @JsonProperty("name") fun name(): String? = name + + /** `true` if the amount is paid by the employers. */ + @JsonProperty("employer") fun employer(): Boolean? = employer + + /** The tax amount in cents. */ + @JsonProperty("amount") fun amount(): Long? = amount + + /** The currency code. */ + @JsonProperty("currency") fun currency(): String? = currency + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Tax && + this.type == other.type && + this.name == other.name && + this.employer == other.employer && + this.amount == other.amount && + this.currency == other.currency && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + type, + name, + employer, + amount, + currency, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Tax{type=$type, name=$name, employer=$employer, amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var type: Type? = null + private var name: String? = null + private var employer: Boolean? = null + private var amount: Long? = null + private var currency: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tax: Tax) = apply { + this.type = tax.type + this.name = tax.name + this.employer = tax.employer + this.amount = tax.amount + this.currency = tax.currency + additionalProperties(tax.additionalProperties) + } + + /** The type of taxes. */ + @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + + /** The exact name of tax from the pay statement. */ + @JsonProperty("name") fun name(name: String) = apply { this.name = name } + + /** `true` if the amount is paid by the employers. */ + @JsonProperty("employer") + fun employer(employer: Boolean) = apply { this.employer = employer } + + /** The tax amount in cents. */ + @JsonProperty("amount") fun amount(amount: Long) = apply { this.amount = amount } + + /** The currency code. */ + @JsonProperty("currency") + fun currency(currency: String) = apply { this.currency = currency } + + 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(): Tax = + Tax( + type, + name, + employer, + amount, + currency, + additionalProperties.toUnmodifiable(), + ) + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val STATE = Type(JsonField.of("state")) + + @JvmField val FEDERAL = Type(JsonField.of("federal")) + + @JvmField val LOCAL = Type(JsonField.of("local")) + + @JvmField val FICA = Type(JsonField.of("fica")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + STATE, + FEDERAL, + LOCAL, + FICA, + } + + enum class Value { + STATE, + FEDERAL, + LOCAL, + FICA, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + STATE -> Value.STATE + FEDERAL -> Value.FEDERAL + LOCAL -> Value.LOCAL + FICA -> Value.FICA + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + STATE -> Known.STATE + FEDERAL -> Known.FEDERAL + LOCAL -> Known.LOCAL + FICA -> Known.FICA + else -> throw FinchInvalidDataException("Unknown Type: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val REGULAR_PAYROLL = Type(JsonField.of("regular_payroll")) + + @JvmField val OFF_CYCLE_PAYROLL = Type(JsonField.of("off_cycle_payroll")) + + @JvmField val ONE_TIME_PAYMENT = Type(JsonField.of("one_time_payment")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + REGULAR_PAYROLL, + OFF_CYCLE_PAYROLL, + ONE_TIME_PAYMENT, + } + + enum class Value { + REGULAR_PAYROLL, + OFF_CYCLE_PAYROLL, + ONE_TIME_PAYMENT, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + REGULAR_PAYROLL -> Value.REGULAR_PAYROLL + OFF_CYCLE_PAYROLL -> Value.OFF_CYCLE_PAYROLL + ONE_TIME_PAYMENT -> Value.ONE_TIME_PAYMENT + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + REGULAR_PAYROLL -> Known.REGULAR_PAYROLL + OFF_CYCLE_PAYROLL -> Known.OFF_CYCLE_PAYROLL + ONE_TIME_PAYMENT -> Known.ONE_TIME_PAYMENT + else -> throw FinchInvalidDataException("Unknown Type: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AuthServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AuthServiceAsync.kt new file mode 100644 index 00000000..9912388e --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AuthServiceAsync.kt @@ -0,0 +1,20 @@ +// 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.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.AuthCreateTokenParams +import com.tryfinch.api.models.CreateAccessTokenResponse +import java.util.concurrent.CompletableFuture + +interface AuthServiceAsync { + + /** Exchange the authorization code for an access token */ + @JvmOverloads + fun createToken( + params: AuthCreateTokenParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AuthServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AuthServiceAsyncImpl.kt new file mode 100644 index 00000000..13d613f4 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AuthServiceAsyncImpl.kt @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +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.errors.FinchError +import com.tryfinch.api.models.AuthCreateTokenParams +import com.tryfinch.api.models.CreateAccessTokenResponse +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture + +class AuthServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : AuthServiceAsync { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createTokenHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Exchange the authorization code for an access token */ + override fun createToken( + params: AuthCreateTokenParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("auth", "token") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { createTokenHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 new file mode 100644 index 00000000..205f73d3 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/SandboxServiceAsync.kt @@ -0,0 +1,30 @@ +// 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.tryfinch.api.services.async.sandbox.CompanyServiceAsync +import com.tryfinch.api.services.async.sandbox.ConnectionServiceAsync +import com.tryfinch.api.services.async.sandbox.DirectoryServiceAsync +import com.tryfinch.api.services.async.sandbox.EmploymentServiceAsync +import com.tryfinch.api.services.async.sandbox.IndividualServiceAsync +import com.tryfinch.api.services.async.sandbox.JobServiceAsync +import com.tryfinch.api.services.async.sandbox.PaymentServiceAsync + +interface SandboxServiceAsync { + + fun connections(): ConnectionServiceAsync + + fun company(): CompanyServiceAsync + + fun directory(): DirectoryServiceAsync + + fun individual(): IndividualServiceAsync + + fun employment(): EmploymentServiceAsync + + fun payment(): PaymentServiceAsync + + fun jobs(): JobServiceAsync +} 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 new file mode 100644 index 00000000..ee7aa9f7 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/SandboxServiceAsyncImpl.kt @@ -0,0 +1,66 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.errors.FinchError +import com.tryfinch.api.services.async.sandbox.CompanyServiceAsync +import com.tryfinch.api.services.async.sandbox.CompanyServiceAsyncImpl +import com.tryfinch.api.services.async.sandbox.ConnectionServiceAsync +import com.tryfinch.api.services.async.sandbox.ConnectionServiceAsyncImpl +import com.tryfinch.api.services.async.sandbox.DirectoryServiceAsync +import com.tryfinch.api.services.async.sandbox.DirectoryServiceAsyncImpl +import com.tryfinch.api.services.async.sandbox.EmploymentServiceAsync +import com.tryfinch.api.services.async.sandbox.EmploymentServiceAsyncImpl +import com.tryfinch.api.services.async.sandbox.IndividualServiceAsync +import com.tryfinch.api.services.async.sandbox.IndividualServiceAsyncImpl +import com.tryfinch.api.services.async.sandbox.JobServiceAsync +import com.tryfinch.api.services.async.sandbox.JobServiceAsyncImpl +import com.tryfinch.api.services.async.sandbox.PaymentServiceAsync +import com.tryfinch.api.services.async.sandbox.PaymentServiceAsyncImpl +import com.tryfinch.api.services.errorHandler + +class SandboxServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : SandboxServiceAsync { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val connections: ConnectionServiceAsync by lazy { + ConnectionServiceAsyncImpl(clientOptions) + } + + private val company: CompanyServiceAsync by lazy { CompanyServiceAsyncImpl(clientOptions) } + + private val directory: DirectoryServiceAsync by lazy { + DirectoryServiceAsyncImpl(clientOptions) + } + + private val individual: IndividualServiceAsync by lazy { + IndividualServiceAsyncImpl(clientOptions) + } + + private val employment: EmploymentServiceAsync by lazy { + EmploymentServiceAsyncImpl(clientOptions) + } + + private val payment: PaymentServiceAsync by lazy { PaymentServiceAsyncImpl(clientOptions) } + + private val jobs: JobServiceAsync by lazy { JobServiceAsyncImpl(clientOptions) } + + override fun connections(): ConnectionServiceAsync = connections + + override fun company(): CompanyServiceAsync = company + + override fun directory(): DirectoryServiceAsync = directory + + override fun individual(): IndividualServiceAsync = individual + + override fun employment(): EmploymentServiceAsync = employment + + override fun payment(): PaymentServiceAsync = payment + + override fun jobs(): JobServiceAsync = jobs +} 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 new file mode 100644 index 00000000..8565c002 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsync.kt @@ -0,0 +1,20 @@ +// 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.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.CompanyUpdateResponse +import com.tryfinch.api.models.SandboxCompanyUpdateParams +import java.util.concurrent.CompletableFuture + +interface CompanyServiceAsync { + + /** Update a sandbox company's data */ + @JvmOverloads + 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 new file mode 100644 index 00000000..f6046736 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.sandbox + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +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.errors.FinchError +import com.tryfinch.api.models.CompanyUpdateResponse +import com.tryfinch.api.models.SandboxCompanyUpdateParams +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture + +class CompanyServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : CompanyServiceAsync { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + /** Update a sandbox company's data */ + override fun update( + params: SandboxCompanyUpdateParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("sandbox", "company") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { updateHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 new file mode 100644 index 00000000..cd3a9715 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsync.kt @@ -0,0 +1,23 @@ +// 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.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.ConnectionCreateResponse +import com.tryfinch.api.models.SandboxConnectionCreateParams +import com.tryfinch.api.services.async.sandbox.connections.AccountServiceAsync +import java.util.concurrent.CompletableFuture + +interface ConnectionServiceAsync { + + fun accounts(): AccountServiceAsync + + /** Create a new connection (new company/provider pair) with a new account */ + @JvmOverloads + 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 new file mode 100644 index 00000000..836cc85f --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt @@ -0,0 +1,61 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.sandbox + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +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.errors.FinchError +import com.tryfinch.api.models.ConnectionCreateResponse +import com.tryfinch.api.models.SandboxConnectionCreateParams +import com.tryfinch.api.services.async.sandbox.connections.AccountServiceAsync +import com.tryfinch.api.services.async.sandbox.connections.AccountServiceAsyncImpl +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture + +class ConnectionServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : ConnectionServiceAsync { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val accounts: AccountServiceAsync by lazy { AccountServiceAsyncImpl(clientOptions) } + + override fun accounts(): AccountServiceAsync = accounts + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** 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") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 new file mode 100644 index 00000000..20741d7c --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt @@ -0,0 +1,20 @@ +// 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.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.SandboxDirectoryCreateParams +import java.util.concurrent.CompletableFuture + +interface DirectoryServiceAsync { + + /** Add new individuals to a sandbox company */ + @JvmOverloads + fun create( + params: SandboxDirectoryCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture> +} 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 new file mode 100644 index 00000000..20844c06 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt @@ -0,0 +1,48 @@ +// File generated from our OpenAPI spec by Stainless. + +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.http.HttpMethod +import com.tryfinch.api.core.http.HttpRequest +import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.errors.FinchError +import com.tryfinch.api.models.SandboxDirectoryCreateParams +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture + +class DirectoryServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : DirectoryServiceAsync { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + /** 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") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + 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 new file mode 100644 index 00000000..4c8888aa --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsync.kt @@ -0,0 +1,20 @@ +// 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.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.EmploymentUpdateResponse +import com.tryfinch.api.models.SandboxEmploymentUpdateParams +import java.util.concurrent.CompletableFuture + +interface EmploymentServiceAsync { + + /** Update sandbox employment */ + @JvmOverloads + 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 new file mode 100644 index 00000000..449253b5 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.sandbox + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +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.errors.FinchError +import com.tryfinch.api.models.EmploymentUpdateResponse +import com.tryfinch.api.models.SandboxEmploymentUpdateParams +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture + +class EmploymentServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : EmploymentServiceAsync { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Update sandbox employment */ + override fun update( + params: SandboxEmploymentUpdateParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("sandbox", "employment", params.getPathParam(0)) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { updateHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 new file mode 100644 index 00000000..eead5ee1 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsync.kt @@ -0,0 +1,20 @@ +// 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.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.IndividualUpdateResponse +import com.tryfinch.api.models.SandboxIndividualUpdateParams +import java.util.concurrent.CompletableFuture + +interface IndividualServiceAsync { + + /** Update sandbox individual */ + @JvmOverloads + 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 new file mode 100644 index 00000000..41d6997d --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.sandbox + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +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.errors.FinchError +import com.tryfinch.api.models.IndividualUpdateResponse +import com.tryfinch.api.models.SandboxIndividualUpdateParams +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture + +class IndividualServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : IndividualServiceAsync { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Update sandbox individual */ + override fun update( + params: SandboxIndividualUpdateParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("sandbox", "individual", params.getPathParam(0)) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { updateHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 new file mode 100644 index 00000000..b1d3c078 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsync.kt @@ -0,0 +1,12 @@ +// 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.tryfinch.api.services.async.sandbox.jobs.ConfigurationServiceAsync + +interface JobServiceAsync { + + fun configuration(): ConfigurationServiceAsync +} 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 new file mode 100644 index 00000000..cb17c535 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt @@ -0,0 +1,24 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.sandbox + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.errors.FinchError +import com.tryfinch.api.services.async.sandbox.jobs.ConfigurationServiceAsync +import com.tryfinch.api.services.async.sandbox.jobs.ConfigurationServiceAsyncImpl +import com.tryfinch.api.services.errorHandler + +class JobServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : JobServiceAsync { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val configuration: ConfigurationServiceAsync by lazy { + ConfigurationServiceAsyncImpl(clientOptions) + } + + override fun configuration(): ConfigurationServiceAsync = configuration +} 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 new file mode 100644 index 00000000..0cd953ff --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsync.kt @@ -0,0 +1,20 @@ +// 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.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.PaymentCreateResponse +import com.tryfinch.api.models.SandboxPaymentCreateParams +import java.util.concurrent.CompletableFuture + +interface PaymentServiceAsync { + + /** Add a new sandbox payment */ + @JvmOverloads + fun create( + params: SandboxPaymentCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture +} 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 new file mode 100644 index 00000000..146a0e36 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.sandbox + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +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.errors.FinchError +import com.tryfinch.api.models.PaymentCreateResponse +import com.tryfinch.api.models.SandboxPaymentCreateParams +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture + +class PaymentServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : PaymentServiceAsync { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + /** Add a new sandbox payment */ + override fun create( + params: SandboxPaymentCreateParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("sandbox", "payment") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 new file mode 100644 index 00000000..40a4fb8a --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsync.kt @@ -0,0 +1,32 @@ +// 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.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.AccountCreateResponse +import com.tryfinch.api.models.AccountUpdateResponse +import com.tryfinch.api.models.SandboxConnectionAccountCreateParams +import com.tryfinch.api.models.SandboxConnectionAccountUpdateParams +import java.util.concurrent.CompletableFuture + +interface AccountServiceAsync { + + /** Create a new account for an existing connection (company/provider pair) */ + @JvmOverloads + fun create( + params: SandboxConnectionAccountCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture + + /** + * Update an existing sandbox account. Change the connection status to understand how the Finch + * API responds. + */ + @JvmOverloads + fun update( + params: SandboxConnectionAccountUpdateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture +} 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 new file mode 100644 index 00000000..8d5d3c3c --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt @@ -0,0 +1,88 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.sandbox.connections + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +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.errors.FinchError +import com.tryfinch.api.models.AccountCreateResponse +import com.tryfinch.api.models.AccountUpdateResponse +import com.tryfinch.api.models.SandboxConnectionAccountCreateParams +import com.tryfinch.api.models.SandboxConnectionAccountUpdateParams +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture + +class AccountServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : AccountServiceAsync { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + /** 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") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + + 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") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { updateHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 new file mode 100644 index 00000000..ba1dbde7 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsync.kt @@ -0,0 +1,28 @@ +// 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.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.SandboxJobConfiguration +import com.tryfinch.api.models.SandboxJobConfigurationRetrieveParams +import com.tryfinch.api.models.SandboxJobConfigurationUpdateParams +import java.util.concurrent.CompletableFuture + +interface ConfigurationServiceAsync { + + /** Get configurations for sandbox jobs */ + @JvmOverloads + fun retrieve( + params: SandboxJobConfigurationRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture> + + /** Update configurations for sandbox jobs */ + @JvmOverloads + 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 new file mode 100644 index 00000000..d727a8a3 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt @@ -0,0 +1,85 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.sandbox.jobs + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +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.errors.FinchError +import com.tryfinch.api.models.SandboxJobConfiguration +import com.tryfinch.api.models.SandboxJobConfigurationRetrieveParams +import com.tryfinch.api.models.SandboxJobConfigurationUpdateParams +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture + +class ConfigurationServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : ConfigurationServiceAsync { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val retrieveHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Get configurations for sandbox jobs */ + override fun retrieve( + params: SandboxJobConfigurationRetrieveParams, + requestOptions: RequestOptions + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("sandbox", "jobs", "configuration") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { retrieveHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + forEach { it.validate() } + } + } + } + } + + 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") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { updateHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AuthService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AuthService.kt new file mode 100644 index 00000000..918bdd9a --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AuthService.kt @@ -0,0 +1,19 @@ +// 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.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.AuthCreateTokenParams +import com.tryfinch.api.models.CreateAccessTokenResponse + +interface AuthService { + + /** Exchange the authorization code for an access token */ + @JvmOverloads + fun createToken( + params: AuthCreateTokenParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CreateAccessTokenResponse +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AuthServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AuthServiceImpl.kt new file mode 100644 index 00000000..cb5d7a02 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AuthServiceImpl.kt @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +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.errors.FinchError +import com.tryfinch.api.models.AuthCreateTokenParams +import com.tryfinch.api.models.CreateAccessTokenResponse +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler + +class AuthServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : AuthService { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createTokenHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Exchange the authorization code for an access token */ + override fun createToken( + params: AuthCreateTokenParams, + requestOptions: RequestOptions + ): CreateAccessTokenResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("auth", "token") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { createTokenHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 new file mode 100644 index 00000000..0fa1f396 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/SandboxService.kt @@ -0,0 +1,30 @@ +// 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.tryfinch.api.services.blocking.sandbox.CompanyService +import com.tryfinch.api.services.blocking.sandbox.ConnectionService +import com.tryfinch.api.services.blocking.sandbox.DirectoryService +import com.tryfinch.api.services.blocking.sandbox.EmploymentService +import com.tryfinch.api.services.blocking.sandbox.IndividualService +import com.tryfinch.api.services.blocking.sandbox.JobService +import com.tryfinch.api.services.blocking.sandbox.PaymentService + +interface SandboxService { + + fun connections(): ConnectionService + + fun company(): CompanyService + + fun directory(): DirectoryService + + fun individual(): IndividualService + + fun employment(): EmploymentService + + fun payment(): PaymentService + + fun jobs(): JobService +} 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 new file mode 100644 index 00000000..4fc2d764 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/SandboxServiceImpl.kt @@ -0,0 +1,58 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.errors.FinchError +import com.tryfinch.api.services.blocking.sandbox.CompanyService +import com.tryfinch.api.services.blocking.sandbox.CompanyServiceImpl +import com.tryfinch.api.services.blocking.sandbox.ConnectionService +import com.tryfinch.api.services.blocking.sandbox.ConnectionServiceImpl +import com.tryfinch.api.services.blocking.sandbox.DirectoryService +import com.tryfinch.api.services.blocking.sandbox.DirectoryServiceImpl +import com.tryfinch.api.services.blocking.sandbox.EmploymentService +import com.tryfinch.api.services.blocking.sandbox.EmploymentServiceImpl +import com.tryfinch.api.services.blocking.sandbox.IndividualService +import com.tryfinch.api.services.blocking.sandbox.IndividualServiceImpl +import com.tryfinch.api.services.blocking.sandbox.JobService +import com.tryfinch.api.services.blocking.sandbox.JobServiceImpl +import com.tryfinch.api.services.blocking.sandbox.PaymentService +import com.tryfinch.api.services.blocking.sandbox.PaymentServiceImpl +import com.tryfinch.api.services.errorHandler + +class SandboxServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : SandboxService { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val connections: ConnectionService by lazy { ConnectionServiceImpl(clientOptions) } + + private val company: CompanyService by lazy { CompanyServiceImpl(clientOptions) } + + private val directory: DirectoryService by lazy { DirectoryServiceImpl(clientOptions) } + + private val individual: IndividualService by lazy { IndividualServiceImpl(clientOptions) } + + private val employment: EmploymentService by lazy { EmploymentServiceImpl(clientOptions) } + + private val payment: PaymentService by lazy { PaymentServiceImpl(clientOptions) } + + private val jobs: JobService by lazy { JobServiceImpl(clientOptions) } + + override fun connections(): ConnectionService = connections + + override fun company(): CompanyService = company + + override fun directory(): DirectoryService = directory + + override fun individual(): IndividualService = individual + + override fun employment(): EmploymentService = employment + + override fun payment(): PaymentService = payment + + override fun jobs(): JobService = jobs +} 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 new file mode 100644 index 00000000..a6b20bb3 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyService.kt @@ -0,0 +1,19 @@ +// 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.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.CompanyUpdateResponse +import com.tryfinch.api.models.SandboxCompanyUpdateParams + +interface CompanyService { + + /** Update a sandbox company's data */ + @JvmOverloads + fun update( + params: SandboxCompanyUpdateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompanyUpdateResponse +} 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 new file mode 100644 index 00000000..f2992541 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.sandbox + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +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.errors.FinchError +import com.tryfinch.api.models.CompanyUpdateResponse +import com.tryfinch.api.models.SandboxCompanyUpdateParams +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler + +class CompanyServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : CompanyService { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + /** Update a sandbox company's data */ + override fun update( + params: SandboxCompanyUpdateParams, + requestOptions: RequestOptions + ): CompanyUpdateResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("sandbox", "company") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { updateHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 new file mode 100644 index 00000000..79026f5e --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionService.kt @@ -0,0 +1,22 @@ +// 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.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.ConnectionCreateResponse +import com.tryfinch.api.models.SandboxConnectionCreateParams +import com.tryfinch.api.services.blocking.sandbox.connections.AccountService + +interface ConnectionService { + + fun accounts(): AccountService + + /** Create a new connection (new company/provider pair) with a new account */ + @JvmOverloads + fun create( + params: SandboxConnectionCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): ConnectionCreateResponse +} 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 new file mode 100644 index 00000000..d0e210b0 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt @@ -0,0 +1,59 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.sandbox + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +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.errors.FinchError +import com.tryfinch.api.models.ConnectionCreateResponse +import com.tryfinch.api.models.SandboxConnectionCreateParams +import com.tryfinch.api.services.blocking.sandbox.connections.AccountService +import com.tryfinch.api.services.blocking.sandbox.connections.AccountServiceImpl +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler + +class ConnectionServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : ConnectionService { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val accounts: AccountService by lazy { AccountServiceImpl(clientOptions) } + + override fun accounts(): AccountService = accounts + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** 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") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 new file mode 100644 index 00000000..cdeb0c1a --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt @@ -0,0 +1,19 @@ +// 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.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.SandboxDirectoryCreateParams + +interface DirectoryService { + + /** Add new individuals to a sandbox company */ + @JvmOverloads + fun create( + params: SandboxDirectoryCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): List +} 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 new file mode 100644 index 00000000..8ffdd799 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +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.http.HttpMethod +import com.tryfinch.api.core.http.HttpRequest +import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.errors.FinchError +import com.tryfinch.api.models.SandboxDirectoryCreateParams +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler + +class DirectoryServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : DirectoryService { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + /** 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") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + 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 new file mode 100644 index 00000000..c16beaa5 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentService.kt @@ -0,0 +1,19 @@ +// 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.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.EmploymentUpdateResponse +import com.tryfinch.api.models.SandboxEmploymentUpdateParams + +interface EmploymentService { + + /** Update sandbox employment */ + @JvmOverloads + fun update( + params: SandboxEmploymentUpdateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): EmploymentUpdateResponse +} 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 new file mode 100644 index 00000000..43849b02 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.sandbox + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +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.errors.FinchError +import com.tryfinch.api.models.EmploymentUpdateResponse +import com.tryfinch.api.models.SandboxEmploymentUpdateParams +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler + +class EmploymentServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : EmploymentService { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Update sandbox employment */ + override fun update( + params: SandboxEmploymentUpdateParams, + requestOptions: RequestOptions + ): EmploymentUpdateResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("sandbox", "employment", params.getPathParam(0)) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { updateHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 new file mode 100644 index 00000000..227ed995 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualService.kt @@ -0,0 +1,19 @@ +// 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.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.IndividualUpdateResponse +import com.tryfinch.api.models.SandboxIndividualUpdateParams + +interface IndividualService { + + /** Update sandbox individual */ + @JvmOverloads + fun update( + params: SandboxIndividualUpdateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): IndividualUpdateResponse +} 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 new file mode 100644 index 00000000..b54c9b15 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.sandbox + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +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.errors.FinchError +import com.tryfinch.api.models.IndividualUpdateResponse +import com.tryfinch.api.models.SandboxIndividualUpdateParams +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler + +class IndividualServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : IndividualService { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Update sandbox individual */ + override fun update( + params: SandboxIndividualUpdateParams, + requestOptions: RequestOptions + ): IndividualUpdateResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("sandbox", "individual", params.getPathParam(0)) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { updateHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 new file mode 100644 index 00000000..2489445b --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobService.kt @@ -0,0 +1,12 @@ +// 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.tryfinch.api.services.blocking.sandbox.jobs.ConfigurationService + +interface JobService { + + fun configuration(): ConfigurationService +} 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 new file mode 100644 index 00000000..a9c3f239 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt @@ -0,0 +1,24 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.sandbox + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.errors.FinchError +import com.tryfinch.api.services.blocking.sandbox.jobs.ConfigurationService +import com.tryfinch.api.services.blocking.sandbox.jobs.ConfigurationServiceImpl +import com.tryfinch.api.services.errorHandler + +class JobServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : JobService { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val configuration: ConfigurationService by lazy { + ConfigurationServiceImpl(clientOptions) + } + + override fun configuration(): ConfigurationService = configuration +} 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 new file mode 100644 index 00000000..9097dc10 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentService.kt @@ -0,0 +1,19 @@ +// 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.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.PaymentCreateResponse +import com.tryfinch.api.models.SandboxPaymentCreateParams + +interface PaymentService { + + /** Add a new sandbox payment */ + @JvmOverloads + fun create( + params: SandboxPaymentCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): PaymentCreateResponse +} 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 new file mode 100644 index 00000000..fa2e0239 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.sandbox + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +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.errors.FinchError +import com.tryfinch.api.models.PaymentCreateResponse +import com.tryfinch.api.models.SandboxPaymentCreateParams +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler + +class PaymentServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : PaymentService { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + /** Add a new sandbox payment */ + override fun create( + params: SandboxPaymentCreateParams, + requestOptions: RequestOptions + ): PaymentCreateResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("sandbox", "payment") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 new file mode 100644 index 00000000..57d84f21 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountService.kt @@ -0,0 +1,31 @@ +// 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.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.AccountCreateResponse +import com.tryfinch.api.models.AccountUpdateResponse +import com.tryfinch.api.models.SandboxConnectionAccountCreateParams +import com.tryfinch.api.models.SandboxConnectionAccountUpdateParams + +interface AccountService { + + /** Create a new account for an existing connection (company/provider pair) */ + @JvmOverloads + fun create( + params: SandboxConnectionAccountCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): AccountCreateResponse + + /** + * Update an existing sandbox account. Change the connection status to understand how the Finch + * API responds. + */ + @JvmOverloads + fun update( + params: SandboxConnectionAccountUpdateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): AccountUpdateResponse +} 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 new file mode 100644 index 00000000..4a778802 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt @@ -0,0 +1,85 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.sandbox.connections + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +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.errors.FinchError +import com.tryfinch.api.models.AccountCreateResponse +import com.tryfinch.api.models.AccountUpdateResponse +import com.tryfinch.api.models.SandboxConnectionAccountCreateParams +import com.tryfinch.api.models.SandboxConnectionAccountUpdateParams +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler + +class AccountServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : AccountService { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + /** 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") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + + 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") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { updateHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + 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 new file mode 100644 index 00000000..e40e3a80 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationService.kt @@ -0,0 +1,27 @@ +// 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.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.SandboxJobConfiguration +import com.tryfinch.api.models.SandboxJobConfigurationRetrieveParams +import com.tryfinch.api.models.SandboxJobConfigurationUpdateParams + +interface ConfigurationService { + + /** Get configurations for sandbox jobs */ + @JvmOverloads + fun retrieve( + params: SandboxJobConfigurationRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none() + ): List + + /** Update configurations for sandbox jobs */ + @JvmOverloads + fun update( + params: SandboxJobConfigurationUpdateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): SandboxJobConfiguration +} 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 new file mode 100644 index 00000000..4d4e29a9 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt @@ -0,0 +1,82 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.sandbox.jobs + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +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.errors.FinchError +import com.tryfinch.api.models.SandboxJobConfiguration +import com.tryfinch.api.models.SandboxJobConfigurationRetrieveParams +import com.tryfinch.api.models.SandboxJobConfigurationUpdateParams +import com.tryfinch.api.services.errorHandler +import com.tryfinch.api.services.json +import com.tryfinch.api.services.jsonHandler +import com.tryfinch.api.services.withErrorHandler + +class ConfigurationServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : ConfigurationService { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val retrieveHandler: Handler> = + jsonHandler>(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Get configurations for sandbox jobs */ + override fun retrieve( + params: SandboxJobConfigurationRetrieveParams, + requestOptions: RequestOptions + ): List { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("sandbox", "jobs", "configuration") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { retrieveHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + forEach { it.validate() } + } + } + } + } + + 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") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { updateHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } +} 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 new file mode 100644 index 00000000..5496a139 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountCreateResponseTest.kt @@ -0,0 +1,33 @@ +// 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 + +class AccountCreateResponseTest { + + @Test + fun createAccountCreateResponse() { + val accountCreateResponse = + AccountCreateResponse.builder() + .accessToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .authenticationType(AccountCreateResponse.AuthenticationType.CREDENTIALS) + .companyId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .products(listOf("string")) + .providerId("string") + .build() + assertThat(accountCreateResponse).isNotNull + assertThat(accountCreateResponse.accessToken()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(accountCreateResponse.accountId()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(accountCreateResponse.authenticationType()) + .isEqualTo(AccountCreateResponse.AuthenticationType.CREDENTIALS) + assertThat(accountCreateResponse.companyId()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(accountCreateResponse.products()).containsExactly("string") + assertThat(accountCreateResponse.providerId()).isEqualTo("string") + } +} 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 new file mode 100644 index 00000000..7e81f9fb --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccountUpdateResponseTest.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 + +class AccountUpdateResponseTest { + + @Test + fun createAccountUpdateResponse() { + val accountUpdateResponse = + AccountUpdateResponse.builder() + .accountId("string") + .authenticationType(AccountUpdateResponse.AuthenticationType.CREDENTIALS) + .companyId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .products(listOf("string")) + .providerId("string") + .build() + assertThat(accountUpdateResponse).isNotNull + assertThat(accountUpdateResponse.accountId()).isEqualTo("string") + assertThat(accountUpdateResponse.authenticationType()) + .isEqualTo(AccountUpdateResponse.AuthenticationType.CREDENTIALS) + assertThat(accountUpdateResponse.companyId()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(accountUpdateResponse.products()).containsExactly("string") + assertThat(accountUpdateResponse.providerId()).isEqualTo("string") + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AuthCreateTokenParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AuthCreateTokenParamsTest.kt new file mode 100644 index 00000000..f63639c1 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AuthCreateTokenParamsTest.kt @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class AuthCreateTokenParamsTest { + + @Test + fun createAuthCreateTokenParams() { + AuthCreateTokenParams.builder() + .clientId("") + .clientSecret("") + .code("") + .redirectUri("https://example.com") + .build() + } + + @Test + fun getBody() { + val params = + AuthCreateTokenParams.builder() + .clientId("") + .clientSecret("") + .code("") + .redirectUri("https://example.com") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.clientId()).isEqualTo("") + assertThat(body.clientSecret()).isEqualTo("") + assertThat(body.code()).isEqualTo("") + assertThat(body.redirectUri()).isEqualTo("https://example.com") + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = + AuthCreateTokenParams.builder() + .clientId("") + .clientSecret("") + .code("") + .redirectUri("https://example.com") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.clientId()).isEqualTo("") + assertThat(body.clientSecret()).isEqualTo("") + assertThat(body.code()).isEqualTo("") + assertThat(body.redirectUri()).isEqualTo("https://example.com") + } +} 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 new file mode 100644 index 00000000..a27ba350 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/CompanyUpdateResponseTest.kt @@ -0,0 +1,107 @@ +// 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 + +class CompanyUpdateResponseTest { + + @Test + fun createCompanyUpdateResponse() { + val companyUpdateResponse = + CompanyUpdateResponse.builder() + .accounts( + listOf( + CompanyUpdateResponse.Account.builder() + .accountName("string") + .accountNumber("string") + .accountType(CompanyUpdateResponse.Account.AccountType.CHECKING) + .institutionName("string") + .routingNumber("string") + .build() + ) + ) + .departments( + listOf( + CompanyUpdateResponse.Department.builder() + .name("string") + .parent( + CompanyUpdateResponse.Department.Parent.builder() + .name("string") + .build() + ) + .build() + ) + ) + .ein("string") + .entity( + CompanyUpdateResponse.Entity.builder() + .subtype(CompanyUpdateResponse.Entity.Subtype.S_CORPORATION) + .type(CompanyUpdateResponse.Entity.Type.LLC) + .build() + ) + .legalName("string") + .locations( + listOf( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + ) + .primaryEmail("string") + .primaryPhoneNumber("string") + .build() + assertThat(companyUpdateResponse).isNotNull + assertThat(companyUpdateResponse.accounts().get()) + .containsExactly( + CompanyUpdateResponse.Account.builder() + .accountName("string") + .accountNumber("string") + .accountType(CompanyUpdateResponse.Account.AccountType.CHECKING) + .institutionName("string") + .routingNumber("string") + .build() + ) + assertThat(companyUpdateResponse.departments().get()) + .containsExactly( + CompanyUpdateResponse.Department.builder() + .name("string") + .parent( + CompanyUpdateResponse.Department.Parent.builder().name("string").build() + ) + .build() + ) + assertThat(companyUpdateResponse.ein()).contains("string") + assertThat(companyUpdateResponse.entity()) + .contains( + CompanyUpdateResponse.Entity.builder() + .subtype(CompanyUpdateResponse.Entity.Subtype.S_CORPORATION) + .type(CompanyUpdateResponse.Entity.Type.LLC) + .build() + ) + assertThat(companyUpdateResponse.legalName()).contains("string") + assertThat(companyUpdateResponse.locations().get()) + .containsExactly( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + assertThat(companyUpdateResponse.primaryEmail()).contains("string") + assertThat(companyUpdateResponse.primaryPhoneNumber()).contains("string") + } +} 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 new file mode 100644 index 00000000..052ab2c2 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectionCreateResponseTest.kt @@ -0,0 +1,34 @@ +// 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 + +class ConnectionCreateResponseTest { + + @Test + fun createConnectionCreateResponse() { + val connectionCreateResponse = + ConnectionCreateResponse.builder() + .accessToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .authenticationType(ConnectionCreateResponse.AuthenticationType.CREDENTIALS) + .companyId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .products(listOf("string")) + .providerId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + assertThat(connectionCreateResponse).isNotNull + assertThat(connectionCreateResponse.accessToken()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(connectionCreateResponse.accountId()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(connectionCreateResponse.authenticationType()) + .isEqualTo(ConnectionCreateResponse.AuthenticationType.CREDENTIALS) + assertThat(connectionCreateResponse.companyId()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(connectionCreateResponse.products()).containsExactly("string") + assertThat(connectionCreateResponse.providerId()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + } +} 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 43edec89..ddbaa73f 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 @@ -65,11 +65,7 @@ class EmploymentDataResponseTest { .state("string") .build() ) - .manager( - EmploymentData.Manager.builder() - .id("e8b90071-0c11-471c-86e8-e303ef2f6782") - .build() - ) + .manager(EmploymentData.Manager.builder().id("string").build()) .middleName("string") .payGroupIds(listOf("string")) .sourceId("string") @@ -137,11 +133,7 @@ class EmploymentDataResponseTest { .state("string") .build() ) - .manager( - EmploymentData.Manager.builder() - .id("e8b90071-0c11-471c-86e8-e303ef2f6782") - .build() - ) + .manager(EmploymentData.Manager.builder().id("string").build()) .middleName("string") .payGroupIds(listOf("string")) .sourceId("string") 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 81f40989..51c572d8 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 @@ -63,11 +63,7 @@ class EmploymentDataTest { .state("string") .build() ) - .manager( - EmploymentData.Manager.builder() - .id("e8b90071-0c11-471c-86e8-e303ef2f6782") - .build() - ) + .manager(EmploymentData.Manager.builder().id("string").build()) .middleName("string") .payGroupIds(listOf("string")) .sourceId("string") @@ -131,9 +127,7 @@ class EmploymentDataTest { .build() ) assertThat(employmentData.manager()) - .contains( - EmploymentData.Manager.builder().id("e8b90071-0c11-471c-86e8-e303ef2f6782").build() - ) + .contains(EmploymentData.Manager.builder().id("string").build()) assertThat(employmentData.middleName()).contains("string") assertThat(employmentData.payGroupIds().get()).containsExactly("string") assertThat(employmentData.sourceId()).contains("string") 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 new file mode 100644 index 00000000..d663e650 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/EmploymentUpdateResponseTest.kt @@ -0,0 +1,133 @@ +// 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 + +class EmploymentUpdateResponseTest { + + @Test + fun createEmploymentUpdateResponse() { + val employmentUpdateResponse = + EmploymentUpdateResponse.builder() + .id("string") + .classCode("string") + .customFields( + listOf( + EmploymentUpdateResponse.CustomField.builder() + .name("string") + .value(JsonValue.from(mapOf())) + .build() + ) + ) + .department(EmploymentUpdateResponse.Department.builder().name("string").build()) + .employment( + EmploymentUpdateResponse.Employment.builder() + .subtype(EmploymentUpdateResponse.Employment.Subtype.FULL_TIME) + .type(EmploymentUpdateResponse.Employment.Type.EMPLOYEE) + .build() + ) + .endDate("string") + .firstName("string") + .income( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + .incomeHistory( + listOf( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + ) + .isActive(true) + .lastName("string") + .location( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + .manager(EmploymentUpdateResponse.Manager.builder().id("string").build()) + .middleName("string") + .sourceId("string") + .startDate("string") + .title("string") + .build() + assertThat(employmentUpdateResponse).isNotNull + assertThat(employmentUpdateResponse.id()).contains("string") + assertThat(employmentUpdateResponse.classCode()).contains("string") + assertThat(employmentUpdateResponse.customFields().get()) + .containsExactly( + EmploymentUpdateResponse.CustomField.builder() + .name("string") + .value(JsonValue.from(mapOf())) + .build() + ) + assertThat(employmentUpdateResponse.department()) + .contains(EmploymentUpdateResponse.Department.builder().name("string").build()) + assertThat(employmentUpdateResponse.employment()) + .contains( + EmploymentUpdateResponse.Employment.builder() + .subtype(EmploymentUpdateResponse.Employment.Subtype.FULL_TIME) + .type(EmploymentUpdateResponse.Employment.Type.EMPLOYEE) + .build() + ) + assertThat(employmentUpdateResponse.endDate()).contains("string") + assertThat(employmentUpdateResponse.firstName()).contains("string") + assertThat(employmentUpdateResponse.income()) + .contains( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + assertThat(employmentUpdateResponse.incomeHistory().get()) + .containsExactly( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + assertThat(employmentUpdateResponse.isActive()).contains(true) + assertThat(employmentUpdateResponse.lastName()).contains("string") + assertThat(employmentUpdateResponse.location()) + .contains( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + assertThat(employmentUpdateResponse.manager()) + .contains(EmploymentUpdateResponse.Manager.builder().id("string").build()) + assertThat(employmentUpdateResponse.middleName()).contains("string") + assertThat(employmentUpdateResponse.sourceId()).contains("string") + assertThat(employmentUpdateResponse.startDate()).contains("string") + assertThat(employmentUpdateResponse.title()).contains("string") + } +} 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 910206e5..fbcb9c8d 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 @@ -14,7 +14,7 @@ class HrisPayStatementRetrieveManyParamsTest { .requests( listOf( HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("e8b90071-0c11-471c-86e8-e303ef2f6782") + .paymentId("string") .limit(123L) .offset(123L) .build() @@ -30,7 +30,7 @@ class HrisPayStatementRetrieveManyParamsTest { .requests( listOf( HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("e8b90071-0c11-471c-86e8-e303ef2f6782") + .paymentId("string") .limit(123L) .offset(123L) .build() @@ -43,7 +43,7 @@ class HrisPayStatementRetrieveManyParamsTest { .isEqualTo( listOf( HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("e8b90071-0c11-471c-86e8-e303ef2f6782") + .paymentId("string") .limit(123L) .offset(123L) .build() @@ -58,7 +58,7 @@ class HrisPayStatementRetrieveManyParamsTest { .requests( listOf( HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("e8b90071-0c11-471c-86e8-e303ef2f6782") + .paymentId("string") .build() ) ) @@ -68,9 +68,7 @@ class HrisPayStatementRetrieveManyParamsTest { assertThat(body.requests()) .isEqualTo( listOf( - HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("e8b90071-0c11-471c-86e8-e303ef2f6782") - .build() + HrisPayStatementRetrieveManyParams.Request.builder().paymentId("string").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 7f7a1995..bf553b24 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 @@ -16,11 +16,7 @@ class IndividualInDirectoryTest { .firstName("string") .isActive(true) .lastName("string") - .manager( - IndividualInDirectory.Manager.builder() - .id("e8b90071-0c11-471c-86e8-e303ef2f6782") - .build() - ) + .manager(IndividualInDirectory.Manager.builder().id("string").build()) .middleName("string") .build() assertThat(individualInDirectory).isNotNull @@ -31,11 +27,7 @@ class IndividualInDirectoryTest { assertThat(individualInDirectory.isActive()).contains(true) assertThat(individualInDirectory.lastName()).contains("string") assertThat(individualInDirectory.manager()) - .contains( - IndividualInDirectory.Manager.builder() - .id("e8b90071-0c11-471c-86e8-e303ef2f6782") - .build() - ) + .contains(IndividualInDirectory.Manager.builder().id("string").build()) assertThat(individualInDirectory.middleName()).contains("string") } } 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 new file mode 100644 index 00000000..ddf8c8b7 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualUpdateResponseTest.kt @@ -0,0 +1,94 @@ +// 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 + +class IndividualUpdateResponseTest { + + @Test + fun createIndividualUpdateResponse() { + val individualUpdateResponse = + IndividualUpdateResponse.builder() + .id("string") + .dob("string") + .emails( + listOf( + IndividualUpdateResponse.Email.builder() + .data("string") + .type(IndividualUpdateResponse.Email.Type.WORK) + .build() + ) + ) + .encryptedSsn("string") + .ethnicity(IndividualUpdateResponse.Ethnicity.ASIAN) + .firstName("string") + .gender(IndividualUpdateResponse.Gender.FEMALE) + .lastName("string") + .middleName("string") + .phoneNumbers( + listOf( + IndividualUpdateResponse.PhoneNumber.builder() + .data("string") + .type(IndividualUpdateResponse.PhoneNumber.Type.WORK) + .build() + ) + ) + .preferredName("string") + .residence( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + .ssn("string") + .build() + assertThat(individualUpdateResponse).isNotNull + assertThat(individualUpdateResponse.id()).contains("string") + assertThat(individualUpdateResponse.dob()).contains("string") + assertThat(individualUpdateResponse.emails().get()) + .containsExactly( + IndividualUpdateResponse.Email.builder() + .data("string") + .type(IndividualUpdateResponse.Email.Type.WORK) + .build() + ) + assertThat(individualUpdateResponse.encryptedSsn()).contains("string") + assertThat(individualUpdateResponse.ethnicity()) + .contains(IndividualUpdateResponse.Ethnicity.ASIAN) + assertThat(individualUpdateResponse.firstName()).contains("string") + assertThat(individualUpdateResponse.gender()) + .contains(IndividualUpdateResponse.Gender.FEMALE) + assertThat(individualUpdateResponse.lastName()).contains("string") + assertThat(individualUpdateResponse.middleName()).contains("string") + assertThat(individualUpdateResponse.phoneNumbers().get()) + .containsExactly( + IndividualUpdateResponse.PhoneNumber.builder() + .data("string") + .type(IndividualUpdateResponse.PhoneNumber.Type.WORK) + .build() + ) + assertThat(individualUpdateResponse.preferredName()).contains("string") + assertThat(individualUpdateResponse.residence()) + .contains( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + assertThat(individualUpdateResponse.ssn()).contains("string") + } +} 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 ffbe6f4a..48b4e46c 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 @@ -12,6 +12,17 @@ class IntrospectionTest { val introspection = Introspection.builder() .accountId("string") + .authenticationMethods( + Introspection.AuthenticationMethods.builder() + .connectionStatus( + Introspection.AuthenticationMethods.ConnectionStatus.builder() + .message("string") + .status(IntrospectResponseConnectionStatus.PENDING) + .build() + ) + .type("string") + .build() + ) .clientId("string") .clientType(Introspection.ClientType.PRODUCTION) .companyId("string") @@ -23,6 +34,18 @@ class IntrospectionTest { .build() assertThat(introspection).isNotNull assertThat(introspection.accountId()).isEqualTo("string") + assertThat(introspection.authenticationMethods()) + .isEqualTo( + Introspection.AuthenticationMethods.builder() + .connectionStatus( + Introspection.AuthenticationMethods.ConnectionStatus.builder() + .message("string") + .status(IntrospectResponseConnectionStatus.PENDING) + .build() + ) + .type("string") + .build() + ) assertThat(introspection.clientId()).isEqualTo("string") assertThat(introspection.clientType()).isEqualTo(Introspection.ClientType.PRODUCTION) assertThat(introspection.companyId()).isEqualTo("string") 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 new file mode 100644 index 00000000..96ea2b98 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PaymentCreateResponseTest.kt @@ -0,0 +1,18 @@ +// 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 + +class PaymentCreateResponseTest { + + @Test + fun createPaymentCreateResponse() { + val paymentCreateResponse = + PaymentCreateResponse.builder().payDate("string").paymentId("string").build() + assertThat(paymentCreateResponse).isNotNull + assertThat(paymentCreateResponse.payDate()).isEqualTo("string") + assertThat(paymentCreateResponse.paymentId()).isEqualTo("string") + } +} 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 0a690747..e745d46e 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 @@ -11,13 +11,13 @@ class PaymentTest { fun createPayment() { val payment = Payment.builder() - .id("e8b90071-0c11-471c-86e8-e303ef2f6782") + .id("string") .companyDebit(Money.builder().amount(123L).currency("string").build()) .debitDate("string") .employeeTaxes(Money.builder().amount(123L).currency("string").build()) .employerTaxes(Money.builder().amount(123L).currency("string").build()) .grossPay(Money.builder().amount(123L).currency("string").build()) - .individualIds(listOf("e8b90071-0c11-471c-86e8-e303ef2f6782")) + .individualIds(listOf("string")) .netPay(Money.builder().amount(123L).currency("string").build()) .payDate("string") .payPeriod( @@ -25,7 +25,7 @@ class PaymentTest { ) .build() assertThat(payment).isNotNull - assertThat(payment.id()).contains("e8b90071-0c11-471c-86e8-e303ef2f6782") + assertThat(payment.id()).contains("string") assertThat(payment.companyDebit()) .contains(Money.builder().amount(123L).currency("string").build()) assertThat(payment.debitDate()).contains("string") @@ -35,8 +35,7 @@ class PaymentTest { .contains(Money.builder().amount(123L).currency("string").build()) assertThat(payment.grossPay()) .contains(Money.builder().amount(123L).currency("string").build()) - assertThat(payment.individualIds().get()) - .containsExactly("e8b90071-0c11-471c-86e8-e303ef2f6782") + assertThat(payment.individualIds().get()).containsExactly("string") assertThat(payment.netPay()) .contains(Money.builder().amount(123L).currency("string").build()) assertThat(payment.payDate()).contains("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 new file mode 100644 index 00000000..66a4fb99 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt @@ -0,0 +1,177 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class SandboxCompanyUpdateParamsTest { + + @Test + fun createSandboxCompanyUpdateParams() { + SandboxCompanyUpdateParams.builder() + .accounts( + listOf( + SandboxCompanyUpdateParams.Account.builder() + .accountName("string") + .accountNumber("string") + .accountType(SandboxCompanyUpdateParams.Account.AccountType.CHECKING) + .institutionName("string") + .routingNumber("string") + .build() + ) + ) + .departments( + listOf( + SandboxCompanyUpdateParams.Department.builder() + .name("string") + .parent( + SandboxCompanyUpdateParams.Department.Parent.builder() + .name("string") + .build() + ) + .build() + ) + ) + .ein("string") + .entity( + SandboxCompanyUpdateParams.Entity.builder() + .subtype(SandboxCompanyUpdateParams.Entity.Subtype.S_CORPORATION) + .type(SandboxCompanyUpdateParams.Entity.Type.LLC) + .build() + ) + .legalName("string") + .locations( + listOf( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + ) + .primaryEmail("string") + .primaryPhoneNumber("string") + .build() + } + + @Test + fun getBody() { + val params = + SandboxCompanyUpdateParams.builder() + .accounts( + listOf( + SandboxCompanyUpdateParams.Account.builder() + .accountName("string") + .accountNumber("string") + .accountType(SandboxCompanyUpdateParams.Account.AccountType.CHECKING) + .institutionName("string") + .routingNumber("string") + .build() + ) + ) + .departments( + listOf( + SandboxCompanyUpdateParams.Department.builder() + .name("string") + .parent( + SandboxCompanyUpdateParams.Department.Parent.builder() + .name("string") + .build() + ) + .build() + ) + ) + .ein("string") + .entity( + SandboxCompanyUpdateParams.Entity.builder() + .subtype(SandboxCompanyUpdateParams.Entity.Subtype.S_CORPORATION) + .type(SandboxCompanyUpdateParams.Entity.Type.LLC) + .build() + ) + .legalName("string") + .locations( + listOf( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + ) + .primaryEmail("string") + .primaryPhoneNumber("string") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.accounts()) + .isEqualTo( + listOf( + SandboxCompanyUpdateParams.Account.builder() + .accountName("string") + .accountNumber("string") + .accountType(SandboxCompanyUpdateParams.Account.AccountType.CHECKING) + .institutionName("string") + .routingNumber("string") + .build() + ) + ) + assertThat(body.departments()) + .isEqualTo( + listOf( + SandboxCompanyUpdateParams.Department.builder() + .name("string") + .parent( + SandboxCompanyUpdateParams.Department.Parent.builder() + .name("string") + .build() + ) + .build() + ) + ) + assertThat(body.ein()).isEqualTo("string") + assertThat(body.entity()) + .isEqualTo( + SandboxCompanyUpdateParams.Entity.builder() + .subtype(SandboxCompanyUpdateParams.Entity.Subtype.S_CORPORATION) + .type(SandboxCompanyUpdateParams.Entity.Type.LLC) + .build() + ) + assertThat(body.legalName()).isEqualTo("string") + assertThat(body.locations()) + .isEqualTo( + listOf( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + ) + assertThat(body.primaryEmail()).isEqualTo("string") + assertThat(body.primaryPhoneNumber()).isEqualTo("string") + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = SandboxCompanyUpdateParams.builder().build() + val body = params.getBody() + assertThat(body).isNotNull + } +} 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 new file mode 100644 index 00000000..1bcb0cbf --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class SandboxConnectionAccountCreateParamsTest { + + @Test + fun createSandboxConnectionAccountCreateParams() { + SandboxConnectionAccountCreateParams.builder() + .companyId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .providerId("string") + .authenticationType(SandboxConnectionAccountCreateParams.AuthenticationType.CREDENTIALS) + .products(listOf("string")) + .build() + } + + @Test + fun getBody() { + val params = + SandboxConnectionAccountCreateParams.builder() + .companyId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .providerId("string") + .authenticationType( + SandboxConnectionAccountCreateParams.AuthenticationType.CREDENTIALS + ) + .products(listOf("string")) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.companyId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(body.providerId()).isEqualTo("string") + assertThat(body.authenticationType()) + .isEqualTo(SandboxConnectionAccountCreateParams.AuthenticationType.CREDENTIALS) + assertThat(body.products()).isEqualTo(listOf("string")) + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = + SandboxConnectionAccountCreateParams.builder() + .companyId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .providerId("string") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.companyId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(body.providerId()).isEqualTo("string") + } +} 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 new file mode 100644 index 00000000..3e3d1f4e --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt @@ -0,0 +1,35 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class SandboxConnectionAccountUpdateParamsTest { + + @Test + fun createSandboxConnectionAccountUpdateParams() { + SandboxConnectionAccountUpdateParams.builder() + .connectionStatus(IntrospectResponseConnectionStatus.PENDING) + .build() + } + + @Test + fun getBody() { + val params = + SandboxConnectionAccountUpdateParams.builder() + .connectionStatus(IntrospectResponseConnectionStatus.PENDING) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.connectionStatus()).isEqualTo(IntrospectResponseConnectionStatus.PENDING) + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = SandboxConnectionAccountUpdateParams.builder().build() + val body = params.getBody() + assertThat(body).isNotNull + } +} 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 new file mode 100644 index 00000000..34332708 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class SandboxConnectionCreateParamsTest { + + @Test + fun createSandboxConnectionCreateParams() { + SandboxConnectionCreateParams.builder() + .providerId("string") + .authenticationType(SandboxConnectionCreateParams.AuthenticationType.CREDENTIALS) + .employerSize(123L) + .products(listOf("string")) + .build() + } + + @Test + fun getBody() { + val params = + SandboxConnectionCreateParams.builder() + .providerId("string") + .authenticationType(SandboxConnectionCreateParams.AuthenticationType.CREDENTIALS) + .employerSize(123L) + .products(listOf("string")) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.providerId()).isEqualTo("string") + assertThat(body.authenticationType()) + .isEqualTo(SandboxConnectionCreateParams.AuthenticationType.CREDENTIALS) + assertThat(body.employerSize()).isEqualTo(123L) + assertThat(body.products()).isEqualTo(listOf("string")) + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = SandboxConnectionCreateParams.builder().providerId("string").build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.providerId()).isEqualTo("string") + } +} 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 new file mode 100644 index 00000000..bf641d12 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParamsTest.kt @@ -0,0 +1,422 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class SandboxDirectoryCreateParamsTest { + + @Test + fun createSandboxDirectoryCreateParams() { + SandboxDirectoryCreateParams.builder() + .body( + listOf( + SandboxDirectoryCreateParams.IndividualOrEmployment.builder() + .classCode("string") + .customFields( + listOf( + SandboxDirectoryCreateParams.IndividualOrEmployment.CustomField + .builder() + .name("string") + .value(JsonValue.from(mapOf())) + .build() + ) + ) + .department( + SandboxDirectoryCreateParams.IndividualOrEmployment.Department.builder() + .name("string") + .build() + ) + .dob("string") + .emails( + listOf( + SandboxDirectoryCreateParams.IndividualOrEmployment.Email.builder() + .data("string") + .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() + ) + .encryptedSsn("string") + .endDate("string") + .ethnicity( + SandboxDirectoryCreateParams.IndividualOrEmployment.Ethnicity.ASIAN + ) + .firstName("string") + .gender(SandboxDirectoryCreateParams.IndividualOrEmployment.Gender.FEMALE) + .income( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + .incomeHistory( + listOf( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + ) + .isActive(true) + .lastName("string") + .location( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + .manager( + SandboxDirectoryCreateParams.IndividualOrEmployment.Manager.builder() + .id("string") + .build() + ) + .middleName("string") + .phoneNumbers( + listOf( + SandboxDirectoryCreateParams.IndividualOrEmployment.PhoneNumber + .builder() + .data("string") + .type( + SandboxDirectoryCreateParams.IndividualOrEmployment + .PhoneNumber + .Type + .WORK + ) + .build() + ) + ) + .preferredName("string") + .residence( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + .sourceId("string") + .ssn("string") + .startDate("string") + .title("string") + .build() + ) + ) + .build() + } + + @Test + fun getBody() { + val params = + SandboxDirectoryCreateParams.builder() + .body( + listOf( + SandboxDirectoryCreateParams.IndividualOrEmployment.builder() + .classCode("string") + .customFields( + listOf( + SandboxDirectoryCreateParams.IndividualOrEmployment.CustomField + .builder() + .name("string") + .value(JsonValue.from(mapOf())) + .build() + ) + ) + .department( + SandboxDirectoryCreateParams.IndividualOrEmployment.Department + .builder() + .name("string") + .build() + ) + .dob("string") + .emails( + listOf( + SandboxDirectoryCreateParams.IndividualOrEmployment.Email + .builder() + .data("string") + .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() + ) + .encryptedSsn("string") + .endDate("string") + .ethnicity( + SandboxDirectoryCreateParams.IndividualOrEmployment.Ethnicity.ASIAN + ) + .firstName("string") + .gender( + SandboxDirectoryCreateParams.IndividualOrEmployment.Gender.FEMALE + ) + .income( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + .incomeHistory( + listOf( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + ) + .isActive(true) + .lastName("string") + .location( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + .manager( + SandboxDirectoryCreateParams.IndividualOrEmployment.Manager + .builder() + .id("string") + .build() + ) + .middleName("string") + .phoneNumbers( + listOf( + SandboxDirectoryCreateParams.IndividualOrEmployment.PhoneNumber + .builder() + .data("string") + .type( + SandboxDirectoryCreateParams.IndividualOrEmployment + .PhoneNumber + .Type + .WORK + ) + .build() + ) + ) + .preferredName("string") + .residence( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + .sourceId("string") + .ssn("string") + .startDate("string") + .title("string") + .build() + ) + ) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.body()) + .isEqualTo( + listOf( + SandboxDirectoryCreateParams.IndividualOrEmployment.builder() + .classCode("string") + .customFields( + listOf( + SandboxDirectoryCreateParams.IndividualOrEmployment.CustomField + .builder() + .name("string") + .value(JsonValue.from(mapOf())) + .build() + ) + ) + .department( + SandboxDirectoryCreateParams.IndividualOrEmployment.Department.builder() + .name("string") + .build() + ) + .dob("string") + .emails( + listOf( + SandboxDirectoryCreateParams.IndividualOrEmployment.Email.builder() + .data("string") + .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() + ) + .encryptedSsn("string") + .endDate("string") + .ethnicity( + SandboxDirectoryCreateParams.IndividualOrEmployment.Ethnicity.ASIAN + ) + .firstName("string") + .gender(SandboxDirectoryCreateParams.IndividualOrEmployment.Gender.FEMALE) + .income( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + .incomeHistory( + listOf( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + ) + .isActive(true) + .lastName("string") + .location( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + .manager( + SandboxDirectoryCreateParams.IndividualOrEmployment.Manager.builder() + .id("string") + .build() + ) + .middleName("string") + .phoneNumbers( + listOf( + SandboxDirectoryCreateParams.IndividualOrEmployment.PhoneNumber + .builder() + .data("string") + .type( + SandboxDirectoryCreateParams.IndividualOrEmployment + .PhoneNumber + .Type + .WORK + ) + .build() + ) + ) + .preferredName("string") + .residence( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + .sourceId("string") + .ssn("string") + .startDate("string") + .title("string") + .build() + ) + ) + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = + SandboxDirectoryCreateParams.builder() + .body(listOf(SandboxDirectoryCreateParams.IndividualOrEmployment.builder().build())) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.body()) + .isEqualTo( + listOf(SandboxDirectoryCreateParams.IndividualOrEmployment.builder().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 new file mode 100644 index 00000000..a24ea8de --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt @@ -0,0 +1,219 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class SandboxEmploymentUpdateParamsTest { + + @Test + fun createSandboxEmploymentUpdateParams() { + SandboxEmploymentUpdateParams.builder() + .individualId("string") + .classCode("string") + .customFields( + listOf( + SandboxEmploymentUpdateParams.CustomField.builder() + .name("string") + .value(JsonValue.from(mapOf())) + .build() + ) + ) + .department(SandboxEmploymentUpdateParams.Department.builder().name("string").build()) + .employment( + SandboxEmploymentUpdateParams.Employment.builder() + .subtype(SandboxEmploymentUpdateParams.Employment.Subtype.FULL_TIME) + .type(SandboxEmploymentUpdateParams.Employment.Type.EMPLOYEE) + .build() + ) + .endDate("string") + .firstName("string") + .income( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + .incomeHistory( + listOf( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + ) + .isActive(true) + .lastName("string") + .location( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + .manager(SandboxEmploymentUpdateParams.Manager.builder().id("string").build()) + .middleName("string") + .sourceId("string") + .startDate("string") + .title("string") + .build() + } + + @Test + fun getBody() { + val params = + SandboxEmploymentUpdateParams.builder() + .individualId("string") + .classCode("string") + .customFields( + listOf( + SandboxEmploymentUpdateParams.CustomField.builder() + .name("string") + .value(JsonValue.from(mapOf())) + .build() + ) + ) + .department( + SandboxEmploymentUpdateParams.Department.builder().name("string").build() + ) + .employment( + SandboxEmploymentUpdateParams.Employment.builder() + .subtype(SandboxEmploymentUpdateParams.Employment.Subtype.FULL_TIME) + .type(SandboxEmploymentUpdateParams.Employment.Type.EMPLOYEE) + .build() + ) + .endDate("string") + .firstName("string") + .income( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + .incomeHistory( + listOf( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + ) + .isActive(true) + .lastName("string") + .location( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + .manager(SandboxEmploymentUpdateParams.Manager.builder().id("string").build()) + .middleName("string") + .sourceId("string") + .startDate("string") + .title("string") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.classCode()).isEqualTo("string") + assertThat(body.customFields()) + .isEqualTo( + listOf( + SandboxEmploymentUpdateParams.CustomField.builder() + .name("string") + .value(JsonValue.from(mapOf())) + .build() + ) + ) + assertThat(body.department()) + .isEqualTo(SandboxEmploymentUpdateParams.Department.builder().name("string").build()) + assertThat(body.employment()) + .isEqualTo( + SandboxEmploymentUpdateParams.Employment.builder() + .subtype(SandboxEmploymentUpdateParams.Employment.Subtype.FULL_TIME) + .type(SandboxEmploymentUpdateParams.Employment.Type.EMPLOYEE) + .build() + ) + assertThat(body.endDate()).isEqualTo("string") + assertThat(body.firstName()).isEqualTo("string") + assertThat(body.income()) + .isEqualTo( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + assertThat(body.incomeHistory()) + .isEqualTo( + listOf( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + ) + assertThat(body.isActive()).isEqualTo(true) + assertThat(body.lastName()).isEqualTo("string") + assertThat(body.location()) + .isEqualTo( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + assertThat(body.manager()) + .isEqualTo(SandboxEmploymentUpdateParams.Manager.builder().id("string").build()) + assertThat(body.middleName()).isEqualTo("string") + assertThat(body.sourceId()).isEqualTo("string") + assertThat(body.startDate()).isEqualTo("string") + assertThat(body.title()).isEqualTo("string") + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = SandboxEmploymentUpdateParams.builder().individualId("string").build() + val body = params.getBody() + assertThat(body).isNotNull + } + + @Test + fun getPathParam() { + val params = SandboxEmploymentUpdateParams.builder().individualId("string").build() + assertThat(params).isNotNull + // path param "individualId" + assertThat(params.getPathParam(0)).isEqualTo("string") + // 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 new file mode 100644 index 00000000..906a35ce --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt @@ -0,0 +1,158 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class SandboxIndividualUpdateParamsTest { + + @Test + fun createSandboxIndividualUpdateParams() { + SandboxIndividualUpdateParams.builder() + .individualId("string") + .dob("string") + .emails( + listOf( + SandboxIndividualUpdateParams.Email.builder() + .data("string") + .type(SandboxIndividualUpdateParams.Email.Type.WORK) + .build() + ) + ) + .encryptedSsn("string") + .ethnicity(SandboxIndividualUpdateParams.Ethnicity.ASIAN) + .firstName("string") + .gender(SandboxIndividualUpdateParams.Gender.FEMALE) + .lastName("string") + .middleName("string") + .phoneNumbers( + listOf( + SandboxIndividualUpdateParams.PhoneNumber.builder() + .data("string") + .type(SandboxIndividualUpdateParams.PhoneNumber.Type.WORK) + .build() + ) + ) + .preferredName("string") + .residence( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + .ssn("string") + .build() + } + + @Test + fun getBody() { + val params = + SandboxIndividualUpdateParams.builder() + .individualId("string") + .dob("string") + .emails( + listOf( + SandboxIndividualUpdateParams.Email.builder() + .data("string") + .type(SandboxIndividualUpdateParams.Email.Type.WORK) + .build() + ) + ) + .encryptedSsn("string") + .ethnicity(SandboxIndividualUpdateParams.Ethnicity.ASIAN) + .firstName("string") + .gender(SandboxIndividualUpdateParams.Gender.FEMALE) + .lastName("string") + .middleName("string") + .phoneNumbers( + listOf( + SandboxIndividualUpdateParams.PhoneNumber.builder() + .data("string") + .type(SandboxIndividualUpdateParams.PhoneNumber.Type.WORK) + .build() + ) + ) + .preferredName("string") + .residence( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + .ssn("string") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.dob()).isEqualTo("string") + assertThat(body.emails()) + .isEqualTo( + listOf( + SandboxIndividualUpdateParams.Email.builder() + .data("string") + .type(SandboxIndividualUpdateParams.Email.Type.WORK) + .build() + ) + ) + assertThat(body.encryptedSsn()).isEqualTo("string") + assertThat(body.ethnicity()).isEqualTo(SandboxIndividualUpdateParams.Ethnicity.ASIAN) + assertThat(body.firstName()).isEqualTo("string") + assertThat(body.gender()).isEqualTo(SandboxIndividualUpdateParams.Gender.FEMALE) + assertThat(body.lastName()).isEqualTo("string") + assertThat(body.middleName()).isEqualTo("string") + assertThat(body.phoneNumbers()) + .isEqualTo( + listOf( + SandboxIndividualUpdateParams.PhoneNumber.builder() + .data("string") + .type(SandboxIndividualUpdateParams.PhoneNumber.Type.WORK) + .build() + ) + ) + assertThat(body.preferredName()).isEqualTo("string") + assertThat(body.residence()) + .isEqualTo( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + assertThat(body.ssn()).isEqualTo("string") + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = SandboxIndividualUpdateParams.builder().individualId("string").build() + val body = params.getBody() + assertThat(body).isNotNull + } + + @Test + fun getPathParam() { + val params = SandboxIndividualUpdateParams.builder().individualId("string").build() + assertThat(params).isNotNull + // path param "individualId" + assertThat(params.getPathParam(0)).isEqualTo("string") + // out-of-bound path param + assertThat(params.getPathParam(1)).isEqualTo("") + } +} 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 new file mode 100644 index 00000000..76a31055 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParamsTest.kt @@ -0,0 +1,14 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.models.* +import org.junit.jupiter.api.Test + +class SandboxJobConfigurationRetrieveParamsTest { + + @Test + fun createSandboxJobConfigurationRetrieveParams() { + SandboxJobConfigurationRetrieveParams.builder().build() + } +} 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 new file mode 100644 index 00000000..9aceb8c2 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationTest.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 + +class SandboxJobConfigurationTest { + + @Test + fun createSandboxJobConfiguration() { + 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()) + .isEqualTo(SandboxJobConfiguration.Type.DATA_SYNC_ALL) + } +} 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 new file mode 100644 index 00000000..1ec12528 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParamsTest.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class SandboxJobConfigurationUpdateParamsTest { + + @Test + fun createSandboxJobConfigurationUpdateParams() { + SandboxJobConfigurationUpdateParams.builder() + .completionStatus(SandboxJobConfigurationUpdateParams.CompletionStatus.COMPLETE) + .type(SandboxJobConfigurationUpdateParams.Type.DATA_SYNC_ALL) + .build() + } + + @Test + fun getBody() { + val params = + SandboxJobConfigurationUpdateParams.builder() + .completionStatus(SandboxJobConfigurationUpdateParams.CompletionStatus.COMPLETE) + .type(SandboxJobConfigurationUpdateParams.Type.DATA_SYNC_ALL) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.completionStatus()) + .isEqualTo(SandboxJobConfigurationUpdateParams.CompletionStatus.COMPLETE) + assertThat(body.type()).isEqualTo(SandboxJobConfigurationUpdateParams.Type.DATA_SYNC_ALL) + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = + SandboxJobConfigurationUpdateParams.builder() + .completionStatus(SandboxJobConfigurationUpdateParams.CompletionStatus.COMPLETE) + .type(SandboxJobConfigurationUpdateParams.Type.DATA_SYNC_ALL) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.completionStatus()) + .isEqualTo(SandboxJobConfigurationUpdateParams.CompletionStatus.COMPLETE) + assertThat(body.type()).isEqualTo(SandboxJobConfigurationUpdateParams.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 new file mode 100644 index 00000000..57b02e19 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt @@ -0,0 +1,219 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class SandboxPaymentCreateParamsTest { + + @Test + fun createSandboxPaymentCreateParams() { + SandboxPaymentCreateParams.builder() + .endDate("string") + .payStatements( + listOf( + SandboxPaymentCreateParams.PayStatement.builder() + .earnings( + listOf( + SandboxPaymentCreateParams.PayStatement.Earning.builder() + .amount(123L) + .currency("string") + .hours(42.23) + .name("string") + .type( + SandboxPaymentCreateParams.PayStatement.Earning.Type.SALARY + ) + .build() + ) + ) + .employeeDeductions( + listOf( + SandboxPaymentCreateParams.PayStatement.EmployeeDeduction.builder() + .amount(123L) + .currency("string") + .name("string") + .preTax(true) + .type(BenefitType._401K) + .build() + ) + ) + .employerContributions( + listOf( + SandboxPaymentCreateParams.PayStatement.EmployerContribution + .builder() + .amount(123L) + .currency("string") + .name("string") + .type(BenefitType._401K) + .build() + ) + ) + .grossPay(Money.builder().amount(123L).currency("string").build()) + .individualId("string") + .netPay(Money.builder().amount(123L).currency("string").build()) + .paymentMethod(SandboxPaymentCreateParams.PayStatement.PaymentMethod.CHECK) + .taxes( + listOf( + SandboxPaymentCreateParams.PayStatement.Tax.builder() + .amount(123L) + .currency("string") + .employer(true) + .name("string") + .type(SandboxPaymentCreateParams.PayStatement.Tax.Type.STATE) + .build() + ) + ) + .totalHours(42.23) + .type(SandboxPaymentCreateParams.PayStatement.Type.REGULAR_PAYROLL) + .build() + ) + ) + .startDate("string") + .build() + } + + @Test + fun getBody() { + val params = + SandboxPaymentCreateParams.builder() + .endDate("string") + .payStatements( + listOf( + SandboxPaymentCreateParams.PayStatement.builder() + .earnings( + listOf( + SandboxPaymentCreateParams.PayStatement.Earning.builder() + .amount(123L) + .currency("string") + .hours(42.23) + .name("string") + .type( + SandboxPaymentCreateParams.PayStatement.Earning.Type + .SALARY + ) + .build() + ) + ) + .employeeDeductions( + listOf( + SandboxPaymentCreateParams.PayStatement.EmployeeDeduction + .builder() + .amount(123L) + .currency("string") + .name("string") + .preTax(true) + .type(BenefitType._401K) + .build() + ) + ) + .employerContributions( + listOf( + SandboxPaymentCreateParams.PayStatement.EmployerContribution + .builder() + .amount(123L) + .currency("string") + .name("string") + .type(BenefitType._401K) + .build() + ) + ) + .grossPay(Money.builder().amount(123L).currency("string").build()) + .individualId("string") + .netPay(Money.builder().amount(123L).currency("string").build()) + .paymentMethod( + SandboxPaymentCreateParams.PayStatement.PaymentMethod.CHECK + ) + .taxes( + listOf( + SandboxPaymentCreateParams.PayStatement.Tax.builder() + .amount(123L) + .currency("string") + .employer(true) + .name("string") + .type( + SandboxPaymentCreateParams.PayStatement.Tax.Type.STATE + ) + .build() + ) + ) + .totalHours(42.23) + .type(SandboxPaymentCreateParams.PayStatement.Type.REGULAR_PAYROLL) + .build() + ) + ) + .startDate("string") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.endDate()).isEqualTo("string") + assertThat(body.payStatements()) + .isEqualTo( + listOf( + SandboxPaymentCreateParams.PayStatement.builder() + .earnings( + listOf( + SandboxPaymentCreateParams.PayStatement.Earning.builder() + .amount(123L) + .currency("string") + .hours(42.23) + .name("string") + .type( + SandboxPaymentCreateParams.PayStatement.Earning.Type.SALARY + ) + .build() + ) + ) + .employeeDeductions( + listOf( + SandboxPaymentCreateParams.PayStatement.EmployeeDeduction.builder() + .amount(123L) + .currency("string") + .name("string") + .preTax(true) + .type(BenefitType._401K) + .build() + ) + ) + .employerContributions( + listOf( + SandboxPaymentCreateParams.PayStatement.EmployerContribution + .builder() + .amount(123L) + .currency("string") + .name("string") + .type(BenefitType._401K) + .build() + ) + ) + .grossPay(Money.builder().amount(123L).currency("string").build()) + .individualId("string") + .netPay(Money.builder().amount(123L).currency("string").build()) + .paymentMethod(SandboxPaymentCreateParams.PayStatement.PaymentMethod.CHECK) + .taxes( + listOf( + SandboxPaymentCreateParams.PayStatement.Tax.builder() + .amount(123L) + .currency("string") + .employer(true) + .name("string") + .type(SandboxPaymentCreateParams.PayStatement.Tax.Type.STATE) + .build() + ) + ) + .totalHours(42.23) + .type(SandboxPaymentCreateParams.PayStatement.Type.REGULAR_PAYROLL) + .build() + ) + ) + assertThat(body.startDate()).isEqualTo("string") + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = SandboxPaymentCreateParams.builder().build() + val body = params.getBody() + assertThat(body).isNotNull + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ServiceParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ServiceParamsTest.kt index 0bb70079..01337a2f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ServiceParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ServiceParamsTest.kt @@ -70,11 +70,7 @@ class ServiceParamsTest { .firstName("string") .isActive(true) .lastName("string") - .manager( - IndividualInDirectory.Manager.builder() - .id("e8b90071-0c11-471c-86e8-e303ef2f6782") - .build() - ) + .manager(IndividualInDirectory.Manager.builder().id("string").build()) .middleName("string") .build() ) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AuthServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AuthServiceTest.kt new file mode 100644 index 00000000..5a392224 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AuthServiceTest.kt @@ -0,0 +1,34 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClient +import com.tryfinch.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class AuthServiceTest { + + @Test + fun callCreateToken() { + val client = + FinchOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val authService = client.auth() + val createAccessTokenResponse = + authService.createToken( + AuthCreateTokenParams.builder() + .clientId("") + .clientSecret("") + .code("") + .redirectUri("https://example.com") + .build() + ) + println(createAccessTokenResponse) + createAccessTokenResponse.validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/SandboxServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/SandboxServiceTest.kt new file mode 100644 index 00000000..0260383b --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/SandboxServiceTest.kt @@ -0,0 +1,9 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.models.* +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) class SandboxServiceTest 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 9e125364..9dc0bfff 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 @@ -26,7 +26,7 @@ class PayStatementServiceTest { .requests( listOf( HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("e8b90071-0c11-471c-86e8-e303ef2f6782") + .paymentId("string") .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 new file mode 100644 index 00000000..f11b324e --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceTest.kt @@ -0,0 +1,79 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.sandbox + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClient +import com.tryfinch.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class CompanyServiceTest { + + @Test + fun callUpdate() { + val client = + FinchOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val companyService = client.sandbox().company() + val companyUpdateResponse = + companyService.update( + SandboxCompanyUpdateParams.builder() + .accounts( + listOf( + SandboxCompanyUpdateParams.Account.builder() + .accountName("string") + .accountNumber("string") + .accountType( + SandboxCompanyUpdateParams.Account.AccountType.CHECKING + ) + .institutionName("string") + .routingNumber("string") + .build() + ) + ) + .departments( + listOf( + SandboxCompanyUpdateParams.Department.builder() + .name("string") + .parent( + SandboxCompanyUpdateParams.Department.Parent.builder() + .name("string") + .build() + ) + .build() + ) + ) + .ein("string") + .entity( + SandboxCompanyUpdateParams.Entity.builder() + .subtype(SandboxCompanyUpdateParams.Entity.Subtype.S_CORPORATION) + .type(SandboxCompanyUpdateParams.Entity.Type.LLC) + .build() + ) + .legalName("string") + .locations( + listOf( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + ) + .primaryEmail("string") + .primaryPhoneNumber("string") + .build() + ) + println(companyUpdateResponse) + companyUpdateResponse.validate() + } +} 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 new file mode 100644 index 00000000..eacf43b8 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceTest.kt @@ -0,0 +1,36 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.sandbox + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClient +import com.tryfinch.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class ConnectionServiceTest { + + @Test + fun callCreate() { + val client = + FinchOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val connectionService = client.sandbox().connections() + val connectionCreateResponse = + connectionService.create( + SandboxConnectionCreateParams.builder() + .providerId("string") + .authenticationType( + SandboxConnectionCreateParams.AuthenticationType.CREDENTIALS + ) + .employerSize(123L) + .products(listOf("string")) + .build() + ) + println(connectionCreateResponse) + connectionCreateResponse.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 new file mode 100644 index 00000000..962bf27d --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt @@ -0,0 +1,167 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.sandbox + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClient +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class DirectoryServiceTest { + + @Test + fun callCreate() { + val client = + FinchOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val directoryService = client.sandbox().directory() + val directoryCreateResponse = + directoryService.create( + SandboxDirectoryCreateParams.builder() + .body( + listOf( + SandboxDirectoryCreateParams.IndividualOrEmployment.builder() + .classCode("string") + .customFields( + listOf( + SandboxDirectoryCreateParams.IndividualOrEmployment + .CustomField + .builder() + .name("string") + .value(JsonValue.from(mapOf())) + .build() + ) + ) + .department( + SandboxDirectoryCreateParams.IndividualOrEmployment.Department + .builder() + .name("string") + .build() + ) + .dob("string") + .emails( + listOf( + SandboxDirectoryCreateParams.IndividualOrEmployment.Email + .builder() + .data("string") + .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() + ) + .encryptedSsn("string") + .endDate("string") + .ethnicity( + SandboxDirectoryCreateParams.IndividualOrEmployment.Ethnicity + .ASIAN + ) + .firstName("string") + .gender( + SandboxDirectoryCreateParams.IndividualOrEmployment.Gender + .FEMALE + ) + .income( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + .incomeHistory( + listOf( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + ) + .isActive(true) + .lastName("string") + .location( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + .manager( + SandboxDirectoryCreateParams.IndividualOrEmployment.Manager + .builder() + .id("string") + .build() + ) + .middleName("string") + .phoneNumbers( + listOf( + SandboxDirectoryCreateParams.IndividualOrEmployment + .PhoneNumber + .builder() + .data("string") + .type( + SandboxDirectoryCreateParams.IndividualOrEmployment + .PhoneNumber + .Type + .WORK + ) + .build() + ) + ) + .preferredName("string") + .residence( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + .sourceId("string") + .ssn("string") + .startDate("string") + .title("string") + .build() + ) + ) + .build() + ) + println(directoryCreateResponse) + } +} 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 new file mode 100644 index 00000000..0379f366 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceTest.kt @@ -0,0 +1,89 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.sandbox + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClient +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class EmploymentServiceTest { + + @Test + fun callUpdate() { + val client = + FinchOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val employmentService = client.sandbox().employment() + val employmentUpdateResponse = + employmentService.update( + SandboxEmploymentUpdateParams.builder() + .individualId("string") + .classCode("string") + .customFields( + listOf( + SandboxEmploymentUpdateParams.CustomField.builder() + .name("string") + .value(JsonValue.from(mapOf())) + .build() + ) + ) + .department( + SandboxEmploymentUpdateParams.Department.builder().name("string").build() + ) + .employment( + SandboxEmploymentUpdateParams.Employment.builder() + .subtype(SandboxEmploymentUpdateParams.Employment.Subtype.FULL_TIME) + .type(SandboxEmploymentUpdateParams.Employment.Type.EMPLOYEE) + .build() + ) + .endDate("string") + .firstName("string") + .income( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + .incomeHistory( + listOf( + Income.builder() + .amount(123L) + .currency("string") + .effectiveDate("string") + .unit(Income.Unit.YEARLY) + .build() + ) + ) + .isActive(true) + .lastName("string") + .location( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + .manager(SandboxEmploymentUpdateParams.Manager.builder().id("string").build()) + .middleName("string") + .sourceId("string") + .startDate("string") + .title("string") + .build() + ) + println(employmentUpdateResponse) + employmentUpdateResponse.validate() + } +} 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 new file mode 100644 index 00000000..63c589d8 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceTest.kt @@ -0,0 +1,68 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.sandbox + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClient +import com.tryfinch.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class IndividualServiceTest { + + @Test + fun callUpdate() { + val client = + FinchOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val individualService = client.sandbox().individual() + val individualUpdateResponse = + individualService.update( + SandboxIndividualUpdateParams.builder() + .individualId("string") + .dob("string") + .emails( + listOf( + SandboxIndividualUpdateParams.Email.builder() + .data("string") + .type(SandboxIndividualUpdateParams.Email.Type.WORK) + .build() + ) + ) + .encryptedSsn("string") + .ethnicity(SandboxIndividualUpdateParams.Ethnicity.ASIAN) + .firstName("string") + .gender(SandboxIndividualUpdateParams.Gender.FEMALE) + .lastName("string") + .middleName("string") + .phoneNumbers( + listOf( + SandboxIndividualUpdateParams.PhoneNumber.builder() + .data("string") + .type(SandboxIndividualUpdateParams.PhoneNumber.Type.WORK) + .build() + ) + ) + .preferredName("string") + .residence( + Location.builder() + .city("string") + .country("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .sourceId("string") + .state("string") + .build() + ) + .ssn("string") + .build() + ) + println(individualUpdateResponse) + individualUpdateResponse.validate() + } +} 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 new file mode 100644 index 00000000..c66dcade --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceTest.kt @@ -0,0 +1,9 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.sandbox + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.models.* +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) class JobServiceTest 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 new file mode 100644 index 00000000..def5670d --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceTest.kt @@ -0,0 +1,97 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.sandbox + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClient +import com.tryfinch.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class PaymentServiceTest { + + @Test + fun callCreate() { + val client = + FinchOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val paymentService = client.sandbox().payment() + val paymentCreateResponse = + paymentService.create( + SandboxPaymentCreateParams.builder() + .endDate("string") + .payStatements( + listOf( + SandboxPaymentCreateParams.PayStatement.builder() + .earnings( + listOf( + SandboxPaymentCreateParams.PayStatement.Earning.builder() + .amount(123L) + .currency("string") + .hours(42.23) + .name("string") + .type( + SandboxPaymentCreateParams.PayStatement.Earning.Type + .SALARY + ) + .build() + ) + ) + .employeeDeductions( + listOf( + SandboxPaymentCreateParams.PayStatement.EmployeeDeduction + .builder() + .amount(123L) + .currency("string") + .name("string") + .preTax(true) + .type(BenefitType._401K) + .build() + ) + ) + .employerContributions( + listOf( + SandboxPaymentCreateParams.PayStatement.EmployerContribution + .builder() + .amount(123L) + .currency("string") + .name("string") + .type(BenefitType._401K) + .build() + ) + ) + .grossPay(Money.builder().amount(123L).currency("string").build()) + .individualId("string") + .netPay(Money.builder().amount(123L).currency("string").build()) + .paymentMethod( + SandboxPaymentCreateParams.PayStatement.PaymentMethod.CHECK + ) + .taxes( + listOf( + SandboxPaymentCreateParams.PayStatement.Tax.builder() + .amount(123L) + .currency("string") + .employer(true) + .name("string") + .type( + SandboxPaymentCreateParams.PayStatement.Tax.Type + .STATE + ) + .build() + ) + ) + .totalHours(42.23) + .type(SandboxPaymentCreateParams.PayStatement.Type.REGULAR_PAYROLL) + .build() + ) + ) + .startDate("string") + .build() + ) + println(paymentCreateResponse) + paymentCreateResponse.validate() + } +} 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 new file mode 100644 index 00000000..c7ac488c --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceTest.kt @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.sandbox.connections + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClient +import com.tryfinch.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class AccountServiceTest { + + @Test + fun callCreate() { + val client = + FinchOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val accountService = client.sandbox().connections().accounts() + val accountCreateResponse = + accountService.create( + SandboxConnectionAccountCreateParams.builder() + .companyId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .providerId("string") + .authenticationType( + SandboxConnectionAccountCreateParams.AuthenticationType.CREDENTIALS + ) + .products(listOf("string")) + .build() + ) + println(accountCreateResponse) + accountCreateResponse.validate() + } + + @Test + fun callUpdate() { + val client = + FinchOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val accountService = client.sandbox().connections().accounts() + val accountUpdateResponse = + accountService.update( + SandboxConnectionAccountUpdateParams.builder() + .connectionStatus(IntrospectResponseConnectionStatus.PENDING) + .build() + ) + println(accountUpdateResponse) + accountUpdateResponse.validate() + } +} 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 new file mode 100644 index 00000000..ceccf5a6 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceTest.kt @@ -0,0 +1,48 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.sandbox.jobs + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClient +import com.tryfinch.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class ConfigurationServiceTest { + + @Test + fun callRetrieve() { + val client = + FinchOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val configurationService = client.sandbox().jobs().configuration() + val configurationRetrieveResponse = + configurationService.retrieve(SandboxJobConfigurationRetrieveParams.builder().build()) + println(configurationRetrieveResponse) + for (sandboxJobConfiguration: SandboxJobConfiguration in configurationRetrieveResponse) { + sandboxJobConfiguration.validate() + } + } + + @Test + fun callUpdate() { + val client = + FinchOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val configurationService = client.sandbox().jobs().configuration() + val sandboxJobConfiguration = + configurationService.update( + SandboxJobConfigurationUpdateParams.builder() + .completionStatus(SandboxJobConfigurationUpdateParams.CompletionStatus.COMPLETE) + .type(SandboxJobConfigurationUpdateParams.Type.DATA_SYNC_ALL) + .build() + ) + println(sandboxJobConfiguration) + sandboxJobConfiguration.validate() + } +} From af8fdeaf7de118bc2db4f6269b3510c79c01d091 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Mon, 8 Jan 2024 19:44:38 -0500 Subject: [PATCH 5/5] release: 0.14.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 15 +++++++++++++++ README.md | 6 +++--- build.gradle.kts | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f80776a4..a26ebfc1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.13.2" + ".": "0.14.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a52fba7..34255faf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 0.14.0 (2024-01-09) + +Full Changelog: [v0.13.2...v0.14.0](https://github.com/Finch-API/finch-api-java/compare/v0.13.2...v0.14.0) + +### Features + +* **api:** add method to create access token ([#125](https://github.com/Finch-API/finch-api-java/issues/125)) ([b456bde](https://github.com/Finch-API/finch-api-java/commit/b456bdee9ae7effecb7a1c4c1a7faacd6b26c335)) +* **api:** add sandbox APIs ([#127](https://github.com/Finch-API/finch-api-java/issues/127)) ([44671e6](https://github.com/Finch-API/finch-api-java/commit/44671e666b645dac5d43e499d29531f0b88dc34a)) + + +### Chores + +* add .keep files for examples and custom code directories ([#126](https://github.com/Finch-API/finch-api-java/issues/126)) ([98b8b4a](https://github.com/Finch-API/finch-api-java/commit/98b8b4a234444abe4dd136931524ee22df2aa2d1)) +* **internal:** bump license ([#123](https://github.com/Finch-API/finch-api-java/issues/123)) ([121f7f9](https://github.com/Finch-API/finch-api-java/commit/121f7f9ffe98731113aecda46effa52976c2ee62)) + ## 0.13.2 (2023-12-19) Full Changelog: [v0.13.1...v0.13.2](https://github.com/Finch-API/finch-api-java/compare/v0.13.1...v0.13.2) diff --git a/README.md b/README.md index 00d9c0dc..4d5f7d19 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,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/0.13.2) +[![Maven Central](https://img.shields.io/maven-central/v/com.tryfinch.api/finch-java)](https://central.sonatype.com/artifact/com.tryfinch.api/finch-java/0.14.0) @@ -25,7 +25,7 @@ The API documentation can be foundĀ [in the Finch Documentation Center](https:// ```kotlin -implementation("com.tryfinch.api:finch-java:0.13.2") +implementation("com.tryfinch.api:finch-java:0.14.0") ``` #### Maven @@ -34,7 +34,7 @@ implementation("com.tryfinch.api:finch-java:0.13.2") com.tryfinch.api finch-java - 0.13.2 + 0.14.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 65ef5515..9dda05aa 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { allprojects { group = "com.tryfinch.api" - version = "0.13.2" // x-release-please-version + version = "0.14.0" // x-release-please-version } nexusPublishing {